Thread overview
[Issue 3824] New: An AA with an AA as key doesn't seem to work
Oct 21, 2012
Andrej Mitrovic
Oct 21, 2012
Andrej Mitrovic
Oct 21, 2012
Andrej Mitrovic
Jan 28, 2013
Don
February 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3824

           Summary: An AA with an AA as key doesn't seem to work
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean@invisibleduck.org
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-02-18 11:26:09 PST ---
import std.stdio;
void main() {
    int[int] aa1 = [1:2, 3:4];
    int[int] aa2 = [5:6, 7:8];
    byte[int[int]] s;
    s[aa1] = 1;
    s[aa2] = 2;
    writeln(s);
}

It prints:
[[1:2,3:4]:2]

Instead of something as:
[[1: 2, 3: 4]: 1, [5: 6, 7: 8]: 2]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3824


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3824


bearophile_hugs@eml.cc changed:

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


--- Comment #1 from bearophile_hugs@eml.cc 2012-10-21 13:47:18 PDT ---
It doesn't work still, see:

void main() {
    int[int] aa1 = [1: 2];
    int[int] aa2 = [1: 2];
    int[int[int]] aa3;
    aa3[aa1] = 1;
    aa3[aa2] = 2;
    assert(aa3.length == 1);
}


In DMD 2.061alpha the aa3 has two identical keys.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3824



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 13:54:26 PDT ---
(In reply to comment #1)
> It doesn't work still, see:
> 
> void main() {
>     int[int] aa1 = [1: 2];
>     int[int] aa2 = [1: 2];
>     int[int[int]] aa3;
>     aa3[aa1] = 1;
>     aa3[aa2] = 2;
>     assert(aa3.length == 1);
> }
> 
> 
> In DMD 2.061alpha the aa3 has two identical keys.

Have you tried HEAD? I see two keys:
assert(aa3.length == 2);  // passes for me

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3824



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 13:57:54 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > It doesn't work still, see:
> > 
> > void main() {
> >     int[int] aa1 = [1: 2];
> >     int[int] aa2 = [1: 2];
> >     int[int[int]] aa3;
> >     aa3[aa1] = 1;
> >     aa3[aa2] = 2;
> >     assert(aa3.length == 1);
> > }
> > 
> > 
> > In DMD 2.061alpha the aa3 has two identical keys.
> 
> Have you tried HEAD? I see two keys:
> assert(aa3.length == 2);  // passes for me

On second thought I'm not sure what you're asking. You want the two keys to be just one key?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3824



--- Comment #4 from bearophile_hugs@eml.cc 2012-10-21 14:15:58 PDT ---
(In reply to comment #3)

> On second thought I'm not sure what you're asking. You want the two keys to be just one key?

Yeah, sorry for not being clear enough. aa1 == aa2 so at the end aa3 should contain only one key with value 2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3824



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2013-01-28 00:40:02 PST ---
(In reply to comment #1)
> It doesn't work still, see:
> 
> void main() {
>     int[int] aa1 = [1: 2];
>     int[int] aa2 = [1: 2];
>     int[int[int]] aa3;
>     aa3[aa1] = 1;
>     aa3[aa2] = 2;
>     assert(aa3.length == 1);
> }
> 
> 
> In DMD 2.061alpha the aa3 has two identical keys.

This code passes now on git head (f8ddb72).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3824


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #6 from bearophile_hugs@eml.cc 2013-01-28 03:01:26 PST ---
Seems fixed. Closed.

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