[REG2.067a] Issue 14039 - function is incorrectly inferred as 'pure'#4344
Merged
WalterBright merged 5 commits intodlang:masterfrom Jan 28, 2015
Merged
[REG2.067a] Issue 14039 - function is incorrectly inferred as 'pure'#4344WalterBright merged 5 commits intodlang:masterfrom
WalterBright merged 5 commits intodlang:masterfrom
Conversation
'X' is just undefined identifier (I had missed to replace it with actual class/struct name), so the __traits(compiles) didn't test compiler behavior.
It's necessary to avoid redundant errors in fail_compilation/diag0148.d.
…enceX() By this, we can use following convenient conditions to chech inference process. - isPureBypassingInference() == PUREimpure The function is already determined to impure. - isPureBypassingInference() == PUREfwdref The function is in inference process. - isPureBypassingInference() >= PUREfwdref The function is in inference process or determined to pure. - isPureBypassingInference() >= PUREweak The function is already determined to pure.
Fixes the interaction between issue 9148 behavior (more precise pure attribute annotation for nested functions) and purity inference.
Contributor
Author
|
@tgehr Could you review the adjusted compiler behavior? |
Member
|
Auto-merge toggled on |
WalterBright
added a commit
that referenced
this pull request
Jan 28, 2015
[REG2.067a] Issue 14039 - function is incorrectly inferred as 'pure'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.dlang.org/show_bug.cgi?id=14039
Fixed behavior:
If a nested function is declared inside pure function, it's implicitly marked as pure. It's introduced behavior to fix issue 9148 in #3626.
However, if a nested function is template, pure inference should be preferred than the implicit "pure inheritance".
While debugging, I found an another purity inference regression since 2.064. This PR will also fix it.
Issue 14049 - [REG2.064] Wrong purity inference for nested lambda