digitalmars.D.bugs - [Issue 3491] New: typeof( (string[string]).init)) == AssociativeArray!(string, string), doesn't implicitly convert to string[string].
- d-bugmail puremagic.com (29/29) Nov 09 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3491
- d-bugmail puremagic.com (71/71) Dec 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3491
- d-bugmail puremagic.com (10/10) Jan 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3491
- d-bugmail puremagic.com (12/12) Mar 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3491
http://d.puremagic.com/issues/show_bug.cgi?id=3491 Summary: typeof( (string[string]).init)) == AssociativeArray!(string, string), doesn't implicitly convert to string[string]. Product: D Version: 2.036 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com string[string][string] foo() { string[string][string] ret; ret["foo"] = (string[string]).init; return ret; } void main() { foo(); } Error: cannot implicitly convert expression (_D6object30__T16AssociativeArrayTAyaTAyaZ16AssociativeArray6__initZ) of type AssociativeArray!(string,string) to string[string] -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3491 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, rejects-valid CC| |r.sagitario gmx.de Severity|normal |regression PST --- A much simpler version also fails: void main() { int[int] s; s = s.init; } c:\l\dmd-2.036\windows\bin\..\..\src\druntime\import\object.di(294): Error: cann ot implicitly convert expression (_D6object26__T16AssociativeArrayTiTiZ16Associa tiveArray6__initZ) of type AssociativeArray!(int,int) to int[int] This used to work for DMD 2.035, so it is a regression. There seems to be some inconsistency whether to use the new implementation of associative arrays or the original type. The following patch ensures usage of the library type for implicitely casting. Index: mtype.c =================================================================== --- mtype.c (revision 317) +++ mtype.c (working copy) -6761,6 +6761,9 { MATCH m; //printf("TypeStruct::implicitConvTo(%s => %s)\n", toChars(), to->toChars()); + if(to->ty == Taarray) + to = ((TypeAArray*)to)->getImpl()->type; + if (ty == to->ty && sym == ((TypeStruct *)to)->sym) { m = MATCHexact; // exact match if (mod != to->mod) Index: e2ir.c =================================================================== --- e2ir.c (revision 317) +++ e2ir.c (working copy) -3508,6 +3508,12 elem *e = e1->toElem(irs); Type *tfrom = e1->type->toBasetype(); Type *t = to->toBasetype(); // skip over typedef's + + if(tfrom->ty == Taarray) + tfrom = ((TypeAArray*)tfrom)->getImpl()->type; + if(t->ty == Taarray) + t = ((TypeAArray*)t)->getImpl()->type; + if (t->equals(tfrom)) goto Lret; This causes some strange cast (pointer to AA - is this supposed to work?) in object.d to fail, but I could not find the place where this magic happens. So I changed the definition : Index: object.di =================================================================== --- object.di (revision 222) +++ object.di (working copy) -300,5 +300,7 Value[Key] rehash() property { - return cast(Value[Key]) _aaRehash(&p, typeid(Value[Key])); + Value[Key] aa; + aa.p = _aaRehash(&p, typeid(Value[Key])); + return aa; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3491 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei metalanguage.com *** Issue 3709 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3491 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 22:25:41 PST --- Fixed dmd 2.041 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2010