* expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
comparing arbitrary types with the null literal.
svn path=/trunk/mcs/; revision=41748
+2005-03-13 Martin Baulig <martin@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
+ comparing arbitrary types with the null literal.
+
2005-03-13 Martin Baulig <martin@ximian.com>
* generic.cs (Nullable.LiftedBinaryOperator): Add support for the
return this;
}
+ bool left_is_null = left is NullLiteral;
+ bool right_is_null = right is NullLiteral;
+ if (left_is_null || right_is_null) {
+ if (oper == Operator.Equality)
+ return new BoolLiteral (left_is_null == right_is_null);
+ else
+ return new BoolLiteral (left_is_null != right_is_null);
+ }
+
//
// operator != (object a, object b)
// operator == (object a, object b)