4 instantiations of TypeWithState
Microsoft.CodeAnalysis.CSharp (4)
Symbols\TypeWithState.cs (4)
34
return new
TypeWithState
(type, defaultState);
37
return new
TypeWithState
(type, state);
81
public TypeWithState WithNotNullState() => new
TypeWithState
(Type, NullableFlowState.NotNull);
83
public TypeWithState WithSuppression(bool suppress) => suppress ? new
TypeWithState
(Type, NullableFlowState.NotNull) : this;
312 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (312)
Binder\Binder_Patterns.cs (1)
1357
var declType =
TypeWithState
.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (1)
36
public static NullableFlowState GetNullableState(ArrayBuilder<
TypeWithState
> types)
FlowAnalysis\NullableWalker.cs (287)
99
public readonly
TypeWithState
RValueType;
111
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType)
120
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda)
128
RValueType =
TypeWithState
.Create(type, state);
137
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults)
216
private static readonly
TypeWithState
_invalidType =
TypeWithState
.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull);
237
private PooledDictionary<BoundExpression,
TypeWithState
>? _methodGroupReceiverMapOpt;
248
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>? _targetTypedAnalysisCompletionOpt;
253
/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations,
TypeWithState
, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
255
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>> TargetTypedAnalysisCompletion
256
=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
297
private
TypeWithState
ResultType
302
private void SetResultType(BoundExpression? expression,
TypeWithState
type, bool updateAnalyzedNullability = true)
307
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
type)
341
private void SetResult(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null)
361
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null)
2313
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2357
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2397
TypeWithState
valueType,
2452
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2489
var
valueState = GetParameterState(
2528
var
valueWhen = ApplyUnconditionalAnnotations(
2542
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2620
TypeWithState
valueType,
2661
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
3006
var
resultType = VisitOptionalImplicitConversion(
3020
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3024
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
3029
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
3060
TypeWithState
returnState;
3077
var
result = VisitRvalueWithState(expr);
3109
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3112
TypeWithState
resultType = ResultType;
3181
SetResultType(node,
TypeWithState
.ForType(node.Type));
3550
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3651
TypeWithState
valueType;
3700
TypeWithState
resultType = ResultType;
3710
var
result = resultType.WithNotNullState();
3832
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3840
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3853
var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
3918
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
3924
TypeWithState
convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>> completions)
3946
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4036
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4040
TypeWithState
setAnalyzedNullability(
4050
var
result =
TypeWithState
.Create(type, resultState);
4411
Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4424
(
TypeWithState
resultType, conversionCompletion) =
4444
Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4552
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4572
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4577
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
4685
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
4717
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4722
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
4756
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
4765
var
expressionType = VisitRvalueWithState(expressionNoConversion);
4799
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
4998
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
5010
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5041
return
TypeWithState
.Create(resultType, resultState);
5058
var
leftType = ResultType;
5085
var
rightType = VisitRvalueWithState(rightOperand);
5128
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5163
var
leftResult = ResultType;
5216
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5224
TypeWithState
leftType,
5227
TypeWithState
rightType,
5230
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5234
private
TypeWithState
ReinferAndVisitBinaryOperator(
5242
TypeWithState
leftType,
5246
TypeWithState
rightType)
5258
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5259
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5280
TypeWithState
operandType)
5313
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5334
private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted)
5344
var
resultType = VisitConversion(
5370
var
leftType = ResultType;
5375
var
rightType = ResultType;
5729
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
5734
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
5750
var
rightUnconditionalResult = ResultType;
5753
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
5758
TypeWithState
leftResult = ResultType;
5769
TypeWithState
rightResult = ResultType;
5787
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
5813
var
conversionResult = VisitConversion(
5820
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
5852
var
operandType = ResultType;
5857
var
result = VisitConversion(boundConversion,
6004
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6040
TypeWithState
consequenceRValue;
6041
TypeWithState
alternativeRValue;
6080
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6144
SetResultType(node,
TypeWithState
.Create(resultType, default));
6155
TypeWithState
typeWithState = convertArms(
6162
TypeWithState
convertArms(
6164
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6170
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6179
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6189
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6202
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6212
TypeWithState
consequenceRValue,
6213
TypeWithState
alternativeRValue,
6231
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6244
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6261
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6266
TypeWithState
operandType,
6283
var
resultType = VisitConversion(
6327
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6353
TypeWithState
receiverType = visitAndCheckReceiver(node);
6408
TypeWithState
receiverType = visitAndCheckReceiver(node);
6436
TypeWithState
visitAndCheckReceiver(BoundCall node)
6438
TypeWithState
receiverType = default;
6450
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6479
var
returnState = GetReturnTypeWithState(method);
6571
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
6707
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
6808
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
6841
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
6843
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
6913
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
6917
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
6922
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7235
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7646
var
resultType = result.RValueType;
7664
var
stateAfterConversion = VisitConversion(
7719
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7737
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7795
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7799
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7822
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7825
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
7886
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
7917
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7922
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7928
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7934
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7943
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7947
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7953
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7962
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7966
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8207
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8443
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8448
return
TypeWithState
.Create(type.Type, state);
8603
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8615
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8625
var
operandType = VisitRvalueWithState(operand);
8629
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8634
Conversion conversion,
TypeWithState
operandType,
8639
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8649
var
resultType = VisitConversion(
8666
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8716
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8721
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8746
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8759
ImmutableArray<
TypeWithState
> types,
8789
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
8803
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
8897
var
convertedType = VisitUserDefinedConversion(
9070
private
TypeWithState
VisitConversion(
9075
TypeWithState
operandType,
9095
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9177
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9392
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9426
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9438
var
resultType =
TypeWithState
.Create(targetType, resultState);
9442
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9476
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9504
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9514
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9622
private
TypeWithState
VisitUserDefinedConversion(
9627
TypeWithState
operandType,
9647
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9679
TypeWithState
underlyingOperandType = default;
9787
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9810
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
9815
return
TypeWithState
.Create(type, state);
9818
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
9831
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
9843
private
TypeWithState
ClassifyAndVisitConversion(
9846
TypeWithState
operandType,
9921
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
9925
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9927
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
10027
var
argState = VisitRvalueWithState(arg);
10080
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
10095
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
10097
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
10106
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
10224
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
10234
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10277
TypeWithState
rightState;
10300
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10320
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10329
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10423
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10453
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10467
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10476
var
rightResult = ResultType;
10568
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10591
TypeWithState
operandType;
10592
TypeWithState
valueType;
10644
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10701
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10741
var
operandType = VisitRvalueWithState(node.Operand);
10780
TypeWithState
resultOfOperandConversionType;
10804
TypeWithState
resultOfIncrementType;
10830
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
10851
var
leftTypeWithState = ResultType;
10859
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
10889
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
10942
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
10955
private void ReportArgumentWarnings(BoundExpression argument,
TypeWithState
argumentType, ParameterSymbol parameter)
11060
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
11118
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
11133
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
11143
resultType =
TypeWithState
.Create(resultType.Type, state);
11247
var
resultTypeWithState = VisitRvalueWithState(expr);
11312
var
convertedResult = VisitConversion(
11329
TypeWithState
currentPropertyGetterTypeWithState;
11370
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11426
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11443
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11457
TypeWithState
result = sourceState;
11458
TypeWithState
resultForType = sourceState;
11584
TypeWithState
resultType;
11616
var
operandResult = ResultType;
11618
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11648
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11649
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11690
private
TypeWithState
InferResultNullability(BoundUserDefinedConditionalLogicalOperator node)
11696
return
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11714
TypeWithState
leftType = ResultType;
11758
TypeWithState
rightType = ResultType;
11770
private
TypeWithState
InferResultNullabilityOfBinaryLogicalOperator(BoundExpression node,
TypeWithState
leftType,
TypeWithState
rightType)
11814
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11836
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
11856
SetResultType(node,
TypeWithState
.ForType(type));
11896
var
argumentType = VisitRvalueWithState(node.Operand);
11918
SetResultType(node,
TypeWithState
.Create(type, resultState));
11950
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
12025
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
12127
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
12149
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
12193
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
12234
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12249
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12298
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12304
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12311
var
rValueType =
TypeWithState
.ForType(node.Type);
12333
var
result = VisitRvalueWithState(expr);
12461
Debug.Assert(ResultType is
TypeWithState
{ Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (16)
298
var
expressionState = ResultType;
378
TypeWithState
expressionTypeWithState,
683
var
value =
TypeWithState
.Create(tempType, tempState);
695
TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot,
TypeWithState
.Create(tempType, tempState), tempSlot);
891
var
expressionState = ResultType;
914
var resultTypes = ArrayBuilder<
TypeWithState
>.GetInstance(numSwitchArms);
935
var
armType = VisitRvalueWithState(expression);
957
TypeWithState
resultType;
970
resultType =
TypeWithState
.Create(inferredType, inferredState);
985
TypeWithState
convertArms(
989
ArrayBuilder<
TypeWithState
> resultTypes,
1020
TypeWithState
resultType =
TypeWithState
.Create(inferredTypeWithAnnotations.Type, inferredState);
1034
ArrayBuilder<
TypeWithState
> resultTypes,
1059
var
expressionState = ResultType;
Symbols\TypeWithAnnotations.cs (2)
805
internal
TypeWithState
ToTypeWithState()
811
return
TypeWithState
.Create(Type, getFlowState(Type, NullableAnnotation));
Symbols\TypeWithState.cs (5)
23
public static
TypeWithState
ForType(TypeSymbol? type)
28
public static
TypeWithState
Create(TypeSymbol? type, NullableFlowState defaultState)
40
public static
TypeWithState
Create(TypeWithAnnotations typeWithAnnotations, FlowAnalysisAnnotations annotations = FlowAnalysisAnnotations.None)
81
public
TypeWithState
WithNotNullState() => new TypeWithState(Type, NullableFlowState.NotNull);
83
public
TypeWithState
WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.NotNull) : this;