make strformat.fmt take the same signature as strfmt.fmt in order to force an ambiguity error; refs #6958
This commit is contained in:
parent
e23ea64c41
commit
b168efd1ab
1 changed files with 2 additions and 3 deletions
|
|
@ -224,7 +224,7 @@ template callFormatOption(res, arg, option) {.dirty.} =
|
||||||
else:
|
else:
|
||||||
res.add format(arg, option)
|
res.add format(arg, option)
|
||||||
|
|
||||||
macro fmt*(pattern: string): untyped =
|
macro fmt*(pattern: string{lit}): untyped =
|
||||||
## For a specification of the ``fmt`` macro, see the module level documentation.
|
## For a specification of the ``fmt`` macro, see the module level documentation.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
template check(actual, expected: string) =
|
template check(actual, expected: string) =
|
||||||
|
|
@ -332,7 +332,7 @@ macro fmt*(pattern: string): untyped =
|
||||||
# works:
|
# works:
|
||||||
import times
|
import times
|
||||||
|
|
||||||
var nullTime: TimeInfo
|
var nullTime: DateTime
|
||||||
check fmt"{nullTime:yyyy-mm-dd}", "0000-00-00"
|
check fmt"{nullTime:yyyy-mm-dd}", "0000-00-00"
|
||||||
|
|
||||||
# Unicode string tests
|
# Unicode string tests
|
||||||
|
|
@ -609,7 +609,6 @@ proc format*(value: string; specifier: string; res: var string) =
|
||||||
## sense to call this directly, but it is required to exist
|
## sense to call this directly, but it is required to exist
|
||||||
## by the ``fmt`` macro.
|
## by the ``fmt`` macro.
|
||||||
let spec = parseStandardFormatSpecifier(specifier)
|
let spec = parseStandardFormatSpecifier(specifier)
|
||||||
var fmode = ffDefault
|
|
||||||
case spec.typ
|
case spec.typ
|
||||||
of 's', '\0': discard
|
of 's', '\0': discard
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue