|
1 | 1 | // RUN: %target-typecheck-verify-swift -enable-upcoming-feature ExistentialAny |
| 2 | +// RUN: %target-typecheck-verify-swift -enable-upcoming-feature ExistentialAny -enable-experimental-feature NoncopyableGenerics |
2 | 3 |
|
3 | 4 | protocol HasSelfRequirements { |
4 | 5 | func foo(_ x: Self) |
@@ -276,7 +277,7 @@ typealias Constraint = Input |
276 | 277 | typealias ConstraintB = Input & InputB |
277 | 278 |
|
278 | 279 | //expected-error@+2{{use of 'Constraint' (aka 'Input') as a type must be written 'any Constraint' (aka 'any Input')}} |
279 | | -//expected-error@+1 2{{use of 'ConstraintB' (aka 'Input & InputB') as a type must be written 'any ConstraintB' (aka 'any Input & InputB')}} |
| 280 | +//expected-error@+1 {{use of 'ConstraintB' (aka 'Input & InputB') as a type must be written 'any ConstraintB' (aka 'any Input & InputB')}} |
280 | 281 | func testConstraintAlias(x: Constraint, y: ConstraintB) {} |
281 | 282 |
|
282 | 283 | typealias Existential = any Input |
@@ -307,7 +308,7 @@ enum EE : Equatable, any Empty { // expected-error {{raw type 'any Empty' is not |
307 | 308 | do { |
308 | 309 | // expected-error@+1 {{use of protocol 'Decodable' as a type must be written 'any Decodable'}} |
309 | 310 | let _: Decodable |
310 | | - // expected-error@+1 2 {{use of 'Codable' (aka 'Decodable & Encodable') as a type must be written 'any Codable' (aka 'any Decodable & Encodable')}} |
| 311 | + // expected-error@+1 {{use of 'Codable' (aka 'Decodable & Encodable') as a type must be written 'any Codable' (aka 'any Decodable & Encodable')}} |
311 | 312 | let _: Codable |
312 | 313 | } |
313 | 314 |
|
@@ -395,3 +396,14 @@ protocol PP {} |
395 | 396 | struct A : PP {} |
396 | 397 | let _: any PP = A() // Ok |
397 | 398 | let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any (any PP)'}} {{8-12=}} |
| 399 | + |
| 400 | +// coverage for rdar://123332844 |
| 401 | +let x: Any.Type = AnyObject.self |
| 402 | +let y: Any.Type = Any.self |
| 403 | + |
| 404 | +typealias Objectlike = AnyObject |
| 405 | +func f(_ x: Objectlike) {} |
| 406 | + |
| 407 | +typealias Copy = Copyable |
| 408 | +func h(_ z1: Copy, // expected-error {{use of 'Copy' (aka 'Copyable') as a type must be written 'any Copy' (aka 'any Copyable')}} |
| 409 | + _ z2: Copyable) {} // expected-error {{use of protocol 'Copyable' as a type must be written 'any Copyable'}} |
0 commit comments