www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5835] New: Class array's TypeInfo.getHash doesn't work correctly

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



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: -------
Apr 11 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

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



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: -------
Apr 11 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

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



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: -------
Apr 11 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5835


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

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



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: -------
Apr 11 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5835


yebblies <yebblies gmail.com> changed:

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



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: -------
Feb 04 2012