123 references to NotNull
Microsoft.CodeAnalysis.CSharp (117)
Binder\Semantics\BestTypeInferrer.cs (1)
38
NullableFlowState result = NullableFlowState.
NotNull
;
FlowAnalysis\NullableWalker.cs (90)
235
private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.
NotNull
);
1994
return NullableFlowState.
NotNull
;
2027
return NullableFlowState.
NotNull
;
2056
return NullableFlowState.
NotNull
;
2402
case NullableFlowState.
NotNull
:
2778
NullableFlowState.
NotNull
;
2826
/// and the new state is not <see cref="NullableFlowState.
NotNull
"/>, this method should be called to perform the
2834
if (newState != NullableFlowState.
NotNull
&& NonMonotonicState.HasValue)
3055
return TypeWithState.Create(parameterType.Type, NullableFlowState.
NotNull
);
3358
SetState(ref state, slot, NullableFlowState.
NotNull
);
3631
placeholderResult = new VisitResult(placeholder.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
3882
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3890
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
3985
NullableFlowState.
NotNull
));
4194
return NullableFlowState.
NotNull
;
4315
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4355
return (-1, NullableFlowState.
NotNull
, inferInitialObjectStateAsContinuation(node, arguments, argumentResults, hasObjectInitializer));
4361
var resultState = NullableFlowState.
NotNull
;
4449
Debug.Assert(resultState == NullableFlowState.
NotNull
);
4629
var result = new VisitResult(objectInitializer.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
);
4856
SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.
NotNull
));
4914
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
4919
var resultType = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
5027
SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.
NotNull
));
5059
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
5064
SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.
NotNull
));
5342
NullableFlowState resultState = NullableFlowState.
NotNull
;
5373
resultState = NullableFlowState.
NotNull
;
5962
SetState(ref stateToUpdate, slot, NullableFlowState.
NotNull
);
5991
SetState(ref state, slot, NullableFlowState.
NotNull
);
6016
if (GetState(ref state, slot) == NullableFlowState.
NotNull
)
6048
SetState(ref state, childSlot, NullableFlowState.
NotNull
);
6127
SetState(ref this.State, leftSlot, NullableFlowState.
NotNull
);
6182
BoundNullCoalescingOperatorResultKind.NoCommonType => (node.Type, NullableFlowState.
NotNull
),
6187
BoundNullCoalescingOperatorResultKind.RightDynamicType => (rightResultType!, NullableFlowState.
NotNull
),
6205
return (rightType, NullableFlowState.
NotNull
);
6211
return (leftType, NullableFlowState.
NotNull
);
6226
TypeWithState.Create(leftType, NullableFlowState.
NotNull
),
6237
return (rightType, NullableFlowState.
NotNull
);
6733
SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.
NotNull
));
7270
return NullableFlowState.
NotNull
;
7404
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8016
SetState(ref state, memberSlot, NullableFlowState.
NotNull
);
8472
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8491
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
8510
return TypeWithState.Create(typeWithState.Type, NullableFlowState.
NotNull
);
9354
SetResultType(node, TypeWithState.Create(null, NullableFlowState.
NotNull
));
9361
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
9379
SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.
NotNull
));
9502
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9519
SetState(ref this.State, targetFieldSlot, NullableFlowState.
NotNull
);
9815
NullableFlowState resultState = NullableFlowState.
NotNull
;
9847
resultState = NullableFlowState.
NotNull
;
9872
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
9878
resultState = NullableFlowState.
NotNull
;
9882
resultState = NullableFlowState.
NotNull
;
9887
resultState = NullableFlowState.
NotNull
;
9948
resultState = NullableFlowState.
NotNull
;
10110
resultState = NullableFlowState.
NotNull
;
10183
resultState = NullableFlowState.
NotNull
;
10407
var resultType = TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10637
var unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.
NotNull
);
10675
return TypeWithState.Create(targetType, NullableFlowState.
NotNull
);
10842
var result = TypeWithState.Create(delegateType, NullableFlowState.
NotNull
);
11139
var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.
NotNull
);
11557
var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.
NotNull
);
11690
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11714
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
11879
SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.
NotNull
));
11907
SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.
NotNull
));
12248
SetState(ref this.StateWhenTrue, slotToSet, NullableFlowState.
NotNull
);
12470
if (enumeratorReturnType.State != NullableFlowState.
NotNull
)
12541
var state = NullableFlowState.
NotNull
;
12745
TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.
NotNull
);
13018
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13055
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13101
NullableFlowState resultState = NullableFlowState.
NotNull
;
13154
SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.
NotNull
));
13438
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13453
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13502
SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.
NotNull
));
13508
SetResultType(node, TypeWithState.Create(type, NullableFlowState.
NotNull
));
13576
SetState(ref this.State, slot, NullableFlowState.
NotNull
);
13718
Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.
NotNull
});
14023
SetValue(Id, index, useNotNullsAsDefault ? NullableFlowState.
NotNull
: walker.GetDefaultState(ref this, slot));
14055
return NullableFlowState.
NotNull
;
14064
(false, false) => NullableFlowState.
NotNull
, // Should not be reachable
14067
(true, true) => NullableFlowState.
NotNull
14096
NullableFlowState.
NotNull
=> (true, true),
14150
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)
126970
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
126976
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },
127002
var inputs = new[] { NullableFlowState.
NotNull
, NullableFlowState.MaybeNull };
127007
{ NullableFlowState.
NotNull
, NullableFlowState.
NotNull
},
127008
{ NullableFlowState.
NotNull
, NullableFlowState.MaybeNull },