Skip to content

Commit

Permalink
Track additional state for "maybe null even if not nullable"
Browse files Browse the repository at this point in the history
  • Loading branch information
cston committed Nov 15, 2019
1 parent 69e2c2b commit b027ec9
Show file tree
Hide file tree
Showing 26 changed files with 1,604 additions and 1,437 deletions.
72 changes: 0 additions & 72 deletions src/Compilers/CSharp/Portable/CSharpResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5396,30 +5396,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="WRN_NullabilityMismatchInAssignment_Title" xml:space="preserve">
<value>Nullability of reference types in value doesn't match target type.</value>
</data>
<data name="WRN_ConditionalAccessMayReturnNull" xml:space="preserve">
<value>Conditional access may produce a null value when '{0}' is a non-nullable reference type.</value>
</data>
<data name="WRN_ConditionalAccessMayReturnNull_Title" xml:space="preserve">
<value>Conditional access may produce a null value for a type parameter.</value>
</data>
<data name="WRN_AsOperatorMayReturnNull" xml:space="preserve">
<value>The 'as' operator may produce a null value when '{0}' is a non-nullable reference type.</value>
</data>
<data name="WRN_AsOperatorMayReturnNull_Title" xml:space="preserve">
<value>The 'as' operator may produce a null value for a type parameter.</value>
</data>
<data name="WRN_DefaultExpressionMayIntroduceNullT" xml:space="preserve">
<value>A default expression introduces a null value when '{0}' is a non-nullable reference type.</value>
</data>
<data name="WRN_DefaultExpressionMayIntroduceNullT_Title" xml:space="preserve">
<value>A default expression introduces a null value for a type parameter.</value>
</data>
<data name="WRN_NullLiteralMayIntroduceNullT" xml:space="preserve">
<value>A null literal introduces a null value when '{0}' is a non-nullable reference type.</value>
</data>
<data name="WRN_NullLiteralMayIntroduceNullT_Title" xml:space="preserve">
<value>A null literal introduces a null value for a type parameter.</value>
</data>
<data name="WRN_ImplicitCopyInReadOnlyMember" xml:space="preserve">
<value>Call to non-readonly member '{0}' from a 'readonly' member results in an implicit copy of '{1}'.</value>
</data>
Expand Down
8 changes: 4 additions & 4 deletions src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ internal enum ErrorCode
ERR_ExplicitNullableAttribute = 8623,
WRN_NullabilityMismatchInArgumentForOutput = 8624,
WRN_NullAsNonNullable = 8625,
WRN_AsOperatorMayReturnNull = 8626,
//WRN_AsOperatorMayReturnNull = 8626,
ERR_NullableUnconstrainedTypeParameter = 8627,
ERR_AnnotationDisallowedInObjectCreation = 8628,
WRN_NullableValueTypeMayBeNull = 8629,
Expand All @@ -1672,7 +1672,7 @@ internal enum ErrorCode
ERR_TripleDotNotAllowed = 8635,
ERR_BadNullableContextOption = 8636,
ERR_NullableDirectiveQualifierExpected = 8637,
WRN_ConditionalAccessMayReturnNull = 8638,
//WRN_ConditionalAccessMayReturnNull = 8638,
ERR_BadNullableTypeof = 8639,
ERR_ExpressionTreeCantContainRefStruct = 8640,
ERR_ElseCannotStartStatement = 8641,
Expand All @@ -1687,8 +1687,8 @@ internal enum ErrorCode
ERR_IsNullableType = 8650,
ERR_AsNullableType = 8651,
ERR_FeatureInPreview = 8652,
WRN_DefaultExpressionMayIntroduceNullT = 8653,
WRN_NullLiteralMayIntroduceNullT = 8654,
//WRN_DefaultExpressionMayIntroduceNullT = 8653,
//WRN_NullLiteralMayIntroduceNullT = 8654,
WRN_SwitchExpressionNotExhaustiveForNull = 8655,

WRN_ImplicitCopyInReadOnlyMember = 8656,
Expand Down
8 changes: 0 additions & 8 deletions src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ static ErrorFacts()
builder.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeParameterNotNullConstraint));
builder.Add(getId(ErrorCode.WRN_ThrowPossibleNull));
builder.Add(getId(ErrorCode.WRN_UnboxPossibleNull));
builder.Add(getId(ErrorCode.WRN_DefaultExpressionMayIntroduceNullT));
builder.Add(getId(ErrorCode.WRN_NullLiteralMayIntroduceNullT));
builder.Add(getId(ErrorCode.WRN_ConditionalAccessMayReturnNull));
builder.Add(getId(ErrorCode.WRN_AsOperatorMayReturnNull));
builder.Add(getId(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull));

builder.Add(getId(ErrorCode.WRN_ConvertingNullableToNonNullable));
Expand Down Expand Up @@ -421,10 +417,6 @@ internal static int GetWarningLevel(ErrorCode code)
case ErrorCode.WRN_CaseConstantNamedUnderscore:
case ErrorCode.WRN_ThrowPossibleNull:
case ErrorCode.WRN_UnboxPossibleNull:
case ErrorCode.WRN_DefaultExpressionMayIntroduceNullT:
case ErrorCode.WRN_NullLiteralMayIntroduceNullT:
case ErrorCode.WRN_ConditionalAccessMayReturnNull:
case ErrorCode.WRN_AsOperatorMayReturnNull:
case ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull:
case ErrorCode.WRN_ImplicitCopyInReadOnlyMember:
case ErrorCode.WRN_UnconsumedEnumeratorCancellationAttributeUsage:
Expand Down
Loading

0 comments on commit b027ec9

Please sign in to comment.