mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 14:53:46 +00:00
fixes #23954
(cherry picked from commit 298ada3412)
This commit is contained in:
@@ -410,8 +410,9 @@ proc foldConv(n, a: PNode; idgen: IdGenerator; g: ModuleGraph; check = false): P
|
||||
of tyChar, tyUInt..tyUInt64, tyInt..tyInt64:
|
||||
var val = a.getOrdValue
|
||||
if dstTyp.kind in {tyUInt..tyUInt64}:
|
||||
result = newIntNodeT(val, n, idgen, g)
|
||||
result = newIntNodeT(maskBytes(val, getSize(g.config, dstTyp)), n, idgen, g)
|
||||
result.transitionIntKind(nkUIntLit)
|
||||
result.typ = dstTyp
|
||||
else:
|
||||
if check: rangeCheck(n, val, g)
|
||||
result = newIntNodeT(val, n, idgen, g)
|
||||
|
||||
@@ -37,3 +37,8 @@ block:
|
||||
# bug #14522
|
||||
doAssert 0xFF000000_00000000.uint64 == 18374686479671623680'u64
|
||||
|
||||
block: # bug #23954
|
||||
let testRT_u8 : uint8 = 0x107.uint8
|
||||
doAssert testRT_u8 == 7
|
||||
const testCT_u8 : uint8 = 0x107.uint8
|
||||
doAssert testCT_u8 == 7
|
||||
|
||||
Reference in New Issue
Block a user