Add/Subtract tests (CompiledExpression<T>) failing

Oct 22, 2016 at 11:29 PM
Edited Oct 22, 2016 at 11:30 PM
from source as of "commit 991ce60420c1, Mar 25, 2014"

both add and subtract are failing with message

"typed expression Expression of type 'System.Object' cannot be used for return type 'System.Int32'"

Potential solution is:

Add method to ExpressionCompiler that converts to T instead of Object
        protected Expression WrapExpression<T>(Expression source)
            if (source.Type != typeof(void))
                return Expression.Convert(source, typeof(T));
            return Expression.Block(source, Expression.Constant(null));
Change CompiledExpression<T>.Compile to use the new method.
        public Func<T> Compile(bool isCall = false)
            if (Expression == null) Expression = WrapExpression<T>(BuildTree());
            return Expression.Lambda<Func<T>>(Expression).Compile();