-
-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 7909 - to!enum(string) and to!string(enum) break when enum is integral #537
Conversation
string based enum to string conversion should return member name, instead of base value.
| @@ -101,6 +101,12 @@ private | |||
| formatValue(w, src, f); | |||
| return w.data; | |||
| } | |||
|
|
|||
| template isEnumStrToStr(S, T) // @@@Workaround@@@ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document what is being worked around.. specifically, what bug number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this is NOT workaround. I'll remove this meaningless comment.
|
I don't feel qualified to review most of phobos, however, commit 52462be feels rather intrusive. Since it's a regression fix, would someone else put eyes on this and let's get it done? |
| assert(to!wstring(F.y) == "y"w); | ||
| assert(to!dstring(F.z) == "z"d); | ||
| enum EB { a = true } | ||
| enum EU { a = 0, b = 1, c = 2 } // base type is unsigned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the base type still int, not uint, because you didn't specify? If that's the case, the base type is not unsigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. I couldn't remember why I added that comment in here and didn't add base type.
Will fix.
Issue 7909 - to!enum(string) and to!string(enum) break when enum is integral
http://d.puremagic.com/issues/show_bug.cgi?id=7909