From 6007a40eac60b52b3c2edb4ed6e8399c96c0f939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Derek=20=E5=91=86?= <116649+derekdai@users.noreply.github.com> Date: Sat, 12 Nov 2022 02:31:59 +0800 Subject: [PATCH] support `UncheckedArray[T]` in repr_v2.nim (#20816) --- lib/system/repr_v2.nim | 5 ++++- tests/arc/trepr.nim | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/system/repr_v2.nim b/lib/system/repr_v2.nim index 60c09e0730..f6c720e2c3 100644 --- a/lib/system/repr_v2.nim +++ b/lib/system/repr_v2.nim @@ -189,4 +189,7 @@ proc repr*[T](x: openArray[T]): string = ## ## .. code-block:: Nim ## $(@[23, 45].toOpenArray(0, 1)) == "[23, 45]" - collectionToRepr(x, "[", ", ", "]") \ No newline at end of file + collectionToRepr(x, "[", ", ", "]") + +proc repr*[T](x: UncheckedArray[T]): string = + "[...]" diff --git a/tests/arc/trepr.nim b/tests/arc/trepr.nim index 50d433208b..abf28330a3 100644 --- a/tests/arc/trepr.nim +++ b/tests/arc/trepr.nim @@ -9,6 +9,7 @@ nil 2 Obj(member: ref @["hello"]) ref (member: ref @["hello"]) +ObjUa(v: 0, a: [...]) ''' """ @@ -87,3 +88,10 @@ macro extract(): untyped = test(parseExpr("discard")) extract() + +type + ObjUa = ref object + v: int + a: UncheckedArray[char] + +echo ObjUa().repr