File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift %s -requirement-machine-protocol-signatures=on
2+ // RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s
3+
4+ // The GenericSignatureBuilder was unable to derive the redundant conformance requirement 'B: P4'
5+ // in protocol P1.
6+ //
7+ // This version includes the requirement; see interdependent_protocol_conformance_example_2 for
8+ // the other case.
9+
10+ // CHECK-LABEL: .P1@
11+ // CHECK-NEXT: Requirement signature: <Self where Self.[P1]A : P2, Self.[P1]B == Self.[P1]A.[P2]B>
12+ protocol P1 {
13+ associatedtype A : P2 where Self. A. B == Self . B
14+ associatedtype B : P4
15+ // expected-warning@-1 {{redundant conformance constraint 'Self.B' : 'P4'}}
16+ }
17+
18+ // CHECK-LABEL: .P2@
19+ // CHECK-NEXT: Requirement signature: <Self where Self.[P2]B == Self.[P2]C.[P3]B, Self.[P2]C : P3>
20+ protocol P2 {
21+ associatedtype B
22+ associatedtype C : P3 where Self. C. B == Self . B
23+ }
24+
25+ // CHECK-LABEL: .P3@
26+ // CHECK-NEXT: Requirement signature: <Self where Self.[P3]B : P4>
27+ protocol P3 {
28+ associatedtype B : P4
29+ }
30+
31+ // CHECK-LABEL: .P4@
32+ // CHECK-NEXT: Requirement signature: <Self where Self == Self.[P4]A.[P2]B, Self.[P4]A : P2>
33+ protocol P4 {
34+ associatedtype A : P2 where Self. A. B == Self
35+ }
36+
37+ func takesP4< T : P4 > ( _: T . Type ) { }
38+
39+ func testP1< T : P1 > ( _: T ) {
40+ takesP4 ( T . B. self)
41+ }
Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift %s -requirement-machine-protocol-signatures=on
2+ // RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s
3+
4+ // The GenericSignatureBuilder was unable to derive the redundant conformance requirement 'B: P4'
5+ // in protocol P1.
6+ //
7+ // This version omits the requirement; see interdependent_protocol_conformance_example_1 for
8+ // the other case.
9+
10+ // CHECK-LABEL: .P1@
11+ // CHECK-NEXT: Requirement signature: <Self where Self.[P1]A : P2, Self.[P1]B == Self.[P1]A.[P2]B>
12+ protocol P1 {
13+ associatedtype A : P2 where Self. A. B == Self . B
14+ associatedtype B
15+ }
16+
17+ // CHECK-LABEL: .P2@
18+ // CHECK-NEXT: Requirement signature: <Self where Self.[P2]B == Self.[P2]C.[P3]B, Self.[P2]C : P3>
19+ protocol P2 {
20+ associatedtype B
21+ associatedtype C : P3 where Self. C. B == Self . B
22+ }
23+
24+ // CHECK-LABEL: .P3@
25+ // CHECK-NEXT: Requirement signature: <Self where Self.[P3]B : P4>
26+ protocol P3 {
27+ associatedtype B : P4
28+ }
29+
30+ // CHECK-LABEL: .P4@
31+ // CHECK-NEXT: Requirement signature: <Self where Self == Self.[P4]A.[P2]B, Self.[P4]A : P2>
32+ protocol P4 {
33+ associatedtype A : P2 where Self. A. B == Self
34+ }
35+
36+ func takesP4< T : P4 > ( _: T . Type ) { }
37+
38+ func testP1< T : P1 > ( _: T ) {
39+ takesP4 ( T . B. self)
40+ }
You can’t perform that action at this time.
0 commit comments