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
Comment #2 by k.hara.pg — 2014-02-14T22:05:08Z
Comment #3 by github-bugzilla — 2014-02-14T22:34:11Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/d9e98320210514f183aedafc107d20c6487ba21d fix Issue 12135 - [AA] Format tail after associative array value is treated as separator if explicit separator is empty https://github.com/D-Programming-Language/phobos/commit/a03e70594106648fe0fac1f5765c0fb38d544c5f Merge pull request #1938 from 9rnsr/fix12135 [REG2.065a] Issue 12135 - [AA] Format tail after associative array value is treated as separator if explicit separator is empty