Add regression fix for numeric string concatenation#366
Open
Richtermeister wants to merge 2 commits into
Open
Conversation
|
Contributor
Author
|
@flosch Hi Florian, please let me know if the SonarCube check is a showstopper here.. seems like it's caused by continuing an existing pattern in the codebase, not sure it's worth trying to prevent that type of code duplication, but happy to do so if you want. |
The "+" fix for issue flosch#342 restored v4 behavior ("10" + 5 == 15), but that flips the v5/v6 string-concatenation behavior ("10" + 5 == "105"), which is itself a breaking change for current users. Gate the arithmetic path behind a new Options.NumericStringArithmetic flag (default false), so the v5/v6 behavior is preserved unless a caller explicitly opts in. This makes the fix non-breaking and mergeable. Add TestIssue342DefaultIsConcatenation to lock in the default behavior; existing TestIssue342 now enables the flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dca94bd to
be5d43d
Compare
|
Contributor
Author
|
@flosch I imagine there is some hesitancy around this feature since it would be another BC break to undo the prior one, so I added an option setting to make this behavior opt-in. What say you? |
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.





This is a fix for #342