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