37 references to WRN_NubExprIsConstBool
Microsoft.CodeAnalysis.CSharp (7)
Errors\ErrorFacts.cs (2)
306
case ErrorCode.
WRN_NubExprIsConstBool
:
917
or ErrorCode.
WRN_NubExprIsConstBool
Generated\ErrorFacts.Generated.cs (1)
43
case ErrorCode.
WRN_NubExprIsConstBool
:
Lowering\DiagnosticsPass_Warnings.cs (4)
770
Error(ErrorCode.
WRN_NubExprIsConstBool
, node, always, node.Left.Type.GetNullableUnderlyingType(), node.Left.Type);
774
Error(ErrorCode.
WRN_NubExprIsConstBool
, node, always, node.Right.Type.GetNullableUnderlyingType(), node.Right.Type);
818
Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.
WRN_NubExprIsConstBool
, node, always, node.Left.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Right));
822
Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.
WRN_NubExprIsConstBool
, node, always, node.Right.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Left));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
CodeGen\CodeGenOptimizedNullableOperators.cs (4)
1409
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new int?(N1()) == new short?()").WithArguments("false", "int", "short?").WithLocation(21, 16),
1412
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(double?) != new short?(N2())").WithArguments("true", "double", "double?").WithLocation(25, 16),
1424
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new int?(N1()) == new short?()").WithArguments("false", "int", "short?").WithLocation(21, 16),
1427
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(double?) != new short?(N2())").WithArguments("true", "double", "double?").WithLocation(25, 16),
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (26)
Semantics\NullableReferenceTypesTests.cs (1)
140210
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "x == null").WithArguments("false", "int", "int?").WithLocation(26, 13),
Semantics\SemanticErrorTests.cs (23)
743
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != null").WithArguments("true", "int", "int?"),
749
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != i").WithArguments("true", "int", "int?"));
21049
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == null").WithArguments("false", "int", "int?").WithLocation(19, 11),
21052
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != null").WithArguments("true", "int", "int?").WithLocation(20, 11),
21061
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == default(short?)").WithArguments("false", "int", "short?").WithLocation(28, 11),
21064
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != default(short?)").WithArguments("true", "int", "short?").WithLocation(29, 11),
21073
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == new sbyte?()").WithArguments("false", "int", "sbyte?").WithLocation(37, 11),
21076
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != new sbyte?()").WithArguments("true", "int", "sbyte?").WithLocation(38, 11),
21085
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null == i").WithArguments("false", "int", "int?").WithLocation(49, 11),
21088
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != i").WithArguments("true", "int", "int?").WithLocation(50, 11),
21097
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(long?) == i").WithArguments("false", "long", "long?").WithLocation(58, 11),
21100
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(long?) != i").WithArguments("true", "long", "long?").WithLocation(59, 11),
21109
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new double?() == i").WithArguments("false", "double", "double?").WithLocation(67, 11),
21112
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new double?() != i").WithArguments("true", "double", "double?").WithLocation(68, 11),
21121
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(E?)1 == null").WithArguments("false", "MyClass.E", "MyClass.E?").WithLocation(84, 11),
21124
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != (E?)1").WithArguments("true", "MyClass.E", "MyClass.E?").WithLocation(85, 11),
21127
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(int?)1 == null").WithArguments("false", "int", "int?").WithLocation(87, 11),
21130
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != (int?)1").WithArguments("true", "int", "int?").WithLocation(88, 11),
21133
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "0 == (int?)null").WithArguments("false", "int", "int?").WithLocation(92, 11),
21136
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(int?)null != 0").WithArguments("true", "int", "int?").WithLocation(93, 11),
21139
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "0 == (E?)null").WithArguments("false", "MyClass.E", "MyClass.E?").WithLocation(95, 11),
21142
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(E?)null != 0").WithArguments("true", "MyClass.E", "MyClass.E?").WithLocation(96, 11)
21168
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == null").WithArguments("false", "int", "int?").WithLocation(9, 21));
Semantics\TargetTypedDefaultTests.cs (2)
2814
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(int?)1 == default").WithArguments("false", "int", "int?").WithLocation(5, 30),
2817
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default == (int?)1").WithArguments("false", "int", "int?").WithLocation(6, 30)