110 references to NotNull
Microsoft.CodeAnalysis.CSharp (110)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (83)
216
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
1953
return NullableFlowState.
NotNull
;
1986
return NullableFlowState.
NotNull
;
2016
return NullableFlowState.
NotNull
;
2362
case NullableFlowState.
NotNull
:
2737
NullableFlowState.
NotNull
;
2785
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2793
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3014
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3317
SetState(ref state, slot, NullableFlowState.
NotNull
);
3816
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3824
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3947
return NullableFlowState.
NotNull
;
4062
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4102
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4108
var resultState = NullableFlowState.
NotNull
;
4175
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4309
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4498
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4556
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4561
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
4669
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
4701
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4706
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
4984
NullableFlowState resultState = NullableFlowState.
NotNull
;
5015
resultState = NullableFlowState.
NotNull
;
5547
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5576
SetState(ref state, slot, NullableFlowState.
NotNull
);
5601
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
5633
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
5712
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
5767
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
5772
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
5789
return (rightType, NullableFlowState.
NotNull
);
5794
return (leftType, NullableFlowState.
NotNull
);
5809
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
5820
return (rightType, NullableFlowState.
NotNull
);
6315
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
6666
return NullableFlowState.
NotNull
;
6801
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7366
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
7801
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7820
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7839
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8588
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
8595
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
8613
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
8735
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
8752
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
8988
NullableFlowState resultState = NullableFlowState.
NotNull
;
9022
resultState = NullableFlowState.
NotNull
;
9046
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9052
resultState = NullableFlowState.
NotNull
;
9056
resultState = NullableFlowState.
NotNull
;
9061
resultState = NullableFlowState.
NotNull
;
9101
resultState = NullableFlowState.
NotNull
;
9225
resultState = NullableFlowState.
NotNull
;
9299
resultState = NullableFlowState.
NotNull
;
9516
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9796
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
10082
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
10500
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
10976
SetState(ref this.StateWhenTrue, containingSlot, NullableFlowState.
NotNull
);
11194
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
11275
var state = NullableFlowState.
NotNull
;
11471
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
11518
return TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11636
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
11673
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
11719
NullableFlowState resultState = NullableFlowState.
NotNull
;
11772
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
12056
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12071
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12120
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12126
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
12194
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12283
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
12588
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
12620
return NullableFlowState.
NotNull
;
12629
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
12632
(true, true) => NullableFlowState.
NotNull
12661
NullableFlowState.
NotNull
=> (true, true),
12715
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)
1204
return NullableFlowState.
NotNull
;
1208
return type.IsNullableTypeOrTypeParameter() ? NullableFlowState.MaybeNull : NullableFlowState.
NotNull
;
1215
return NullableFlowState.
NotNull
;
1220
return NullableFlowState.
NotNull
;
1240
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;