mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Don't allow explicit closure result to be implicitly converted to Void
It's allowed to convert a single statement closure from `(...) -> T` to `(...) -> Void` _only_ if there is no explicit `return` in the body. Resolves: [SR-12277](https://bugs.swift.org/browse/SR-12277) Resolves: rdar://problem/52204414
This commit is contained in:
@@ -3434,6 +3434,7 @@ void constraints::simplifyLocator(Expr *&anchor,
|
||||
}
|
||||
break;
|
||||
|
||||
case ConstraintLocator::ClosureBody:
|
||||
case ConstraintLocator::ClosureResult:
|
||||
if (auto CE = dyn_cast<ClosureExpr>(anchor)) {
|
||||
if (CE->hasSingleExpressionBody()) {
|
||||
|
||||
Reference in New Issue
Block a user