-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Verify that just-emitted module interfaces parse and typecheck #33114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify that just-emitted module interfaces parse and typecheck #33114
Conversation
68453ce
to
d602bca
Compare
@swift-ci please test |
I still need to figure out how this should interact with the prebuild script's Edit: No. |
Build failed |
Build failed |
@@ -116,6 +116,8 @@ class FrontendOptions { | |||
|
|||
/// Build from a swiftinterface, as close to `import` as possible | |||
CompileModuleFromInterface, | |||
/// Same as CompileModuleFromInterface, but stopping after typechecking | |||
TypecheckModuleFromInterface, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition overall! Why not we just reuse CompileModuleFromInterface
action instead of defining a new one? We could potentially add another flag to indicate stopping after typechecking for -compile-module-from-interface
. Maintaining an additional frontend action doesn't seem appealing to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-typecheck
and -compile-module-from-interface
are both compiler modes (ModeOpt
s), so they're mutually exclusive. Also note that their behavior is pretty different—if you take a look at the FrontendOptions.cpp diff, ActionType::TypecheckModuleFromInterface
's behavior tends to match ActionType::Typecheck
, not ActionType::CompileModuleFromInterface
.
There's something to be said for the idea of removing -compile-module-from-interface
and instead having people use -emit-module
to do that; either there would be a flag to restart the compilation in the module interface builder, or this would just happen automatically when you passed a module interface. This would have a couple of nice benefits, like allowing other flags such as -dump-ast
or -emit-sil
. But that would be a much bigger change and I'm not sure it can be fully justified.
(Ultimately, I think the new driver probably ought to treat .swiftinterface
inputs as implicitly being requests to either compile or typecheck the interface—not sure which. But that's a whole different story, and I think it's better handled in the new driver instead of the old one.)
d602bca
to
43a8e5e
Compare
This makes development in Xcode somewhat simpler.
43a8e5e
to
5488473
Compare
@swift-ci please test |
Build failed |
Build failed |
The driver can now schedule jobs which typecheck just-emitted module interfaces to ensure that they can be consumed later. This can be enabled manually by passing `-verify-emitted-module-interface` to the driver.
Isolated into its own commit so that it can be reverted easily.
SwiftPM test is failing:
Seems totally plausible that something might need to be updated there. |
5488473
to
f824204
Compare
With swiftlang/swift-package-manager#2854 @swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
This PR makes Swift verify module interfaces and private module interfaces after emitting them. To do this, it adds a new frontend mode,
-typecheck-module-from-interface
, and modifies the driver to optionally schedule a typechecking job for each emitted module interface after merge-modules.This is currently done unconditionally, but I'll probably add some kind of flag later on to turn it on only when requested.This extra verification step is enabled by default in assert compilers, but can be enabled in any compiler by passing the-verify-emitted-module-interface
flag to the driver.Fixes rdar://66710563.