Skip to content

Commit 7fc8377

Browse files
committed
Gardening: Migrate test suite to GH issues: Constraints (1/5)
1 parent b0fb7c5 commit 7fc8377

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+199
-108
lines changed

test/Constraints/ErrorBridging.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ let e1fix = ns1 as FooError // expected-error {{'NSError' is not convertible to
4343
let esub = ns1 as Error
4444
let esub2 = ns1 as? Error // expected-warning{{conditional cast from 'NSError' to 'any Error' always succeeds}}
4545

46-
// SR-1562 / rdar://problem/26370984
46+
// rdar://problem/26370984
47+
// https://github.com/apple/swift/issues/44171
48+
4749
enum MyError : Error {
4850
case failed
4951
}

test/Constraints/array_literal_local_array.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: %target-typecheck-verify-swift
22

3-
// SR-9611: Array type locally interferes with array literals.
3+
/// https://github.com/apple/swift/issues/52057
4+
/// `Array` type locally interferes with array literals
5+
46
struct Array { }
57

68
func foo() {

test/Constraints/assignment.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,20 @@ func f23798944() {
7171
}
7272
}
7373

74-
.sr_3506 = 0 // expected-error {{type 'Int' has no member 'sr_3506'}}
75-
76-
// SR-1553
74+
// https://github.com/apple/swift/issues/46094
75+
do {
76+
.x = 0 // expected-error {{type 'Int' has no member 'x'}}
77+
}
7778

79+
// https://github.com/apple/swift/issues/44162
7880
func returnsVoid() {}
7981
_ = returnsVoid() // expected-warning {{using '_' to ignore the result of a Void-returning function is redundant}}{{1-5=}}
8082

