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
arg.covariantAssoc1() // expected-error {{member 'covariantAssoc1' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
252
-
arg.covariantAssoc2() // expected-error {{member 'covariantAssoc2' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
253
-
arg.covariantAssoc3() // expected-error {{member 'covariantAssoc3' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
254
-
arg.covariantAssoc4() // expected-error {{member 'covariantAssoc4' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
255
-
arg.covariantAssoc5() // expected-error {{member 'covariantAssoc5' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
256
-
arg.covariantAssoc6() // expected-error {{member 'covariantAssoc6' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
257
-
_ = arg.covariantAssoc7 // expected-error {{member 'covariantAssoc7' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
258
-
_ = arg.covariantAssocComplex // expected-error {{member 'covariantAssocComplex' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
251
+
let _:Any= arg.covariantAssoc1()
252
+
let _:Any?= arg.covariantAssoc2()
253
+
let _:Any.Type= arg.covariantAssoc3()
254
+
let _:(Any,Any)= arg.covariantAssoc4()
255
+
let _:Array<Any>= arg.covariantAssoc5()
256
+
let _:[String:Any]= arg.covariantAssoc6()
257
+
arg.covariantAssoc7{(_:Any)in}
258
+
let _:[String:()->(Any,Any)]= arg.covariantAssocComplex(
arg.covariantAssocProp1 // expected-error {{member 'covariantAssocProp1' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
275
-
arg.covariantAssocProp2 // expected-error {{member 'covariantAssocProp2' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
276
-
arg.covariantAssocProp3 // expected-error {{member 'covariantAssocProp3' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
277
-
arg.covariantAssocProp4 // expected-error {{member 'covariantAssocProp4' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
278
-
arg.covariantAssocProp5 // expected-error {{member 'covariantAssocProp5' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
279
-
arg.covariantAssocProp6 // expected-error {{member 'covariantAssocProp6' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
280
-
arg.covariantAssocProp7 // expected-error {{member 'covariantAssocProp7' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
281
-
arg.covariantAssocPropComplex // expected-error {{member 'covariantAssocPropComplex' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
279
+
let _:Any= arg.covariantAssocProp1
280
+
let _:Any?= arg.covariantAssocProp2
281
+
let _:Any.Type= arg.covariantAssocProp3
282
+
let _:(Any,Any)= arg.covariantAssocProp4
283
+
let _:Array<Any>= arg.covariantAssocProp5
284
+
let _:[String:Any]= arg.covariantAssocProp6
285
+
let _:((Any)->Void)->Void= arg.covariantAssocProp7
arg[covariantAssocSubscript1:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
298
-
arg[covariantAssocSubscript2:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
299
-
arg[covariantAssocSubscript3:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
300
-
arg[covariantAssocSubscript4:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
301
-
arg[covariantAssocSubscript5:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
302
-
arg[covariantAssocSubscript6:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
303
-
arg[covariantAssocSubscript7:{ _ in}] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
304
-
arg[covariantAssocSubscriptComplex:{ _ in},{ _ in},{ _ in},{ _ in}] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
307
+
let _:Any=arg[covariantAssocSubscript1:()]
308
+
let _:Any?=arg[covariantAssocSubscript2:()]
309
+
let _:Any.Type=arg[covariantAssocSubscript3:()]
310
+
let _:(Any,Any)=arg[covariantAssocSubscript4:()]
311
+
let _:Array<Any>=arg[covariantAssocSubscript5:()]
312
+
let _:[String:Any]=arg[covariantAssocSubscript6:()]
313
+
let _:Any=arg[covariantAssocSubscript7:{(_:Any)in}]
314
+
let _:[String:()->(Any,Any)]=arg[
315
+
covariantAssocSubscriptComplex:{(_:Any.Type)in},
316
+
{(_:Array<Any>)in},
317
+
{(_:Array<Array<Any>?>)in},
318
+
{(_:()->Any?)in}
319
+
]
305
320
306
321
arg.contravariantSelf1(0) // expected-error {{member 'contravariantSelf1' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
307
322
arg.contravariantSelf2(0) // expected-error {{member 'contravariantSelf2' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
@@ -633,36 +648,24 @@ func takesP2(p2: any P2) {
633
648
}
634
649
635
650
protocolMiscTestsProto{
636
-
associatedtypeAssoc
637
-
func runce<A>(_:A)
638
-
func spoon(_:Self)
639
-
640
651
associatedtypeR:IteratorProtocol, Sequence
641
652
func getR()->R
642
653
643
-
subscript(intToAssoc _:Int)->Assoc{get}
644
-
subscript(intToInt _:Int)->Int{get}
654
+
associatedtypeAssoc
655
+
subscript()->Assoc{get}
656
+
vargetAssoc:Assoc?{get}
645
657
}
646
658
do{
647
-
func miscTests(_ arg:anyMiscTestsProto){ // ok
648
-
arg.runce(5)
649
-
650
-
do{
651
-
// FIXME: Crummy diagnostics.
652
-
varx= arg.getR() // expected-error{{member 'getR' cannot be used on value of protocol type 'MiscTestsProto'; use a generic constraint instead}}
653
-
x.makeIterator()
654
-
x.next()
655
-
x.nonexistent()
656
-
}
657
-
658
-
var _:Int=arg[intToInt:17]
659
-
_ =arg[intToAssoc:17] // expected-error{{member 'subscript' cannot be used on value of protocol type 'MiscTestsProto'; use a generic constraint instead}}
660
-
}
661
-
662
-
func existentialSequence(_ e:anySequence){
663
-
varx= e.makeIterator() // expected-error{{member 'makeIterator' cannot be used on value of protocol type 'Sequence'; use a generic constraint instead}}
664
-
x.next()
665
-
x.nonexistent()
659
+
func miscTests(_ arg:anyMiscTestsProto){
660
+
varr:anySequence&IteratorProtocol= arg.getR()
661
+
r.makeIterator() // expected-warning {{result of call to 'makeIterator()' is unused}}
662
+
// FIXME: We are leaking an implementation detail in this warning.
663
+
r.next() // expected-warning {{expression of type '(IteratorProtocol & Sequence).Element' is unused}}
664
+
r.nonexistent() // expected-error {{value of type 'IteratorProtocol & Sequence' has no member 'nonexistent'}}
665
+
666
+
// FIXME: We are leaking an implementation detail in this warning.
667
+
arg[] // expected-warning {{expression of type '(MiscTestsProto).Assoc' is unused}}
668
+
arg.getAssoc // expected-warning {{expression of type '(MiscTestsProto).Assoc' is unused}}
let _:(anyCovariantMetatypes.Type,anyCovariantMetatypes.Type.Type)= arg.covariantSelfMetatype2()
695
698
696
-
arg.covariantAssocMetatype1 // expected-error {{member 'covariantAssocMetatype1' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
697
-
arg.covariantAssocMetatype2 // expected-error {{member 'covariantAssocMetatype2' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
let _:(Any.Type,Any.Type.Type)= arg.covariantAssocMetatype2()
698
701
699
702
let _:anyCovariantMetatypes.Type.Type.Type= arg.covariantSelfMetatypeProp1
700
703
let _:(anyCovariantMetatypes.Type,anyCovariantMetatypes.Type.Type)= arg.covariantSelfMetatypeProp2
701
704
702
-
arg.covariantAssocMetatypeProp1 // expected-error {{member 'covariantAssocMetatypeProp1' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
703
-
arg.covariantAssocMetatypeProp2 // expected-error {{member 'covariantAssocMetatypeProp2' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
705
+
let _:Any.Type.Type.Type= arg.covariantAssocMetatypeProp1
706
+
let _:(Any.Type,Any.Type.Type)= arg.covariantAssocMetatypeProp2
704
707
705
708
let _:anyCovariantMetatypes.Type=arg[covariantSelfMetatypeSubscript1:{(_:anyCovariantMetatypes.Type.Type.Type)in}]
706
709
let _:(anyCovariantMetatypes.Type,anyCovariantMetatypes.Type.Type)=arg[covariantSelfMetatypeSubscript2:()]
707
710
708
-
arg[covariantAssocMetatypeSubscript1:{_ in}] // expected-error {{member 'subscript' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
709
-
arg[covariantAssocMetatypeSubscript2:()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'CovariantMetatypes'; use a generic constraint instead}}
711
+
let _:Any.Type=arg[covariantAssocMetatypeSubscript1:{(_:Any.Type.Type.Type)in}]
712
+
let _:(Any.Type,Any.Type.Type)=arg[covariantAssocMetatypeSubscript2:()]
0 commit comments