[ConstraintSystem] Infer whether locator is related to return of a single-expression function

This information could be inferred from state recorded in a
constraint system, so to need to record that in the
constraint locator as well.
This commit is contained in:
Pavel Yaskevich
2020-09-30 18:04:44 -07:00
parent 8920da22a6
commit e254f1c3e2
5 changed files with 15 additions and 38 deletions

View File

@@ -97,12 +97,6 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
llvm_unreachable("Unhandled PathElementKind in switch.");
}
bool LocatorPathElt::isResultOfSingleExprFunction() const {
if (auto elt = getAs<ContextualType>())
return elt->isForSingleExprFunction();
return false;
}
/// Determine whether given locator points to the subscript reference
/// e.g. `foo[0]` or `\Foo.[0]`
bool ConstraintLocator::isSubscriptMemberRef() const {
@@ -412,10 +406,7 @@ void ConstraintLocator::dump(SourceManager *sm, raw_ostream &out) const {
break;
case ContextualType:
if (elt.isResultOfSingleExprFunction())
out << "expected result type of the function with a single expression";
else
out << "contextual type";
out << "contextual type";
break;
case SynthesizedArgument: {