Bug 13129 – Equality between compatible but differently typed associative arrays

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-07-14T10:23:10Z
Last change time
2024-12-13T18:22:10Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: dmd#17668 →

Comments

Comment #0 by bearophile_hugs — 2014-07-14T10:23:10Z
void main() { uint[] a = [1, 2]; byte[] b = [1, 2]; auto r1 = a == b; // OK uint[int] aa1 = [10: 20]; byte[int] aa2 = [10: 20]; auto r2 = aa1 == aa2; // Error } DMD 2.066beta3 gives: temp.d(7,15): Error: incompatible types for ((aa1) == (aa2)): 'uint[int]' and 'byte[int]'
Comment #1 by hsteoh — 2014-07-15T15:17:26Z
This doesn't look likely to be fixable until AA's are fully implemented as a library type. The problem is that the current implementation is keyed on TypeInfo's, and given two arbitrary TypeInfo's it's not obvious how to determine whether the underlying types are implicitly convertible to each other. Maybe there's some obvious way that I missed, but as of now, I don't see this fixed anytime in the near future. :-(
Comment #2 by bearophile_hugs — 2014-07-15T16:42:50Z
(In reply to hsteoh from comment #1) > I don't see this fixed anytime in the near future. :-( This is a low-priority enhancement request.
Comment #3 by hsteoh — 2014-07-15T16:47:50Z
I know, I'm just saying, don't expect it to be fixed anytime soon. It's a bit sad for me, esp. since the last time I tried to implement a library AA, this is already supported. :-/
Comment #4 by robert.schadek — 2024-12-13T18:22:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17668 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB