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

Enum implicit cast support #306

Merged
merged 8 commits into from May 7, 2019

Conversation

Projects
None yet
2 participants
@mrmonday
Copy link
Contributor

commented May 1, 2019

Closes #180

Problem

We currently don't handle implicit enum conversions. This adds support for them

Solution

  • Add support for explicit conversions in variable declarations. This is a little verbose for eg. floating point equals integer literal.

  • Add support for enum -> integer conversions. This is a little verbose for eg. Binary equals. We could special case this in VisitBinaryExpression() to give nicer output, I opted not to do that here - happy to change it though.

  • Not sure about how I got the TypeConversionAnalyzer into CommonConversions - I tried a few ways and they all seemed kinda ugly.

  • At least one test covering the code changed

  • All tests pass

@GrahamTheCoder
Copy link
Member

left a comment

I've detangled the dependencies a bit. Just had one comment on that test case. Is it easy to special case? If not, I'm happy to merge it anyway.

@GrahamTheCoder GrahamTheCoder merged commit 8ec9001 into icsharpcode:master May 7, 2019

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@mrmonday mrmonday deleted the mrmonday:180-enum-implicit-cast branch May 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.