@@ -2171,7 +2171,7 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
21712171 if (auto Init = PBD->getInit (i)) {
21722172 if (!PBD->isInitializerChecked (i)) {
21732173 typeCheckPatternBinding (PBD, i,
2174- /* LeaveClosureBodyUnchecked=*/ true );
2174+ /* LeaveClosureBodyUnchecked=*/ false );
21752175 // Retrieve the accessor's body to trigger RecontextualizeClosures
21762176 // This is important to get the correct USR of variables defined
21772177 // in closures initializing lazy variables.
@@ -2393,8 +2393,6 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
23932393 }
23942394 }
23952395
2396- bool LeaveBodyUnchecked = !ctx.CompletionCallback ;
2397-
23982396 // The enclosing closure might be a single expression closure or a function
23992397 // builder closure. In such cases, the body elements are type checked with
24002398 // the closure itself. So we need to try type checking the enclosing closure
@@ -2418,17 +2416,13 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
24182416 auto ActorIsolation = determineClosureActorIsolation (
24192417 CE, __Expr_getType, __AbstractClosureExpr_getActorIsolation);
24202418 CE->setActorIsolation (ActorIsolation);
2421- if (!LeaveBodyUnchecked) {
2422- // Type checking the parent closure also type checked this node.
2423- // Nothing to do anymore.
2424- return false ;
2425- }
2426- if (CE->getBodyState () != ClosureExpr::BodyState::ReadyForTypeChecking)
2427- return false ;
2419+ // Type checking the parent closure also type checked this node.
2420+ // Nothing to do anymore.
2421+ return false ;
24282422 }
24292423 }
24302424
2431- TypeChecker::typeCheckASTNode (finder.getRef (), DC, LeaveBodyUnchecked);
2425+ TypeChecker::typeCheckASTNode (finder.getRef (), DC, /* LeaveBodyUnchecked= */ false );
24322426 return false ;
24332427}
24342428
0 commit comments