Skip to content

Commit c26b2f6

Browse files
committed
[CodeCompletion] Don’t set actor isolation in TypeCheckASTNodeAtLocRequest
Since we migrated all of code completion to solver-based, this is no longer needed.
1 parent 36f8739 commit c26b2f6

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,31 +2611,14 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
26112611
}
26122612
}
26132613

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.
26182617
if (auto CE = dyn_cast<ClosureExpr>(DC)) {
26192618
if (CE->getBodyState() == ClosureExpr::BodyState::Parsed) {
26202619
swift::typeCheckASTNodeAtLoc(
26212620
TypeCheckASTNodeAtLocContext::declContext(CE->getParent()),
26222621
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.
26392622
return false;
26402623
}
26412624
}

0 commit comments

Comments
 (0)