Bug 12135 – [AA] Format tail after associative array value is treated as separator if explicit separator is empty
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-12T01:57:00Z
Last change time
2014-02-15T02:08:21Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2014-02-12T01:57:54Z
These asserts should pass:
---
import std.string;
void main()
{
assert(format("%(%s:<%s>%|,%)", [1:2]) == "1:<2>"); // ok
assert(format("%(%s:<%s>%|%)" , [1:2]) == "1:<2>"); // fails, "1:<2"
}
---
The second assert fails because in `formatValue` for AA the only test whether to treat format tail after associative array value as a separator is empty `f.sep`. Instead wheather there is an explicit separator ("%|") should be stored and checked, e.g. as a flag or non-null `f.sep` pointer.
Comment #1 by dlang-bugzilla — 2014-02-12T13:19:59Z