Ruby >= 4.1.0 allows trailing comma in method signature#1178
Merged
tompng merged 1 commit intoruby:masterfrom Feb 25, 2026
Merged
Conversation
See "Allow trailing comma in method signature": ruby/prism#3920 This test is no longer passing because of the change in Prism.
Contributor
Author
|
Alternatively the Prism version could be inspected and the test adapted: def test_colorize_trailing_comma_in_method_definition_complete_false
prism_1_9_1_or_later = ENV['PRISM_VERSION'] == 'latest' || Gem::Version.new(Prism::VERSION) >= Gem::Version.new('1.9.1')
code = "def f(a,)"
result = if prism_1_9_1_or_later
"#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}f#{CLEAR}(a,)"
else
"#{GREEN}def#{CLEAR} #{BLUE}#{BOLD}f#{CLEAR}(a#{RED}#{REVERSE},#{CLEAR})"
end
assert_equal_with_term(result, code, complete: false)
assert_equal_with_term(code, code, complete: false, tty: false)
assert_equal_with_term(code, code, complete: false, colorable: false)
assert_equal_with_term(result, code, complete: false, tty: false, colorable: true)
end |
tompng
approved these changes
Feb 25, 2026
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.
See "Allow trailing comma in method signature":
https://bugs.ruby-lang.org/issues/19107
ruby/prism#3920
So this is now valid ruby:
The colorize special code test is no longer passing because of this change in latest Prism: https://github.com/ruby/irb/actions/runs/22390686601/job/64811636988
This PR fixes the failing test with latest Prism here by removing this special case from the color test.
I noticed this failure in the following PR, which will pass after merging this PR: #1177