Fix sprinf with explicit zero precision and zero value#8769
Merged
enebo merged 1 commit intojruby:masterfrom Apr 16, 2025
Merged
Fix sprinf with explicit zero precision and zero value#8769enebo merged 1 commit intojruby:masterfrom
sprinf with explicit zero precision and zero value#8769enebo merged 1 commit intojruby:masterfrom
Conversation
Member
|
I have an ancient branch (#6913) which rewrites much of this but I got stuck on dtoa impl. We know this is horrifically messy and your fix looks fine even if it "maybe" could be somewhere else. As it stands this fixes the issue with new specs. LGTM. Also you may be passing some more tests in test/mri/ruby/test_sprintf_comb.rb (another fun piece of code). |
Earlopain
added a commit
to Earlopain/rubocop
that referenced
this pull request
Aug 12, 2025
I fixed this in jruby/jruby#8769
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.
In that case, nothing is written. It's documented: https://docs.ruby-lang.org/en/3.4/format_specifications_rdoc.html#:~:text=if%20the%20precision%20is%200%20and%20the%20value%20is%200%2C%20nothing%20is%20written
NOTE: I found this code quite hard to follow and there was at least one other place I contemplated implementing a fix. Not sure if what I chose is in fact the best place for a fix.