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)
2411
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2455
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2495
TypeWithState
valueType,
2550
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2587
var
valueState = GetParameterState(
2626
var
valueWhen = ApplyUnconditionalAnnotations(
2640
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2718
TypeWithState
valueType,
2759
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
3112
var
resultType = VisitOptionalImplicitConversion(
3126
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3130
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
3135
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
3166
TypeWithState
returnState;
3183
var
result = VisitRvalueWithState(expr);
3215
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3218
TypeWithState
resultType = ResultType;
3285
SetResultType(node,
TypeWithState
.ForType(node.Type));
3655
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: withExpr.CloneMethod));
3781
TypeWithState
valueType;
3830
TypeWithState
resultType = ResultType;
3840
var
result = resultType.WithNotNullState();
3962
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3970
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
4015
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
4222
TypeWithState
convertCollection(
4249
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4356
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4360
TypeWithState
setAnalyzedNullability(
4370
var
result =
TypeWithState
.Create(type, resultState);
4550
private void SetUnionValueStateFromConstructorArgument(BoundExpression argument,
TypeWithState
argumentTypeWithState, int containingSlot, PropertySymbol valueProperty)
4790
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4803
(
TypeWithState
resultType, conversionCompletion) =
4823
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4984
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
5004
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
5009
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
5098
var
argumentType = argumentTypes[i];
5117
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
5149
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
5154
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
5188
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
5197
var
expressionType = VisitRvalueWithState(expressionNoConversion);
5231
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
5430
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
5442
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5473
return
TypeWithState
.Create(resultType, resultState);
5490
var
leftType = ResultType;
5517
var
rightType = VisitRvalueWithState(rightOperand);
5560
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5595
var
leftResult = ResultType;
5664
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5672
TypeWithState
leftType,
5675
TypeWithState
rightType,
5678
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5682
private
TypeWithState
ReinferAndVisitBinaryOperator(
5690
TypeWithState
leftType,
5694
TypeWithState
rightType)
5704
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5705
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5727
TypeWithState
operandType)
5760
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5770
TypeWithState
leftUnderlyingType,
5771
TypeWithState
rightUnderlyingType)
5836
private
TypeWithState
VisitBinaryOperatorOperandConversion(
5837
BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted,
5861
private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted)
5864
TypeWithState
resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations);
5880
var
leftType = ResultType;
5885
var
rightType = ResultType;
6239
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
6244
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
6260
var
rightUnconditionalResult = ResultType;
6263
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
6268
TypeWithState
leftResult = ResultType;
6279
TypeWithState
rightResult = ResultType;
6297
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
6325
var
conversionResult = VisitConversion(
6332
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
6364
var
operandType = ResultType;
6369
var
result = VisitConversion(boundConversion,
6516
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6552
TypeWithState
consequenceRValue;
6553
TypeWithState
alternativeRValue;
6592
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6656
SetResultType(node,
TypeWithState
.Create(resultType, default));
6667
TypeWithState
typeWithState = convertArms(
6674
TypeWithState
convertArms(
6676
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6682
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6691
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6701
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6714
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6724
TypeWithState
consequenceRValue,
6725
TypeWithState
alternativeRValue,
6743
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6756
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6773
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6778
TypeWithState
operandType,
6795
var
resultType = VisitConversion(
6839
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6865
TypeWithState
receiverType = visitAndCheckReceiver(node);
6939
TypeWithState
receiverType = visitAndCheckReceiver(node);
6967
TypeWithState
visitAndCheckReceiver(BoundCall node)
6977
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
7018
var
returnState = GetReturnTypeWithState(method);
7029
private
TypeWithState
VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
7031
TypeWithState
receiverType = default;
7046
TypeWithState
receiverType,
7185
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
7321
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
7422
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
7455
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
7457
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: method));
7535
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7539
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7544
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7878
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
8309
var
resultType = result.RValueType;
8327
var
stateAfterConversion = VisitConversion(
8382
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
8400
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
8459
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8463
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
8486
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8489
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
8550
void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter)
8600
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8605
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8611
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8617
static
TypeWithState
applyPostConditionsWhenTrue(TypeSymbol? receiverType,
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter)
8626
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8630
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8636
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8645
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8649
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8937
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
9214
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
9219
return
TypeWithState
.Create(type.Type, state);
9375
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
9387
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
9397
var
operandType = VisitRvalueWithState(operand);
9401
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
9406
Conversion conversion,
TypeWithState
operandType,
9411
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
9421
var
resultType = VisitConversion(
9438
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
9488
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
9493
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
9518
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
9531
ImmutableArray<
TypeWithState
> types,
9561
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
9575
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
9670
var
convertedType = VisitUserDefinedConversion(
9695
TypeWithState
valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: valueField));
9702
valueFieldType =
TypeWithState
.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot));
9720
TypeWithState
convertedType = VisitUnionConversion(
9900
private
TypeWithState
VisitConversion(
9905
TypeWithState
operandType,
9927
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
10010
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10282
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
10316
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
10328
var
resultType =
TypeWithState
.Create(targetType, resultState);
10332
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10366
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10394
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
10404
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
10520
private
TypeWithState
VisitUserDefinedConversion(
10525
TypeWithState
operandType,
10544
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10576
TypeWithState
underlyingOperandType = default;
10652
private
TypeWithState
GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState)
10655
TypeWithState
returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState);
10672
private
TypeWithState
VisitUnionConversion(
10677
TypeWithState
operandType,
10696
var
resultType =
TypeWithState
.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull);
10784
TypeWithState
unionTypeWithState;
10789
unionTypeWithState =
TypeWithState
.Create(toType, NullableFlowState.NotNull);
10855
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10883
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
10888
return
TypeWithState
.Create(type, state);
10891
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
10904
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
10916
private
TypeWithState
ClassifyAndVisitConversion(
10919
TypeWithState
operandType,
10994
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
10998
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
11000
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
11100
var
argState = VisitRvalueWithState(arg);
11153
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
11168
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
11170
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
11179
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11297
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11307
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
11350
TypeWithState
rightState;
11373
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
11400
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
11409
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
11501
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
11531
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
11545
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
11554
var
rightResult = ResultType;
11646
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
11669
TypeWithState
operandType;
11670
TypeWithState
valueType;
11722
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
11779
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
11832
TypeWithState
receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod);
11855
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
11859
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
11871
var
opType = VisitRvalueWithState(node.Operand);
11879
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11886
var
operandType = VisitRvalueWithState(node.Operand);
11942
TypeWithState
resultOfOperandConversionType;
11966
TypeWithState
resultOfIncrementType;
11992
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
12025
TypeWithState
receiverType = VisitAndCheckReceiver(node.Left, instanceMethod);
12048
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
12052
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
12065
var
opType = ResultType;
12076
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
12086
var
leftTypeWithState = ResultType;
12094
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
12101
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
12154
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
12285
TypeWithState
typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations);
12338
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: receiverOpt?.Type, symbol: indexer));
12402
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
12426
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
12436
resultType =
TypeWithState
.Create(resultType.Type, state);
12557
var
resultTypeWithState = VisitRvalueWithState(expr);
12627
var
convertedResult = VisitConversion(
12645
TypeWithState
currentPropertyGetterTypeWithState;
12686
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
12732
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
12749
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
12763
TypeWithState
result = sourceState;
12764
TypeWithState
resultForType = sourceState;
12855
private
TypeWithState
VisitBadExpressionChild(BoundExpression? child)
12897
TypeWithState
resultType;
12929
var
operandResult = ResultType;
12931
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
12962
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
12963
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
12969
private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand,
TypeWithState
operandType)
13104
TypeWithState
leftType = ResultType;
13113
TypeWithState
rightType = ResultType;
13120
TypeWithState
leftType = ResultType;
13135
var
rightType = ResultType;
13143
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
13144
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
13229
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13251
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
13271
SetResultType(node,
TypeWithState
.ForType(type));
13311
var
argumentType = VisitRvalueWithState(node.Operand);
13333
SetResultType(node,
TypeWithState
.Create(type, resultState));
13365
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
13440
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
13542
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
13564
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
13608
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
13649
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13664
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13713
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13719
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
13726
var
rValueType =
TypeWithState
.ForType(node.Type);
13748
var
result = VisitRvalueWithState(expr);
13937
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;