summary refs log tree commit diff stats
path: root/lib/system/repr_v2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/repr_v2.nim')
-rw-r--r--lib/system/repr_v2.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/system/repr_v2.nim b/lib/system/repr_v2.nim
index f81c615e9..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 '\\'
@@ -99,7 +99,7 @@ proc repr*(p: proc | iterator {.closure.}): string =
   ## repr of a proc as its address
   repr(cast[ptr pointer](unsafeAddr p)[])
 
-template repr*[T: distinct|range](x: T): string =
+template repr*[T: distinct|(range and not enum)](x: T): string =
   when T is range: # add a branch to handle range
     repr(rangeBase(typeof(x))(x))
   elif T is distinct: