Skip to content

Commit 9dbe72a

Browse files
committed
Sema: Centralize check for -experimental-lazy-typecheck.
Always check for the flag before evaluating `TypeCheckSourceFileRequest`, rather than just in `performSema()`. This ensures later compilation stages that re-request eager typechecking honor the flag.
1 parent 9ba500d commit 9dbe72a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,11 +1425,6 @@ bool CompilerInstance::performParseAndResolveImportsOnly() {
14251425
void CompilerInstance::performSema() {
14261426
performParseAndResolveImportsOnly();
14271427

1428-
// Skip eager type checking. Instead, let later stages of compilation drive
1429-
// type checking as needed through request evaluation.
1430-
if (getASTContext().TypeCheckerOpts.EnableLazyTypecheck)
1431-
return;
1432-
14331428
FrontendStatsTracer tracer(getStatsReporter(), "perform-sema");
14341429

14351430
forEachFileToTypeCheck([&](SourceFile &SF) {

lib/Sema/TypeChecker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ void swift::bindExtensions(ModuleDecl &mod) {
242242
}
243243

244244
void swift::performTypeChecking(SourceFile &SF) {
245+
if (SF.getASTContext().TypeCheckerOpts.EnableLazyTypecheck) {
246+
// Skip eager type checking. Instead, let later stages of compilation drive
247+
// type checking as needed through request evaluation.
248+
return;
249+
}
250+
245251
return (void)evaluateOrDefault(SF.getASTContext().evaluator,
246252
TypeCheckSourceFileRequest{&SF}, {});
247253
}

0 commit comments

Comments
 (0)