Constrain type checking of expressions in optional pattern bindings

so that they must result in an optional type.

Add constraint locator path for identifying constraints/variables that are part of the convert type passed into the system.
This commit is contained in:
gregomni
2018-07-23 21:54:23 -07:00
parent 14f7799f16
commit 775cca60b6
7 changed files with 92 additions and 5 deletions

View File

@@ -80,6 +80,7 @@ void ConstraintLocator::Profile(llvm::FoldingSetNodeID &id, Expr *anchor,
case TypeParameterRequirement:
case ImplicitlyUnwrappedDisjunctionChoice:
case DynamicLookupResult:
case ContextualType:
if (unsigned numValues = numNumericValuesInPathElement(elt.getKind())) {
id.AddInteger(elt.getValue());
if (numValues > 1)
@@ -258,6 +259,10 @@ void ConstraintLocator::dump(SourceManager *sm, raw_ostream &out) {
case DynamicLookupResult:
out << "dynamic lookup result";
break;
case ContextualType:
out << "contextual type";
break;
}
}