diff options
author | Oscar Nihlgård <oscarnihlgard@gmail.com> | 2018-06-29 14:53:09 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-29 14:53:09 +0200 |
commit | 7674df0dffc8746a9377ed9680b179118f14a0cd (patch) | |
tree | d05d6afdb1fb2fd5952590ea6c6bf93ffe347216 /lib | |
parent | 4deda6b73253ee98bf112ad43d0c37562899db2c (diff) | |
download | Nim-7674df0dffc8746a9377ed9680b179118f14a0cd.tar.gz |
Fixes #8100 (#8101)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strformat.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/pure/strformat.nim b/lib/pure/strformat.nim index 36404cdf7..247b9ec5c 100644 --- a/lib/pure/strformat.nim +++ b/lib/pure/strformat.nim @@ -258,7 +258,9 @@ template callFormat(res, arg) {.dirty.} = # workaround in order to circumvent 'strutils.format' which matches # too but doesn't adhere to our protocol. res.add arg - elif compiles(format(arg, res)): + elif compiles(format(arg, res)) and + # Check if format returns void + not (compiles do: discard format(arg, res)): format(arg, res) elif compiles(format(arg)): res.add format(arg) @@ -684,6 +686,9 @@ when isMainModule: var nullTime: DateTime check &"{nullTime:yyyy-mm-dd}", "0000-00-00" + var tm = fromUnix(0) + discard &"{tm}" + # Unicode string tests check &"""{"αβγ"}""", "αβγ" check &"""{"αβγ":>5}""", " αβγ" |