Skip to content

Commit dad0027

Browse files
committed
[Sema] Run effects checking after actor isolation checking.
Effects checking for `async` requires actor isolation to have been computed. This change removes effects checking out of the contextualize initializers request, because effects checking isn't needed for secondary files. Instead, effects checking is done in the primary decl checker after actor isolation checking.
1 parent 1d3cb5c commit dad0027

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: lib/Sema/TypeCheckDeclPrimary.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,13 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
28942894
if (!PBD->getDeclContext()->isLocalContext()) {
28952895
(void) PBD->getInitializerIsolation(i);
28962896
}
2897+
2898+
// Effects checking for 'async' needs actor isolation to be computed.
2899+
// Always run effects checking after the actor isolation checker.
2900+
if (auto *initContext = PBD->getInitContext(i)) {
2901+
auto *init = PBD->getInit(i);
2902+
TypeChecker::checkInitializerEffects(initContext, init);
2903+
}
28972904
}
28982905
}
28992906

Diff for: lib/Sema/TypeCheckStorage.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ static void checkAndContextualizePatternBindingInit(PatternBindingDecl *binding,
619619
if (auto *initContext = binding->getInitContext(i)) {
620620
auto *init = binding->getInit(i);
621621
TypeChecker::contextualizeInitializer(initContext, init);
622-
TypeChecker::checkInitializerEffects(initContext, init);
623622
}
624623
}
625624

0 commit comments

Comments
 (0)