113 references to NotNull
Microsoft.CodeAnalysis.CSharp (113)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (86)
216
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
1968
return NullableFlowState.
NotNull
;
2001
return NullableFlowState.
NotNull
;
2031
return NullableFlowState.
NotNull
;
2377
case NullableFlowState.
NotNull
:
2752
NullableFlowState.
NotNull
;
2800
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2808
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3029
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3333
SetState(ref state, slot, NullableFlowState.
NotNull
);
3832
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3840
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4012
return NullableFlowState.
NotNull
;
4132
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4172
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4178
var resultState = NullableFlowState.
NotNull
;
4245
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4379
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4568
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4626
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4631
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
4739
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
4771
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4776
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5054
NullableFlowState resultState = NullableFlowState.
NotNull
;
5085
resultState = NullableFlowState.
NotNull
;
5674
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5703
SetState(ref state, slot, NullableFlowState.
NotNull
);
5728
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
5760
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
5839
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
5894
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
5899
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
5916
return (rightType, NullableFlowState.
NotNull
);
5921
return (leftType, NullableFlowState.
NotNull
);
5936
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
5947
return (rightType, NullableFlowState.
NotNull
);
6443
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
6932
return NullableFlowState.
NotNull
;
7066
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7661
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8096
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8115
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8134
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8920
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
8927
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
8945
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9067
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9084
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9320
NullableFlowState resultState = NullableFlowState.
NotNull
;
9352
resultState = NullableFlowState.
NotNull
;
9376
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9382
resultState = NullableFlowState.
NotNull
;
9386
resultState = NullableFlowState.
NotNull
;
9391
resultState = NullableFlowState.
NotNull
;
9431
resultState = NullableFlowState.
NotNull
;
9555
resultState = NullableFlowState.
NotNull
;
9629
resultState = NullableFlowState.
NotNull
;
9846
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10126
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
10423
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
10843
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
10973
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
10997
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11151
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11179
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11487
SetState(ref this.StateWhenTrue, containingSlot, NullableFlowState.
NotNull
);
11705
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
11786
var state = NullableFlowState.
NotNull
;
11983
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
12251
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12288
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12334
NullableFlowState resultState = NullableFlowState.
NotNull
;
12387
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
12671
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12686
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12735
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12741
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
12809
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12898
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
13203
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
13235
return NullableFlowState.
NotNull
;
13244
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
13247
(true, true) => NullableFlowState.
NotNull
13276
NullableFlowState.
NotNull
=> (true, true),
13330
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (2)
481
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
577
SetState(ref this.State, outputSlot, NullableFlowState.
NotNull
); // Slice value is assumed to be never null
Symbols\ConstraintsHelper.cs (5)
1233
return NullableFlowState.
NotNull
;
1237
return type.IsNullableTypeOrTypeParameter() ? NullableFlowState.MaybeNull : NullableFlowState.
NotNull
;
1244
return NullableFlowState.
NotNull
;
1249
return NullableFlowState.
NotNull
;
1269
if (state == 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;