@@ -2629,31 +2629,14 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
26292629 }
26302630 }
26312631
2632- // The enclosing closure might be a single expression closure or a function
2633- // builder closure. In such cases, the body elements are type checked with
2634- // the closure itself. So we need to try type checking the enclosing closure
2635- // signature first unless it has already been type checked.
2632+ // If the context is a closure, type check the entire surrounding closure.
2633+ // Conjunction constraints ensure that statements unrelated to the one that
2634+ // contains the code completion token are not type checked.
26362635 if (auto CE = dyn_cast<ClosureExpr>(DC)) {
26372636 if (CE->getBodyState () == ClosureExpr::BodyState::Parsed) {
26382637 swift::typeCheckASTNodeAtLoc (
26392638 TypeCheckASTNodeAtLocContext::declContext (CE->getParent ()),
26402639 CE->getLoc ());
2641- // We need the actor isolation of the closure to be set so that we can
2642- // annotate results that are on the same global actor.
2643- // Since we are evaluating TypeCheckASTNodeAtLocRequest for every closure
2644- // from outermost to innermost, we don't want to call checkActorIsolation,
2645- // because that would cause actor isolation to be checked multiple times
2646- // for nested closures. Instead, call determineClosureActorIsolation
2647- // directly and set the closure's actor isolation manually. We can
2648- // guarantee of that the actor isolation of enclosing closures have their
2649- // isolation checked before nested ones are being checked by the way
2650- // TypeCheckASTNodeAtLocRequest is called multiple times, as described
2651- // above.
2652- auto ActorIsolation = determineClosureActorIsolation (
2653- CE, __Expr_getType, __AbstractClosureExpr_getActorIsolation);
2654- CE->setActorIsolation (ActorIsolation);
2655- // Type checking the parent closure also type checked this node.
2656- // Nothing to do anymore.
26572640 return false ;
26582641 }
26592642 }
0 commit comments