37 references to WRN_NubExprIsConstBool
Microsoft.CodeAnalysis.CSharp (7)
Errors\ErrorFacts.cs (2)
293
case ErrorCode.
WRN_NubExprIsConstBool
:
855
case 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)
1101
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new int?(N1()) == new short?()").WithArguments("false", "int", "short?").WithLocation(21, 16),
1104
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(double?) != new short?(N2())").WithArguments("true", "double", "double?").WithLocation(25, 16),
1116
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new int?(N1()) == new short?()").WithArguments("false", "int", "short?").WithLocation(21, 16),
1119
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)
135910
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "x == null").WithArguments("false", "int", "int?").WithLocation(26, 13),
Semantics\SemanticErrorTests.cs (23)
745
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != null").WithArguments("true", "int", "int?"),
751
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != i").WithArguments("true", "int", "int?"));
20825
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == null").WithArguments("false", "int", "int?").WithLocation(19, 11),
20828
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != null").WithArguments("true", "int", "int?").WithLocation(20, 11),
20837
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == default(short?)").WithArguments("false", "int", "short?").WithLocation(28, 11),
20840
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != default(short?)").WithArguments("true", "int", "short?").WithLocation(29, 11),
20849
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i == new sbyte?()").WithArguments("false", "int", "sbyte?").WithLocation(37, 11),
20852
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "i != new sbyte?()").WithArguments("true", "int", "sbyte?").WithLocation(38, 11),
20861
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null == i").WithArguments("false", "int", "int?").WithLocation(49, 11),
20864
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != i").WithArguments("true", "int", "int?").WithLocation(50, 11),
20873
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(long?) == i").WithArguments("false", "long", "long?").WithLocation(58, 11),
20876
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "default(long?) != i").WithArguments("true", "long", "long?").WithLocation(59, 11),
20885
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new double?() == i").WithArguments("false", "double", "double?").WithLocation(67, 11),
20888
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "new double?() != i").WithArguments("true", "double", "double?").WithLocation(68, 11),
20897
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(E?)1 == null").WithArguments("false", "MyClass.E", "MyClass.E?").WithLocation(84, 11),
20900
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != (E?)1").WithArguments("true", "MyClass.E", "MyClass.E?").WithLocation(85, 11),
20903
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(int?)1 == null").WithArguments("false", "int", "int?").WithLocation(87, 11),
20906
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "null != (int?)1").WithArguments("true", "int", "int?").WithLocation(88, 11),
20909
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "0 == (int?)null").WithArguments("false", "int", "int?").WithLocation(92, 11),
20912
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(int?)null != 0").WithArguments("true", "int", "int?").WithLocation(93, 11),
20915
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "0 == (E?)null").WithArguments("false", "MyClass.E", "MyClass.E?").WithLocation(95, 11),
20918
Diagnostic(ErrorCode.
WRN_NubExprIsConstBool
, "(E?)null != 0").WithArguments("true", "MyClass.E", "MyClass.E?").WithLocation(96, 11)
20944
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)