You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
0x7FFF_FFFF : Float is the same as 2147483647 : Float.
Would be nice to warn or indicate that Array(3.14f, 0x7FFF_FFFE) is inferred Float element, so that the int literal is lossy. Alternatively, infer boxed AnyVal, which is not intended but will catch the eye of a linter.
Similarly, Seq(3.14f, 0x7FFF_FFFE): Seq[Float] is tricky if you're innocently passing the arg to a method f(xs: Seq[Float]).
I have to do more cleaning, probably I ran .22 and also .23.
scala> sumall(3.14f, 0x7FFF_FFFF)
error while loading test$,
class file f/test.class is broken, reading aborted with class dotty.tools.tasty.UnpickleException
TASTy signature has wrong version.
expected: 19.0
found : 18.0
error while loading C$,
class file f/C.class is broken, reading aborted with class dotty.tools.tasty.UnpickleException
TASTy signature has wrong version.
expected: 19.0
found : 18.0
1 |sumall(3.14f, 0x7FFF_FFFF)
| ^^^^^^^^^^^^^^^^^^
| Found: (Float, Int)
| Required: Seq[Float]
The text was updated successfully, but these errors were encountered:
so what's happening here is the ascription to float then causes the compiler to call FromDigits.floatFromDigits("0x7FFF_FFFF") to inline the constant, which delegates to java.lang.Float.parseFloat("0x7FFF_FFFF")
minimized code
Compilation output
expectation
0x7FFF_FFFF : Float
is the same as2147483647 : Float
.Would be nice to warn or indicate that
Array(3.14f, 0x7FFF_FFFE)
is inferredFloat
element, so that the int literal is lossy. Alternatively, infer boxedAnyVal
, which is not intended but will catch the eye of a linter.Similarly,
Seq(3.14f, 0x7FFF_FFFE): Seq[Float]
is tricky if you're innocently passing the arg to a methodf(xs: Seq[Float])
.Also repeating parameter works as above:
I have to do more cleaning, probably I ran
.22
and also.23
.The text was updated successfully, but these errors were encountered: