The following test fails with an exception below. As a user, I would expect it to pass. I can create a PR with a fix if you agree it's a bug.
[Fact]
public void ShouldCompareNullableNullToNonNullable()
{
var e = new Expression("[x] = 5", EvaluateOptions.AllowNullParameter);
e.Parameters["x"] = null;
Assert.False((bool)e.Evaluate());
}
System.InvalidCastException
Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at NCalc.Domain.EvaluationVisitor.CompareUsingMostPreciseType(Object a, Object b) in \src\NCalc\Domain\EvaluationVisitor.cs:line 65
at NCalc.Domain.EvaluationVisitor.Visit(BinaryExpression expression) in \src\NCalc\Domain\EvaluationVisitor.cs:line 160
at NCalc.Domain.BinaryExpression.Accept(LogicalExpressionVisitor visitor) in \src\NCalc\Domain\BinaryExpression.cs:line 20
at NCalc.Expression.Evaluate() in \src\NCalc\Expression.cs:line 323
at NCalc.Tests.Fixtures.ShouldCompareNullableNullToNonNullable() in \test\NCalc.Tests\Fixtures.cs:line 96
The following test fails with an exception below. As a user, I would expect it to pass. I can create a PR with a fix if you agree it's a bug.