diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-08-19 02:33:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 11:33:52 +0200 |
commit | 394f4ac7bb92fe5aaf902495c6b43b3451667602 (patch) | |
tree | 8957f2337957a2c28d152490d07be106b1dd2994 /lib/system/assertions.nim | |
parent | 7b58dc2de0f606b757a558dfdda9d930ae63f41a (diff) | |
download | Nim-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.nim | 5 |
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) |