Repository navigation
Sema: fix switch loop inline capture - #24792
Closed
Justus2308 wants to merge 1 commit into
Closed
Justus2308 wants to merge 1 commit into
Justus2308 wants to merge 1 commit into
Conversation
Fixes a premature load of `operand_alloc` in `SwitchProngAnalysis.analyzeCapture` which is `undefined` if no non-inline captures occur by making it `.none` instead and checking for that case. If it is `.none` and a capture occurs it must be `inline` and `inline_case_capture` is now instantly resolved and returned. The special case here are unions which still need an alloc to store their payload in even if all captures are `inline`. They now unconditionally get an `operand_alloc`.
Contributor
|
I think the correct fix looks something like: Rexicon226@6aff7ce. I honestly completely forgot that I had even made these fixes. I believe the reason I hadn't opened a PR was that, in discussion with @mlugg, we wanted to pursue making |
Member
Author
|
Ah that looks more sensible thanks! Yeah I think making it an error makes a lot of sense here especially since capturing the value isn't mandatory anyway |
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
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.
Resolves #24789
Fixes a premature load of
operand_allocinSwitchProngAnalysis.analyzeCapturewhich isundefinedif no non-inline captures occur by making it.noneinstead and checking for that case. If it is.noneand a capture occurs it must beinlineandinline_case_captureis now instantly resolved and returned. The special case here are unions which still need an alloc to store their payload in even if all captures areinline. They now unconditionally get anoperand_alloc.