mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
macros: Extend treeTraverse intVal range to nnkUInt64Lit (#21597)
* Extend intVal range to nnkUInt64Lit Fixes #21593 * Properly cast intVal as unsigned * Add testcase for #21593
This commit is contained in:
@@ -947,6 +947,8 @@ proc treeTraverse(n: NimNode; res: var string; level = 0; isLisp = false, indent
|
||||
discard # same as nil node in this representation
|
||||
of nnkCharLit .. nnkInt64Lit:
|
||||
res.add(" " & $n.intVal)
|
||||
of nnkUIntLit .. nnkUInt64Lit:
|
||||
res.add(" " & $cast[uint64](n.intVal))
|
||||
of nnkFloatLit .. nnkFloat64Lit:
|
||||
res.add(" " & $n.floatVal)
|
||||
of nnkStrLit .. nnkTripleStrLit, nnkCommentStmt, nnkIdent, nnkSym:
|
||||
|
||||
13
tests/macros/t21593.nim
Normal file
13
tests/macros/t21593.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
discard """
|
||||
nimout: '''
|
||||
StmtList
|
||||
UIntLit 18446744073709551615
|
||||
IntLit -1'''
|
||||
"""
|
||||
|
||||
import macros
|
||||
|
||||
dumpTree:
|
||||
0xFFFFFFFF_FFFFFFFF'u
|
||||
0xFFFFFFFF_FFFFFFFF
|
||||
|
||||
Reference in New Issue
Block a user