summary refs log tree commit diff stats
path: root/lib/system/assertions.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-08-19 02:33:52 -0700
committerGitHub <noreply@github.com>2021-08-19 11:33:52 +0200
commit394f4ac7bb92fe5aaf902495c6b43b3451667602 (patch)
tree8957f2337957a2c28d152490d07be106b1dd2994 /lib/system/assertions.nim
parent7b58dc2de0f606b757a558dfdda9d930ae63f41a (diff)
downloadNim-394f4ac7bb92fe5aaf902495c6b43b3451667602.tar.gz
improvements to `addInt` and `$` for integer types (#18592)
* improvements to $(SomeInteger) and addInt
* remove mIntToStr, mInt64ToStr
* improvements
* fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode
* rm tests/system/tstrmantle.nim
* revert compiler/jsgen.nim for -d:nimVersion140
Diffstat (limited to 'lib/system/assertions.nim')
-rw-r--r--lib/system/assertions.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/system/assertions.nim b/lib/system/assertions.nim
index cd789845b..6f64a55b7 100644
--- a/lib/system/assertions.nim
+++ b/lib/system/assertions.nim
@@ -12,7 +12,6 @@ import std/private/miscdollars
 
 type InstantiationInfo = tuple[filename: string, line: int, column: int]
 
-proc `$`(x: int): string {.magic: "IntToStr", noSideEffect.}
 proc `$`(info: InstantiationInfo): string =
   # The +1 is needed here
   # instead of overriding `$` (and changing its meaning), consider explicit name.
@@ -108,7 +107,9 @@ template doAssertRaises*(exception: typedesc, code: untyped) =
       wrong = true
     except exception:
       discard
-    except Exception as e: raiseAssert(begin & " raised '" & $e.name & "'" & msgEnd)
+    except Exception as e:
+      mixin `$` # alternatively, we could define $cstring in this module
+      raiseAssert(begin & " raised '" & $e.name & "'" & msgEnd)
     except: raisedForeign()
   if wrong:
     raiseAssert(begin & " nothing was raised" & msgEnd)