[Issue 12135] New: [AA] Format tail after associative array value is treated as separator if explicit separator is empty

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 12 01:58:08 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12135

           Summary: [AA] Format tail after associative array value is
                    treated as separator if explicit separator is empty
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2014-02-12 13:57:54 MSK ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list