-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Requestify implicit imports #31016
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
Requestify implicit imports #31016
Conversation
@swift-ci please test |
@swift-ci please test source compatibility Debug |
Debug failure seems like a consequence of Slava's patches to opaque type reconstruction. I wouldn't worry about it. |
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.
Nice cleanups here.
Check whether the user has provided a valid identifier when parsing the options. Also make ImplicitImportModuleNames a private member of FrontendOptions to prevent mutation after being parsed.
Add ModuleImplicitImportsRequest, which computes the modules that should be implicitly imported by each file of a given module. Use this request in import resolution to add all the necessary implicit imports. The request computes the implicit imports by consulting the ImplicitImportInfo, which ModuleDecl can now be created with. This allows us to remove uses of `SourceFile::addImports` in favor of adding modules needed to be implicitly imported to the ImplicitImportInfo.
The associated comment appears to outdated. Make sure we continue to record implicit imports for empty files.
Temporarily replace with `SourceFile::setImports` until import resolution is requestified. Now imports are only set once for a given SourceFile. Because we're now asserting in more places that import resolution must have run before querying imports, this commit also adds `getCachedUnderlyingType` to TypeAliasDecl to stop the ASTDumper from trying to query imports for a -dump-parse invocation.
92ef6bc
to
92103a7
Compare
Rebased to resolve a merge conflict. @swift-ci please test |
@swift-ci please test Linux |
Add
ModuleImplicitImportsRequest
, which computes the modules that should be implicitly imported by each file of a given module by consulting theImplicitImportInfo
that it's created with. Use this request in import resolution to add all the necessary implicit imports.Along with swiftlang/llvm-project#1079, this allows us to remove
SourceFile::addImports
, ensuring that a file's imports are computed only once.Note I'm not planning on merging this until after the 5.3 re-branch.