-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coerce int values into float when expected #1150
Conversation
variables = Some( | ||
Map( | ||
"input" -> InputValue.ObjectValue( | ||
Map("float" -> Value.IntValue(42)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this strikes me as a bit odd since JSON only supports floats 🤔 I would probably have expected the coercion to be the other way around...
But perhaps we have some smartness in the parser to parse numbers without decimals as ints so we need to deal with both cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parser would parse into a FloatValue
only if there is a dot or a e
for exponent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In scala 2. The scala 3 one checks for int before float so the result is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the spec, float should not be coerced into int.
Also did a bit of unrelated cleanup.