Closed StandBackBurrito closed 10 years ago
I made a change to promote Nullable<int>
and Nullable<byte>
to Nullable<double>
. This works, but I am not sure if it is the correct way to solve the issue.
https://github.com/StandBackBurrito/ExpressiveAnnotations/compare/nullable-byte-fix
I think it is a good solution. Based on that, I've pushed some code to the trunk now. In addition I've made few modifications to be able to support all numeric types promotion to double (not only int and byte). Now, all underlying enum types (byte, sbyte, short, ushort, int, uint, long and ulong) are supported: https://github.com/JaroslawWaliszko/ExpressiveAnnotations/commit/4e0d312246d95f0cb5274624f4591d29d1c369de
This seems to be an issue with Linq and what types it determines are arithmetic.
For me
Expression.Divide
was the killer, but there may be other issues as well.You can trace through the
Expression.Divide
code here: http://referencesource.microsoft.com/System.Core/a.html#e48196c57cc9f07cIt calls
IsArithmetic
which is here: http://referencesource.microsoft.com/System.Core/Microsoft/Scripting/Ast/TypeUtils.cs.html#d279c9ec254c1933Byte is not listed in
IsArithmetic
.A normal byte works because it is up-cast to a Double.