File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,18 @@ func doNotOpenOuter(p: any P) {
140
140
// expected-note@-1{{only concrete types such as structs, enums and classes can conform to protocols}}
141
141
}
142
142
143
+ func takesVariadic< T: P > ( _ args: T ... ) { }
144
+ // expected-note@-1 2{{required by global function 'takesVariadic' where 'T' = 'P'}}
145
+ // expected-note@-2{{in call to function 'takesVariadic'}}
146
+
147
+ func callVariadic( p1: any P , p2: any P ) {
148
+ takesVariadic ( ) // expected-error{{generic parameter 'T' could not be inferred}}
149
+ takesVariadic ( p1) // expected-error{{protocol 'P' as a type cannot conform to the protocol itself}}
150
+ // expected-note@-1{{only concrete types such as structs, enums and classes can conform to protocols}}
151
+ takesVariadic ( p1, p2) // expected-error{{protocol 'P' as a type cannot conform to the protocol itself}}
152
+ // expected-note@-1{{only concrete types such as structs, enums and classes can conform to protocols}}
153
+ }
154
+
143
155
@available ( SwiftStdlib 5 . 1 , * )
144
156
func testReturningOpaqueTypes( p: any P ) {
145
157
let q = p. getQ ( )
You can’t perform that action at this time.
0 commit comments