Skip to content

Commit 6d8b905

Browse files
committed
[Type checker] Move capture computation before actor isolation checking.
Actor isolation checking is going to make use of capture information, so move the computation of captures before both actor isolation checking and effects checking.
1 parent 810f1cd commit 6d8b905

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,12 +910,13 @@ Expr *DefaultArgumentExprRequest::evaluate(Evaluator &evaluator,
910910
return new (ctx) ErrorExpr(initExpr->getSourceRange(), ErrorType::get(ctx));
911911
}
912912

913-
checkInitializerActorIsolation(dc, initExpr);
914-
TypeChecker::checkInitializerEffects(dc, initExpr);
915-
916913
// Walk the checked initializer and contextualize any closures
917914
// we saw there.
918915
TypeChecker::contextualizeInitializer(dc, initExpr);
916+
917+
checkInitializerActorIsolation(dc, initExpr);
918+
TypeChecker::checkInitializerEffects(dc, initExpr);
919+
919920
return initExpr;
920921
}
921922

@@ -1746,10 +1747,9 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
17461747
auto *initContext = cast_or_null<PatternBindingInitializer>(
17471748
PBD->getInitContext(i));
17481749
if (initContext) {
1749-
// Check safety of error-handling in the declaration, too.
1750+
TypeChecker::contextualizeInitializer(initContext, init);
17501751
checkInitializerActorIsolation(initContext, init);
17511752
TypeChecker::checkInitializerEffects(initContext, init);
1752-
TypeChecker::contextualizeInitializer(initContext, init);
17531753
}
17541754
}
17551755
}

lib/Sema/TypeCheckStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,9 +2067,9 @@ TypeCheckFunctionBodyRequest::evaluate(Evaluator &evaluator,
20672067
if (!hadError)
20682068
performAbstractFuncDeclDiagnostics(AFD);
20692069

2070+
TypeChecker::computeCaptures(AFD);
20702071
checkFunctionActorIsolation(AFD);
20712072
TypeChecker::checkFunctionEffects(AFD);
2072-
TypeChecker::computeCaptures(AFD);
20732073

20742074
return hadError ? errorBody() : body;
20752075
}

0 commit comments

Comments
 (0)