Skip to content

[Sema] Don't parse skipped bodies when computing discriminators #75421

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
Jul 24, 2024

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Jul 23, 2024

The refactoring in #68760 accidentally caused us to start parsing skipped function bodies if they have parameters when emitting modules, as the local discriminator request kicks parsing through getBody(). Cherry-pick part of 47ff956 which was never landed, ensuring we don't call getBody for a skipped function body.

This is meant to be a minimal low-risk change that fixes the issue in question, restoring the behavior we had in 5.10 (and currently have in Xcode 16b3). Fixing the parser skipping behavior for #sourceLocation will be done in a follow-up. We also ought to see if there's a better way we can enforce that skipped function bodies don't end up getting parsed, for now I've added a test.

rdar://131726797
Resolves #74561

The refactoring in swiftlang#68760 accidentally caused us to
start parsing skipped function bodies if they have
parameters, as the local discriminator request kicks
parsing through `getBody()`. Cherry-pick part of
47ff956 which was
never landed, ensuring we don't call `getBody` for
a skipped function body.

This is meant to be a minimal low-risk change that
fixes the issue in question, restoring the behavior
we had in 5.10. Fixing the parser skipping
behavior for `#sourceLocation` will be done in
a follow-up. We also ought to see if there's a
better way we can enforce that skipped function
bodies don't end up getting parsed, for now I've
added a test.

rdar://131726797
@hamishknight
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@tshortli tshortli left a comment

Choose a reason for hiding this comment

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

Thanks!

@hamishknight hamishknight merged commit b191390 into swiftlang:main Jul 24, 2024
5 checks passed
@hamishknight hamishknight deleted the skip branch July 24, 2024 08:58
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.

sourceLocation error in Swift 6 (but not Swift 5 or with slight modification)
2 participants