120 references to NotNull
Microsoft.CodeAnalysis.CSharp (114)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (87)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
1993
return NullableFlowState.
NotNull
;
2026
return NullableFlowState.
NotNull
;
2056
return NullableFlowState.
NotNull
;
2402
case NullableFlowState.
NotNull
:
2777
NullableFlowState.
NotNull
;
2825
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2833
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3054
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3357
SetState(ref state, slot, NullableFlowState.
NotNull
);
3854
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3862
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3957
NullableFlowState.
NotNull
));
4166
return NullableFlowState.
NotNull
;
4287
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4327
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4333
var resultState = NullableFlowState.
NotNull
;
4400
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4557
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4784
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4842
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4847
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
4955
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
4987
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4992
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5270
NullableFlowState resultState = NullableFlowState.
NotNull
;
5301
resultState = NullableFlowState.
NotNull
;
5890
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5919
SetState(ref state, slot, NullableFlowState.
NotNull
);
5944
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
5976
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6055
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6110
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6115
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6132
return (rightType, NullableFlowState.
NotNull
);
6137
return (leftType, NullableFlowState.
NotNull
);
6152
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6163
return (rightType, NullableFlowState.
NotNull
);
6659
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7196
return NullableFlowState.
NotNull
;
7330
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
7913
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8348
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8367
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8386
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9230
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9237
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9255
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9377
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9394
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9630
NullableFlowState resultState = NullableFlowState.
NotNull
;
9662
resultState = NullableFlowState.
NotNull
;
9686
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9692
resultState = NullableFlowState.
NotNull
;
9696
resultState = NullableFlowState.
NotNull
;
9701
resultState = NullableFlowState.
NotNull
;
9741
resultState = NullableFlowState.
NotNull
;
9865
resultState = NullableFlowState.
NotNull
;
9939
resultState = NullableFlowState.
NotNull
;
10163
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10443
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
10740
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11158
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11291
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11315
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11472
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11500
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11822
SetState(ref this.StateWhenTrue, containingSlot, NullableFlowState.
NotNull
);
12044
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12125
var state = NullableFlowState.
NotNull
;
12329
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
12597
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
12634
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
12680
NullableFlowState resultState = NullableFlowState.
NotNull
;
12733
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13017
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13032
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13081
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13087
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13155
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13246
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
13551
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
13583
return NullableFlowState.
NotNull
;
13592
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
13595
(true, true) => NullableFlowState.
NotNull
13624
NullableFlowState.
NotNull
=> (true, true),
13678
var oldValue = oldReachable ? GetValue(i) : NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker_Patterns.cs (2)
462
SetState(ref State, outputSlot, NullableFlowState.
NotNull
);
514
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)
126979
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
126985
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },
127011
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
127016
{ NullableFlowState.
NotNull
, NullableFlowState.
NotNull
},
127017
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },