private BoundExpression CompareWithConstant(BoundExpression input, BoundExpression boundConstant) { var systemObject = _factory.SpecialType(SpecialType.System_Object); if (boundConstant.ConstantValue == ConstantValue.Null) { if (input.Type.IsNonNullableValueType()) { var systemBoolean = _factory.SpecialType(SpecialType.System_Boolean); return(RewriteNullableNullEquality( syntax: _factory.Syntax, kind: BinaryOperatorKind.NullableNullEqual, loweredLeft: input, loweredRight: boundConstant, returnType: systemBoolean)); } else { return(_factory.ObjectEqual(_factory.Convert(systemObject, input), boundConstant)); } } else if (input.Type.IsNullableType() && boundConstant.NullableNeverHasValue()) { return(_factory.Not(MakeNullableHasValue(_factory.Syntax, input))); } else { return(_factory.StaticCall( systemObject, "Equals", _factory.Convert(systemObject, boundConstant), _factory.Convert(systemObject, input) )); } }