mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Typed throws] Enable checking of thrown types on closures.
Enable typed throws on explicit closures, either due to contextual type information or due to explicit specification.
This commit is contained in:
@@ -5809,6 +5809,16 @@ void constraints::simplifyLocator(ASTNode &anchor,
|
||||
}
|
||||
break;
|
||||
|
||||
case ConstraintLocator::ClosureThrownError:
|
||||
if (auto CE = getAsExpr<ClosureExpr>(anchor)) {
|
||||
if (auto thrownTypeRepr = CE->getExplicitThrownTypeRepr()) {
|
||||
anchor = thrownTypeRepr;
|
||||
path = path.slice(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ConstraintLocator::CoercionOperand: {
|
||||
auto *CE = castToExpr<CoerceExpr>(anchor);
|
||||
anchor = CE->getSubExpr()->getValueProvidingExpr();
|
||||
|
||||
Reference in New Issue
Block a user