81-
// SR-14003
82-
class SR14003 {
83-
var callback: ((SR14003) -> Void)!
83+
// https://github.com/apple/swift/issues/56396
84+
class С_56396 {
85+
var callback: ((С_56396) -> Void)!
8486

8587
func setCallback(_ callback: @escaping (Self) -> Void) {
86-
self.callback = callback // expected-error {{cannot assign value of type '(Self) -> Void' to type '((SR14003) -> Void)?'}}
88+
self.callback = callback // expected-error {{cannot assign value of type '(Self) -> Void' to type '((С_56396) -> Void)?'}}
8789
}
8890
}

test/Constraints/associated_types.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ func owl3() {
3232
Owl<Spoon>().eat(Mince(), with:Spoon())
3333
}
3434

35-
// "Can't access associated types through class-constrained generic parameters"
36-
// (https://bugs.swift.org/browse/SR-726)
35+
// https://github.com/apple/swift/issues/43341
36+
// Can't access associated types through class-constrained generic parameters
3737
func spoon<S: Spoon>(_ s: S) {
3838
let _: S.Runcee?
3939
}
4040

41-
// SR-4143
41+
// https://github.com/apple/swift/issues/46726
4242

4343
protocol SameTypedDefault {
4444
associatedtype X
@@ -109,15 +109,15 @@ struct UsesSameTypedDefaultDerivedWithoutSatisfyingReqts: SameTypedDefaultDerive
109109
static var y: YType { return YType() }
110110
}
111111

112-
// SR-12199
112+
// https://github.com/apple/swift/issues/54624
113113

114-
protocol SR_12199_P1 {
114+
protocol P1_54624 {
115115
associatedtype Assoc // expected-note {{'Assoc' declared here}}
116116
}
117117

118-
enum SR_12199_E {}
118+
enum E_54624 {}
119119

120-
protocol SR_12199_P2: SR_12199_P1 where Assoc == SR_12199_E {
121-
associatedtype Assoc: SR_12199_E // expected-error {{type 'Self.Assoc' constrained to non-protocol, non-class type 'SR_12199_E'}}
122-
// expected-warning@-1 {{redeclaration of associated type 'Assoc' from protocol 'SR_12199_P1' is better expressed as a 'where' clause on the protocol}}
120+
protocol P2_54624: P1_54624 where Assoc == E_54624 {
121+
associatedtype Assoc: E_54624 // expected-error {{type 'Self.Assoc' constrained to non-protocol, non-class type 'E_54624'}}
122+
// expected-warning@-1 {{redeclaration of associated type 'Assoc' from protocol 'P1_54624' is better expressed as a 'where' clause on the protocol}}
123123
}

test/Constraints/availability.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func test_contextual_member_with_availability() {
3838
@available(*, unavailable)
3939
func unavailableFunction(_ x: Int) -> Bool { true } // expected-note {{'unavailableFunction' has been explicitly marked unavailable here}}
4040

41-
// SR-13260: Availability checking not working in the where clause of a for
42-
// loop.
43-
func sr13260(_ arr: [Int]) {
41+
/// https://github.com/apple/swift/issues/55700
42+
/// Availability checking not working in the `where` clause of a `for` loop
43+
func f_55700(_ arr: [Int]) {
4444
for x in arr where unavailableFunction(x) {} // expected-error {{'unavailableFunction' is unavailable}}
4545
}

test/Constraints/bridging.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,17 @@ func rdar60501780() {
395395
}
396396
}
397397

398-
// SR-15161
399-
func SR15161_as(e: Error?) {
400-
let _ = e as? NSError // Ok
401-
}
398+
// https://github.com/apple/swift/issues/57484
399+
do {
400+
func as1(e: Error?) {
401+
let _ = e as? NSError // Ok
402+
}
402403

403-
func SR15161_is(e: Error?) {
404-
_ = e is NSError // expected-warning{{checking a value with optional type '(any Error)?' against type 'NSError' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}
405-
}
404+
func as2(e: Error?) {
405+
let _ = e as! NSError // expected-warning{{forced cast from '(any Error)?' to 'NSError' only unwraps and bridges; did you mean to use '!' with 'as'?}}
406+
}
406407

407-
func SR15161_as_1(e: Error?) {
408-
let _ = e as! NSError // expected-warning{{forced cast from '(any Error)?' to 'NSError' only unwraps and bridges; did you mean to use '!' with 'as'?}}
408+
func is1(e: Error?) {
409+
_ = e is NSError // expected-warning{{checking a value with optional type '(any Error)?' against type 'NSError' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}
410+
}
409411
}

test/Constraints/casts_objc.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ func test(_ a : CFString!, b : CFString) {
4343
let r22507759: NSObject! = "test" as NSString
4444
let _: NSString! = unsafeDowncast(r22507759) // expected-error {{missing argument for parameter 'to' in call}}
4545

46-
// rdar://problem/29496775 / SR-3319
47-
func sr3319(f: CGFloat, n: NSNumber) {
46+
// rdar://problem/29496775
47+
// https://github.com/apple/swift/issues/45907
48+
func f_45907(f: CGFloat, n: NSNumber) {
4849
let _ = [f].map { $0 as NSNumber }
4950
let _ = [n].map { $0 as! CGFloat }
5051
}

test/Constraints/diag_ambiguities.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ func rdar29907555(_ value: Any!) -> String {
4242
// expected-note@-2 {{provide a default value to avoid this warning}}
4343
}
4444

45-
struct SR3715 {
45+
// https://github.com/apple/swift/issues/46300
46+
struct S_46300 {
4647
var overloaded: Int! // expected-note {{implicitly unwrapped property 'overloaded' declared here}}
4748

4849
func overloaded(_ x: Int) {}
@@ -73,8 +74,9 @@ class MoviesViewController {
7374
}
7475
}
7576

76-
// SR-15053
77-
func SR15053<T : Numeric>(_ a: T, _ b: T) -> T {
77+
// https://github.com/apple/swift/issues/57380
78+
79+
func f1_57380<T : Numeric>(_ a: T, _ b: T) -> T {
7880
(a + b) / 2 // expected-note {{overloads for '/' exist with these partially matching parameter lists: (Int, Int)}}
7981
// expected-error@-1 {{binary operator '/' cannot be applied to operands of type 'T' and 'Int'}}
8082
}
@@ -89,7 +91,7 @@ func %% (_ lhs: Float, _ rhs: Float) -> Float {
8991
lhs / rhs
9092
}
9193

92-
func SR15053<T : Numeric>(_ a: T, _ b: T) {
94+
func f2_57380<T : Numeric>(_ a: T, _ b: T) {
9395
(a + b) %% 2 // expected-error {{cannot convert value of type 'T' to expected argument type 'Int'}}
9496
}
9597

test/Constraints/dictionary_literal.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ func testDefaultExistentials() {
150150
// expected-error@-1{{heterogeneous collection literal could only be inferred to '[AnyHashable : String]'}}
151151
}
152152

153-
// SR-4952, rdar://problem/32330004 - Assertion failure during swift::ASTVisitor<::FailureDiagnosis,...>::visit
153+
/// rdar://problem/32330004
154+
/// https://github.com/apple/swift/issues/47529
155+
/// Assertion failure during `swift::ASTVisitor<::FailureDiagnosis,...>::visit`
154156
func rdar32330004_1() -> [String: Any] {
155157
return ["a""one": 1, "two": 2, "three": 3] // expected-note {{did you mean to use a dictionary literal instead?}}
156158
// expected-error@-1 {{expected ',' separator}}

test/Constraints/dynamic_lookup.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,22 +408,25 @@ func testAnyObjectAmbiguity(_ x: AnyObject) {
408408
_ = x.ambiguousMethodParam // expected-error {{ambiguous use of 'ambiguousMethodParam'}}
409409
_ = x.unambiguousMethodParam
410410

411-
// SR-12799: Don't emit a "single-element" tuple error.
411+
// https://github.com/apple/swift/issues/55244
412+
// Don't emit a single-element tuple error.
412413
_ = x[singleCandidate: 0]
413414

414415
_ = x[ambiguousSubscript: 0] // expected-error {{ambiguous use of 'subscript(ambiguousSubscript:)'}}
415416
_ = x[ambiguousSubscript: 0] as Int
416417
_ = x[ambiguousSubscript: 0] as String
417418

418-
// SR-8611: Make sure we can coalesce subscripts with the same types and
419-
// selectors through AnyObject lookup.
419+
// https://github.com/apple/swift/issues/51126
420+
// Make sure we can coalesce subscripts with the same types and selectors
421+
// through AnyObject lookup.
420422
_ = x[unambiguousSubscript: ""]
421423

422424
// But not if they have different selectors.
423425
_ = x[differentSelectors: 0] // expected-error {{ambiguous use of 'subscript(differentSelectors:)}}
424426
}
425427

426-
// SR-11648
428+
// https://github.com/apple/swift/issues/54059
429+
427430
class HasMethodWithDefault {
428431
@objc func hasDefaultParam(_ x: Int = 0) {}
429432
}
@@ -432,7 +435,9 @@ func testAnyObjectWithDefault(_ x: AnyObject) {
432435
x.hasDefaultParam()
433436
}
434437

435-
// SR-11829: Don't perform dynamic lookup for callAsFunction.
438+
/// https://github.com/apple/swift/issues/54241
439+
/// Don't perform dynamic lookup for `callAsFunction`.
440+
436441
class ClassWithObjcCallAsFunction {
437442
@objc func callAsFunction() {}
438443
}
@@ -462,6 +467,7 @@ func test_dynamic_subscript_accepts_type_name_argument() {
462467
func testAnyObjectConstruction(_ x: AnyObject) {
463468
AnyObject() // expected-error {{type 'AnyObject' cannot be instantiated}}
464469

465-
// FIXME(SR-15210): This should also be rejected.
470+
// https://github.com/apple/swift/issues/57532
471+
// FIXME: This should also be rejected.
466472
_ = type(of: x).init()
467473
}

0 commit comments

Comments
 (0)