-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[rbi] Change Region Based Isolation for closures to not use the AST and instead just use SIL. #78837
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is used for synthetic uses like _ = x that do not act as a true use but instead only suppress unused variable warnings. This patch just adds the instruction. Eventually, we can use it to move the unused variable warning from Sema to SIL slimmming the type checker down a little bit... but for now I am using it so that other diagnostic passes can have a SIL instruction (with SIL location) so that we can emit diagnostics on code like _ = x. Today we just do not emit anything at all for that case so a diagnostic SIL pass would not see any instruction that it could emit a diagnostic upon. In the next patch of this series, I am going to add SILGen support to do that.
…lack hole initialization.
…nd instead just use SIL. The reason why I am doing this is that in certain cases the AST captures indices will never actually line up with partial apply capture indices since we seem to "smush" together closures and locally defined functions. NOTE: The reason for the really small amount of test changes is that this change does not change the actual output by design. The only cases I had to change were a case where we began to emit a better diagnostic and also where I added code coverage around _ and let _ since those require ignored_use to be implemented so that they would be diagnosed (previously we just did not emit anything so we couldn't emit the diagnostic at the SIL level). rdar://142661388
@swift-ci smoke test |
eeckstein
reviewed
Jan 23, 2025
|
@swift-ci smoke test |
1 similar comment
@swift-ci smoke test |
@swift-ci test macOS platform |
@swift-ci smoke test macOS platform |
This was referenced Jan 29, 2025
gottesmm
added a commit
that referenced
this pull request
Jan 30, 2025
[rbi] Small tweaks to the closure patch #78837
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The reason why I am doing this is that in certain cases the AST captures indices
will never actually line up with partial apply capture indices since we seem to
"smush" together closures and locally defined functions.
NOTE: The reason for the really small amount of test changes is that this change
does not change the actual output by design. The only cases I had to change were
a case where we began to emit a better diagnostic and also where I added code
coverage around _ and let _ since those require ignored_use to be implemented so
that they would be diagnosed (previously we just did not emit anything so we
couldn't emit the diagnostic at the SIL level).
rdar://142661388
The first two patches introduce a new type of instruction called ignored_use. I needed to introduce this to ensure feature parity in between the AST/SIL implementations since the AST would emit errors on code that involved _ = ... but at the SIL level, we wouldn't emit any code for such statements implying we could not emit a diagnostic. Now we emit ignored_use in that case, so we now have an instruction emitted in such a case meaning that parity is restored.