Skip to content

Commit 530bee5

Browse files
committed
RequirementMachine: Loosen check in RewriteSystem::verifyRewriteRules() to allow protocol typealias rules
1 parent 4a06e21 commit 530bee5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,14 @@ void RewriteSystem::verifyRewriteRules(ValidityPolicy policy) const {
754754
for (unsigned index : indices(rhs)) {
755755
auto symbol = rhs[index];
756756

757-
// Permanent rules contain name symbols at the end, like
758-
// [P].T => [P:T].
759-
if (!rule.isRHSSimplified() &&
760-
(!rule.isPermanent() || index == rhs.size() - 1)) {
757+
// RHS-simplified rules might have unresolved name symbols on the
758+
// right hand side. Also, completion can introduce rules of the
759+
// form T.X.[concrete: C] => T.X, where T is some resolved term,
760+
// and X is a name symbol for a protocol typealias.
761+
if (!rule.isLHSSimplified() &&
762+
!rule.isRHSSimplified() &&
763+
!(rule.isPropertyRule() &&
764+
index == rhs.size() - 1)) {
761765
// This is only true if the input requirements were valid.
762766
if (policy == DisallowInvalidRequirements) {
763767
ASSERT_RULE(symbol.getKind() != Symbol::Kind::Name);

0 commit comments

Comments
 (0)