summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-04-15 15:36:37 +0800
committerGitHub <noreply@github.com>2024-04-15 09:36:37 +0200
commit7208a27c0f8396e6a6e73b36c92c870390bd0287 (patch)
treec9fd6bc02c9652132453ade00f52411df467e3f2 /lib/system
parentbcc935ae6a2fe4748241c0f0f01df611981a94a8 (diff)
downloadNim-7208a27c0f8396e6a6e73b36c92c870390bd0287.tar.gz
strictdefs for `repr` so that it can used for debugging purposes in t… (#23501)
…he compiler
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/repr_v2.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/repr_v2.nim b/lib/system/repr_v2.nim
index a486cb224..d2aef536c 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..<x.len:
     if x[i] in {'"', '\\', '\0'..'\31', '\127'..'\255'}:
       result.add '\\'