mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user