61 references to WRN_AlwaysNull
Microsoft.CodeAnalysis.CSharp (9)
Binder\Binder_Operators.cs (1)
3858
Error(diagnostics, ErrorCode.
WRN_AlwaysNull
, node, targetType);
Errors\ErrorFacts.cs (2)
290
case ErrorCode.
WRN_AlwaysNull
:
846
case 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?"));
1977
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?() + new long?()").WithArguments("long?"),
1980
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "(short?)null * default(decimal?)").WithArguments("decimal?"));
2104
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?() + N()").WithArguments("int?"),
2107
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "new int?(B()) * default(int?)").WithArguments("int?"));
CodeGen\CodeGenTupleTest.cs (1)
25485
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)
2054
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),
10932
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "((System.TypeCode)0) as int?").WithArguments("int?").WithLocation(15, 15),
10935
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "0 as long?").WithArguments("long?").WithLocation(18, 15),
10938
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "0 as ulong?").WithArguments("ulong?").WithLocation(19, 15),
10941
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "GetNullableInt() as long?").WithArguments("long?").WithLocation(20, 15)
Semantics\SemanticErrorTests.cs (35)
12262
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "(int?)null + x").WithArguments("int?").WithLocation(7, 23)
20168
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null + x").WithArguments("int?"),
20169
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x + default(int?)").WithArguments("int?"),
20170
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x += new int?()").WithArguments("int?"),
20172
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null - x").WithArguments("int?"),
20173
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x - default(int?)").WithArguments("int?"),
20174
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x -= new int?()").WithArguments("int?"),
20176
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null * x").WithArguments("int?"),
20177
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x * default(int?)").WithArguments("int?"),
20178
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x *= new int?()").WithArguments("int?"),
20180
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null / x").WithArguments("int?"),
20181
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x / default(int?)").WithArguments("int?"),
20182
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x /= new int?()").WithArguments("int?"),
20184
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null % x").WithArguments("int?"),
20185
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x % default(int?)").WithArguments("int?"),
20186
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x %= new int?()").WithArguments("int?"),
20188
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null << x").WithArguments("int?"),
20189
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x << default(int?)").WithArguments("int?"),
20190
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x <<= new int?()").WithArguments("int?"),
20192
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null >> x").WithArguments("int?"),
20193
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x >> default(int?)").WithArguments("int?"),
20194
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x >>= new int?()").WithArguments("int?"),
20196
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null & x").WithArguments("int?"),
20197
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x & default(int?)").WithArguments("int?"),
20198
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x &= new int?()").WithArguments("int?"),
20200
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null | x").WithArguments("int?"),
20201
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x | default(int?)").WithArguments("int?"),
20202
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x |= new int?()").WithArguments("int?"),
20204
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "null ^ x").WithArguments("int?"),
20205
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x ^ default(int?)").WithArguments("int?"),
20206
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "x ^= new int?()").WithArguments("int?"),
20208
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "+default(double?)").WithArguments("double?"),
20209
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "-default(int?)").WithArguments("int?"),
20210
Diagnostic(ErrorCode.
WRN_AlwaysNull
, "~default(long?)").WithArguments("long?"),
20211
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[] { KeyValuePairUtil.Create($"CS{(int)ErrorCode.
WRN_AlwaysNull
:D4}", ReportDiagnostic.Suppress) }));
44
var d2 = SimpleDiagnostic.Create(MessageProvider.Instance, (int)ErrorCode.
WRN_AlwaysNull
, "1");