Continue bool conversion fixing (#13751)
* continue fixing #13744 * improve style * improve test Co-authored-by: cooldome <ariabushenko@bk.ru>
This commit is contained in:
parent
e1e062197e
commit
764a81ca25
3 changed files with 20 additions and 2 deletions
|
|
@ -433,6 +433,15 @@ proc foldConv(n, a: PNode; g: ModuleGraph; check = false): PNode =
|
|||
# echo high(int64)
|
||||
# writeStackTrace()
|
||||
case dstTyp.kind
|
||||
of tyBool:
|
||||
case srcTyp.kind
|
||||
of tyFloat..tyFloat64:
|
||||
result = newIntNodeT(int(getFloat(a) != 0.0), n, g)
|
||||
of tyChar, tyUInt..tyUInt64, tyInt..tyInt64:
|
||||
result = newIntNodeT(int(a.getOrdValue != 0), n, g)
|
||||
else:
|
||||
result = a
|
||||
result.typ = n.typ
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64:
|
||||
case srcTyp.kind
|
||||
of tyFloat..tyFloat64:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue