We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using v4.0.0-preview4
v4.0.0-preview4
The following method returns x != null && x != 4:
x != null && x != 4
[Projectable(NullConditionalRewriteSupport = NullConditionalRewriteSupport.Rewrite)] public static bool Test(this object? x) => x?.Equals(4) == false;
Unfortunately, the generated code has a nasty bug! It now returns x != null && x == 4 - inverting the result when x is not null.
x != null && x == 4
x
static global::System.Linq.Expressions.Expression<global::System.Func<object, bool>> Expression() { return (object x) => x != null ? (x.Equals(4)) : (bool?)null == false; }
The ternary expression should be wrapped in parentheses before == false. This seems somewhat similar to #115. The corrected code should read:
== false
static global::System.Linq.Expressions.Expression<global::System.Func<object, bool>> Expression() { return (object x) => (x != null ? (x.Equals(4)) : (bool?)null) == false; }
The text was updated successfully, but these errors were encountered:
5b4a3a0
Merge pull request #118 from PhenX/bugfix/116-ternary-parenthesis
fe695d1
Fix missing parenthesis around ternary expressions (Fixes #116)
No branches or pull requests
I'm using
v4.0.0-preview4
The following method returns
x != null && x != 4
:Unfortunately, the generated code has a nasty bug!
It now returns
x != null && x == 4
- inverting the result whenx
is not null.The ternary expression should be wrapped in parentheses before
== false
.This seems somewhat similar to #115.
The corrected code should read:
The text was updated successfully, but these errors were encountered: