Thread overview
[Issue 5835] New: Class array's TypeInfo.getHash doesn't work correctly
Apr 11, 2011
Kenji Hara
Apr 11, 2011
Kenji Hara
Apr 12, 2011
Kenji Hara
Apr 12, 2011
Kenji Hara
Feb 05, 2012
yebblies
April 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5835

           Summary: Class array's TypeInfo.getHash doesn't work correctly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-04-11 05:52:31 PDT ---
Sample code:
----
import std.stdio;
class Foo{
  hash_t toHash(){ writeln("Foo.toHash"); return 0; }
}
void main(){
  Foo[] arr = [new Foo(), new Foo()];
  typeid(arr).getHash(&arr);  // doesn't call Foo.toHash()
}
----

The typeid(arr) returns instance of TypeInfo_Array, but its getHash is not call Object.toHash of each element.

The internal TypeInfo class rt.typeinfo.ti_AC.TypeInfo_AC supports it, but this is only used in array/associative-array operations.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-04-11 05:56:44 PDT ---
Patches: https://github.com/9rnsr/dmd/compare/master...aa_hash_fix https://github.com/9rnsr/druntime/compare/master...aa_hash_fix

Changes:
- TypeInfo_AC is derived from TypeInfo_Array.
- Class array's TypeInfo is instance of TypeInfo_AC.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-04-11 19:34:45 PDT ---
Sorry, this patch has disabling optimizing problem.
I'll fix it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-04-11 22:55:45 PDT ---
Changed.
- Removing getInternalTypeInfo is too strict.
- Changed internal TypeInfo of class array -> typeid(Object[])
- TypeInfo_AC is only used for TypeInfo class of typeid(user class array).

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #4 from yebblies <yebblies@gmail.com> 2012-02-05 15:50:53 EST ---
Are these patches still valid?  Maybe worth turning them into pull requests.

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