Skip to content

Commit

Permalink
fixes #11089
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Apr 23, 2019
1 parent 3161e48 commit 8d206b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/pure/strformat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,13 @@ proc formatValue*(result: var string; value: SomeInteger; specifier: string) =
" of 'x', 'X', 'b', 'd', 'o' but got: " & spec.typ)
result.add formatInt(value, radix, spec)

proc formatValue*(result: var string; value: SomeFloat; specifier: string): void =
proc formatValue*(result: var string; value: SomeFloat; specifier: string) =
## Standard format implementation for ``SomeFloat``. It makes little
## sense to call this directly, but it is required to exist
## by the ``&`` macro.
if specifier.len == 0:
result.add $value
return
let spec = parseStandardFormatSpecifier(specifier)

var fmode = ffDefault
Expand Down Expand Up @@ -712,6 +715,9 @@ when isMainModule:
for s in invalidUtf8:
check &"{s:>5}", repeat(" ", 5-s.len) & s

# bug #11089
let flfoo: float = 1.0
check &"{flfoo}", "1.0"

import json

Expand Down

0 comments on commit 8d206b2

Please sign in to comment.