122 references to NotNull
Microsoft.CodeAnalysis.CSharp (122)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (3)
466
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
518
SetState(ref this.State, outputSlot, NullableFlowState.
NotNull
); // Slice value is assumed to be never null
999
receiverType: TypeWithState.Create(inputType, NullableFlowState.
NotNull
),
FlowAnalysis\NullableWalker.cs (93)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
2048
return NullableFlowState.
NotNull
;
2081
return NullableFlowState.
NotNull
;
2110
return NullableFlowState.
NotNull
;
2475
case NullableFlowState.
NotNull
:
2858
NullableFlowState.
NotNull
;
2906
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2914
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3135
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3438
SetState(ref state, slot, NullableFlowState.
NotNull
);
3711
placeholderResult = new VisitResult(placeholder.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
3962
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3970
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4066
NullableFlowState.
NotNull
));
4276
return NullableFlowState.
NotNull
;
4398
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4438
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4444
var resultState = NullableFlowState.
NotNull
;
4504
SetUnionValueState(slot, valueProperty, NullableFlowState.
NotNull
);
4544
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4702
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4727
argumentResults = argumentResults.SetItem(0, new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4853
firstArgumentResult = new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4946
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
5004
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5009
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
5117
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
5149
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5154
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5432
NullableFlowState resultState = NullableFlowState.
NotNull
;
5463
resultState = NullableFlowState.
NotNull
;
6068
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
6097
SetState(ref state, slot, NullableFlowState.
NotNull
);
6122
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
6154
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6233
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6288
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6293
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6311
return (rightType, NullableFlowState.
NotNull
);
6317
return (leftType, NullableFlowState.
NotNull
);
6332
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6343
return (rightType, NullableFlowState.
NotNull
);
6839
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7397
return NullableFlowState.
NotNull
;
7539
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8160
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8611
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8630
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8649
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9493
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9500
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9518
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9641
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9658
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9953
NullableFlowState resultState = NullableFlowState.
NotNull
;
9985
resultState = NullableFlowState.
NotNull
;
10010
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10016
resultState = NullableFlowState.
NotNull
;
10020
resultState = NullableFlowState.
NotNull
;
10025
resultState = NullableFlowState.
NotNull
;
10085
resultState = NullableFlowState.
NotNull
;
10247
resultState = NullableFlowState.
NotNull
;
10320
resultState = NullableFlowState.
NotNull
;
10544
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10696
var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.
NotNull
);
10789
unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.
NotNull
);
11000
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
11297
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11722
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11855
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11879
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12048
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
12076
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12457
SetState(ref this.StateWhenTrue, slotToSet, NullableFlowState.
NotNull
);
12688
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12759
var state = NullableFlowState.
NotNull
;
12963
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
13229
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13266
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13312
NullableFlowState resultState = NullableFlowState.
NotNull
;
13365
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13649
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13664
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13713
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13719
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13787
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13937
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
14243
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
14275
return NullableFlowState.
NotNull
;
14284
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
14287
(true, true) => NullableFlowState.
NotNull
14316
NullableFlowState.
NotNull
=> (true, true),
14370
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
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\NamedTypeSymbol.cs (1)
2687
var result = 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;