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)
1591
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)
2362
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2406
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2446
TypeWithState
valueType,
2501
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2538
var
valueState = GetParameterState(
2577
var
valueWhen = ApplyUnconditionalAnnotations(
2591
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2669
TypeWithState
valueType,
2710
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
3063
var
resultType = VisitOptionalImplicitConversion(
3077
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3081
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
3086
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
3117
TypeWithState
returnState;
3134
var
result = VisitRvalueWithState(expr);
3166
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3169
TypeWithState
resultType = ResultType;
3236
SetResultType(node,
TypeWithState
.ForType(node.Type));
3606
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3732
TypeWithState
valueType;
3781
TypeWithState
resultType = ResultType;
3791
var
result = resultType.WithNotNullState();
3913
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3921
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3966
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
4173
TypeWithState
convertCollection(
4200
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4306
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4310
TypeWithState
setAnalyzedNullability(
4320
var
result =
TypeWithState
.Create(type, resultState);
4489
private void SetUnionValueStateFromConstructorArgument(BoundExpression argument,
TypeWithState
argumentTypeWithState, int containingSlot, PropertySymbol valueProperty)
4724
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4737
(
TypeWithState
resultType, conversionCompletion) =
4757
InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4918
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4938
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4943
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
5032
var
argumentType = argumentTypes[i];
5051
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
5083
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
5088
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
5122
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
5131
var
expressionType = VisitRvalueWithState(expressionNoConversion);
5165
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
5364
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
5376
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5407
return
TypeWithState
.Create(resultType, resultState);
5424
var
leftType = ResultType;
5451
var
rightType = VisitRvalueWithState(rightOperand);
5494
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5529
var
leftResult = ResultType;
5582
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5590
TypeWithState
leftType,
5593
TypeWithState
rightType,
5596
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5600
private
TypeWithState
ReinferAndVisitBinaryOperator(
5608
TypeWithState
leftType,
5612
TypeWithState
rightType)
5622
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5623
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5645
TypeWithState
operandType)
5678
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5688
TypeWithState
leftUnderlyingType,
5689
TypeWithState
rightUnderlyingType)
5754
private
TypeWithState
VisitBinaryOperatorOperandConversion(
5755
BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted,
5779
private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted)
5782
TypeWithState
resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations);
5798
var
leftType = ResultType;
5803
var
rightType = ResultType;
6157
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
6162
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
6178
var
rightUnconditionalResult = ResultType;
6181
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
6186
TypeWithState
leftResult = ResultType;
6197
TypeWithState
rightResult = ResultType;
6215
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
6243
var
conversionResult = VisitConversion(
6250
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
6282
var
operandType = ResultType;
6287
var
result = VisitConversion(boundConversion,
6434
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6470
TypeWithState
consequenceRValue;
6471
TypeWithState
alternativeRValue;
6510
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6574
SetResultType(node,
TypeWithState
.Create(resultType, default));
6585
TypeWithState
typeWithState = convertArms(
6592
TypeWithState
convertArms(
6594
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6600
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6609
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6619
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6632
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6642
TypeWithState
consequenceRValue,
6643
TypeWithState
alternativeRValue,
6661
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6674
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6691
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6696
TypeWithState
operandType,
6713
var
resultType = VisitConversion(
6757
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6783
TypeWithState
receiverType = visitAndCheckReceiver(node);
6857
TypeWithState
receiverType = visitAndCheckReceiver(node);
6885
TypeWithState
visitAndCheckReceiver(BoundCall node)
6895
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6936
var
returnState = GetReturnTypeWithState(method);
6947
private
TypeWithState
VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
6949
TypeWithState
receiverType = default;
6964
TypeWithState
receiverType,
7103
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
7239
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
7340
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
7373
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
7375
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
7445
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7449
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7454
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7789
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
8220
var
resultType = result.RValueType;
8238
var
stateAfterConversion = VisitConversion(
8293
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
8311
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
8370
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8374
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
8397
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
8400
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
8461
void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter)
8511
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8516
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8522
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8528
static
TypeWithState
applyPostConditionsWhenTrue(TypeSymbol? receiverType,
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter)
8537
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8541
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8547
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8556
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8560
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8848
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
9125
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
9130
return
TypeWithState
.Create(type.Type, state);
9286
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
9298
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
9308
var
operandType = VisitRvalueWithState(operand);
9312
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
9317
Conversion conversion,
TypeWithState
operandType,
9322
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
9332
var
resultType = VisitConversion(
9349
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
9399
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
9404
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
9429
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
9442
ImmutableArray<
TypeWithState
> types,
9472
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
9486
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
9581
var
convertedType = VisitUserDefinedConversion(
9606
TypeWithState
valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField));
9613
valueFieldType =
TypeWithState
.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot));
9631
TypeWithState
convertedType = VisitUnionConversion(
9811
private
TypeWithState
VisitConversion(
9816
TypeWithState
operandType,
9838
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9921
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10193
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
10227
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
10239
var
resultType =
TypeWithState
.Create(targetType, resultState);
10243
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10277
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
10305
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
10315
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
10431
private
TypeWithState
VisitUserDefinedConversion(
10436
TypeWithState
operandType,
10455
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
10487
TypeWithState
underlyingOperandType = default;
10563
private
TypeWithState
GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState)
10566
TypeWithState
returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState);
10583
private
TypeWithState
VisitUnionConversion(
10588
TypeWithState
operandType,
10607
var
resultType =
TypeWithState
.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull);
10695
TypeWithState
unionTypeWithState;
10700
unionTypeWithState =
TypeWithState
.Create(toType, NullableFlowState.NotNull);
10766
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10794
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
10799
return
TypeWithState
.Create(type, state);
10802
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
10815
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
10827
private
TypeWithState
ClassifyAndVisitConversion(
10830
TypeWithState
operandType,
10905
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
10909
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
10911
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
11011
var
argState = VisitRvalueWithState(arg);
11064
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
11079
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
11081
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
11090
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11208
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11218
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
11261
TypeWithState
rightState;
11284
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
11304
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
11313
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
11405
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
11435
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
11449
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
11458
var
rightResult = ResultType;
11550
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
11573
TypeWithState
operandType;
11574
TypeWithState
valueType;
11626
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
11683
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
11736
TypeWithState
receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod);
11759
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
11763
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
11775
var
opType = VisitRvalueWithState(node.Operand);
11783
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11790
var
operandType = VisitRvalueWithState(node.Operand);
11846
TypeWithState
resultOfOperandConversionType;
11870
TypeWithState
resultOfIncrementType;
11896
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
11929
TypeWithState
receiverType = VisitAndCheckReceiver(node.Left, instanceMethod);
11952
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
11956
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
11969
var
opType = ResultType;
11980
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11990
var
leftTypeWithState = ResultType;
11998
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
12005
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
12058
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
12189
TypeWithState
typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations);
12242
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
12306
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
12330
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
12340
resultType =
TypeWithState
.Create(resultType.Type, state);
12452
var
resultTypeWithState = VisitRvalueWithState(expr);
12522
var
convertedResult = VisitConversion(
12540
TypeWithState
currentPropertyGetterTypeWithState;
12581
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
12627
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
12644
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
12658
TypeWithState
result = sourceState;
12659
TypeWithState
resultForType = sourceState;
12750
private
TypeWithState
VisitBadExpressionChild(BoundExpression? child)
12792
TypeWithState
resultType;
12824
var
operandResult = ResultType;
12826
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
12857
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
12858
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
12864
private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand,
TypeWithState
operandType)
12999
TypeWithState
leftType = ResultType;
13008
TypeWithState
rightType = ResultType;
13015
TypeWithState
leftType = ResultType;
13030
var
rightType = ResultType;
13038
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
13039
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
13124
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13146
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
13166
SetResultType(node,
TypeWithState
.ForType(type));
13206
var
argumentType = VisitRvalueWithState(node.Operand);
13228
SetResultType(node,
TypeWithState
.Create(type, resultState));
13260
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
13335
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
13437
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
13459
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
13503
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
13544
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13559
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13608
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
13614
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
13621
var
rValueType =
TypeWithState
.ForType(node.Type);
13643
var
result = VisitRvalueWithState(expr);
13824
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;