mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
fix #19199; properly fold float conversion
(cherry picked from commit ab47707586)
This commit is contained in:
@@ -412,7 +412,7 @@ proc foldConv(n, a: PNode; idgen: IdGenerator; g: ModuleGraph; check = false): P
|
||||
rangeCheck(n, getInt(result), g)
|
||||
of tyFloat..tyFloat64:
|
||||
case srcTyp.kind
|
||||
of tyInt..tyInt64, tyEnum, tyBool, tyChar:
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyBool, tyChar:
|
||||
result = newFloatNodeT(toFloat64(getOrdValue(a)), n, g)
|
||||
else:
|
||||
result = a
|
||||
|
||||
6
tests/vm/t19199.nim
Normal file
6
tests/vm/t19199.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
# bug #19199
|
||||
proc mikasa(x: float) = doAssert x == 42
|
||||
|
||||
static:
|
||||
mikasa 42.uint.float
|
||||
mikasa 42.uint.float
|
||||
Reference in New Issue
Block a user