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
Copy file name to clipboardExpand all lines: test/Constraints/generics.swift
+57-51Lines changed: 57 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -205,11 +205,9 @@ struct R24267414<T> { // expected-note {{'T' declared as parameter to type 'R24
205
205
var _ :Int=R24267414.foo() // expected-error {{generic parameter 'T' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{24-24=<Any>}}
206
206
207
207
208
-
// https://bugs.swift.org/browse/SR-599
209
-
func SR599<T:FixedWidthInteger>()->T.Type{returnT.self } // expected-note {{in call to function 'SR599()'}}
210
-
_ =SR599() // expected-error {{generic parameter 'T' could not be inferred}}
211
-
212
-
208
+
// https://github.com/apple/swift/issues/43216
209
+
func f_43216<T:FixedWidthInteger>()->T.Type{returnT.self } // expected-note {{in call to function 'f_43216()'}}
210
+
_ =f_43216() // expected-error {{generic parameter 'T' could not be inferred}}
213
211
214
212
215
213
// <rdar://problem/19215114> QoI: Poor diagnostic when we are unable to infer type
@@ -456,17 +454,20 @@ func genericFunc<T>(t: T) {
456
454
// expected-note@-1 {{explicitly specify the generic arguments to fix this issue}}
457
455
}
458
456
459
-
structSR_3525<T>{}
460
-
func sr3525_arg_int(_:inoutSR_3525<Int>){}
461
-
func sr3525_arg_gen<T>(_:inoutSR_3525<T>){}
462
-
func sr3525_1(t:SR_3525<Int>){
463
-
let _ =sr3525_arg_int(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
464
-
}
465
-
func sr3525_2(t:SR_3525<Int>){
466
-
let _ =sr3525_arg_gen(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
467
-
}
468
-
func sr3525_3<T>(t:SR_3525<T>){
469
-
let _ =sr3525_arg_gen(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
457
+
// https://github.com/apple/swift/issues/46113
458
+
do{
459
+
structS<T>{}
460
+
461
+
func arg_int(_:inoutS<Int>){}
462
+
func arg_gen<T>(_:inoutS<T>){}
463
+
464
+
func f1(t:S<Int>){
465
+
let _ =arg_int(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
466
+
let _ =arg_gen(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
467
+
}
468
+
func f2<T>(t:S<T>){
469
+
let _ =arg_gen(&t) // expected-error {{cannot pass immutable value as inout argument: 't' is a 'let' constant}}
470
+
}
470
471
}
471
472
472
473
classtestStdlibType{
@@ -566,7 +567,9 @@ func rdar35541153() {
566
567
bar(y,"ultimate question",42) // Ok
567
568
}
568
569
569
-
// rdar://problem/38159133 - [SR-7125]: Swift 4.1 Xcode 9.3b4 regression
570
+
// rdar://problem/38159133
571
+
// https://github.com/apple/swift/issues/49673
572
+
// Swift 4.1 Xcode 9.3b4 regression
570
573
571
574
protocolP_38159133{}
572
575
@@ -601,9 +604,8 @@ func rdar39616039() {
601
604
c +=1 // ok
602
605
}
603
606
604
-
// https://bugs.swift.org/browse/SR-8075
605
-
606
-
func sr8075(){
607
+
// https://github.com/apple/swift/issues/50608
608
+
do{
607
609
structUIFont{
608
610
init(ofSize:Float){}
609
611
}
@@ -640,7 +642,7 @@ func rdar40537858() {
640
642
let _:E=.bar([s]) // expected-error {{generic enum 'E' requires that 'S' conform to 'P'}}
641
643
}
642
644
643
-
// https://bugs.swift.org/browse/SR-8934
645
+
// https://github.com/apple/swift/issues/51439
644
646
structBottleLayout{
645
647
letcount:Int
646
648
}
@@ -650,40 +652,38 @@ let ix = arr.firstIndex(of:layout) // expected-error {{referencing instance meth
650
652
651
653
let _:()->UInt8={.init("a"asUnicode.Scalar)} // expected-error {{missing argument label 'ascii:' in call}}
extensionS1_50517where Bar:String{} // expected-error {{type 'Bar' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'Bar == String' to require 'Bar' to be 'String'}} {{29-30= ==}}
664
668
665
-
extensionSR_7984where Bar:String{} // expected-error {{type 'Bar' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'Bar == String' to require 'Bar' to be 'String'}} {{28-29= ==}}
666
-
667
-
protocolSR_7984_Proto{
669
+
protocolP1_50517{
668
670
associatedtypeBar
669
671
}
672
+
extensionP1_50517where Bar:String{} // expected-error {{type 'Self.Bar' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'Bar == String' to require 'Bar' to be 'String'}} {{29-30= ==}}
670
673
671
-
extensionSR_7984_Protowhere Bar:String{} // expected-error {{type 'Self.Bar' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'Bar == String' to require 'Bar' to be 'String'}} {{34-35= ==}}
672
-
673
-
protocolSR_7984_HasFoo{
674
+
protocolP2_50517{
674
675
associatedtypeFoo
675
676
}
676
-
protocolSR_7984_HasAssoc{
677
-
associatedtypeAssoc:SR_7984_HasFoo
677
+
protocolP3_50517{
678
+
associatedtypeAssoc:P2_50517
678
679
}
680
+
structS2_50517<T:P3_50517>{}
681
+
extensionS2_50517where T.Assoc.Foo:String{} // expected-error {{type 'T.Assoc.Foo' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Assoc.Foo == String' to require 'T.Assoc.Foo' to be 'String'}} {{37-38= ==}}
679
682
680
-
structSR_7984_X<T:SR_7984_HasAssoc>{}
681
-
extensionSR_7984_Xwhere T.Assoc.Foo:String{} // expected-error {{type 'T.Assoc.Foo' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Assoc.Foo == String' to require 'T.Assoc.Foo' to be 'String'}} {{38-39= ==}}
682
-
683
-
structSR_7984_S<T:Sequence>where T.Element:String{} // expected-error {{type 'T.Element' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Element == String' to require 'T.Element' to be 'String'}} {{46-47= ==}}
684
-
func SR_7984_F<T:Sequence>(foo:T)where T.Element:String{} // expected-error {{type 'T.Element' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Element == String' to require 'T.Element' to be 'String'}} {{52-53= ==}}
683
+
structS3_50517<T:Sequence>where T.Element:String{} // expected-error {{type 'T.Element' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Element == String' to require 'T.Element' to be 'String'}} {{45-46= ==}}
684
+
func f_50517<T:Sequence>(foo:T)where T.Element:String{} // expected-error {{type 'T.Element' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Element == String' to require 'T.Element' to be 'String'}} {{50-51= ==}}
685
685
686
-
protocolSR_7984_P{
686
+
protocolP4_50517{
687
687
func S<T :Sequence>(bar:T)where T.Element:String // expected-error {{type 'T.Element' constrained to non-protocol, non-class type 'String'}} expected-note {{use 'T.Element == String' to require 'T.Element' to be 'String'}} {{47-48= ==}}
0 commit comments