www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg 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: -------
Feb 12 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12135


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com


--- Comment #1 from Vladimir Panteleev <thecybershadow gmail.com> 2014-02-12
23:19:59 EET ---
Introduced in https://github.com/D-Programming-Language/phobos/pull/1777

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12135


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2014-02-14 22:05:08 PST ---
https://github.com/D-Programming-Language/phobos/pull/1938

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12135



--- Comment #3 from github-bugzilla puremagic.com 2014-02-14 22:34:11 PST ---
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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12135


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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