// Due to a long-standing bug, the native compiler does not produce warnings for "guid == null", but does
// for "int == null". Roslyn corrects this lapse and produces warnings for both built-in and
// user-defined lifted equality operators.
// Due to a long-standing bug, the native compiler does not produce warnings for "guid == null",
// but does for "int == null". Roslyn corrects this lapse and produces warnings for both built-in
// and user-defined lifted equality operators, but the new warnings for user-defined types are
// only given in "strict" more.
var text = @"
using System;
...
...
@@ -19145,8 +19146,7 @@ public static void Main()
ftftftftftftftftftftftft
tf
ftftftft";
var comp = this.CompileAndVerify(source: text, expectedOutput: expected);
comp.VerifyDiagnostics(
var fullExpected = new DiagnosticDescription[] {
// (19,11): warning CS0472: The result of the expression is always 'false' since a value of type 'int' is never equal to 'null' of type 'int?'
// W(i == null); // CS0472
Diagnostic(ErrorCode.WRN_NubExprIsConstBool, "i == null").WithArguments("false", "int", "int?").WithLocation(19, 11),
...
...
@@ -19243,7 +19243,10 @@ public static void Main()
// (96,11): warning CS0472: The result of the expression is always 'true' since a value of type 'MyClass.E' is never equal to 'null' of type 'MyClass.E?'
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.