563 references to NullableAnnotation
ConfigurationSchemaGenerator (5)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (3)
87ITypeSymbol? type = ResolveType(instanceArg.Value)?.WithNullableAnnotation(NullableAnnotation.None); 155type = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None); 205type = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None);
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (1)
28ITypeSymbol? typeSymbol = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None);
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (1)
72ITypeSymbol? typeSymbol = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None);
GenerateDocumentationAndConfigFiles (49)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (10)
332NullableAnnotation nullableAnnotation = NullableAnnotation.None, 353public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 424NullableAnnotation nullableAnnotation = NullableAnnotation.None, 443NullableAnnotation nullableAnnotation = NullableAnnotation.None, 468NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (4)
57public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.NullableAnnotation; 58public NullableAnnotation ReturnNullableAnnotation => ReturnType.NullableAnnotation; 59public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.NullableAnnotation); 115public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
30NullableAnnotation nullableAnnotation, 64public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 85public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (3)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 40protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 65public NullableAnnotation ElementNullableAnnotation => ElementType.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (2)
33public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => t.NullableAnnotation); 95protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
24public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
23public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (4)
35NullableAnnotation nullableAnnotation, 52protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 130public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations 135return this.TypeParameters.SelectAsArray(t => NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
28public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 13protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
27public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (4)
16NullableAnnotation nullableAnnotation, 36protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 88public NullableAnnotation ReferenceTypeConstraintNullableAnnotation => throw new System.NotImplementedException(); 90public ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations => ConstraintTypes.SelectAsArray(t => t.NullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
20NullableAnnotation nullableAnnotation) 85public NullableAnnotation NullableAnnotation { get; } = nullableAnnotation; 87public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation) 93protected abstract CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
71parameters: [CodeGenerationSymbolFactory.CreateParameterSymbol(parameterType.WithNullableAnnotation(NullableAnnotation.Annotated), parameterName)],
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (2)
78protected IEnumerable<TypeInferenceInfo> CreateResult(SpecialType type, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
103if (foreachInfo.ElementType != null && foreachInfo.ElementType.NullableAnnotation != NullableAnnotation.NotAnnotated)
Microsoft.Analyzers.Extra (4)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
370loggerType = gen.TypeExpression(t.WithNullableAnnotation(NullableAnnotation.Annotated));
CoalesceAnalyzer.cs (2)
36&& type.NullableAnnotation == NullableAnnotation.NotAnnotated 63&& type.NullableAnnotation == NullableAnnotation.NotAnnotated
ConditionalAccessAnalyzer.cs (1)
95if (type.NullableAnnotation == NullableAnnotation.NotAnnotated)
Microsoft.AspNetCore.App.Analyzers (3)
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
32var argumentIsOptional = parameter.IsOptional || parameter.NullableAnnotation != NullableAnnotation.NotAnnotated;
src\aspnetcore\src\Shared\RoslynUtils\SymbolExtensions.cs (2)
228NullableAnnotation: NullableAnnotation.Annotated 234NullableAnnotation: NullableAnnotation.Annotated
Microsoft.CodeAnalysis (38)
Compilation\Compilation.cs (10)
1105public IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation elementNullableAnnotation = NullableAnnotation.None) 1120protected abstract IArrayTypeSymbol CommonCreateArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation elementNullableAnnotation); 1320ImmutableArray<NullableAnnotation> elementNullableAnnotations = default) 1367ImmutableArray<NullableAnnotation> elementNullableAnnotations) 1425ImmutableArray<NullableAnnotation> elementNullableAnnotations); 1437ImmutableArray<NullableAnnotation> elementNullableAnnotations = default) 1465ImmutableArray<NullableAnnotation> elementNullableAnnotations); 1478ImmutableArray<NullableAnnotation> memberNullableAnnotations = default) 1556ImmutableArray<NullableAnnotation> memberNullableAnnotations);
Symbols\IArrayTypeSymbol.cs (1)
55NullableAnnotation ElementNullableAnnotation { get; }
Symbols\IDiscardSymbol.cs (1)
23NullableAnnotation NullableAnnotation { get; }
Symbols\IEventSymbol.cs (1)
27NullableAnnotation NullableAnnotation { get; }
Symbols\IFieldSymbol.cs (1)
87NullableAnnotation NullableAnnotation { get; }
Symbols\ILocalSymbol.cs (1)
24NullableAnnotation NullableAnnotation { get; }
Symbols\IMethodSymbol.cs (5)
105NullableAnnotation ReturnNullableAnnotation { get; } 117/// then <see cref="NullableAnnotation.None"/> is returned. 119ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; } 175NullableAnnotation ReceiverNullableAnnotation { get; } 264IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations);
Symbols\INamedTypeSymbol.cs (3)
86/// then <see cref="NullableAnnotation.None"/> is returned for that type argument. 88ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; } 136INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations);
Symbols\IParameterSymbol.cs (1)
68NullableAnnotation NullableAnnotation { get; }
Symbols\IPropertySymbol.cs (1)
65NullableAnnotation NullableAnnotation { get; }
Symbols\ITypeParameterSymbol.cs (3)
53/// constraint, this returns <see cref="NullableAnnotation.None"/>. 55NullableAnnotation ReferenceTypeConstraintNullableAnnotation { get; } 91ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations { get; }
Symbols\ITypeSymbol.cs (3)
205/// Nullable annotation associated with the type, or <see cref="NullableAnnotation.None"/> if there are none. 207NullableAnnotation NullableAnnotation { get; } 213ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation);
Symbols\NullabilityInfo.cs (2)
19public NullableAnnotation Annotation { get; } 28internal NullabilityInfo(NullableAnnotation annotation, NullableFlowState flowState)
Symbols\NullableFlowState.cs (5)
30/// This method directly converts a <see cref="NullableFlowState"/> to a <see cref="NullableAnnotation"/>, 35public static NullableAnnotation ToAnnotation(this NullableFlowState nullableFlowState) 40return CodeAnalysis.NullableAnnotation.Annotated; 42return CodeAnalysis.NullableAnnotation.NotAnnotated; 44return CodeAnalysis.NullableAnnotation.None;
Microsoft.CodeAnalysis.Analyzers (49)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (10)
332NullableAnnotation nullableAnnotation = NullableAnnotation.None, 353public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 424NullableAnnotation nullableAnnotation = NullableAnnotation.None, 443NullableAnnotation nullableAnnotation = NullableAnnotation.None, 468NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (4)
57public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.NullableAnnotation; 58public NullableAnnotation ReturnNullableAnnotation => ReturnType.NullableAnnotation; 59public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.NullableAnnotation); 115public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
30NullableAnnotation nullableAnnotation, 64public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 85public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (3)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 40protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 65public NullableAnnotation ElementNullableAnnotation => ElementType.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (2)
33public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => t.NullableAnnotation); 95protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
24public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
23public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (4)
35NullableAnnotation nullableAnnotation, 52protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 130public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations 135return this.TypeParameters.SelectAsArray(t => NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
28public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 13protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
27public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (4)
16NullableAnnotation nullableAnnotation, 36protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 88public NullableAnnotation ReferenceTypeConstraintNullableAnnotation => throw new System.NotImplementedException(); 90public ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations => ConstraintTypes.SelectAsArray(t => t.NullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
20NullableAnnotation nullableAnnotation) 85public NullableAnnotation NullableAnnotation { get; } = nullableAnnotation; 87public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation) 93protected abstract CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
71parameters: [CodeGenerationSymbolFactory.CreateParameterSymbol(parameterType.WithNullableAnnotation(NullableAnnotation.Annotated), parameterName)],
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (2)
78protected IEnumerable<TypeInferenceInfo> CreateResult(SpecialType type, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
103if (foreachInfo.ElementType != null && foreachInfo.ElementType.NullableAnnotation != NullableAnnotation.NotAnnotated)
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToDataFlowOperationVisitor.cs (1)
984method.ReturnType.NullableAnnotation == NullableAnnotation.Annotated)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
Microsoft.CodeAnalysis.CodeStyle (5)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
Microsoft.CodeAnalysis.CodeStyle.Fixes (46)
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
265field.Type.NullableAnnotation is NullableAnnotation.Annotated && 266property.Type.NullableAnnotation is NullableAnnotation.NotAnnotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (10)
332NullableAnnotation nullableAnnotation = NullableAnnotation.None, 353public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 424NullableAnnotation nullableAnnotation = NullableAnnotation.None, 443NullableAnnotation nullableAnnotation = NullableAnnotation.None, 468NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (4)
57public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.NullableAnnotation; 58public NullableAnnotation ReturnNullableAnnotation => ReturnType.NullableAnnotation; 59public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.NullableAnnotation); 115public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
30NullableAnnotation nullableAnnotation, 64public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 85public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (3)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 40protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 65public NullableAnnotation ElementNullableAnnotation => ElementType.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (2)
33public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => t.NullableAnnotation); 95protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
24public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
23public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (4)
35NullableAnnotation nullableAnnotation, 52protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 130public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations 135return this.TypeParameters.SelectAsArray(t => NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
28public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 13protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
27public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (4)
16NullableAnnotation nullableAnnotation, 36protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 88public NullableAnnotation ReferenceTypeConstraintNullableAnnotation => throw new System.NotImplementedException(); 90public ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations => ConstraintTypes.SelectAsArray(t => t.NullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
20NullableAnnotation nullableAnnotation) 85public NullableAnnotation NullableAnnotation { get; } = nullableAnnotation; 87public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation) 93protected abstract CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
71parameters: [CodeGenerationSymbolFactory.CreateParameterSymbol(parameterType.WithNullableAnnotation(NullableAnnotation.Annotated), parameterName)],
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (2)
78protected IEnumerable<TypeInferenceInfo> CreateResult(SpecialType type, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
103if (foreachInfo.ElementType != null && foreachInfo.ElementType.NullableAnnotation != NullableAnnotation.NotAnnotated)
Microsoft.CodeAnalysis.CSharp (96)
BoundTree\BoundNode.cs (7)
247CodeAnalysis.NullableAnnotation.Annotated => BoundNodeAttributes.TopLevelAnnotated, 248CodeAnalysis.NullableAnnotation.NotAnnotated => BoundNodeAttributes.TopLevelNotAnnotated, 249CodeAnalysis.NullableAnnotation.None => BoundNodeAttributes.TopLevelNone, 282var annotation = (_attributes & BoundNodeAttributes.TopLevelAnnotationMask) switch 284BoundNodeAttributes.TopLevelAnnotated => CodeAnalysis.NullableAnnotation.Annotated, 285BoundNodeAttributes.TopLevelNotAnnotated => CodeAnalysis.NullableAnnotation.NotAnnotated, 286BoundNodeAttributes.TopLevelNone => CodeAnalysis.NullableAnnotation.None,
Compilation\CSharpCompilation.cs (4)
4241protected override IArrayTypeSymbol CommonCreateArrayTypeSymbol(ITypeSymbol elementType, int rank, CodeAnalysis.NullableAnnotation elementNullableAnnotation) 4352ImmutableArray<CodeAnalysis.NullableAnnotation> elementNullableAnnotations) 4378ImmutableArray<CodeAnalysis.NullableAnnotation> elementNullableAnnotations) 4408ImmutableArray<CodeAnalysis.NullableAnnotation> memberNullableAnnotations)
Compilation\CSharpSemanticModel.cs (4)
593private (ITypeSymbol Type, CodeAnalysis.NullableAnnotation Annotation) TypeFromVariable(SingleVariableDesignationSyntax variableDesignation, CancellationToken cancellationToken) 979var (declarationType, annotation) = ((ITypeSymbol, CodeAnalysis.NullableAnnotation))TypeFromVariable((SingleVariableDesignationSyntax)parent.Designation, cancellationToken); 2111convertedNullability = new NullabilityInfo(CodeAnalysis.NullableAnnotation.NotAnnotated, CodeAnalysis.NullableFlowState.NotNull); 2262nullability = new NullabilityInfo(CodeAnalysis.NullableAnnotation.NotAnnotated, CodeAnalysis.NullableFlowState.NotNull);
SymbolDisplay\SymbolDisplay.cs (4)
50CodeAnalysis.NullableAnnotation nullableAnnotation, 114CodeAnalysis.NullableAnnotation nullableAnnotation, 160CodeAnalysis.NullableAnnotation nullableAnnotation, 207CodeAnalysis.NullableAnnotation nullableAnnotation,
SymbolDisplay\SymbolDisplayVisitor.Types.cs (5)
73AddPunctuation(type.NullableAnnotation == CodeAnalysis.NullableAnnotation.Annotated ? SyntaxKind.QuestionToken : SyntaxKind.ExclamationToken); 81case CodeAnalysis.NullableAnnotation.Annotated: 89case CodeAnalysis.NullableAnnotation.NotAnnotated: 919case CodeAnalysis.NullableAnnotation.Annotated: 926case CodeAnalysis.NullableAnnotation.NotAnnotated:
Symbols\ArrayTypeSymbol.cs (1)
478protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\DynamicTypeSymbol.cs (1)
243protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\ErrorTypeSymbol.cs (1)
567protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (1)
125protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\FunctionTypeSymbol.cs (1)
146protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation) => throw ExceptionUtilities.Unreachable();
Symbols\MethodSymbol.cs (3)
1162internal virtual CodeAnalysis.NullableAnnotation ReceiverNullableAnnotation => 1163RequiresInstanceReceiver ? CodeAnalysis.NullableAnnotation.NotAnnotated : CodeAnalysis.NullableAnnotation.None;
Symbols\NamedTypeSymbol.cs (1)
2077protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\NullableAnnotationExtensions.cs (14)
91internal static NullabilityInfo ToNullabilityInfo(this CodeAnalysis.NullableAnnotation annotation, TypeSymbol type) 93if (annotation == CodeAnalysis.NullableAnnotation.None) 118internal static CodeAnalysis.NullableAnnotation ToPublicAnnotation(this TypeWithAnnotations type) => 121internal static ImmutableArray<CodeAnalysis.NullableAnnotation> ToPublicAnnotations(this ImmutableArray<TypeWithAnnotations> types) => 126internal static CodeAnalysis.NullableAnnotation ToPublicAnnotation(TypeSymbol? type, NullableAnnotation annotation) 131NullableAnnotation.Annotated => CodeAnalysis.NullableAnnotation.Annotated, 132NullableAnnotation.NotAnnotated => CodeAnalysis.NullableAnnotation.NotAnnotated, 137NullableAnnotation.Oblivious when type?.IsValueType == true => CodeAnalysis.NullableAnnotation.NotAnnotated, 138NullableAnnotation.Oblivious => CodeAnalysis.NullableAnnotation.None, 140NullableAnnotation.Ignored => CodeAnalysis.NullableAnnotation.None, 148internal static CSharp.NullableAnnotation ToInternalAnnotation(this CodeAnalysis.NullableAnnotation annotation) => 151CodeAnalysis.NullableAnnotation.None => CSharp.NullableAnnotation.Oblivious, 152CodeAnalysis.NullableAnnotation.NotAnnotated => CSharp.NullableAnnotation.NotAnnotated, 153CodeAnalysis.NullableAnnotation.Annotated => CSharp.NullableAnnotation.Annotated,
Symbols\PointerTypeSymbol.cs (1)
305protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ArrayTypeSymbol.cs (3)
17public ArrayTypeSymbol(Symbols.ArrayTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 24protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 56CodeAnalysis.NullableAnnotation IArrayTypeSymbol.ElementNullableAnnotation
Symbols\PublicModel\DiscardSymbol.cs (1)
36CodeAnalysis.NullableAnnotation IDiscardSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\DynamicTypeSymbol.cs (2)
14public DynamicTypeSymbol(Symbols.DynamicTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 21protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ErrorTypeSymbol.cs (2)
15public ErrorTypeSymbol(Symbols.ErrorTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 22protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\EventSymbol.cs (1)
38CodeAnalysis.NullableAnnotation IEventSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\FieldSymbol.cs (1)
51CodeAnalysis.NullableAnnotation IFieldSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\FunctionPointerTypeSymbol.cs (2)
14public FunctionPointerTypeSymbol(Symbols.FunctionPointerTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 40protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\LocalSymbol.cs (1)
38CodeAnalysis.NullableAnnotation ILocalSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\MethodSymbol.cs (4)
93CodeAnalysis.NullableAnnotation IMethodSymbol.ReturnNullableAnnotation 112ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentNullableAnnotations => 187CodeAnalysis.NullableAnnotation IMethodSymbol.ReceiverNullableAnnotation => _underlying.ReceiverNullableAnnotation; 294IMethodSymbol IMethodSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\NamedTypeSymbol.cs (4)
17public NamedTypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation = CodeAnalysis.NullableAnnotation.None) 86ImmutableArray<CodeAnalysis.NullableAnnotation> INamedTypeSymbol.TypeArgumentNullableAnnotations 136INamedTypeSymbol INamedTypeSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\NonErrorNamedTypeSymbol.cs (2)
15public NonErrorNamedTypeSymbol(Symbols.NamedTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ParameterSymbol.cs (1)
39CodeAnalysis.NullableAnnotation IParameterSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\PointerTypeSymbol.cs (2)
16public PointerTypeSymbol(Symbols.PointerTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\PropertySymbol.cs (1)
44CodeAnalysis.NullableAnnotation IPropertySymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
Symbols\PublicModel\Symbol.cs (1)
31protected static ImmutableArray<TypeWithAnnotations> ConstructTypeArguments(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\TypeParameterSymbol.cs (8)
16public TypeParameterSymbol(Symbols.TypeParameterSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation) 23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 35CodeAnalysis.NullableAnnotation ITypeParameterSymbol.ReferenceTypeConstraintNullableAnnotation => 38false when !_underlying.HasReferenceTypeConstraint => CodeAnalysis.NullableAnnotation.None, 39false => CodeAnalysis.NullableAnnotation.NotAnnotated, 40true => CodeAnalysis.NullableAnnotation.Annotated, 41null => CodeAnalysis.NullableAnnotation.None, 70ImmutableArray<CodeAnalysis.NullableAnnotation> ITypeParameterSymbol.ConstraintNullableAnnotations =>
Symbols\PublicModel\TypeSymbol.cs (7)
16protected TypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation) 21protected CodeAnalysis.NullableAnnotation NullableAnnotation { get; } 23protected abstract ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation); 27CodeAnalysis.NullableAnnotation ITypeSymbol.NullableAnnotation => NullableAnnotation; 29ITypeSymbol ITypeSymbol.WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 76(NullableAnnotation != CodeAnalysis.NullableAnnotation.None && otherType.NullableAnnotation != CodeAnalysis.NullableAnnotation.None)) &&
Symbols\ReducedExtensionMethodSymbol.cs (1)
255internal override CodeAnalysis.NullableAnnotation ReceiverNullableAnnotation =>
Symbols\TypeParameterSymbol.cs (1)
708protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\TypeSymbol.cs (3)
2514internal ITypeSymbol GetITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation) 2524internal CodeAnalysis.NullableAnnotation DefaultNullableAnnotation => NullableAnnotationExtensions.ToPublicAnnotation(this, NullableAnnotation.Oblivious); 2526protected abstract ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation);
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
229if (localSymbol.Type.NullableAnnotation == NullableAnnotation.Annotated) 245if (rightType.Type is null or { NullableAnnotation: NullableAnnotation.Annotated })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1142var normalized1 = type1.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 1143var normalized2 = type2.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (17)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
413property.Type.NullableAnnotation == NullableAnnotation.Annotated
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
167if (typeSymbol.NullableAnnotation == NullableAnnotation.Annotated) 175return typeSymbol.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
143var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 144var asType = asExpressionTypeInfo.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
247.Where(tp => tp.NullableAnnotation == NullableAnnotation.Annotated)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (3)
57NullableAnnotation.None => NullableSyntaxAnnotation.Oblivious, 58NullableAnnotation.Annotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated, 59NullableAnnotation.NotAnnotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (5)
72if (underlyingType.NullableAnnotation == NullableAnnotation.Annotated) 106if (symbol.NullableAnnotation == NullableAnnotation.Annotated) 117return symbol.NullableAnnotation is NullableAnnotation.Annotated 302if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated }) 357if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
1133return CreateResult(SpecialType.System_Object, NullableAnnotation.Annotated); 1158return symbol.WithNullableAnnotation(NullableAnnotation.Annotated); 1670private static ImmutableArray<NullableAnnotation> GetNullableAnnotations(ImmutableArray<ITypeSymbol> elementTypes)
Microsoft.CodeAnalysis.CSharp.Features (15)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
343return type.WithNullableAnnotation(NullableAnnotation.NotAnnotated) as INamedTypeSymbol;
Completion\CompletionProviders\ObjectCreationCompletionProvider.cs (1)
94symbol = typeSymbol.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
1057if (methodSymbol.ReturnType.NullableAnnotation != NullableAnnotation.Annotated) 1123var newType = methodSymbol.ReturnType.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
QuickInfo\CSharpSemanticQuickInfoProvider.cs (4)
245(NullableAnnotation.None, _) => string.Format(FeaturesResources._0_is_not_nullable_aware, symbol.ToDisplayString(s_nullableDisplayFormat)), 251(NullableAnnotation annotation, NullableFlowState flowState)? GetNullabilityInfo() 253if (symbol.GetMemberType() is { IsValueType: false, NullableAnnotation: NullableAnnotation.None }) 254return (NullableAnnotation.None, NullableFlowState.NotNull);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
229if (localSymbol.Type.NullableAnnotation == NullableAnnotation.Annotated) 245if (rightType.Type is null or { NullableAnnotation: NullableAnnotation.Annotated })
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
413property.Type.NullableAnnotation == NullableAnnotation.Annotated
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
167if (typeSymbol.NullableAnnotation == NullableAnnotation.Annotated) 175return typeSymbol.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
143var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 144var asType = asExpressionTypeInfo.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (2)
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.cs (2)
80if (symbol.NullableAnnotation == NullableAnnotation.Annotated && 113if (symbol.NullableAnnotation == NullableAnnotation.Annotated)
Microsoft.CodeAnalysis.CSharp.Workspaces (14)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1142var normalized1 = type1.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 1143var normalized2 = type2.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
247.Where(tp => tp.NullableAnnotation == NullableAnnotation.Annotated)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (3)
57NullableAnnotation.None => NullableSyntaxAnnotation.Oblivious, 58NullableAnnotation.Annotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated, 59NullableAnnotation.NotAnnotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (5)
72if (underlyingType.NullableAnnotation == NullableAnnotation.Annotated) 106if (symbol.NullableAnnotation == NullableAnnotation.Annotated) 117return symbol.NullableAnnotation is NullableAnnotation.Annotated 302if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated }) 357if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
1133return CreateResult(SpecialType.System_Object, NullableAnnotation.Annotated); 1158return symbol.WithNullableAnnotation(NullableAnnotation.Annotated); 1670private static ImmutableArray<NullableAnnotation> GetNullableAnnotations(ImmutableArray<ITypeSymbol> elementTypes)
Microsoft.CodeAnalysis.Extensions.Package (5)
Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
Microsoft.CodeAnalysis.Features (22)
Completion\Providers\AbstractOverrideCompletionProvider.cs (1)
48overriddenMember = CodeGenerationSymbolFactory.CreateMethodSymbol(methodSymbol, returnType: methodSymbol.ReturnType.WithNullableAnnotation(NullableAnnotation.NotAnnotated));
ExtractMethod\MethodExtractor.Analyzer.cs (2)
539if (type.NullableAnnotation is not NullableAnnotation.Annotated) 550return type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeAction.cs (3)
111? equatableType.Construct(_containingType.WithNullableAnnotation(NullableAnnotation.Annotated)) 134CodeGenerationSymbolFactory.CreateParameterSymbol(_containingType.IsValueType ? _containingType : _containingType.WithNullableAnnotation(NullableAnnotation.Annotated), LeftName), 135CodeGenerationSymbolFactory.CreateParameterSymbol(_containingType.IsValueType ? _containingType : _containingType.WithNullableAnnotation(NullableAnnotation.Annotated), RightName));
GenerateType\AbstractGenerateTypeService.State.cs (1)
271BaseTypeOrInterfaceOpt = (INamedTypeSymbol)baseType.WithNullableAnnotation(NullableAnnotation.None);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
344if (parameter.Type.NullableAnnotation == NullableAnnotation.Annotated)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
574if (symbol.NullableAnnotation == NullableAnnotation.Annotated)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedEventSymbol.cs (1)
34public NullableAnnotation NullableAnnotation => _symbol.NullableAnnotation;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedFieldSymbol.cs (1)
48public NullableAnnotation NullableAnnotation => _symbol.NullableAnnotation;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (4)
72public NullableAnnotation ReceiverNullableAnnotation => _symbol.ReceiverNullableAnnotation; 94public NullableAnnotation ReturnNullableAnnotation => _symbol.ReturnNullableAnnotation; 105public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _symbol.TypeArgumentNullableAnnotations; 112public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (4)
79public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _symbol.TypeArgumentNullableAnnotations; 93public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 157NullableAnnotation ITypeSymbol.NullableAnnotation => throw new NotImplementedException(); 159ITypeSymbol ITypeSymbol.WithNullableAnnotation(NullableAnnotation nullableAnnotation)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
54public NullableAnnotation NullableAnnotation => _symbol.NullableAnnotation;
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
265field.Type.NullableAnnotation is NullableAnnotation.Annotated && 266property.Type.NullableAnnotation is NullableAnnotation.NotAnnotated;
Microsoft.CodeAnalysis.ResxSourceGenerator (5)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
Microsoft.CodeAnalysis.VisualBasic (30)
Compilation\VisualBasicCompilation.vb (3)
2875Protected Overrides Function CommonCreateArrayTypeSymbol(elementType As ITypeSymbol, rank As Integer, elementNullableAnnotation As NullableAnnotation) As IArrayTypeSymbol 2882elementNullableAnnotations As ImmutableArray(Of NullableAnnotation)) As INamedTypeSymbol 2900elementNullableAnnotations As ImmutableArray(Of NullableAnnotation)) As INamedTypeSymbol
Symbols\ArrayTypeSymbol.vb (2)
412Private ReadOnly Property IArrayTypeSymbol_ElementNullableAnnotation As NullableAnnotation Implements IArrayTypeSymbol.ElementNullableAnnotation 414Return NullableAnnotation.None
Symbols\EventSymbol.vb (2)
285Private ReadOnly Property IEventSymbol_NullableAnnotation As NullableAnnotation Implements IEventSymbol.NullableAnnotation 287Return NullableAnnotation.None
Symbols\FieldSymbol.vb (2)
476Private ReadOnly Property IFieldSymbol_NullableAnnotation As NullableAnnotation Implements IFieldSymbol.NullableAnnotation 478Return NullableAnnotation.None
Symbols\MethodSymbol.vb (6)
981Private ReadOnly Property IMethodSymbol_ReceiverNullableAnnotation As NullableAnnotation Implements IMethodSymbol.ReceiverNullableAnnotation 983Return NullableAnnotation.None 1096Private ReadOnly Property IMethodSymbol_ReturnNullableAnnotation As NullableAnnotation Implements IMethodSymbol.ReturnNullableAnnotation 1098Return NullableAnnotation.None 1120Private ReadOnly Property IMethodSymbol_TypeArgumentsNullableAnnotation As ImmutableArray(Of NullableAnnotation) Implements IMethodSymbol.TypeArgumentNullableAnnotations 1122Return Me.TypeArguments.SelectAsArray(Function(t) NullableAnnotation.None)
Symbols\NamedTypeSymbol.vb (2)
1383Private ReadOnly Property TypeArgumentNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements INamedTypeSymbol.TypeArgumentNullableAnnotations 1385Return Me.TypeArgumentsNoUseSiteDiagnostics.SelectAsArray(Function(t) NullableAnnotation.None)
Symbols\ParameterSymbol.vb (2)
330Private ReadOnly Property IParameterSymbol_NullableAnnotation As NullableAnnotation Implements IParameterSymbol.NullableAnnotation 332Return NullableAnnotation.None
Symbols\PropertySymbol.vb (2)
621Private ReadOnly Property IPropertySymbol_NullableAnnotation As NullableAnnotation Implements IPropertySymbol.NullableAnnotation 623Return NullableAnnotation.None
Symbols\Source\LocalSymbol.vb (2)
401Private ReadOnly Property ILocalSymbol_NullableAnnotation As NullableAnnotation Implements ILocalSymbol.NullableAnnotation 403Return NullableAnnotation.None
Symbols\TypeParameterSymbol.vb (4)
369Private ReadOnly Property ITypeParameterSymbol_ReferenceTypeConstraintNullableAnnotation As NullableAnnotation Implements ITypeParameterSymbol.ReferenceTypeConstraintNullableAnnotation 371Return NullableAnnotation.None 399Private ReadOnly Property ITypeParameterSymbol_ConstraintNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements ITypeParameterSymbol.ConstraintNullableAnnotations 401Return Me.ConstraintTypesNoUseSiteDiagnostics.SelectAsArray(Function(t) NullableAnnotation.None)
Symbols\TypeSymbol.vb (3)
779Private ReadOnly Property ITypeSymbol_NullableAnnotation As NullableAnnotation Implements ITypeSymbol.NullableAnnotation 781Return NullableAnnotation.None 785Private Function ITypeSymbol_WithNullability(nullableAnnotation As NullableAnnotation) As ITypeSymbol Implements ITypeSymbol.WithNullableAnnotation
Microsoft.CodeAnalysis.Workspaces (50)
Editing\SyntaxGenerator.cs (1)
249return Equals(current, typeParameter) && current.NullableAnnotation == NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (10)
332NullableAnnotation nullableAnnotation = NullableAnnotation.None, 353public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 424NullableAnnotation nullableAnnotation = NullableAnnotation.None, 443NullableAnnotation nullableAnnotation = NullableAnnotation.None, 468NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (4)
57public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.NullableAnnotation; 58public NullableAnnotation ReturnNullableAnnotation => ReturnType.NullableAnnotation; 59public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.NullableAnnotation); 115public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
30NullableAnnotation nullableAnnotation, 64public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 85public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (3)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 40protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 65public NullableAnnotation ElementNullableAnnotation => ElementType.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (2)
33public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => t.NullableAnnotation); 95protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
24public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
23public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (4)
35NullableAnnotation nullableAnnotation, 52protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 130public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations 135return this.TypeParameters.SelectAsArray(t => NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
28public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 13protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
27public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (4)
16NullableAnnotation nullableAnnotation, 36protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 88public NullableAnnotation ReferenceTypeConstraintNullableAnnotation => throw new System.NotImplementedException(); 90public ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations => ConstraintTypes.SelectAsArray(t => t.NullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
20NullableAnnotation nullableAnnotation) 85public NullableAnnotation NullableAnnotation { get; } = nullableAnnotation; 87public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation) 93protected abstract CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
71parameters: [CodeGenerationSymbolFactory.CreateParameterSymbol(parameterType.WithNullableAnnotation(NullableAnnotation.Annotated), parameterName)],
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (2)
78protected IEnumerable<TypeInferenceInfo> CreateResult(SpecialType type, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
103if (foreachInfo.ElementType != null && foreachInfo.ElementType.NullableAnnotation != NullableAnnotation.NotAnnotated)
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
776string classConstraint = typeParameter.ReferenceTypeConstraintNullableAnnotation == NullableAnnotation.Annotated
Microsoft.Extensions.Options.SourceGeneration (10)
Emitter.cs (1)
95return tryValidateValueMethod.Parameters[0].NullableAnnotation == NullableAnnotation.NotAnnotated ? "!" : string.Empty;
Parser.cs (9)
90_ = _visitedModelTypes.Add(modelType.WithNullableAnnotation(NullableAnnotation.None)); 392else if (!_visitedModelTypes.Add(memberType.WithNullableAnnotation(NullableAnnotation.None))) 406_ = _visitedModelTypes.Remove(memberType.WithNullableAnnotation(NullableAnnotation.None)); 418enumeratedIsNullable = enumeratedType.IsReferenceType || enumeratedType.NullableAnnotation == NullableAnnotation.Annotated; 420enumeratedMayBeNull = enumeratedType.NullableAnnotation == NullableAnnotation.Annotated; 455else if (!_visitedModelTypes.Add(enumeratedType.WithNullableAnnotation(NullableAnnotation.None))) 469_ = _visitedModelTypes.Remove(enumeratedType.WithNullableAnnotation(NullableAnnotation.None)); 588memberType.IsReferenceType || memberType.NullableAnnotation == NullableAnnotation.Annotated, 686var mt = modelType.WithNullableAnnotation(NullableAnnotation.None);
Microsoft.Gen.Logging (10)
Parsing\Parser.cs (3)
584IsNullable = paramTypeSymbol.NullableAnnotation == NullableAnnotation.Annotated, 677isNullable = typeSymbol.NullableAnnotation == NullableAnnotation.Annotated; 731isNullable = parameter.Type.NullableAnnotation == NullableAnnotation.Annotated;
Parsing\Parser.LogProperties.cs (1)
202IsNullable = property.Type.NullableAnnotation == NullableAnnotation.Annotated,
Parsing\Parser.TagProvider.cs (6)
153if (type.NullableAnnotation == NullableAnnotation.Annotated) 155if (target.NullableAnnotation == NullableAnnotation.NotAnnotated) 163if (SymbolEqualityComparer.Default.Equals(type.WithNullableAnnotation(NullableAnnotation.None), target.WithNullableAnnotation(NullableAnnotation.None))) 170if (SymbolEqualityComparer.Default.Equals(target.WithNullableAnnotation(NullableAnnotation.None), iface.WithNullableAnnotation(NullableAnnotation.None)))
Microsoft.Interop.SourceGeneration (5)
TypeSymbolExtensions.cs (5)
276var annotations = new NullableAnnotation[numArgumentsToInsert]; 305public static (ImmutableArray<ITypeSymbol> TypeArguments, ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations) GetAllTypeArgumentsIncludingInContainingTypes(this INamedTypeSymbol genericType) 309Stack<(ImmutableArray<ITypeSymbol>, ImmutableArray<NullableAnnotation>)> genericTypesToSubstitute = new(); 317ImmutableArray<NullableAnnotation>.Builder nullableAnnotations = ImmutableArray.CreateBuilder<NullableAnnotation>();
Microsoft.Maui.Controls.BindingSourceGen (1)
ITypeSymbolExtensions.cs (1)
33 typeInfo.IsReferenceType && typeInfo.NullableAnnotation == NullableAnnotation.Annotated;
Roslyn.Diagnostics.Analyzers (50)
DefaultableTypeShouldHaveDefaultableFieldsAnalyzer.cs (1)
117return type.NullableAnnotation != NullableAnnotation.NotAnnotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
38var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
106(NullableAnnotation.None, NullableAnnotation.NotAnnotated) => true, 107(NullableAnnotation.NotAnnotated, NullableAnnotation.None) => true,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (10)
332NullableAnnotation nullableAnnotation = NullableAnnotation.None, 353public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 424NullableAnnotation nullableAnnotation = NullableAnnotation.None, 443NullableAnnotation nullableAnnotation = NullableAnnotation.None, 468NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (4)
57public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.NullableAnnotation; 58public NullableAnnotation ReturnNullableAnnotation => ReturnType.NullableAnnotation; 59public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.NullableAnnotation); 115public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
30NullableAnnotation nullableAnnotation, 64public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 85public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (3)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 40protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 65public NullableAnnotation ElementNullableAnnotation => ElementType.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (2)
33public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => t.NullableAnnotation); 95protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
24public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
23public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (4)
35NullableAnnotation nullableAnnotation, 52protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 130public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations 135return this.TypeParameters.SelectAsArray(t => NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
28public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 13protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
27public NullableAnnotation NullableAnnotation => Type.NullableAnnotation;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (4)
16NullableAnnotation nullableAnnotation, 36protected override CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation) 88public NullableAnnotation ReferenceTypeConstraintNullableAnnotation => throw new System.NotImplementedException(); 90public ImmutableArray<NullableAnnotation> ConstraintNullableAnnotations => ConstraintTypes.SelectAsArray(t => t.NullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
20NullableAnnotation nullableAnnotation) 85public NullableAnnotation NullableAnnotation { get; } = nullableAnnotation; 87public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation) 93protected abstract CodeGenerationTypeSymbol CloneWithNullableAnnotation(NullableAnnotation nullableAnnotation);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
71parameters: [CodeGenerationSymbolFactory.CreateParameterSymbol(parameterType.WithNullableAnnotation(NullableAnnotation.Annotated), parameterName)],
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (2)
78protected IEnumerable<TypeInferenceInfo> CreateResult(SpecialType type, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
103if (foreachInfo.ElementType != null && foreachInfo.ElementType.NullableAnnotation != NullableAnnotation.NotAnnotated)
Roslyn.Diagnostics.CSharp.Analyzers (15)
CSharpAvoidOptSuffixForNullableEnableCode.cs (1)
85if (symbol?.GetMemberOrLocalOrParameterType()?.NullableAnnotation != NullableAnnotation.Annotated)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
1142var normalized1 = type1.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 1143var normalized2 = type2.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
247.Where(tp => tp.NullableAnnotation == NullableAnnotation.Annotated)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (3)
57NullableAnnotation.None => NullableSyntaxAnnotation.Oblivious, 58NullableAnnotation.Annotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated, 59NullableAnnotation.NotAnnotated => NullableSyntaxAnnotation.AnnotatedOrNotAnnotated,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (5)
72if (underlyingType.NullableAnnotation == NullableAnnotation.Annotated) 106if (symbol.NullableAnnotation == NullableAnnotation.Annotated) 117return symbol.NullableAnnotation is NullableAnnotation.Annotated 302if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated }) 357if (symbol is { IsValueType: false, NullableAnnotation: NullableAnnotation.Annotated })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
1133return CreateResult(SpecialType.System_Object, NullableAnnotation.Annotated); 1158return symbol.WithNullableAnnotation(NullableAnnotation.Annotated); 1670private static ImmutableArray<NullableAnnotation> GetNullableAnnotations(ImmutableArray<ITypeSymbol> elementTypes)
System.Text.Json.SourceGeneration (4)
Helpers\RoslynExtensions.cs (4)
48if (type.NullableAnnotation is NullableAnnotation.Annotated) 50type = type.WithNullableAnnotation(NullableAnnotation.None); 352return returnType.NullableAnnotation is NullableAnnotation.NotAnnotated; 374return inputType.NullableAnnotation is NullableAnnotation.NotAnnotated;
System.Text.RegularExpressions.Generator (2)
RegexGenerator.Parser.cs (2)
124nullableRegex = regexMethodSymbol.ReturnNullableAnnotation == NullableAnnotation.Annotated; 138nullableRegex = regexPropertySymbol.NullableAnnotation == NullableAnnotation.Annotated;