Fix nested destructuring after a splat in multiple assignment - #482
Open
sinsoku wants to merge 1 commit into
Open
Fix nested destructuring after a splat in multiple assignment#482sinsoku wants to merge 1 commit into
sinsoku wants to merge 1 commit into
Conversation
MultiWriteNode#install0 collected the targets after the splat by their
own `ret` instead of the vertex behind their DummyRHSNode. A nested
target (MultiTargetNode) has a nil `ret`, which blew up as the
destination of a graph edge in the next reinstall. The same mistake hit
an index or attribute writer silently: it got the return vertex of its
own call, so the assigned value never reached it.
*a, (b, c) = 1, 2, [3, 4]
#=> undefined method 'on_type_added' for nil
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.
Motivation / Background
This Pull Request has been created because a nested target after a splat in a multiple assignment crashes TypeProf:
A nested target is a
MultiTargetNode, whoseretis nil, so the collected nil became the destination of a graph edge and blew up in the next reinstall. An index or attribute writer got the return vertex of its own call instead, so it silently received the wrong type rather than crashing.ruby/ruby's
test/ruby/test_assignment.rbhas one, so TypeProf aborts there. The same target before the splat (a, (b, c) = ...) goes through another branch and has always worked.Detail
The value of the multiple assignment statement itself stays nil, since
MAsgnBox#retreads an@rhsthe box never assigns — this Pull Request leaves that alone.🤖 Generated with Claude Code