support UncheckedArray[T] in repr_v2.nim (#20816)
This commit is contained in:
parent
993630e40f
commit
6007a40eac
2 changed files with 12 additions and 1 deletions
|
|
@ -189,4 +189,7 @@ proc repr*[T](x: openArray[T]): string =
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
## $(@[23, 45].toOpenArray(0, 1)) == "[23, 45]"
|
## $(@[23, 45].toOpenArray(0, 1)) == "[23, 45]"
|
||||||
collectionToRepr(x, "[", ", ", "]")
|
collectionToRepr(x, "[", ", ", "]")
|
||||||
|
|
||||||
|
proc repr*[T](x: UncheckedArray[T]): string =
|
||||||
|
"[...]"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ nil
|
||||||
2
|
2
|
||||||
Obj(member: ref @["hello"])
|
Obj(member: ref @["hello"])
|
||||||
ref (member: ref @["hello"])
|
ref (member: ref @["hello"])
|
||||||
|
ObjUa(v: 0, a: [...])
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -87,3 +88,10 @@ macro extract(): untyped =
|
||||||
test(parseExpr("discard"))
|
test(parseExpr("discard"))
|
||||||
|
|
||||||
extract()
|
extract()
|
||||||
|
|
||||||
|
type
|
||||||
|
ObjUa = ref object
|
||||||
|
v: int
|
||||||
|
a: UncheckedArray[char]
|
||||||
|
|
||||||
|
echo ObjUa().repr
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue