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

Preparation for the issue 13701 - fix AA.dup for const elements #1031

Merged
merged 1 commit into from
Nov 21, 2014

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Nov 21, 2014

Required by: dlang/dmd#4148

After fixing issue 13701, aa[k] = v; will be rejected if the element of the aa is not mutable. Therefore it should be improved before the compiler fix.

Note that, the improved dup is not CTFEable. To keep aa.dup workable in CTFE, the CTFE interpreter in the compiler should handle aa.dup specially.

@9rnsr
Copy link
Contributor Author

9rnsr commented Nov 21, 2014

This PR should be merged in the 2nd of the three PRs (dlang/dmd#4154, #1031, dlang/dmd#4148).

@MartinNowak
Copy link
Member

Auto-merge toggled on

@9rnsr
Copy link
Contributor Author

9rnsr commented Nov 21, 2014

Thanks!

MartinNowak added a commit that referenced this pull request Nov 21, 2014
Preparation for the issue 13701 - fix AA.dup for const elements
@MartinNowak MartinNowak merged commit 4ae1da4 into dlang:master Nov 21, 2014
@9rnsr 9rnsr deleted the const_aa_dup branch November 23, 2014 01:35
@@ -365,16 +365,16 @@ extern (C)
// from druntime/src/rt/aaA.d

// size_t _aaLen(in void* p) pure nothrow @nogc;
// void* _aaGetX(void** pp, const TypeInfo keyti, in size_t valuesize, in void* pkey);
private void* _aaGetX(void** paa, const TypeInfo keyti, in size_t valuesize, in void* pkey) pure nothrow;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did that slipped through, _aaGetX is neither pure nor nothrow because it has to call TypeInfo.getHash and TypeInfo.equals which in turn might call any user defined function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currentry the purity and nothrowness of toHash is just ignored on the AA assignment aa[key] = val;. It should go a searated issue.

@CyberShadow
Copy link
Member

This pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=13809

@CyberShadow
Copy link
Member

According to Martin Krejcirik, this pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=14225

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.

3 participants