Skip to content

Commit 6a8ed0c

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 49f8dce commit 6a8ed0c

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
@@ -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

Comments
 (0)