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;
313 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (313)
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 (288)
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);
7254
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7665
var
resultType = result.RValueType;
7683
var
stateAfterConversion = VisitConversion(
7738
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7756
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7814
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7818
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7841
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7844
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
7905
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
7936
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7941
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7947
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7953
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7962
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7966
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7972
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7981
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7985
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8227
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8493
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8498
return
TypeWithState
.Create(type.Type, state);
8653
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8665
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8675
var
operandType = VisitRvalueWithState(operand);
8679
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8684
Conversion conversion,
TypeWithState
operandType,
8689
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8699
var
resultType = VisitConversion(
8716
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8766
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8771
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8796
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8809
ImmutableArray<
TypeWithState
> types,
8839
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
8853
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
8947
var
convertedType = VisitUserDefinedConversion(
9120
private
TypeWithState
VisitConversion(
9125
TypeWithState
operandType,
9145
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9227
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9442
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9476
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9488
var
resultType =
TypeWithState
.Create(targetType, resultState);
9492
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9526
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9554
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9564
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9672
private
TypeWithState
VisitUserDefinedConversion(
9677
TypeWithState
operandType,
9697
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9729
TypeWithState
underlyingOperandType = default;
9837
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9860
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
9865
return
TypeWithState
.Create(type, state);
9868
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
9881
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
9893
private
TypeWithState
ClassifyAndVisitConversion(
9896
TypeWithState
operandType,
9971
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
9975
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9977
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
10077
var
argState = VisitRvalueWithState(arg);
10130
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
10145
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
10147
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
10156
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
10274
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
10284
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10327
TypeWithState
rightState;
10350
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10370
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10379
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10473
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10503
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10517
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10526
var
rightResult = ResultType;
10618
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10641
TypeWithState
operandType;
10642
TypeWithState
valueType;
10694
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10751
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10791
var
operandType = VisitRvalueWithState(node.Operand);
10830
TypeWithState
resultOfOperandConversionType;
10854
TypeWithState
resultOfIncrementType;
10880
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
10901
var
leftTypeWithState = ResultType;
10909
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
10939
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
10992
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
11005
private void ReportArgumentWarnings(BoundExpression argument,
TypeWithState
argumentType, ParameterSymbol parameter)
11096
TypeWithState
typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations);
11139
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
11197
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
11212
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
11222
resultType =
TypeWithState
.Create(resultType.Type, state);
11326
var
resultTypeWithState = VisitRvalueWithState(expr);
11391
var
convertedResult = VisitConversion(
11408
TypeWithState
currentPropertyGetterTypeWithState;
11449
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11505
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11522
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11536
TypeWithState
result = sourceState;
11537
TypeWithState
resultForType = sourceState;
11663
TypeWithState
resultType;
11695
var
operandResult = ResultType;
11697
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11727
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11728
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11769
private
TypeWithState
InferResultNullability(BoundUserDefinedConditionalLogicalOperator node)
11775
return
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11793
TypeWithState
leftType = ResultType;
11837
TypeWithState
rightType = ResultType;
11849
private
TypeWithState
InferResultNullabilityOfBinaryLogicalOperator(BoundExpression node,
TypeWithState
leftType,
TypeWithState
rightType)
11893
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11915
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
11935
SetResultType(node,
TypeWithState
.ForType(type));
11975
var
argumentType = VisitRvalueWithState(node.Operand);
11997
SetResultType(node,
TypeWithState
.Create(type, resultState));
12029
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
12104
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
12206
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
12228
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
12272
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
12313
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12328
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12377
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12383
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12390
var
rValueType =
TypeWithState
.ForType(node.Type);
12412
var
result = VisitRvalueWithState(expr);
12540
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;