@@ -2611,31 +2611,14 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
2611
2611
}
2612
2612
}
2613
2613
2614
- // The enclosing closure might be a single expression closure or a function
2615
- // builder closure. In such cases, the body elements are type checked with
2616
- // the closure itself. So we need to try type checking the enclosing closure
2617
- // signature first unless it has already been type checked.
2614
+ // If the context is a closure, type check the entire surrounding closure.
2615
+ // Conjunction constraints ensure that statements unrelated to the one that
2616
+ // contains the code completion token are not type checked.
2618
2617
if (auto CE = dyn_cast<ClosureExpr>(DC)) {
2619
2618
if (CE->getBodyState () == ClosureExpr::BodyState::Parsed) {
2620
2619
swift::typeCheckASTNodeAtLoc (
2621
2620
TypeCheckASTNodeAtLocContext::declContext (CE->getParent ()),
2622
2621
CE->getLoc ());
2623
- // We need the actor isolation of the closure to be set so that we can
2624
- // annotate results that are on the same global actor.
2625
- // Since we are evaluating TypeCheckASTNodeAtLocRequest for every closure
2626
- // from outermost to innermost, we don't want to call checkActorIsolation,
2627
- // because that would cause actor isolation to be checked multiple times
2628
- // for nested closures. Instead, call determineClosureActorIsolation
2629
- // directly and set the closure's actor isolation manually. We can
2630
- // guarantee of that the actor isolation of enclosing closures have their
2631
- // isolation checked before nested ones are being checked by the way
2632
- // TypeCheckASTNodeAtLocRequest is called multiple times, as described
2633
- // above.
2634
- auto ActorIsolation = determineClosureActorIsolation (
2635
- CE, __Expr_getType, __AbstractClosureExpr_getActorIsolation);
2636
- CE->setActorIsolation (ActorIsolation);
2637
- // Type checking the parent closure also type checked this node.
2638
- // Nothing to do anymore.
2639
2622
return false ;
2640
2623
}
2641
2624
}
0 commit comments