120 references to NullableAnnotation
Microsoft.CodeAnalysis.CSharp (120)
Binder\Binder_Constraints.cs (1)
555if (typeWithAnnotations.NullableAnnotation == NullableAnnotation.Annotated && performOnlyCycleSafeValidation &&
Binder\Binder_Deconstruct.cs (1)
856return new BoundDiscardExpression(syntax, declTypeWithAnnotations.NullableAnnotation, isInferred: type is null, type);
Binder\Binder_Expressions.cs (5)
1234return new BoundRefValueOperator(node, typeWithAnnotations.NullableAnnotation, argument, typeWithAnnotations.Type, hasErrors); 1385else if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && type.IsReferenceType) 1404|| (typeWithAnnotations.NullableAnnotation.IsAnnotated() && !type.IsValueType) 3135return new BoundDiscardExpression(declarationExpression, declType.NullableAnnotation, isInferred: type is null, type); 5146if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && !type.IsNullableType())
Binder\Binder_Operators.cs (2)
3262if (targetType.IsReferenceType && targetTypeWithAnnotations.NullableAnnotation.IsAnnotated()) 3734if (targetType.IsReferenceType && targetTypeWithAnnotations.NullableAnnotation.IsAnnotated())
Binder\Semantics\Conversions\ConversionsBase.cs (12)
1835if (source.NullableAnnotation.IsOblivious() || destination.NullableAnnotation.IsOblivious()) 1844return destination.NullableAnnotation.IsAnnotated(); 1849return source.NullableAnnotation.IsAnnotated(); 1852return source.NullableAnnotation.IsAnnotated() == destination.NullableAnnotation.IsAnnotated(); 1867if (source.NullableAnnotation.IsOblivious() || destination.NullableAnnotation.IsOblivious() || destination.NullableAnnotation.IsAnnotated()) 1877return !source.NullableAnnotation.IsAnnotated(); 2613if (source.NullableAnnotation != destination.NullableAnnotation &&
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (5)
627else if (IsUnfixedTypeParameter(target) && !target.NullableAnnotation.IsAnnotated() && kind is ExactOrBoundsKind.LowerBound) 630_nullableAnnotationLowerBounds[ordinal] = _nullableAnnotationLowerBounds[ordinal].Join(argumentType.NullableAnnotation); 1793=> type.NullableAnnotation.IsAnnotated(); 2967best = TypeWithAnnotations.Create(resultType, best.NullableAnnotation); 3391var oldAnnotation = oldBound.NullableAnnotation;
BoundTree\BoundDiscardExpression.cs (1)
16return this.Update(type.NullableAnnotation, isInferred: true, type.Type);
Compilation\CSharpSemanticModel.cs (1)
2068nullability = local.LocalSymbol.TypeWithAnnotations.NullableAnnotation.ToNullabilityInfo(type);
Emitter\Model\TypeParameterSymbolAdapter.cs (1)
262Debug.Assert(!type.NullableAnnotation.IsAnnotated());
FlowAnalysis\NullableWalker.cs (14)
772if (!symbolType.NullableAnnotation.IsNotAnnotated()) 839if (!type.NullableAnnotation.IsOblivious()) 2270switch (type.NullableAnnotation) 3036type = TypeWithAnnotations.Create(node.Type, type.NullableAnnotation); 5899var lValueAnnotation = consequenceLValue.NullableAnnotation.EnsureCompatible(alternativeLValue.NullableAnnotation); 6158new BoundExpressionWithNullability(expr.Syntax, expr, type.NullableAnnotation, type.Type); 7994return new BoundExpressionWithNullability(argument.Syntax, argument, argumentType.NullableAnnotation, argumentType.Type); 9136else if (fromExplicitCast && targetTypeWithNullability.NullableAnnotation.IsAnnotated() && !targetType.IsNullableType()) 9159else if (targetType.NullableAnnotation.IsNotAnnotated() && 9190else if (targetType.NullableAnnotation.IsNotAnnotated() && 9243dependsOnTypeParameter(constraintTypeParameter, typeParameter2, constraintType.NullableAnnotation, out var constraintAnnotation)) 9828arguments.Add(new BoundExpressionWithNullability(syntax, new BoundParameter(syntax, parameter), parameterType.NullableAnnotation, parameterType.Type)); 9993if (lValueType.NullableAnnotation.IsOblivious() || !lValueType.CanBeAssignedNull)
FlowAnalysis\NullableWalker_Patterns.cs (2)
688inferredType = TypeWithAnnotations.Create(inferredType.Type, existingType.NullableAnnotation.Join(inferredType.NullableAnnotation));
Lowering\ClosureConversion\ClosureConversion.cs (2)
1002Debug.Assert(oldTypeArg.NullableAnnotation == newTypeArg.NullableAnnotation);
Symbols\AliasSymbol.cs (1)
409annotatedNamespaceOrType.TypeWithAnnotations.NullableAnnotation == NullableAnnotation.Annotated &&
Symbols\ConstraintsHelper.cs (7)
1210switch (typeWithAnnotations.NullableAnnotation) 1249switch (typeWithAnnotations.NullableAnnotation) 1607switch (type2.NullableAnnotation) 1614if (type1.NullableAnnotation.IsNotAnnotated()) 1621throw ExceptionUtilities.UnexpectedValue(type2.NullableAnnotation); 1629switch (type.NullableAnnotation) 1658if (objectConstraint.NullableAnnotation.IsOblivious())
Symbols\Metadata\PE\PETypeParameterSymbol.cs (3)
200if (bestObjectConstraint.NullableAnnotation.IsOblivious() && !HasReferenceTypeConstraint) 325if (constraintType.NullableAnnotation.IsAnnotated() || isNotNullable == false) 329else if (constraintType.NullableAnnotation.IsOblivious() || isNotNullable == null)
Symbols\Metadata\PE\TupleTypeDecoder.cs (2)
121TypeWithAnnotations.Create(decoded, metadataType.NullableAnnotation, metadataType.CustomModifiers); 346TypeWithAnnotations.Create(decoded, typeWithAnnotations.NullableAnnotation, typeWithAnnotations.CustomModifiers);
Symbols\NullableAnnotationExtensions.cs (1)
119ToPublicAnnotation(type.Type, type.NullableAnnotation);
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (1)
351static (type, arg, flag) => !type.Type.IsValueType && !type.NullableAnnotation.IsOblivious(),
Symbols\SubstitutedTypeParameterSymbol.cs (1)
124if (bestObjectConstraint.NullableAnnotation.IsOblivious() && !HasReferenceTypeConstraint)
Symbols\TypeParameterSymbol.cs (2)
479if (constraintType.NullableAnnotation.IsAnnotated()) 498if (constraintType.NullableAnnotation.IsOblivious())
Symbols\TypeWithAnnotations.cs (55)
110if (NullableAnnotation.IsAnnotated() || (Type.IsValueType && Type.IsNullableType())) 120if (NullableAnnotation.IsNotAnnotated() || (Type.IsValueType && !Type.IsNullableType())) 131if (NullableAnnotation.IsAnnotated()) 133return NullableAnnotation; 146return NullableAnnotation; 153switch (NullableAnnotation) 163throw ExceptionUtilities.UnexpectedValue(NullableAnnotation); 186internal bool IsDefault => DefaultType is null && this.NullableAnnotation == 0 && (_extensions == null || _extensions == Extensions.Default); 244NullableAnnotation nullableAnnotation = this.NullableAnnotation.MergeNullableAnnotation(other.NullableAnnotation, variance); 294if (NullableAnnotation.IsAnnotated() && 307if (NullableAnnotation.IsAnnotated() && 313else if (NullableAnnotation.IsNotAnnotated() && 364var thisAnnotation = NullableAnnotation; 365var otherAnnotation = other.NullableAnnotation; 442Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 450Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && newTypeWithModifiers.NullableAnnotation.IsAnnotated())); 452Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 459else if ((NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && NullableAnnotation.IsAnnotated())) && 465return Create(newTypeWithModifiers.Type, NullableAnnotation, newCustomModifiers); 473else if (Is((TypeParameterSymbol)typeSymbol) && newTypeWithModifiers.NullableAnnotation != NullableAnnotation.Ignored) 484Debug.Assert(newTypeWithModifiers.Type is not IndexedTypeParameterSymbol || newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Ignored); 486if (NullableAnnotation.IsAnnotated() || newTypeWithModifiers.NullableAnnotation.IsAnnotated()) 490else if (newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Ignored) 492newAnnotation = NullableAnnotation; 494else if (NullableAnnotation != NullableAnnotation.Oblivious) 496Debug.Assert(NullableAnnotation == NullableAnnotation.NotAnnotated); 497if (newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Oblivious) 518Debug.Assert(newTypeWithModifiers.NullableAnnotation is NullableAnnotation.NotAnnotated); 522else if (newTypeWithModifiers.NullableAnnotation != NullableAnnotation.Oblivious) 524newAnnotation = newTypeWithModifiers.NullableAnnotation; 528Debug.Assert(NullableAnnotation.IsOblivious()); 529Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious()); 530newAnnotation = NullableAnnotation; 596typeWithAnnotationsPredicate: (t, a, b) => t.NullableAnnotation != NullableAnnotation.Oblivious && !t.Type.IsErrorType() && !t.Type.IsValueType, 633var annotation = typeWithAnnotations.NullableAnnotation; 709if (result.NullableAnnotation != NullableAnnotation.Oblivious && 710!(result.NullableAnnotation.IsAnnotated() && oldTypeSymbol.IsNullableType())) // Preserve nullable annotation on Nullable<T>. 727if (NullableAnnotation.IsNotAnnotated() || (typeSymbol.IsValueType && !typeSymbol.IsNullableType())) 740if (NullableAnnotation != NullableAnnotation.Oblivious) 811return TypeWithState.Create(Type, getFlowState(Type, NullableAnnotation)); 909return CreateNonLazyType(type.DefaultType, type.NullableAnnotation, customModifiers); 916return CreateNonLazyType(typeSymbol, type.NullableAnnotation, customModifiers); 927return CreateNonLazyType(defaultType, defaultType.IsNullableType() ? type.NullableAnnotation : NullableAnnotation.NotAnnotated, _customModifiers); 1014return CreateNonLazyType(type.DefaultType, type.NullableAnnotation, customModifiers); 1019return CreateNonLazyType(typeSymbol, type.NullableAnnotation, customModifiers); 1030return CreateNonLazyType(defaultType, defaultType.IsNullableType() ? type.NullableAnnotation : NullableAnnotation.NotAnnotated, _customModifiers); 1067Debug.Assert(!underlying.NullableAnnotation.IsAnnotated()); 1122return TypeWithAnnotations.Create(resolvedType, type.NullableAnnotation, customModifiers: customModifiers); 1125return CreateNonLazyType(resolvedType, type.NullableAnnotation, customModifiers); 1132return TypeWithAnnotations.Create(typeSymbol, type.NullableAnnotation, customModifiers: customModifiers); 1135return CreateNonLazyType(typeSymbol, type.NullableAnnotation, customModifiers);