diff --git a/compiler/types.nim b/compiler/types.nim index b78461769712..0ade59fd02ca 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -450,7 +450,10 @@ proc mutateType(t: PType, iter: TTypeMutator, closure: RootRef): PType = proc valueToString(a: PNode): string = case a.kind - of nkCharLit..nkUInt64Lit: result = $a.intVal + of nkCharLit, nkUIntLit..nkUInt64Lit: + result = $cast[uint64](a.intVal) + of nkIntLit..nkInt64Lit: + result = $a.intVal of nkFloatLit..nkFloat128Lit: result = $a.floatVal of nkStrLit..nkTripleStrLit: result = a.strVal else: result = "" diff --git a/tests/misc/t6549.nim b/tests/misc/t6549.nim new file mode 100644 index 000000000000..1d7393318df4 --- /dev/null +++ b/tests/misc/t6549.nim @@ -0,0 +1,4 @@ + +const l = $(range[low(uint64) .. high(uint64)]) +const r = "range 0..18446744073709551615(uint64)" +doAssert l == r