if (lifted_type == null)
return null;
- if (left is UserCast || left is TypeCast)
+ if (left is UserCast || left is EmptyCast || left is OpcodeCast)
left.Type = lifted_type;
else
left = EmptyCast.Create (left, lifted_type);
if (r is ReducedExpression)
r = ((ReducedExpression) r).OriginalExpression;
- if (r is UserCast || r is TypeCast)
+ if (r is UserCast || r is EmptyCast || r is OpcodeCast)
r.Type = lifted_type;
else
right = EmptyCast.Create (right, lifted_type);
--- /dev/null
+using System;
+
+class X
+{
+ static int Main ()
+ {
+ object o = 10;
+ int? x = 3;
+
+ if ((int) o < x) {
+ return 1;
+ }
+
+ if (x > (int) o) {
+ return 2;
+ }
+
+ return 0;
+ }
+}
Assert (false, e8.Compile ().Invoke (MyEnum.Value_2, MyEnum.Value_2));
}
+ void LessThanTest_9 ()
+ {
+ Expression<Func<object, int?, bool>> e = (a, b) => (int) a < b;
+ AssertNodeType (e, ExpressionType.LessThan);
+ Assert (false, e.Compile ().Invoke (1, null));
+ Assert (false, e.Compile ().Invoke (3, 3));
+ Assert (true, e.Compile ().Invoke (1, 3));
+ }
+
void LessThanOrEqualTest ()
{
Expression<Func<int, int, bool>> e = (int a, int b) => a <= b;
</method>
</type>
</test>
+ <test name="gtest-568.cs">
+ <type name="X">
+ <method name="Int32 Main()" attrs="145">
+ <size>111</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-anontype-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="145">
<size>21</size>
</method>
</type>
+ <type name="Tester">
+ <method name="Void LessThanTest_9()" attrs="129">
+ <size>199</size>
+ </method>
+ </type>
</test>
<test name="gtest-etree-02.cs">
<type name="M">