Fix #14270 and add testcases (#14276)

This commit is contained in:
Clyybber
2020-05-08 15:54:34 +02:00
committed by GitHub
parent de27910ab7
commit 120ea906fb
2 changed files with 36 additions and 2 deletions

View File

@@ -106,8 +106,12 @@ proc repr*[T: tuple|object](x: T): string =
proc repr*[T](x: ref T | ptr T): string =
if isNil(x): return "nil"
result = $typeof(x)
reprObject(result, x[])
when T is object:
result = $typeof(x)
reprObject(result, x[])
else:
result = when typeof(x) is ref: "ref " else: "ptr "
result.add repr(x[])
proc collectionToRepr[T](x: T, prefix, separator, suffix: string): string =
result = prefix