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;
344 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (344)
Binder\Binder_Patterns.cs (1)
1580
var declType =
TypeWithState
.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (2)
36
public static NullableFlowState GetNullableState(ArrayBuilder<
TypeWithState
> types)
39
foreach (
var
type in types)
FlowAnalysis\NullableWalker_Patterns.cs (19)
301
var
expressionState = ResultType;
381
TypeWithState
expressionTypeWithState,
527
var
inputTypeWithState =
TypeWithState
.Create(inputType, inputState);
634
var
value =
TypeWithState
.Create(tempType, tempState);
646
TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot,
TypeWithState
.Create(tempType, tempState), tempSlot);
999
receiverType:
TypeWithState
.Create(inputType, NullableFlowState.NotNull),
1080
var
expressionState = ResultType;
1108
var resultTypes = ArrayBuilder<
TypeWithState
>.GetInstance(numSwitchArms);
1129
var
armType = VisitRvalueWithState(expression);
1151
TypeWithState
resultType;
1164
resultType =
TypeWithState
.Create(inferredType, inferredState);
1179
TypeWithState
convertArms(
1183
ArrayBuilder<
TypeWithState
> resultTypes,
1214
TypeWithState
resultType =
TypeWithState
.Create(inferredTypeWithAnnotations.Type, inferredState);
1228
ArrayBuilder<
TypeWithState
> resultTypes,
1253
var
expressionState = ResultType;
FlowAnalysis\NullableWalker.cs (315)
118
public readonly
TypeWithState
RValueType;
130
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType)
139
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda)
147
RValueType =
TypeWithState
.Create(type, state);
156
public VisitResult(
TypeWithState
rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults)
235
private static readonly
TypeWithState
_invalidType =
TypeWithState
.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull);
256
private PooledDictionary<BoundExpression,
TypeWithState
>? _methodGroupReceiverMapOpt;
267
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>? _targetTypedAnalysisCompletionOpt;
272
/// 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, int, Location, ArrayBuilder<VisitResult>)"/>.
274
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>> TargetTypedAnalysisCompletion
275
=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
316
private
TypeWithState
ResultType
321
private void SetResultType(BoundExpression? expression,
TypeWithState
type, bool updateAnalyzedNullability = true)
326
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
type)
360
private void SetResult(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null)
380
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null)
2418
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2462
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2502
TypeWithState
valueType,
2557
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2594
var
valueState = GetParameterState(
2633
var
valueWhen = ApplyUnconditionalAnnotations(
2647
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2725
TypeWithState
valueType,
2766
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
3119
var
resultType = VisitOptionalImplicitConversion(
3133
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3137
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
3142
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
3173
TypeWithState
returnState;
3190
var
result = VisitRvalueWithState(expr);
3222
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3225
TypeWithState
resultType = ResultType;
3292
SetResultType(node,
TypeWithState
.ForType(node.Type));
3662
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3788
TypeWithState
valueType;
3837
TypeWithState
resultType = ResultType;
3847
var
result = resultType.WithNotNullState();
3969
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3977
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
4022
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
4229
TypeWithState
convertCollection(
4256
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4362
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4366
TypeWithState
setAnalyzedNullability(
4376
var
result =
TypeWithState
.Create(type, resultState);
4545
private void SetUnionValueStateFromConstructorArgument(BoundExpression argument,
TypeWithState
argumentTypeWithState, int containingSlot, PropertySymbol valueProperty)
4780
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4793
(
TypeWithState
resultType, conversionCompletion) =
4813
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4974
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4994
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4999
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
5088
var
argumentType = argumentTypes[i];
5107
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
5139
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
5144
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
5178
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
5187
var
expressionType = VisitRvalueWithState(expressionNoConversion);
5221
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
5420
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
5432
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5463
return
TypeWithState
.Create(resultType, resultState);
5480
var
leftType = ResultType;
5507
var
rightType = VisitRvalueWithState(rightOperand);
5550
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5585
var
leftResult = ResultType;
5654
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5662
TypeWithState
leftType,
5665
TypeWithState
rightType,
5668
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5672
private
TypeWithState
ReinferAndVisitBinaryOperator(
5680
TypeWithState
leftType,
5684
TypeWithState
rightType)
5694
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5695
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5717
TypeWithState
operandType)
5750
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5760
TypeWithState
leftUnderlyingType,
5761
TypeWithState
rightUnderlyingType)
5826
private
TypeWithState
VisitBinaryOperatorOperandConversion(
5827
BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted,
5851
private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted)
5854
TypeWithState
resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations);
5870
var
leftType = ResultType;
5875
var
rightType = ResultType;
6229
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
6234
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
6250
var
rightUnconditionalResult = ResultType;
6253
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
6258
TypeWithState
leftResult = ResultType;
6269
TypeWithState
rightResult = ResultType;
6287
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
6315
var
conversionResult = VisitConversion(
6322
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
6354
var
operandType = ResultType;
6359
var
result = VisitConversion(boundConversion,
6506
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6542
TypeWithState
consequenceRValue;
6543
TypeWithState
alternativeRValue;
6582
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6646
SetResultType(node,
TypeWithState
.Create(resultType, default));
6657
TypeWithState
typeWithState = convertArms(
6664
TypeWithState
convertArms(
6666
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6672
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6681
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6691
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6704
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6714
TypeWithState
consequenceRValue,
6715
TypeWithState
alternativeRValue,
6733
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6746
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6763
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6768
TypeWithState
operandType,
6785
var
resultType = VisitConversion(
6829
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6855
TypeWithState
receiverType = visitAndCheckReceiver(node);
6929
TypeWithState
receiverType = visitAndCheckReceiver(node);
6957
TypeWithState
visitAndCheckReceiver(BoundCall node)
6967
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
7008
var
returnState = GetReturnTypeWithState(method);
7019
private
TypeWithState
VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
7021
TypeWithState
receiverType = default;
7036
TypeWithState
receiverType,
7175
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
7311
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
7412
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
7445
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
7447
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
7517
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7521
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7526
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7861
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
8292
var
resultType = result.RValueType;
8310
var
stateAfterConversion = VisitConversion(
8365
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
8383
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
8442
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8446
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
8469
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8472
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
8533
void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter)
8583
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8588
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8594
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8600
static
TypeWithState
applyPostConditionsWhenTrue(TypeSymbol? receiverType,
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter)
8609
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8613
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8619
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8628
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8632
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8920
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
9197
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
9202
return
TypeWithState
.Create(type.Type, state);
9358
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
9370
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
9380
var
operandType = VisitRvalueWithState(operand);
9384
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
9389
Conversion conversion,
TypeWithState
operandType,
9394
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
9404
var
resultType = VisitConversion(
9421
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
9471
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
9476
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
9501
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
9514
ImmutableArray<
TypeWithState
> types,
9544
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
9558
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
9653
var
convertedType = VisitUserDefinedConversion(
9678
TypeWithState
valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField));
9685
valueFieldType =
TypeWithState
.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot));
9703
TypeWithState
convertedType = VisitUnionConversion(
9883
private
TypeWithState
VisitConversion(
9888
TypeWithState
operandType,
9910
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9993
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10265
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
10299
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
10311
var
resultType =
TypeWithState
.Create(targetType, resultState);
10315
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10349
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10377
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
10387
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
10503
private
TypeWithState
VisitUserDefinedConversion(
10508
TypeWithState
operandType,
10527
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10559
TypeWithState
underlyingOperandType = default;
10635
private
TypeWithState
GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState)
10638
TypeWithState
returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState);
10655
private
TypeWithState
VisitUnionConversion(
10660
TypeWithState
operandType,
10679
var
resultType =
TypeWithState
.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull);
10767
TypeWithState
unionTypeWithState;
10772
unionTypeWithState =
TypeWithState
.Create(toType, NullableFlowState.NotNull);
10838
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10866
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
10871
return
TypeWithState
.Create(type, state);
10874
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
10887
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
10899
private
TypeWithState
ClassifyAndVisitConversion(
10902
TypeWithState
operandType,
10977
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
10981
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
10983
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
11083
var
argState = VisitRvalueWithState(arg);
11136
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
11151
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
11153
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
11162
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11280
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11290
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
11333
TypeWithState
rightState;
11356
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
11383
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
11392
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
11484
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
11514
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
11528
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
11537
var
rightResult = ResultType;
11629
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
11652
TypeWithState
operandType;
11653
TypeWithState
valueType;
11705
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
11762
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
11815
TypeWithState
receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod);
11838
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
11842
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
11854
var
opType = VisitRvalueWithState(node.Operand);
11862
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11869
var
operandType = VisitRvalueWithState(node.Operand);
11925
TypeWithState
resultOfOperandConversionType;
11949
TypeWithState
resultOfIncrementType;
11975
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
12008
TypeWithState
receiverType = VisitAndCheckReceiver(node.Left, instanceMethod);
12031
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
12035
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
12048
var
opType = ResultType;
12059
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
12069
var
leftTypeWithState = ResultType;
12077
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
12084
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
12137
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
12268
TypeWithState
typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations);
12321
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
12385
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
12409
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
12419
resultType =
TypeWithState
.Create(resultType.Type, state);
12540
var
resultTypeWithState = VisitRvalueWithState(expr);
12610
var
convertedResult = VisitConversion(
12628
TypeWithState
currentPropertyGetterTypeWithState;
12669
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
12715
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
12732
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
12746
TypeWithState
result = sourceState;
12747
TypeWithState
resultForType = sourceState;
12838
private
TypeWithState
VisitBadExpressionChild(BoundExpression? child)
12880
TypeWithState
resultType;
12912
var
operandResult = ResultType;
12914
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
12945
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
12946
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
12952
private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand,
TypeWithState
operandType)
13087
TypeWithState
leftType = ResultType;
13096
TypeWithState
rightType = ResultType;
13103
TypeWithState
leftType = ResultType;
13118
var
rightType = ResultType;
13126
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
13127
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
13212
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13234
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
13254
SetResultType(node,
TypeWithState
.ForType(type));
13294
var
argumentType = VisitRvalueWithState(node.Operand);
13316
SetResultType(node,
TypeWithState
.Create(type, resultState));
13348
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
13423
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
13525
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
13547
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
13591
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
13632
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13647
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13696
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13702
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
13709
var
rValueType =
TypeWithState
.ForType(node.Type);
13731
var
result = VisitRvalueWithState(expr);
13912
Debug.Assert(ResultType is
TypeWithState
{ Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
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;