Pass -1 for max arity when there's rest args - #9630
Merged
Merged
Conversation
Arity errors use -1 to indicate "unlimited arguments" and format the arguments' upper bound as "1+". Core methods and one instance in popen logic instead used either Integer.MAX_VALUE or incorrectly just added rest plus optional even when rest.
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.
Arity errors use -1 to indicate "unlimited arguments" and format the arguments' upper bound as "1+". Core methods and one instance in popen logic instead used either Integer.MAX_VALUE or incorrectly just added required plus optional even when rest.
I discovered this while connecting
Kernel.execlogic up to the CRuby popen logic in #9627. That change moved the implementation ofKernel.execinto core, where it was subject to the arity-checking in generated method stubs that incorrectly used "rest + optional" as the max, even when a rest argument was provided. This caused the newexeclogic to fail an unrelated arity-error message test intest_message_change_issue_6085in CRuby's test_arity.rb.