Merge pull request #31390 from CodaFi/tone-loc

Strip Out More TypeLocs
This commit is contained in:
Robert Widmann
2020-04-29 16:46:00 -07:00
committed by GitHub
18 changed files with 134 additions and 147 deletions

View File

@@ -7083,14 +7083,11 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
closureType->getResult(),
getConstraintLocator(closure, LocatorPathElt::ClosureBody(hasReturn)));
} else if (!hasReturn) {
bool hasExplicitResult = closure->hasExplicitResultType() &&
closure->getExplicitResultTypeLoc().getType();
// If this closure has an empty body and no explicit result type
// let's bind result type to `Void` since that's the only type empty body
// can produce. Otherwise, if (multi-statement) closure doesn't have
// an explicit result (no `return` statements) let's default it to `Void`.
auto constraintKind = (closure->hasEmptyBody() && !hasExplicitResult)
auto constraintKind = (closure->hasEmptyBody() && !closure->hasExplicitResultType())
? ConstraintKind::Bind
: ConstraintKind::Defaultable;
addConstraint(