[ConstraintSystem] Record holes in the constraint system using a new flag in

`TypeVariableOptions` rather than using a separate data structure in the
constraint system.
This commit is contained in:
Holly Borla
2019-11-11 14:41:54 -08:00
parent ea1a46c84d
commit c0312b9c0e
10 changed files with 65 additions and 72 deletions

View File

@@ -3161,6 +3161,17 @@ bool MissingMemberFailure::diagnoseAsError() {
if (baseType->is<TupleType>())
diagnostic = diag::could_not_find_tuple_member;
bool hasUnresolvedPattern = false;
anchor->forEachChildExpr([&](Expr *expr) {
hasUnresolvedPattern |= isa<UnresolvedPatternExpr>(expr);
return hasUnresolvedPattern ? nullptr : expr;
});
if (hasUnresolvedPattern && !baseType->getAs<EnumType>()) {
emitDiagnostic(anchor->getLoc(),
diag::cannot_match_unresolved_expr_pattern_with_value, baseType);
return;
}
emitDiagnostic(anchor->getLoc(), diagnostic, baseType, getName())
.highlight(baseExpr->getSourceRange())
.highlight(nameLoc.getSourceRange());