You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
associatedtypeAssoc: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
+
protocolP2_54624:P1_54624where Assoc ==E_54624{
121
+
associatedtypeAssoc: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}}
Copy file name to clipboardExpand all lines: test/Constraints/bridging.swift
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -395,15 +395,17 @@ func rdar60501780() {
395
395
}
396
396
}
397
397
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
+
}
402
403
403
-
funcSR15161_is(e:Error?){
404
-
_ = e isNSError // 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
+
funcas2(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
+
}
406
407
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'?}}
0 commit comments