Skip to content

Commit 5e5578a

Browse files
committed
Frontend: Ignore -experimental-lazy-typecheck when verifying module interfaces.
1 parent 606bb39 commit 5e5578a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ bool ArgsToFrontendOptionsConverter::convert(
325325
Opts.SkipNonExportableDecls |=
326326
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
327327
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
328+
// HACK: The driver currently erroneously passes all flags to module interface
329+
// verification jobs. -experimental-skip-non-exportable-decls is not
330+
// appropriate for verification tasks and should be ignored, though.
331+
if (Opts.RequestedAction ==
332+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
333+
Opts.SkipNonExportableDecls = false;
328334

329335
Opts.DebugPrefixSerializedDebuggingOptions |=
330336
Args.hasArg(OPT_prefix_serialized_debugging_options);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,12 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
15061506
Opts.EnableLazyTypecheck |=
15071507
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
15081508
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1509+
// HACK: The driver currently erroneously passes all flags to module interface
1510+
// verification jobs. -experimental-skip-non-exportable-decls is not
1511+
// appropriate for verification tasks and should be ignored, though.
1512+
if (FrontendOpts.RequestedAction ==
1513+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
1514+
Opts.EnableLazyTypecheck = false;
15091515

15101516
return HadError;
15111517
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-compiler-version: Swift version 5.11
3+
// swift-module-flags: -swift-version 5 -enable-library-evolution -module-name Test
4+
// expected-error @-3 {{failed to verify module interface of 'Test'}}
5+
import Swift
6+
public struct S {
7+
@inlinable public func foo() {
8+
doesNotExist() // expected-error {{cannot find 'doesNotExist' in scope}}
9+
}
10+
}
11+
12+
// RUN: %target-swift-typecheck-module-from-interface(%s) -module-name Test -verify -verify-ignore-unknown -experimental-lazy-typecheck

0 commit comments

Comments
 (0)