|
1 |
| -// RUN: %target-typecheck-verify-swift |
2 |
| -// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures -requirement-machine-inferred-signatures=verify %s 2>&1 | %FileCheck %s |
| 1 | +// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on |
| 2 | +// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures -requirement-machine-inferred-signatures=on %s 2>&1 | %FileCheck %s |
| 3 | + |
3 | 4 | struct S {}
|
4 | 5 | class C {}
|
5 | 6 |
|
6 | 7 | struct G1<T : AnyObject> {}
|
7 | 8 |
|
8 |
| -// CHECK-LABEL: Generic signature: <T where T == S> |
| 9 | +// CHECK: ExtensionDecl line={{.*}} base=G1 |
| 10 | +// CHECK-NEXT: Generic signature: <T> |
9 | 11 | extension G1 where T == S {}
|
10 |
| -// expected-error@-1 {{'T' requires that 'S' be a class type}} |
11 |
| -// expected-note@-2 {{same-type constraint 'T' == 'S' implied here}} |
| 12 | +// expected-error@-1 {{no type for 'T' can satisfy both 'T : AnyObject' and 'T == S'}} |
12 | 13 |
|
13 |
| -// CHECK-LABEL: Generic signature: <T where T == C> |
| 14 | +// CHECK: ExtensionDecl line={{.*}} base=G1 |
| 15 | +// CHECK-NEXT: Generic signature: <T where T == C> |
14 | 16 | extension G1 where T == C {}
|
15 | 17 |
|
16 | 18 | struct G2<U> {}
|
17 | 19 |
|
18 |
| -// CHECK-LABEL: Generic signature: <U where U == S> |
| 20 | +// CHECK: ExtensionDecl line={{.*}} base=G2 |
| 21 | +// CHECK-NEXT: Generic signature: <U> |
19 | 22 | extension G2 where U == S, U : AnyObject {}
|
20 |
| -// expected-error@-1 {{'U' requires that 'S' be a class type}} |
21 |
| -// expected-note@-2 {{same-type constraint 'U' == 'S' implied here}} |
22 |
| -// expected-note@-3 {{constraint 'U' : 'AnyObject' implied here}} |
| 23 | +// expected-error@-1 {{no type for 'U' can satisfy both 'U : AnyObject' and 'U == S'}} |
23 | 24 |
|
24 |
| -// CHECK-LABEL: Generic signature: <U where U == C> |
| 25 | +// CHECK: ExtensionDecl line={{.*}} base=G2 |
| 26 | +// CHECK-NEXT: Generic signature: <U where U == C> |
25 | 27 | extension G2 where U == C, U : AnyObject {}
|
26 |
| -// expected-warning@-1 {{redundant constraint 'U' : 'AnyObject'}} |
27 |
| -// expected-note@-2 {{constraint 'U' : 'AnyObject' implied here}} |
| 28 | +// expected-warning@-1 {{redundant constraint 'C' : 'AnyObject'}} |
28 | 29 |
|
29 |
| -// CHECK-LABEL: Generic signature: <U where U : C> |
| 30 | +// CHECK: ExtensionDecl line={{.*}} base=G2 |
| 31 | +// CHECK-NEXT: Generic signature: <U where U : C> |
30 | 32 | extension G2 where U : C, U : AnyObject {}
|
31 | 33 | // expected-warning@-1 {{redundant constraint 'U' : 'AnyObject'}}
|
32 |
| -// expected-note@-2 {{constraint 'U' : 'AnyObject' implied here}} |
33 | 34 |
|
34 | 35 | // Explicit AnyObject conformance vs derived same-type
|
35 | 36 | protocol P {
|
36 | 37 | associatedtype A where A == C
|
37 | 38 | }
|
38 | 39 |
|
39 |
| -// CHECK-LABEL: Generic signature: <T where T : P> |
| 40 | +// CHECK: .explicitAnyObjectIsRedundant@ |
| 41 | +// CHECK-NEXT: Generic signature: <T where T : P> |
40 | 42 | func explicitAnyObjectIsRedundant<T : P>(_: T) where T.A : AnyObject {}
|
41 | 43 | // expected-warning@-1 {{redundant constraint 'T.A' : 'AnyObject'}}
|
42 |
| -// expected-note@-2 {{constraint 'T.A' : 'AnyObject' implied here}} |
|
0 commit comments