From 7208a27c0f8396e6a6e73b36c92c870390bd0287 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:36:37 +0800 Subject: [PATCH] =?UTF-8?q?strictdefs=20for=20`repr`=20so=20that=20it=20ca?= =?UTF-8?q?n=20used=20for=20debugging=20purposes=20in=20t=E2=80=A6=20(#235?= =?UTF-8?q?01)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …he compiler --- lib/system/repr_v2.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/system/repr_v2.nim b/lib/system/repr_v2.nim index a486cb224e..d2aef536c6 100644 --- a/lib/system/repr_v2.nim +++ b/lib/system/repr_v2.nim @@ -41,7 +41,7 @@ proc repr*(x: char): string {.noSideEffect, raises: [].} = ## ```Nim ## assert repr('c') == "'c'" ## ``` - result.add '\'' + result = "'" # Elides string creations if not needed if x in {'\\', '\0'..'\31', '\127'..'\255'}: result.add '\\' @@ -54,7 +54,7 @@ proc repr*(x: char): string {.noSideEffect, raises: [].} = proc repr*(x: string | cstring): string {.noSideEffect, raises: [].} = ## repr for a string argument. Returns `x` ## converted to a quoted and escaped string. - result.add '\"' + result = "\"" for i in 0..