-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AST/SILGen: Requestify function body skipping #68760
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
AST/SILGen: Requestify function body skipping #68760
Conversation
@swift-ci please test |
263a278
to
66d75f8
Compare
@swift-ci please smoke test |
9b81054
to
dbb21a0
Compare
@swift-ci please test |
@swift-ci please build toolchain macOS platform |
dbb21a0
to
c22e046
Compare
@swift-ci please smoke test |
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.
It looks good and surprisingly clean! (except for that last commit)
34d5efc
to
9faa2e5
Compare
Thanks! Yeah, I found one last minute case that I need to handle and I'm just about done with it. I will fix up the commit in a bit |
77c7754
to
b175d1b
Compare
Function bodies are skipped during typechecking when one of the -experimental-skip-*-function-bodies flags is passed to the frontend. This was implemented by setting the "body kind" of an `AbstractFunctionDecl` during decl checking in `TypeCheckDeclPrimary`. This approach had a couple of issues: - It is incompatible with skipping function bodies during lazy typechecking, since the skipping is only evaluated during a phase of eager typechecking. - It prevents skipped function bodies from being parsed on-demand ("skipped" is a state that is distinct from "parsed", when they ought to be orthogonal). This needlessly prevented complete module interfaces from being emitted with -experimental-skip-all-function-bodies. Storing the skipped status of a function separately from body kind and requestifying the determination of whether to skip a function solves these problems. Resolves rdar://116020403
b175d1b
to
1d8fc10
Compare
@swift-ci please smoke test |
@swift-ci please smoke test Linux |
@tshortli looks like this changes regressed one of the projects in the source compatibility suite - https://ci.swift.org/job/swift-main-source-compat-suite-debug/560/artifact/swift-source-compat-suite/FAIL_swift-distributed-actors_5.7_BuildSwiftPackage.log |
But somehow only in Debug configuration. |
@xedin Thanks for the heads up, I'll take a look |
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. We ought to see if we can do a better job of enforcing we never parse a skipped body, as well as actually fixing the parser skipping behavior for `#sourceLocation`, in a follow-up. rdar://131726797
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. rdar://131726797
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
The refactoring in #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
Function bodies are skipped during typechecking when one of the
-experimental-skip-*-function-bodies
flags is passed to the frontend. This was implemented by setting the "body kind" of anAbstractFunctionDecl
during decl checking inTypeCheckDeclPrimary
. This approach had a couple of issues:-experimental-skip-all-function-bodies
.Storing the skipped status of a function separately from body kind and requestifying the determination of whether to skip a function solves these problems.
Resolves rdar://116020403