mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Constaint system] Add a predicate for when to check closures in enclosing expr
Introduce a new predicate, shouldTypeCheckInEnclosingExpression(), to determine when the body of a closure should be checked as part of the enclosing expression rather than separately, and use it in the various places where "hasSingleExpressionBody()" was used for that purpose.
This commit is contained in:
@@ -1701,6 +1701,13 @@ public:
|
||||
FunctionBuilderBodyPreCheck
|
||||
PreCheckFunctionBuilderRequest::evaluate(Evaluator &eval,
|
||||
AnyFunctionRef fn) const {
|
||||
// We don't want to do the precheck if it will already have happened in
|
||||
// the enclosing expression.
|
||||
bool skipPrecheck = false;
|
||||
if (auto closure = dyn_cast_or_null<ClosureExpr>(
|
||||
fn.getAbstractClosureExpr()))
|
||||
skipPrecheck = shouldTypeCheckInEnclosingExpression(closure);
|
||||
|
||||
return PreCheckFunctionBuilderApplication(fn, false).run();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user