Add asOriginalType function for enums#5401
Merged
dlang-bot merged 1 commit intodlang:masterfrom May 19, 2017
Merged
Conversation
Member
|
Auto-merge toggled on |
Contributor
|
Auto-merge toggled off |
Contributor
|
I'm not sure I follow as to why this is fixing the linked bug when the bug talks about DMD giving no warning about the comparison of different enum types when this function is about enum manifest constants. |
Member
Author
|
@JackStouffer The idea is to have the error message say: "Cannot compare unrelated enums, use std.conv.representation to convert each or both to their representation type". |
Member
|
This function gives a safe way to convert the enums being compared to a comparable type. |
Contributor
|
Ah, ok. Be careful though, as Phobos already has a function called representation in std.string. |
Member
Author
|
Yah, the use of the same name is intentional. |
JackStouffer
approved these changes
May 19, 2017
Member
Author
|
Let me rename it to |
8951b9c to
c4bad1b
Compare
c4bad1b to
bf43110
Compare
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.
In order to fix https://issues.dlang.org/show_bug.cgi?id=6227, we need to recommend the appropriate way of comparing different enum types if the user wants so. This supports that.