119 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
);
1974
return NullableFlowState.
NotNull
;
2007
return NullableFlowState.
NotNull
;
2037
return NullableFlowState.
NotNull
;
2383
case NullableFlowState.
NotNull
:
2758
NullableFlowState.
NotNull
;
2806
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2814
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3035
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3339
SetState(ref state, slot, NullableFlowState.
NotNull
);
3838
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3846
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4018
return NullableFlowState.
NotNull
;
4138
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4178
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4184
var resultState = NullableFlowState.
NotNull
;
4251
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4385
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4575
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4633
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4638
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
4746
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
4778
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4783
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5061
NullableFlowState resultState = NullableFlowState.
NotNull
;
5092
resultState = NullableFlowState.
NotNull
;
5681
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5710
SetState(ref state, slot, NullableFlowState.
NotNull
);
5735
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
5767
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
5846
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
5901
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
5906
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
5923
return (rightType, NullableFlowState.
NotNull
);
5928
return (leftType, NullableFlowState.
NotNull
);
5943
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
5954
return (rightType, NullableFlowState.
NotNull
);
6450
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
6939
return NullableFlowState.
NotNull
;
7073
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7663
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8098
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8117
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8136
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8923
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
8930
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
8948
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9070
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9087
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9323
NullableFlowState resultState = NullableFlowState.
NotNull
;
9355
resultState = NullableFlowState.
NotNull
;
9379
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9385
resultState = NullableFlowState.
NotNull
;
9389
resultState = NullableFlowState.
NotNull
;
9394
resultState = NullableFlowState.
NotNull
;
9434
resultState = NullableFlowState.
NotNull
;
9558
resultState = NullableFlowState.
NotNull
;
9632
resultState = NullableFlowState.
NotNull
;
9857
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10137
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
10434
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
10854
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
10984
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11008
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11162
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11190
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11504
SetState(ref this.StateWhenTrue, containingSlot, NullableFlowState.
NotNull
);
11728
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
11809
var state = NullableFlowState.
NotNull
;
12006
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
12274
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12311
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12357
NullableFlowState resultState = NullableFlowState.
NotNull
;
12410
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
12694
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12709
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12758
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12764
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
12832
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12921
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
13226
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
13258
return NullableFlowState.
NotNull
;
13267
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
13270
(true, true) => NullableFlowState.
NotNull
13299
NullableFlowState.
NotNull
=> (true, true),
13353
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (2)
481
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
579
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;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (6)
Semantics\NullableReferenceTypesTests.cs (6)
126898
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
126904
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },
126930
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
126935
{ NullableFlowState.
NotNull
, NullableFlowState.
NotNull
},
126936
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },