121 references to NotNull
Microsoft.CodeAnalysis.CSharp (121)
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 (92)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
2011
return NullableFlowState.
NotNull
;
2044
return NullableFlowState.
NotNull
;
2080
return NullableFlowState.
NotNull
;
2426
case NullableFlowState.
NotNull
:
2809
NullableFlowState.
NotNull
;
2857
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2865
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3086
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3389
SetState(ref state, slot, NullableFlowState.
NotNull
);
3662
placeholderResult = new VisitResult(placeholder.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
3913
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3921
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
4017
NullableFlowState.
NotNull
));
4227
return NullableFlowState.
NotNull
;
4348
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4388
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4394
var resultState = NullableFlowState.
NotNull
;
4483
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4636
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4661
argumentResults = argumentResults.SetItem(0, new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4787
firstArgumentResult = new VisitResult(containingType, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4880
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4938
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4943
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
5051
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
5083
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5088
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5366
NullableFlowState resultState = NullableFlowState.
NotNull
;
5397
resultState = NullableFlowState.
NotNull
;
5986
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
6015
SetState(ref state, slot, NullableFlowState.
NotNull
);
6040
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
6072
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6151
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6206
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6211
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6229
return (rightType, NullableFlowState.
NotNull
);
6235
return (leftType, NullableFlowState.
NotNull
);
6250
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6261
return (rightType, NullableFlowState.
NotNull
);
6757
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7315
return NullableFlowState.
NotNull
;
7449
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8071
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8522
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8541
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8560
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9404
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9411
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9429
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9552
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9569
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9864
NullableFlowState resultState = NullableFlowState.
NotNull
;
9896
resultState = NullableFlowState.
NotNull
;
9921
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9927
resultState = NullableFlowState.
NotNull
;
9931
resultState = NullableFlowState.
NotNull
;
9936
resultState = NullableFlowState.
NotNull
;
9996
resultState = NullableFlowState.
NotNull
;
10158
resultState = NullableFlowState.
NotNull
;
10231
resultState = NullableFlowState.
NotNull
;
10455
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10607
var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.
NotNull
);
10700
unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.
NotNull
);
10911
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
11208
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11626
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11759
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11783
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11952
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11980
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12361
SetState(ref this.StateWhenTrue, slotToSet, NullableFlowState.
NotNull
);
12583
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12654
var state = NullableFlowState.
NotNull
;
12858
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
13124
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13161
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13207
NullableFlowState resultState = NullableFlowState.
NotNull
;
13260
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13544
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13559
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13608
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13614
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13682
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13824
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
14130
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
14162
return NullableFlowState.
NotNull
;
14171
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
14174
(true, true) => NullableFlowState.
NotNull
14203
NullableFlowState.
NotNull
=> (true, true),
14257
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;