sema: accept an array literal of enum case references as compile-time constant

This commit is contained in:
Xi Ge
2022-03-24 20:07:23 -07:00
parent fbbfb708ec
commit 6206d7cc9d
6 changed files with 51 additions and 23 deletions

View File

@@ -1961,14 +1961,8 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
auto *locator = cs.getConstraintLocator(loc);
SourceRange range;
// simplify locator so the anchor is the exact argument.
locator = simplifyLocator(cs, locator, range);
if (locator->getPath().empty() &&
locator->getAnchor().isExpr(ExprKind::UnresolvedMemberChainResult)) {
locator =
cs.getConstraintLocator(cast<UnresolvedMemberChainResultExpr>(
locator->getAnchor().get<Expr*>())->getSubExpr());
}
cs.recordFix(NotCompileTimeConst::create(cs, paramTy, locator));
cs.recordFix(NotCompileTimeConst::create(cs, paramTy,
simplifyLocator(cs, locator, range)));
}
cs.addConstraint(