File tree 2 files changed +36
-3
lines changed
lib/AST/RequirementMachine
2 files changed +36
-3
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 (index != 0 && index != lhs.size () - 1 &&
560
+ !rule.isLHSSimplified ()) {
560
561
ASSERT_RULE (symbol.getKind () != Symbol::Kind::Protocol);
561
562
}
562
563
}
@@ -585,13 +586,18 @@ void RewriteSystem::verifyRewriteRules(ValidityPolicy policy) const {
585
586
}
586
587
587
588
ASSERT_RULE (symbol.getKind () != Symbol::Kind::Layout);
588
- ASSERT_RULE (!symbol.hasSubstitutions ());
589
+
590
+ if (!rule.isRHSSimplified () &&
591
+ index != rhs.size () - 1 ) {
592
+ ASSERT_RULE (!symbol.hasSubstitutions ());
593
+ }
589
594
590
595
if (index != 0 ) {
591
596
ASSERT_RULE (symbol.getKind () != Symbol::Kind::GenericParam);
592
597
}
593
598
594
- if (index != 0 && !rule.isRHSSimplified ()) {
599
+ if (!rule.isRHSSimplified () &&
600
+ index != 0 ) {
595
601
ASSERT_RULE (symbol.getKind () != Symbol::Kind::Protocol);
596
602
}
597
603
}
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