Fix several float range issues
This commit is contained in:
parent
66a8856152
commit
def6234903
5 changed files with 30 additions and 3 deletions
|
|
@ -513,6 +513,12 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) =
|
|||
if value < firstOrd(c.config, newType) or value > lastOrd(c.config, newType):
|
||||
localError(c.config, n.info, "cannot convert " & $value &
|
||||
" to " & typeToString(newType))
|
||||
of nkFloatLit..nkFloat64Lit:
|
||||
if check:
|
||||
echo newType.kind
|
||||
if not floatRangeCheck(n.floatVal, newType):
|
||||
localError(c.config, n.info, "cannot convert " & $n.floatVal &
|
||||
" to " & typeToString(newType))
|
||||
else: discard
|
||||
n.typ = newType
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue