Skip to content
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 scoped import validation #30038

Merged

Conversation

hamishknight
Copy link
Collaborator

@hamishknight hamishknight commented Feb 24, 2020

Move the lookup and validation of scoped imports into a request, and force the request when we're type-checking a primary file. This avoids having to do an additional pass during name binding, and has the nice bonus of no longer running the validation for secondary files.

This PR also adds ModuleDecl::getTopLevelModule, and uses it for the lookup of the scoped import rather than attempting to retrieve a module with the same name as the top-level module. This allows us to correctly retrieve the top-level module for a Clang submodule, rather than potentially retrieving the Swift module in a mixed source project.

Resolves SR-12265.

@hamishknight
Copy link
Collaborator Author

@swift-ci please test

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup.

This can be used to retrieve the Swift module
wrapper for a Clang submodule's top-level module.
@hamishknight hamishknight force-pushed the plenty-of-scope-for-requestification branch from 188b99e to 97837c1 Compare February 25, 2020 05:21
@apple apple deleted a comment from swift-ci Feb 25, 2020
@apple apple deleted a comment from swift-ci Feb 25, 2020
@hamishknight
Copy link
Collaborator Author

@swift-ci please test

@hamishknight
Copy link
Collaborator Author

@swift-ci please test source compatibility

Copy link
Member

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cleanup. Only one question

@hamishknight hamishknight force-pushed the plenty-of-scope-for-requestification branch from 97837c1 to 586559c Compare February 25, 2020 18:43
@compnerd
Copy link
Collaborator

@swift-ci please test Windows platform

@hamishknight
Copy link
Collaborator Author

@compnerd Mind triggering again?

Move the validation of scoped imports into a
request, and force the request when we're
type-checking a primary file. This has the nice
bonus of no longer running the validation for
secondary files.

The use of `ModuleDecl::getTopLevelModule` also
allows us to correctly retrieve the top-level
module for a Clang submodule, rather than
potentially retrieving the Swift module in a mixed
source project.

Resolves SR-12265.
This was only required to represent an import that
hadn't yet had its scope validated. Now that the
validation has been requestified, we can directly
record the resulting `ImportedModuleDesc` instead.
@hamishknight hamishknight force-pushed the plenty-of-scope-for-requestification branch from 586559c to 0c785aa Compare February 25, 2020 21:30
@hamishknight
Copy link
Collaborator Author

@swift-ci please smoke test

@hamishknight
Copy link
Collaborator Author

@swift-ci please test Windows platform

@hamishknight hamishknight merged commit 63e4ec6 into apple:master Feb 26, 2020
@hamishknight hamishknight deleted the plenty-of-scope-for-requestification branch February 26, 2020 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants