61 references to WRN_AlwaysNull
Microsoft.CodeAnalysis.CSharp (9)
Binder\Binder_Operators.cs (1)
5357
Error(diagnostics, ErrorCode.
WRN_AlwaysNull
, node, targetType);
Errors\ErrorFacts.cs (2)
303
case ErrorCode.
WRN_AlwaysNull
:
908
or ErrorCode.
WRN_AlwaysNull
Generated\ErrorFacts.Generated.cs (1)
39
case ErrorCode.
WRN_AlwaysNull
:
Lowering\DiagnosticsPass_Warnings.cs (5)
729
Error(ErrorCode.
WRN_AlwaysNull
, node, node.Type);
745
Error(ErrorCode.
WRN_AlwaysNull
, node, node.Type);
830
Error(ErrorCode.
WRN_AlwaysNull
, node, node.Type);
836
Error(ErrorCode.
WRN_AlwaysNull
, node, node.Type);
847
Error(ErrorCode.
WRN_AlwaysNull
, node, node.Type);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (8)
BreakingChanges.cs (1)
950
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "ct & null ^ null").WithArguments("bool?") //,
CodeGen\CodeGenOptimizedNullableOperators.cs (6)
320
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "~(new int?())").WithArguments("int?"));
363
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "-(new short?())").WithArguments("int?"));
2285
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?() + new long?()").WithArguments("long?"),
2288
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "(short?)null * default(decimal?)").WithArguments("decimal?"));
2412
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?() + N()").WithArguments("int?"),
2415
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?(B()) * default(int?)").WithArguments("int?"));
CodeGen\CodeGenTupleTest.cs (1)
25447
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "(1, 1) as (int, long)?").WithArguments("(int, long)?").WithLocation(7, 17)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (41)
Semantics\NullableTests.cs (1)
2050
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "xn0 - null").WithArguments("int?").WithLocation(9, 28)
Semantics\OperatorTests.cs (5)
1939
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new Q<int>?() + new int?()").WithArguments("int?").WithLocation(37, 18),
11574
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "((System.TypeCode)0) as int?").WithArguments("int?").WithLocation(15, 15),
11577
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "0 as long?").WithArguments("long?").WithLocation(18, 15),
11580
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "0 as ulong?").WithArguments("ulong?").WithLocation(19, 15),
11583
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "GetNullableInt() as long?").WithArguments("long?").WithLocation(20, 15)
Semantics\SemanticErrorTests.cs (35)
12312
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "(int?)null + x").WithArguments("int?").WithLocation(7, 23)
20392
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null + x").WithArguments("int?"),
20393
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x + default(int?)").WithArguments("int?"),
20394
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x += new int?()").WithArguments("int?"),
20396
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null - x").WithArguments("int?"),
20397
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x - default(int?)").WithArguments("int?"),
20398
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x -= new int?()").WithArguments("int?"),
20400
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null * x").WithArguments("int?"),
20401
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x * default(int?)").WithArguments("int?"),
20402
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x *= new int?()").WithArguments("int?"),
20404
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null / x").WithArguments("int?"),
20405
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x / default(int?)").WithArguments("int?"),
20406
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x /= new int?()").WithArguments("int?"),
20408
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null % x").WithArguments("int?"),
20409
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x % default(int?)").WithArguments("int?"),
20410
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x %= new int?()").WithArguments("int?"),
20412
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null << x").WithArguments("int?"),
20413
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x << default(int?)").WithArguments("int?"),
20414
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x <<= new int?()").WithArguments("int?"),
20416
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null >> x").WithArguments("int?"),
20417
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x >> default(int?)").WithArguments("int?"),
20418
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x >>= new int?()").WithArguments("int?"),
20420
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null & x").WithArguments("int?"),
20421
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x & default(int?)").WithArguments("int?"),
20422
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x &= new int?()").WithArguments("int?"),
20424
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null | x").WithArguments("int?"),
20425
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x | default(int?)").WithArguments("int?"),
20426
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x |= new int?()").WithArguments("int?"),
20428
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null ^ x").WithArguments("int?"),
20429
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x ^ default(int?)").WithArguments("int?"),
20430
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x ^= new int?()").WithArguments("int?"),
20432
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "+default(double?)").WithArguments("double?"),
20433
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "-default(int?)").WithArguments("int?"),
20434
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "~default(long?)").WithArguments("long?"),
20435
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "!default(bool?)").WithArguments("bool?")
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\EnumTests.cs (1)
571
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null & MyEnum.One").WithArguments("MyEnum?")
Microsoft.CodeAnalysis.UnitTests (2)
Diagnostics\CompilationWithAnalyzersTests.cs (2)
41
new[] { KeyValuePair.Create($"CS{(int)ErrorCode.
WRN_AlwaysNull
:D4}", ReportDiagnostic.Suppress) }));
44
var d2 = SimpleDiagnostic.Create(MessageProvider.Instance, (int)ErrorCode.
WRN_AlwaysNull
, "1");