private static bool IsNullComparison(Expression left, Expression right)
{
// If we have x==null, x!=null, null==x or null!=x where x is
// nullable but not null, then this is treated as a call to x.HasValue
// and is legal even if there is no equality operator defined on the
// type of x.
return IsNullConstant(left)
? !IsNullConstant(right) && right.Type.IsNullableType()
: IsNullConstant(right) && left.Type.IsNullableType();
}