119 references to NotNull
Microsoft.CodeAnalysis.CSharp (113)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (86)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
1992
return NullableFlowState.
NotNull
;
2025
return NullableFlowState.
NotNull
;
2055
return NullableFlowState.
NotNull
;
2401
case NullableFlowState.
NotNull
:
2776
NullableFlowState.
NotNull
;
2824
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2832
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3053
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3356
SetState(ref state, slot, NullableFlowState.
NotNull
);
3853
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3861
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4033
return NullableFlowState.
NotNull
;
4152
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4192
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4198
var resultState = NullableFlowState.
NotNull
;
4265
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4399
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4626
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4684
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4689
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
4797
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
4829
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4834
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5112
NullableFlowState resultState = NullableFlowState.
NotNull
;
5143
resultState = NullableFlowState.
NotNull
;
5732
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5761
SetState(ref state, slot, NullableFlowState.
NotNull
);
5786
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
5818
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
5897
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
5952
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
5957
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
5974
return (rightType, NullableFlowState.
NotNull
);
5979
return (leftType, NullableFlowState.
NotNull
);
5994
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6005
return (rightType, NullableFlowState.
NotNull
);
6501
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7032
return NullableFlowState.
NotNull
;
7166
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7756
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8191
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8210
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8229
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9062
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9069
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9087
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9209
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9226
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9462
NullableFlowState resultState = NullableFlowState.
NotNull
;
9494
resultState = NullableFlowState.
NotNull
;
9518
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9524
resultState = NullableFlowState.
NotNull
;
9528
resultState = NullableFlowState.
NotNull
;
9533
resultState = NullableFlowState.
NotNull
;
9573
resultState = NullableFlowState.
NotNull
;
9697
resultState = NullableFlowState.
NotNull
;
9771
resultState = NullableFlowState.
NotNull
;
9996
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10276
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
10573
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
10991
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11120
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11144
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11297
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11325
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11639
SetState(ref this.StateWhenTrue, containingSlot, NullableFlowState.
NotNull
);
11860
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
11941
var state = NullableFlowState.
NotNull
;
12145
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
12413
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12450
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12496
NullableFlowState resultState = NullableFlowState.
NotNull
;
12549
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
12833
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12848
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12897
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12903
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
12971
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13062
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
13367
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
13399
return NullableFlowState.
NotNull
;
13408
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
13411
(true, true) => NullableFlowState.
NotNull
13440
NullableFlowState.
NotNull
=> (true, true),
13494
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)
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;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (6)
Semantics\NullableReferenceTypesTests.cs (6)
126982
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
126988
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },
127014
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
127019
{ NullableFlowState.
NotNull
, NullableFlowState.
NotNull
},
127020
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },