1 write to Nullability
Microsoft.CodeAnalysis (1)
Compilation\TypeInfo.cs (1)
46this.Nullability = nullability;
147 references to Nullability
Microsoft.CodeAnalysis (3)
Compilation\TypeInfo.cs (3)
55&& this.Nullability.Equals(other.Nullability) 68Hash.Combine(this.Nullability.GetHashCode(),
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableExtensions.cs (1)
13=> typeInfo.Type?.WithNullableAnnotation(typeInfo.Nullability.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableHelpers.cs (1)
84if (typeInfo.Nullability.FlowState == NullableFlowState.MaybeNull)
Microsoft.CodeAnalysis.CSharp.Features (2)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
760if (returnTypeInfo.Nullability.FlowState == NullableFlowState.MaybeNull)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
136return typeInfo.Nullability.FlowState;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (102)
Semantics\DynamicTests.cs (66)
4983Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 5064Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 5107Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 5187Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 5230Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 5311Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6029Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6109Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6152Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6232Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6272Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6352Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6678Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6741Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 6787Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6850Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 6897Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 6961Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 7066Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7123Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 7169Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7235Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7282Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7351Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7398Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7468Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7588Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7647Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7693Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7753Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7799Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7859Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 7903Assert.Equal(CodeAnalysis.NullableFlowState.None, typeInfo.Nullability.FlowState); 7974Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8034Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8080Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8140Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8185Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8244Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8290Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8353Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 8399Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8462Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 8508Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8571Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 8618Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 8682Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 8868Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10020Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10097Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10148Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10225Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10276Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10353Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10430Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10505Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10564Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10652Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10712Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10802Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 10982Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 11068Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 11324Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 11377Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 11591Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 11643Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState);
Semantics\NullableContextTests.cs (12)
354Assert.Equal(expectedNullability, typeInfo.Nullability.FlowState); 393Assert.Equal(expectedNullability, typeInfo.Nullability.FlowState); 428Assert.Equal(expectedNullability, typeInfo.Nullability.FlowState); 1776Assert.Equal(Microsoft.CodeAnalysis.NullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 1781Assert.Equal(Microsoft.CodeAnalysis.NullableFlowState.None, typeInfo.Nullability.FlowState); 1844Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 1890Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 1945Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 1982Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 2022Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 2061Assert.Equal(expectedFlowState, typeInfo.Nullability.FlowState); 2232Assert.Equal(expectedAnnotation, typeInfo.Nullability.Annotation);
Semantics\NullableReferenceTypesTests.cs (20)
59024Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, model.GetTypeInfo(declaration.Type).Nullability.Annotation); 62846Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 62847Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, typeInfo.Nullability.Annotation); 71879Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, model.GetTypeInfo(discard1).Nullability.Annotation); 71884Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, model.GetTypeInfo(discard2).Nullability.Annotation); 71889Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, model.GetTypeInfo(discard3).Nullability.Annotation); 71894Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, model.GetTypeInfo(discard4).Nullability.Annotation); 71928Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(discard1).Nullability.Annotation); 71937Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(discard2).Nullability.Annotation); 71966Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(discardPattern1).Nullability.Annotation); 71972Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(discardPattern2).Nullability.Annotation); 146472Assert.Equal(CodeAnalysis.NullableAnnotation.Annotated, typeInfo.Nullability.Annotation); 155998Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, model.GetTypeInfo(identifiers[0]).Nullability.Annotation); 155999Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(identifiers[1]).Nullability.Annotation); 156000Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, model.GetTypeInfo(identifiers[2]).Nullability.Annotation); 156001Assert.Equal(CodeAnalysis.NullableAnnotation.None, model.GetTypeInfo(identifiers[3]).Nullability.Annotation); 161253Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 161254Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, typeInfo.Nullability.Annotation); 161299Assert.Equal(CodeAnalysis.NullableFlowState.NotNull, typeInfo.Nullability.FlowState); 161300Assert.Equal(CodeAnalysis.NullableAnnotation.NotAnnotated, typeInfo.Nullability.Annotation);
Semantics\TopLevelStatementsTests.cs (4)
1523Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, model1.GetTypeInfo(reference).Nullability.FlowState); 1526Assert.Equal(CodeAnalysis.NullableFlowState.MaybeNull, model1.GetTypeInfo(reference).Nullability.FlowState); 1594_ = model1.GetTypeInfo(id).Nullability; 1600_ = model2.GetTypeInfo(id).Nullability;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (31)
Compilation\SemanticModelAPITests.cs (3)
4493Assert.Equal(CodeAnalysis.NullableAnnotation.None, typeInfo.Nullability.Annotation); 4557Assert.Equal(CodeAnalysis.NullableAnnotation.None, typeInfo.Nullability.Annotation); 4571Assert.Equal(CodeAnalysis.NullableAnnotation.None, typeInfo.Nullability.Annotation);
Symbols\Source\NullablePublicAPITests.cs (28)
1404Assert.Equal(PublicNullableFlowState.NotNull, referenceTypeInfo.Nullability.FlowState); 1406Assert.Equal(PublicNullableFlowState.NotNull, coalesceTypeInfo.Nullability.FlowState); 1411Assert.Equal(conditionFlowState, referenceTypeInfo.Nullability.FlowState); 1414Assert.Equal(conditionFlowState, coalesceTypeInfo.Nullability.FlowState); 1532Assert.Equal(expectedFlowState, specTypeInfo.Nullability.FlowState); 1534Assert.Equal(PublicNullableFlowState.NotNull, specTypeInfo.Nullability.FlowState); 1588Assert.Equal(expectedFlowState, specTypeInfo.Nullability.FlowState); 1590Assert.Equal(PublicNullableFlowState.NotNull, specTypeInfo.Nullability.FlowState); 1630Assert.Equal(PublicNullableFlowState.MaybeNull, type.Nullability.FlowState); 1631Assert.Equal(PublicNullableAnnotation.Annotated, type.Nullability.Annotation); 1673Assert.Equal(PublicNullableFlowState.None, type.Nullability.FlowState); 1674Assert.Equal(PublicNullableAnnotation.None, type.Nullability.Annotation); 1716Assert.Equal(PublicNullableFlowState.None, type.Nullability.FlowState); 1717Assert.Equal(PublicNullableAnnotation.None, type.Nullability.Annotation); 1795Assert.Equal(PublicNullableAnnotation.Annotated, info.Nullability.Annotation); 1796Assert.Equal(PublicNullableFlowState.MaybeNull, info.Nullability.FlowState); 2921Assert.Equal(PublicNullableFlowState.MaybeNull, typeInfo.Nullability.FlowState); 2925Assert.Equal(PublicNullableFlowState.NotNull, typeInfo.Nullability.FlowState); 2930Assert.Equal(PublicNullableFlowState.None, typeInfo.Nullability.FlowState); 4273Assert.Equal(PublicNullableFlowState.MaybeNull, model.GetTypeInfo(default0).Nullability.FlowState); 4276Assert.Equal(PublicNullableFlowState.NotNull, model.GetTypeInfo(default1).Nullability.FlowState); 4307Assert.Equal(PublicNullableFlowState.MaybeNull, model.GetTypeInfo(default0).Nullability.FlowState); 4310Assert.Equal(PublicNullableFlowState.NotNull, model.GetTypeInfo(default1).Nullability.FlowState); 4822Assert.Equal(PublicNullableFlowState.NotNull, info.Nullability.FlowState); 4827Assert.Equal(PublicNullableFlowState.NotNull, info.Nullability.FlowState); 4851Assert.Equal(PublicNullableAnnotation.NotAnnotated, info.Nullability.Annotation); 4852Assert.Equal(PublicNullableFlowState.NotNull, info.Nullability.FlowState); 4917Assert.Equal(PublicNullableFlowState.NotNull, typeInfo.Nullability.FlowState);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (5)
CompilationTestUtils.cs (5)
240summary.Nullability = typeInfo.Nullability; 277summary.Nullability = typeInfo.Nullability; 314summary.Nullability = typeInfo.Nullability; 474Assert.NotEqual(CodeAnalysis.NullableFlowState.None, typeInfo.Nullability.FlowState); 478(annotation.IsConverted ? typeInfo.ConvertedNullability : typeInfo.Nullability).FlowState.ToInternalFlowState()).ToTypeWithAnnotations(compilation);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableExtensions.cs (1)
13=> typeInfo.Type?.WithNullableAnnotation(typeInfo.Nullability.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableHelpers.cs (1)
84if (typeInfo.Nullability.FlowState == NullableFlowState.MaybeNull)