diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-10-16 20:29:16 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-10-16 20:29:16 +0200 |
commit | 9485f1c888422bc39f6f6b0e06e5dc230636be06 (patch) | |
tree | 1cbd2069a47a6e8231664c00cfdc7a63bfd69475 | |
parent | 527e20fd3a0f2cc13afcfb0d402b77087c94c3ee (diff) | |
download | Nim-9485f1c888422bc39f6f6b0e06e5dc230636be06.tar.gz |
make tests green again
-rw-r--r-- | changelog.md | 6 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 9 | ||||
-rw-r--r-- | tests/ccgbugs/tret_arg_init.nim | 6 | ||||
-rw-r--r-- | tests/concepts/tmapconcept.nim | 2 |
4 files changed, 14 insertions, 9 deletions
diff --git a/changelog.md b/changelog.md index a4161f504..ef9850915 100644 --- a/changelog.md +++ b/changelog.md @@ -8,5 +8,7 @@ - Arrays of char cannot be converted to ``cstring`` anymore, pointers to arrays of char can! This means ``$`` for arrays can finally exist in ``system.nim`` and do the right thing. -- JSON: Deprecated `getBVal`, `getFNum`, and `getNum` in favour to - `getBool`, `getFloat`, `getBiggestInt`. Also `getInt` procedure was added. \ No newline at end of file +- JSON: Deprecated `getBVal`, `getFNum`, and `getNum` in favour to + `getBool`, `getFloat`, `getBiggestInt`. Also `getInt` procedure was added. +- ``echo`` now works with strings that contain ``\0`` (the binary zero is not + shown) and ``nil`` strings are equal to empty strings. diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 008599727..12e457e90 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -978,9 +978,12 @@ proc genEcho(p: BProc, n: PNode) = p.module.includeHeader("<base/log.h>") linefmt(p, cpsStmts, """Genode::log(""$1);$n""", args) else: - var a: TLoc - initLocExpr(p, n, a) - linefmt(p, cpsStmts, "#echoBinSafe($1, $2);$n", a.rdLoc, n.len.rope) + if n.len == 0: + linefmt(p, cpsStmts, "#echoBinSafe(NIM_NIL, $1);$n", n.len.rope) + else: + var a: TLoc + initLocExpr(p, n, a) + linefmt(p, cpsStmts, "#echoBinSafe($1, $2);$n", a.rdLoc, n.len.rope) when false: p.module.includeHeader("<stdio.h>") linefmt(p, cpsStmts, "printf($1$2);$n", diff --git a/tests/ccgbugs/tret_arg_init.nim b/tests/ccgbugs/tret_arg_init.nim index 3c80fb061..5cd67de3e 100644 --- a/tests/ccgbugs/tret_arg_init.nim +++ b/tests/ccgbugs/tret_arg_init.nim @@ -1,7 +1,7 @@ discard """ - output: '''nil -nil -nil''' + output: ''' + +''' """ type Bar = object diff --git a/tests/concepts/tmapconcept.nim b/tests/concepts/tmapconcept.nim index 81caed7c6..5082fcb61 100644 --- a/tests/concepts/tmapconcept.nim +++ b/tests/concepts/tmapconcept.nim @@ -1,7 +1,7 @@ discard """ output: '''10 10 -nil + 1''' msg: ''' K=string V=int |