fixes #11972
This commit is contained in:
parent
75baaa5e25
commit
b1b0960c36
2 changed files with 7 additions and 1 deletions
|
|
@ -1660,6 +1660,8 @@ proc getInt64*(a: PNode): int64 {.deprecated: "use getInt".} =
|
||||||
proc getFloat*(a: PNode): BiggestFloat =
|
proc getFloat*(a: PNode): BiggestFloat =
|
||||||
case a.kind
|
case a.kind
|
||||||
of nkFloatLiterals: result = a.floatVal
|
of nkFloatLiterals: result = a.floatVal
|
||||||
|
of nkCharLit, nkUIntLit..nkUInt64Lit, nkIntLit..nkInt64Lit:
|
||||||
|
result = BiggestFloat a.intVal
|
||||||
else:
|
else:
|
||||||
raiseRecoverableError("cannot extract number from invalid AST node")
|
raiseRecoverableError("cannot extract number from invalid AST node")
|
||||||
#doAssert false, "getFloat"
|
#doAssert false, "getFloat"
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,7 @@ doAssert y.low == -1'f64
|
||||||
doAssert y.high == 1'f64
|
doAssert y.high == 1'f64
|
||||||
doAssert y.type.low == -1'f64
|
doAssert y.type.low == -1'f64
|
||||||
doAssert y.type.high == 1'f64
|
doAssert y.type.high == 1'f64
|
||||||
|
|
||||||
|
# bug #11972
|
||||||
|
var num: uint8
|
||||||
|
doAssert num.high.float == 255.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue