diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-10-11 18:06:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 12:06:42 +0200 |
commit | 2cf214d6d46d11024e6420520e39eed779da284e (patch) | |
tree | 0fcd252b20566b6af0ce1e8ad14aeaa41c1aeed8 | |
parent | bf72d87f249221ed6623321f3cca0de9b35e0e36 (diff) | |
download | Nim-2cf214d6d46d11024e6420520e39eed779da284e.tar.gz |
allows cast int to bool/enum in VM (#22809)
Since they are integer types, by mean of allowing cast integer to enums in VM, we can suppress some enum warnings in the stdlib in the unified form, namely using a cast expression.
-rw-r--r-- | compiler/vmgen.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 2e54812a0..03265f5b5 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -904,9 +904,9 @@ proc genCard(c: PCtx; n: PNode; dest: var TDest) = c.freeTemp(tmp) proc genCastIntFloat(c: PCtx; n: PNode; dest: var TDest) = - const allowedIntegers = {tyInt..tyInt64, tyUInt..tyUInt64, tyChar} + const allowedIntegers = {tyInt..tyInt64, tyUInt..tyUInt64, tyChar, tyEnum, tyBool} var signedIntegers = {tyInt..tyInt64} - var unsignedIntegers = {tyUInt..tyUInt64, tyChar} + var unsignedIntegers = {tyUInt..tyUInt64, tyChar, tyEnum, tyBool} let src = n[1].typ.skipTypes(abstractRange)#.kind let dst = n[0].typ.skipTypes(abstractRange)#.kind let srcSize = getSize(c.config, src) |