121 references to NotNull
Microsoft.CodeAnalysis.CSharp (121)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (3)
466
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
518
SetState(ref this.State, outputSlot, NullableFlowState.
NotNull
); // Slice value is assumed to be never null
999
receiverType: TypeWithState.Create(inputType, NullableFlowState.
NotNull
),
FlowAnalysis\NullableWalker.cs (92)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
2048
return NullableFlowState.
NotNull
;
2081
return NullableFlowState.
NotNull
;
2117
return NullableFlowState.
NotNull
;
2482
case NullableFlowState.
NotNull
:
2865
NullableFlowState.
NotNull
;
2913
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2921
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3142
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3445
SetState(ref state, slot, NullableFlowState.
NotNull
);
3718
placeholderResult = new VisitResult(placeholder.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
3969
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3977
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4073
NullableFlowState.
NotNull
));
4283
return NullableFlowState.
NotNull
;
4404
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4444
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4450
var resultState = NullableFlowState.
NotNull
;
4539
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4692
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4717
argumentResults = argumentResults.SetItem(0, new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4843
firstArgumentResult = new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4936
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4994
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4999
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
5107
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
5139
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5144
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5422
NullableFlowState resultState = NullableFlowState.
NotNull
;
5453
resultState = NullableFlowState.
NotNull
;
6058
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
6087
SetState(ref state, slot, NullableFlowState.
NotNull
);
6112
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
6144
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6223
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6278
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6283
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6301
return (rightType, NullableFlowState.
NotNull
);
6307
return (leftType, NullableFlowState.
NotNull
);
6322
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6333
return (rightType, NullableFlowState.
NotNull
);
6829
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7387
return NullableFlowState.
NotNull
;
7521
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8143
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8594
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8613
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8632
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9476
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9483
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9501
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9624
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9641
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9936
NullableFlowState resultState = NullableFlowState.
NotNull
;
9968
resultState = NullableFlowState.
NotNull
;
9993
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9999
resultState = NullableFlowState.
NotNull
;
10003
resultState = NullableFlowState.
NotNull
;
10008
resultState = NullableFlowState.
NotNull
;
10068
resultState = NullableFlowState.
NotNull
;
10230
resultState = NullableFlowState.
NotNull
;
10303
resultState = NullableFlowState.
NotNull
;
10527
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10679
var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.
NotNull
);
10772
unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.
NotNull
);
10983
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
11280
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11705
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11838
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11862
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12031
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
12059
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12440
SetState(ref this.StateWhenTrue, slotToSet, NullableFlowState.
NotNull
);
12671
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12742
var state = NullableFlowState.
NotNull
;
12946
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
13212
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13249
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13295
NullableFlowState resultState = NullableFlowState.
NotNull
;
13348
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13632
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13647
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13696
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13702
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13770
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13912
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
14218
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
14250
return NullableFlowState.
NotNull
;
14259
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
14262
(true, true) => NullableFlowState.
NotNull
14291
NullableFlowState.
NotNull
=> (true, true),
14345
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
Symbols\ConstraintsHelper.cs (5)
1231
return NullableFlowState.
NotNull
;
1235
return type.IsNullableTypeOrTypeParameter() ? NullableFlowState.MaybeNull : NullableFlowState.
NotNull
;
1242
return NullableFlowState.
NotNull
;
1247
return NullableFlowState.
NotNull
;
1267
if (state == NullableFlowState.
NotNull
)
Symbols\NamedTypeSymbol.cs (1)
2687
var result = NullableFlowState.
NotNull
;
Symbols\NullableFlowState.cs (1)
11
/// When in doubt we conservatively use <see cref="NullableFlowState.
NotNull
"/>
Symbols\NullableFlowStateExtensions.cs (6)
13
public static bool MayBeNull(this NullableFlowState state) => state != NullableFlowState.
NotNull
;
15
public static bool IsNotNull(this NullableFlowState state) => state == NullableFlowState.
NotNull
;
25
/// The result is <see cref="NullableFlowState.
NotNull
"/> if either operand is that.
32
CSharp.NullableFlowState.
NotNull
=> CodeAnalysis.NullableFlowState.NotNull,
42
CodeAnalysis.NullableFlowState.None => CSharp.NullableFlowState.
NotNull
,
43
CodeAnalysis.NullableFlowState.NotNull => CSharp.NullableFlowState.
NotNull
,
Symbols\TypeWithAnnotations.cs (4)
817
return annotation.IsAnnotated() ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
;
821
return annotation switch { NullableAnnotation.Annotated => NullableFlowState.MaybeDefault, NullableAnnotation.NotAnnotated => NullableFlowState.MaybeNull, _ => NullableFlowState.
NotNull
};
825
return annotation switch { NullableAnnotation.Annotated => NullableFlowState.MaybeDefault, _ => NullableFlowState.
NotNull
};
831
return annotation switch { NullableAnnotation.Annotated => NullableFlowState.MaybeNull, _ => NullableFlowState.
NotNull
};
Symbols\TypeWithState.cs (8)
21
public bool IsNotNull => State == NullableFlowState.
NotNull
;
36
var state = defaultState != NullableFlowState.
NotNull
&& type?.CanContainNull() != false ? NullableFlowState.MaybeNull : NullableFlowState.
NotNull
;
54
state = NullableFlowState.
NotNull
;
63
state = NullableFlowState.
NotNull
;
71
Debug.Assert(state == NullableFlowState.
NotNull
|| type?.CanContainNull() != false);
81
public TypeWithState WithNotNullState() => new TypeWithState(Type, NullableFlowState.
NotNull
);
83
public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.
NotNull
) : this;