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

Convert short literals in ternary expressions [#363] #412

Merged
merged 2 commits into from Nov 11, 2019

Conversation

@mrmonday
Copy link
Contributor

mrmonday commented Nov 11, 2019

  • Add explicit conversions for both branches of a ternary expression
  • Add conversions for short literals

Fixes #363

Problem

Short literals in ternary expressions were not converted.

Solution

There were a couple of things here - we need to add conversions for each branch of the ternary opeartor. We could probably be more clever about this, but just adding the conversion is easy enough.

The other thing is the conversion of VB short literals. I added a case to the conversion analysis code to handle this - another (more invasive) approach would be to add an explicit case whenever we convert a VB literal that has an explicit suffix.

  • At least one test covering the code changed
 * Add explicit conversions for both branches of a ternary expression
 * Add conversions for short literals

Fixes #363
@mrmonday

This comment has been minimized.

Copy link
Contributor Author

mrmonday commented Nov 11, 2019

Not sure why CI is failing - running the failing tests locally seems to work.

Avoid non-determinism when converting files in parallel
@GrahamTheCoder

This comment has been minimized.

Copy link
Member

GrahamTheCoder commented Nov 11, 2019

I reran and it passed, and it works locally too. I recently allowed files to be converted in parallel, so it just happened to show up this race condition. It wasn't anything to do with your PR, but since we saw it here and it's a tiny fix I've added it on the end.

@GrahamTheCoder GrahamTheCoder merged commit fe86a5a into icsharpcode:master Nov 11, 2019
2 checks passed
2 checks passed
icsharpcode.CodeConverter Build #20191111.17 succeeded
Details
icsharpcode.CodeConverter (Job Config_Release) Job Config_Release succeeded
Details
@mrmonday mrmonday deleted the mrmonday:363-ternary-conversions branch Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.