Skip to content

Commit bbbbfba

Browse files
committed
RequirementMachine: Fix assertion when protocol Self is constrained to a non-conforming type
The conflicting rule here is the permanent 'identity conformance' ([P].[P] => [P]). Permanent rules cannot be marked as conflicting, so just check for this condition first.
1 parent aa210d2 commit bbbbfba

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/AST/RequirementMachine/ConcreteTypeWitness.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ void PropertyMap::concretizeNestedTypesFromConcreteParent(
159159
concreteRule.markConflicting();
160160

161161
auto &conformanceRule = System.getRule(conformanceRuleID);
162-
if (conformanceRule.getRHS().size() == key.size())
162+
if (!conformanceRule.isIdentityConformanceRule() &&
163+
conformanceRule.getRHS().size() == key.size())
163164
conformanceRule.markConflicting();
164165
}
165166

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=on
2+
3+
// This triggered a Requirement Machine assertion because the permanent
4+
// 'identity conformance' rule ([P].[P] => [P]) was the source of the
5+
// conflict.
6+
7+
struct S {}
8+
9+
protocol P where Self == S {}

0 commit comments

Comments
 (0)