Fixes language specs involving blocks/yield#8014
Merged
enebo merged 5 commits intojruby:masterfrom Nov 16, 2023
Merged
Conversation
The issue is if we try to call to_ary during block dispatch and respond_to? does not exist on the object it should return the original object. We were failing because we rightly called method_missing but because m_m did not handle to_ary we just raised NoMethodError and not the original object.
This is a followup to previous commit and also reduces the number of respond_to? calls by making a new TypeConverter method: convertToTypeUnchecked. This method already knows the conversion method exists so we do not check it again.
In the presence of only opt-args a single array value will spread but we have not. I adjusted our isSpreadable method to "form-fit" to make everything pass. An interesting note that part of my fit was to realize kwrest was special and not in spreadable but did happen to see it in the same code JIT had. both interp and JIT both call into the same method now.
This lead to discovering a bug in a method which would find first non-closure IRScope (it did the opposite). Weirdly, the main consumer rolled with this mistake. Corrected caller and the method which in turn removed the yield from being a runtime error into a Syntax error.
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.
The issue is if we try to call to_ary during block dispatch and respond_to? does not exist on the object it should return the original object. We were failing because we rightly called method_missing but because m_m did not handle to_ary we just raised NoMethodError and not the original object.
This also fixes improper spreading of a single value array into a proc which only has optargs.
Some very minor error handling for uncommon syntax.