fix: std.parseInt accepts + prefix like go-jsonnet#1030
Merged
stephenamar-db merged 1 commit intoJun 24, 2026
Conversation
1d5d985 to
e2836ae
Compare
CertainLach
added a commit
to deltarocks/jrsonnet
that referenced
this pull request
Jun 24, 2026
Ref: databricks/sjsonnet#1030 Change-Id: I1e4a88229841d25d9502bff7795c43676a6a6964 Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
Collaborator
|
do you need the LLM md file in this PR? |
afffd2c to
19ee313
Compare
Contributor
Author
|
@stephenamar-db fixed, and the result is |
Motivation: go-jsonnet accepts a leading + sign in std.parseInt decimal input, while sjsonnet rejected it despite already handling the negative sign path. Modification: Treat a leading + as a sign marker, reject bare + explicitly, and parse the remaining decimal digits using the existing natural-number parser. Add a golden regression test for +123, +0, +007, and unchanged positive/negative baselines. Result: std.parseInt now accepts plus-prefixed decimal integers like go-jsonnet without changing existing unsigned or negative parsing behavior.
19ee313 to
9b1e45c
Compare
stephenamar-db
approved these changes
Jun 24, 2026
Fixed on master |
Contributor
Author
|
@CertainLach Thanks |
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.
Summary
This PR updates
std.parseIntto accept a leading+sign, matching go-jsonnet behavior for decimal integer parsing.Behavior comparison
Local reference versions used:
v0.22.0v0.21.0andv0.22.00.5.0-pre99std.parseInt("+1")11std.parseInt("+0")00std.parseInt("+01")11std.parseInt("+")std.parseInt("+-1")std.parseInt("-123")-123-123-123-123-123std.parseInt("123")123123123123123The intentional compatibility target here is go-jsonnet for plus-prefixed decimal input. C++ jsonnet and jrsonnet currently reject the leading
+cases above.Changes
StringModule.scala: handle a leading+sign instd.parseIntparseInt_positive_sign.jsonnet: golden regression coverage for accepted+inputs and unchanged positive/negative baselinesTests
rtk ./mill 'sjsonnet.jvm[3.3.7]'.test.testOnly sjsonnet.FileTests rtk git diff --check upstream/master...HEADBoth passed locally after rebasing onto
upstream/master.