mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-21 08:21:32 +00:00
fixes #11131
This commit is contained in:
@@ -323,9 +323,10 @@ proc litAux(g: TSrcGen; n: PNode, x: BiggestInt, size: int): string =
|
||||
result &= e.sym.name.s
|
||||
return
|
||||
|
||||
if nfBase2 in n.flags: result = "0b" & toBin(x, size * 8)
|
||||
elif nfBase8 in n.flags: result = "0o" & toOct(x, size * 3)
|
||||
elif nfBase16 in n.flags: result = "0x" & toHex(x, size * 2)
|
||||
let y = x and ((1 shl (size*8)) - 1)
|
||||
if nfBase2 in n.flags: result = "0b" & toBin(y, size * 8)
|
||||
elif nfBase8 in n.flags: result = "0o" & toOct(y, size * 3)
|
||||
elif nfBase16 in n.flags: result = "0x" & toHex(y, size * 2)
|
||||
else: result = $x
|
||||
|
||||
proc ulitAux(g: TSrcGen; n: PNode, x: BiggestInt, size: int): string =
|
||||
|
||||
@@ -26,6 +26,7 @@ range[0 .. 100]
|
||||
array[0 .. 100, int]
|
||||
10
|
||||
test
|
||||
0o377'i8
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -236,3 +237,10 @@ block tbugs:
|
||||
sampleMacroInt(42)
|
||||
sampleMacroBool(false)
|
||||
sampleMacroBool(system.true)
|
||||
|
||||
|
||||
# bug #11131
|
||||
macro toRendererBug(n): untyped =
|
||||
result = newLit repr(n)
|
||||
|
||||
echo toRendererBug(0o377'i8)
|
||||
|
||||
Reference in New Issue
Block a user