I'm using v4.0.0-preview4
The following method returns 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.
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:
static global::System.Linq.Expressions.Expression<global::System.Func<object, bool>> Expression()
{
return (object x) => (x != null ? (x.Equals(4)) : (bool?)null) == false;
}
I'm using
v4.0.0-preview4The 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 whenxis not null.The ternary expression should be wrapped in parentheses before
== false.This seems somewhat similar to #115.
The corrected code should read: