[ConstraintSystem] Implement simplication of PatternMatch element

This commit is contained in:
Pavel Yaskevich
2022-03-16 11:27:48 -07:00
parent ea355fd8fe
commit 696c8f1d9d

View File

@@ -4758,6 +4758,12 @@ void constraints::simplifyLocator(ASTNode &anchor,
path = path.slice(1); path = path.slice(1);
continue; continue;
} }
if (anchor.is<Pattern *>()) {
path = path.slice(1);
continue;
}
break; break;
case ConstraintLocator::SubscriptMember: case ConstraintLocator::SubscriptMember:
@@ -4851,6 +4857,13 @@ void constraints::simplifyLocator(ASTNode &anchor,
continue; continue;
} }
case ConstraintLocator::PatternMatch: {
auto patternElt = path[0].castTo<LocatorPathElt::PatternMatch>();
anchor = patternElt.getPattern();
path = path.slice(1);
continue;
}
default: default:
// FIXME: Lots of other cases to handle. // FIXME: Lots of other cases to handle.
break; break;