File tree 2 files changed +31
-2
lines changed
lib/AST/RequirementMachine
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -556,7 +556,8 @@ void RewriteSystem::verifyRewriteRules(ValidityPolicy policy) const {
556
556
ASSERT_RULE (symbol.getKind () != Symbol::Kind::GenericParam);
557
557
}
558
558
559
- if (index != 0 && index != lhs.size () - 1 ) {
559
+ if (!rule.isLHSSimplified () &&
560
+ index != 0 && index != lhs.size () - 1 ) {
560
561
ASSERT_RULE (symbol.getKind () != Symbol::Kind::Protocol);
561
562
}
562
563
}
@@ -591,7 +592,8 @@ void RewriteSystem::verifyRewriteRules(ValidityPolicy policy) const {
591
592
ASSERT_RULE (symbol.getKind () != Symbol::Kind::GenericParam);
592
593
}
593
594
594
- if (index != 0 && !rule.isRHSSimplified ()) {
595
+ if (!rule.isRHSSimplified () &&
596
+ index != 0 ) {
595
597
ASSERT_RULE (symbol.getKind () != Symbol::Kind::Protocol);
596
598
}
597
599
}
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
2
+
3
+ // CHECK-LABEL: .P1@
4
+ // CHECK-NEXT: Requirement signature: <Self where Self == Self.[P1]T.[P2]T, Self.[P1]T : P2>
5
+ protocol P1 {
6
+ associatedtype T : P2 where T. T == Self
7
+ }
8
+
9
+ // CHECK-LABEL: .P2@
10
+ // CHECK-NEXT: Requirement signature: <Self where Self == Self.[P2]T.[P1]T, Self.[P2]T : P1>
11
+ protocol P2 {
12
+ associatedtype T : P1 where T. T == Self
13
+ }
14
+
15
+ class SomeClass { }
16
+
17
+ // CHECK-LABEL: .P3@
18
+ // CHECK-NEXT: Requirement signature: <Self where Self : P2, Self.[P2]T : SomeClass>
19
+ protocol P3 : P2 where T: SomeClass { }
20
+
21
+ protocol P4 {
22
+ associatedtype T
23
+ }
24
+
25
+ // CHECK-LABEL: .foo@
26
+ // CHECK-NEXT: Generic signature: <T where T : P4, T.[P4]T : P1, T.[P4]T.[P1]T : P3>
27
+ func foo< T: P4 > ( _: T ) where T. T: P1 , T. T. T: P3 { }
You can’t perform that action at this time.
0 commit comments