Skip to content

Commit

Permalink
Fixes #8100
Browse files Browse the repository at this point in the history
  • Loading branch information
GULPF committed Jun 24, 2018
1 parent 105a472 commit 4fb7f9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/pure/strformat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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((block: discard format(arg, res))):
format(arg, res)
elif compiles(format(arg)):
res.add format(arg)
Expand Down Expand Up @@ -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}""", " αβγ"
Expand Down

0 comments on commit 4fb7f9b

Please sign in to comment.