Skip to content

Comparisson to "null" does not work when not Typed #93

@jogibear9988

Description

@jogibear9988

If you compare "null" without type info, for example with a string, this could not be compiled

    [Test]
    public void ConditionTest()
    {
        var pParam = Expression.Parameter(typeof(string), "p");

        var condition = Expression.Condition(Expression.NotEqual(pParam, Expression.Constant(null)),
            Expression.Constant(1),
            Expression.Constant(0));
        var lambda = Expression.Lambda<Func<string, int>>(condition, pParam);
        var convert0 = lambda.Compile();
        Assert.NotNull(convert0);
        var convert1 = FastExpressionCompiler.ExpressionCompiler.CompileFast(lambda, true);
        Assert.NotNull(convert1);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions