Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

MartinNowak
Copy link
Member

  • the internal TypeInfo_P.getHash for pointers trucated the hash to
    32-bit unlike the TypeInfo_Pointer.getHash
  • internal TypeInfos are used when no full type information is needed
    so they must behave identical

Issue 14104 – aa with pointer key type doesn't find existing value

@rainers
Copy link
Member

rainers commented Feb 1, 2015

Although this fixes the issue, wouldn't it be more correct to supply the proper type info? I.e. ban getInternalTypeInfo from the compiler.

@Safety0ff
Copy link
Contributor

TypeInfo_P.compare looks buggy too, I think it should be brought in line with TypeInfo_Pointer.compare.
(I also wonder the same thing as rainers.)

@MartinNowak
Copy link
Member Author

Although this fixes the issue, wouldn't it be more correct to supply the proper type info? I.e. ban getInternalTypeInfo from the compiler.

That's a different topic and as the comment says, it makes sense to use as few TypeInfo objects as possible.

- the internal TypeInfo_P.getHash for pointers trucated the hash to
  32-bit unlike the TypeInfo_Pointer.getHash
- internal TypeInfos are used when no full type information is needed
  so they must behave identical
@MartinNowak
Copy link
Member Author

Fixed, I copied the methods verbatim from TypeInfo_Pointer.

@Safety0ff
Copy link
Contributor

LGTM.

andralex added a commit that referenced this pull request Feb 2, 2015
fix Issue 14104 - aa with pointer key type doesn't find existing value
@andralex andralex merged commit 86f8b7c into dlang:master Feb 2, 2015
@rainers
Copy link
Member

rainers commented Feb 2, 2015

That's a different topic and as the comment says, it makes sense to use as few TypeInfo objects as possible.

The comment seems out of date, too. For example, static arrays are no longer translated to dynamic arrays. I think getInternalTypeInfo is a bad case of premature optimization. It's only used for some AA operations, array comparisons and array.sort (though explicitely not called for static arrays there).

@MartinNowak MartinNowak deleted the fix14104 branch February 2, 2015 10:20
@MartinNowak
Copy link
Member Author

Well, go ahead and remove it if the footprint is neglectable. You've worked a lot more with TypeInfo than I did.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants