Skip to content

Commit f6bb2cb

Browse files
authored
Merge pull request swiftlang#40457 from slavapestov/two-rqm-protocol-tests
RequirementMachine: Add a couple of passing protocol minimization test cases
2 parents 1ed3ce3 + 478d04b commit f6bb2cb

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

test/Generics/rdar77683844.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s
2+
3+
// CHECK-LABEL: rdar77683844.(file).P1@
4+
// CHECK-LABEL: Requirement signature: <Self where Self.T1 : P2, Self.T1 == Self.T3.T1, Self.T2 == Self.T1.T2, Self.T3 == Self.T1.T3, Self.T1.T2 == Self.T1.T4.T2, Self.T1.T3 == Self.T2.T3>
5+
6+
public protocol P1 {
7+
associatedtype T1: P2 where T1.T4.T2 == T2, T1.T2 == T2, T1.T3 == T3
8+
associatedtype T2 where T2.T3 == T3
9+
associatedtype T3 where T3.T1 == T1
10+
}
11+
12+
// CHECK-LABEL: rdar77683844.(file).P2@
13+
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4, Self.T3 : P3, Self.T4 : P5>
14+
15+
public protocol P2 {
16+
associatedtype T3: P3
17+
associatedtype T2: P4
18+
associatedtype T4: P5
19+
}
20+
21+
// CHECK-LABEL: rdar77683844.(file).P3@
22+
// CHECK-LABEL: Requirement signature: <Self where Self.T1 : P2, Self.T2 : P4>
23+
24+
public protocol P3 {
25+
associatedtype T1: P2
26+
associatedtype T2: P4
27+
}
28+
29+
// CHECK-LABEL: rdar77683844.(file).P4@
30+
// CHECK-LABEL: Requirement signature: <Self where Self.T3 : P3>
31+
32+
public protocol P4 {
33+
associatedtype T3: P3
34+
}
35+
36+
// CHECK-LABEL: rdar77683844.(file).P5@
37+
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>
38+
39+
public protocol P5 {
40+
associatedtype T2: P4
41+
}

test/Generics/rdar78233378.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s
2+
3+
// CHECK-LABEL: rdar78233378.(file).P1@
4+
// CHECK-LABEL: Requirement signature: <Self where Self : P4, Self == Self.T1.T2, Self.T1 : P2>
5+
public protocol P1: P4 where T1.T2 == Self {
6+
associatedtype T1: P2
7+
}
8+
9+
// CHECK-LABEL: rdar78233378.(file).P2@
10+
// CHECK-LABEL: Requirement signature: <Self where Self : P5, Self.T2 : P1>
11+
public protocol P2: P5 where T2: P1 {}
12+
13+
// CHECK-LABEL: rdar78233378.(file).P3@
14+
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>
15+
public protocol P3 {
16+
associatedtype T2: P4
17+
}
18+
19+
// CHECK-LABEL: rdar78233378.(file).P4@
20+
// CHECK-LABEL: Requirement signature: <Self where Self == Self.T3.T2, Self.T3 : P3>
21+
public protocol P4 where T3.T2 == Self {
22+
associatedtype T3: P3
23+
}
24+
25+
// CHECK-LABEL: rdar78233378.(file).P5@
26+
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>
27+
public protocol P5 {
28+
associatedtype T2: P4
29+
}

0 commit comments

Comments
 (0)