dadhi/FastExpressionCompiler

Comparisons with nullable types

celi opened this issue · 2 comments

celi commented

Hi,

It looks like FastExpressionCompiler is not comparing correctly nullable types. I didn't find any mention of it.

public static class FastExpressionCompilerTests
{
    public class Test
    {
        public decimal? D1 { get; set; }
    }

    public static void RunTest()
    {
        Expression<Func<Test, bool>> expression = t => t.D1 < 20;

        var normalCompiled = expression.Compile();

        var fastCompiled = expression.CompileFast(true, CompilerFlags.EnableDelegateDebugInfo);

        var test = new Test()
        {
            D1 = null
        };

        var result1 = normalCompiled(test); // false

        var result2 = fastCompiled(test); // true
    }
}

after execution result1 is equal false, but result2 is equal true

dadhi commented

@celi Missed this one, will look now. Thanks for posting.

dadhi commented

@celi Yep, reproduced :/ Will fix.