Skip to content

[IDE] Skip walking serialized internal top level decls in SemaAnnotator #42406

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

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

bnbarham
Copy link
Contributor

SemaAnnotator always attempts to retrieve the location of the decl. This
requires generating the USR, which needs to resolve the type. But that's
invalid in the presence of @_implementationOnly.

This most commonly comes up during index while building as even though
it skip internal decls, by that point it's too late (SemaAnnotator has
already tried retrieving the location). Other uses of
SourceEntityWalker should be unaffected as they only run over the
current decls in the current module.

For now skip walking internal top level decls from serialized modules in
SemaAnnotator. Consider expanding this to most, if not all,
ASTWalker clients in the future - it's unlikely SemaAnnotator is the
only one with this problem.

Resolves rdar://91279771.

`SemaAnnotator` always attempts to retrieve the location of the decl. This
requires generating the USR, which needs to resolve the type. But that's
invalid in the presence of `@_implementationOnly`.

This most commonly comes up during index while building as even though
it skip internal decls, by that point it's too late (`SemaAnnotator` has
already tried retrieving the location). Other uses of
`SourceEntityWalker` should be unaffected as they only run over the
current decls in the current module.

For now skip walking internal top level decls from serialized modules in
`SemaAnnotator`. Consider expanding this to most, if not all,
`ASTWalker` clients in the future - it's unlikely `SemaAnnotator` is the
only one with this problem.

Resolves rdar://91279771.
@bnbarham bnbarham force-pushed the skip-internal-types branch from 50aa672 to fec7a0b Compare April 16, 2022 00:09
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham bnbarham requested review from xymus and rintaro April 16, 2022 00:11
Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

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

This looks good, thanks!

@bnbarham bnbarham requested a review from benlangmuir April 18, 2022 17:12
@bnbarham bnbarham merged commit 6aca5e5 into swiftlang:main Apr 18, 2022
@bnbarham bnbarham deleted the skip-internal-types branch April 18, 2022 18:22
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.

3 participants