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