Fix several float range issues

This commit is contained in:
Oscar Nihlgård 2019-08-07 20:34:52 +02:00 • committed by narimiran
commit def6234903
5 changed files with 30 additions and 3 deletions

View file

@ -414,9 +414,10 @@ proc isConvertibleToRange(f, a: PType): bool =
of tyUInt16: result = a.kind in {tyUInt8, tyUInt16, tyUInt}
of tyUInt32: result = a.kind in {tyUInt8, tyUInt16, tyUInt32, tyUInt}
else: result = false
elif f.kind in {tyFloat..tyFloat128} and
a.kind in {tyFloat..tyFloat128}:
result = true
elif f.kind in {tyFloat..tyFloat128}:
# `isIntLit` is correct and should be used above as well, see PR:
# https://github.com/nim-lang/Nim/pull/11197
result = isIntLit(a) or a.kind in {tyFloat..tyFloat128}
proc handleFloatRange(f, a: PType): TTypeRelation =
if a.kind == f.kind: