118 references to NotNull
Microsoft.CodeAnalysis.CSharp (118)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (91)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
2011
return NullableFlowState.
NotNull
;
2044
return NullableFlowState.
NotNull
;
2073
var result = NullableFlowState.
NotNull
;
2092
return NullableFlowState.
NotNull
;
2438
case NullableFlowState.
NotNull
:
2814
NullableFlowState.
NotNull
;
2862
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2870
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3091
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3394
SetState(ref state, slot, NullableFlowState.
NotNull
);
3667
placeholderResult = new VisitResult(placeholder.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
3918
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3926
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4022
NullableFlowState.
NotNull
));
4232
return NullableFlowState.
NotNull
;
4353
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4393
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4399
var resultState = NullableFlowState.
NotNull
;
4488
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4668
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4896
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4954
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4959
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
5067
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
5099
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5104
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5382
NullableFlowState resultState = NullableFlowState.
NotNull
;
5413
resultState = NullableFlowState.
NotNull
;
6002
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
6031
SetState(ref state, slot, NullableFlowState.
NotNull
);
6056
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
6088
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6167
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6222
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6227
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6245
return (rightType, NullableFlowState.
NotNull
);
6251
return (leftType, NullableFlowState.
NotNull
);
6266
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6277
return (rightType, NullableFlowState.
NotNull
);
6773
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7310
return NullableFlowState.
NotNull
;
7444
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8058
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8509
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8528
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8547
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9391
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9398
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9416
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9539
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9556
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9851
NullableFlowState resultState = NullableFlowState.
NotNull
;
9883
resultState = NullableFlowState.
NotNull
;
9908
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9914
resultState = NullableFlowState.
NotNull
;
9918
resultState = NullableFlowState.
NotNull
;
9923
resultState = NullableFlowState.
NotNull
;
9983
resultState = NullableFlowState.
NotNull
;
10145
resultState = NullableFlowState.
NotNull
;
10218
resultState = NullableFlowState.
NotNull
;
10442
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10594
var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.
NotNull
);
10681
unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.
NotNull
);
10892
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
11189
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11608
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11741
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11765
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11934
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11962
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12303
SetState(ref this.StateWhenTrue, slotToSet, NullableFlowState.
NotNull
);
12525
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12596
var state = NullableFlowState.
NotNull
;
12800
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
13066
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13103
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13149
NullableFlowState resultState = NullableFlowState.
NotNull
;
13202
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13486
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13501
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13550
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13556
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13624
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13766
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
14072
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
14104
return NullableFlowState.
NotNull
;
14113
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
14116
(true, true) => NullableFlowState.
NotNull
14145
NullableFlowState.
NotNull
=> (true, true),
14199
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (2)
464
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
516
SetState(ref this.State, outputSlot, NullableFlowState.
NotNull
); // Slice value is assumed to be never null
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\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;