diff options
author | Alfred Morgan <alfred@54.org> | 2022-05-10 08:45:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-10 17:45:57 +0200 |
commit | b9f243eb2aeb4930ba552f8bf487719d628f4a2a (patch) | |
tree | 94b0909ee96b4a795ec1f73edb81f379c1727c5c /lib | |
parent | 85bc8326acc9bf18e748055e770a40890e7ac069 (diff) | |
download | Nim-b9f243eb2aeb4930ba552f8bf487719d628f4a2a.tar.gz |
string is missing formatting when calling fmt (#19780)
it appears the documentation intends to compare & with .fmt but there is no formatting in the string. even though the assert is true it doesn't quite prove that .fmt is an equivalent formatter.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strformat.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/strformat.nim b/lib/pure/strformat.nim index ce3439600..247d0a296 100644 --- a/lib/pure/strformat.nim +++ b/lib/pure/strformat.nim @@ -705,6 +705,6 @@ macro `&`*(pattern: string{lit}): string = runnableExamples: let x = 7 assert &"{x}\n" == "7\n" # regular string literal - assert &"{x}\n" == "7\n".fmt # `fmt` can be used instead - assert &"{x}\n" != fmt"7\n" # see `fmt` docs, this would use a raw string literal + assert &"{x}\n" == "{x}\n".fmt # `fmt` can be used instead + assert &"{x}\n" != fmt"{x}\n" # see `fmt` docs, this would use a raw string literal strformatImpl(pattern.strVal, '{', '}') |