KEMBAR78
Improve generation of not equals check by ElektroKill · Pull Request #3425 · icsharpcode/ILSpy · GitHub
Skip to content

Conversation

@ElektroKill
Copy link
Contributor

Link to issue(s) this covers:
fixes #3423

Problem

The decompiler would use 0 for the != 0 check even if the type was an enum.

Solution

  • Adjust the code to use ExpressionBuilder.ConvertConstantValue to generate the expression for the 0 constant
  • A pretty test was added to cover the issue

@siegfriedpammer
Copy link
Member

Thank you very much for your contribution!

@siegfriedpammer siegfriedpammer merged commit 4ef3581 into icsharpcode:master Mar 22, 2025
5 checks passed
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.

Enum fails to resolve in != 0 condition

2 participants