www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3824] New: An AA with an AA as key doesn't seem to work

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



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: -------
Feb 18 2010
next sibling parent d-bugmail puremagic.com writes:
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: -------
Oct 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824


bearophile_hugs eml.cc changed:

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



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: -------
Oct 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824




13:54:26 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.
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: -------
Oct 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824




13:57:54 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.
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: -------
Oct 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824






 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: -------
Oct 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824





 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: -------
Jan 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3824


bearophile_hugs eml.cc changed:

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



Seems fixed. Closed.

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