Skip to content
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

Merged
merged 7 commits into from
May 22, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Apr 15, 2012

@@ -101,6 +101,12 @@ private
formatValue(w, src, f);
return w.data;
}

template isEnumStrToStr(S, T) // @@@Workaround@@@
Copy link
Member

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?

Copy link
Contributor Author

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.

@braddr
Copy link
Member

braddr commented May 12, 2012

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?

@9rnsr
Copy link
Contributor Author

9rnsr commented May 12, 2012

This is not only regression fix, and also contains some improvements of std.traits.XXXTypeOf.
If users specify isXXXType!T, in most cases they expects that returns false when T is enum type.
I didn't consider that case in #488 (was merged in 2.059), so this is almost a part of #488 IMO.

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
Copy link
Member

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.

Copy link
Contributor Author

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.

WalterBright added a commit that referenced this pull request May 22, 2012
Issue 7909 - to!enum(string) and to!string(enum) break when enum is integral
@WalterBright WalterBright merged commit ac143b6 into dlang:master May 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants