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;
330 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (330)
Binder\Binder_Patterns.cs (1)
1358
var declType =
TypeWithState
.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (1)
36
public static NullableFlowState GetNullableState(ArrayBuilder<
TypeWithState
> types)
FlowAnalysis\NullableWalker.cs (305)
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 /*targetElementType*/, TypeSymbol /*targetCollectionType*/,
TypeWithState
>>.GetInstance();
3875
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
3881
void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol,
TypeWithState
>> elementConversionCompletions)
3915
var
resultType = VisitConversion(
3973
TypeWithState
convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol,
TypeWithState
>> completions)
3995
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4090
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4094
TypeWithState
setAnalyzedNullability(
4104
var
result =
TypeWithState
.Create(type, resultState);
4465
Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4478
(
TypeWithState
resultType, conversionCompletion) =
4498
Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4606
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4626
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4631
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
4739
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
4771
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4776
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
4810
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
4819
var
expressionType = VisitRvalueWithState(expressionNoConversion);
4853
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
5052
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
5064
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5095
return
TypeWithState
.Create(resultType, resultState);
5112
var
leftType = ResultType;
5139
var
rightType = VisitRvalueWithState(rightOperand);
5182
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5217
var
leftResult = ResultType;
5270
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5278
TypeWithState
leftType,
5281
TypeWithState
rightType,
5284
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5288
private
TypeWithState
ReinferAndVisitBinaryOperator(
5296
TypeWithState
leftType,
5300
TypeWithState
rightType)
5310
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5311
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5333
TypeWithState
operandType)
5366
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5376
TypeWithState
leftUnderlyingType,
5377
TypeWithState
rightUnderlyingType)
5442
private
TypeWithState
VisitBinaryOperatorOperandConversion(
5443
BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted,
5467
private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter,
TypeWithState
operandType, bool isLifted)
5470
TypeWithState
resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations);
5486
var
leftType = ResultType;
5491
var
rightType = ResultType;
5845
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
5850
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
5866
var
rightUnconditionalResult = ResultType;
5869
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
5874
TypeWithState
leftResult = ResultType;
5885
TypeWithState
rightResult = ResultType;
5903
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
5929
var
conversionResult = VisitConversion(
5936
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
5968
var
operandType = ResultType;
5973
var
result = VisitConversion(boundConversion,
6120
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6156
TypeWithState
consequenceRValue;
6157
TypeWithState
alternativeRValue;
6196
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6260
SetResultType(node,
TypeWithState
.Create(resultType, default));
6271
TypeWithState
typeWithState = convertArms(
6278
TypeWithState
convertArms(
6280
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6286
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6295
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6305
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6318
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6328
TypeWithState
consequenceRValue,
6329
TypeWithState
alternativeRValue,
6347
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6360
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6377
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6382
TypeWithState
operandType,
6399
var
resultType = VisitConversion(
6443
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6469
TypeWithState
receiverType = visitAndCheckReceiver(node);
6524
TypeWithState
receiverType = visitAndCheckReceiver(node);
6552
TypeWithState
visitAndCheckReceiver(BoundCall node)
6557
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6575
var
returnState = GetReturnTypeWithState(method);
6586
private
TypeWithState
VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method)
6588
TypeWithState
receiverType = default;
6603
TypeWithState
receiverType,
6720
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
6856
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
6957
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
6990
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
6992
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
7062
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7066
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7071
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7403
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7814
var
resultType = result.RValueType;
7832
var
stateAfterConversion = VisitConversion(
7887
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7905
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7963
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7967
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7990
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7993
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
8054
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
8085
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8090
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8096
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8102
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8111
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8115
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8121
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
8130
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
8134
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8376
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8642
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8647
return
TypeWithState
.Create(type.Type, state);
8802
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8814
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8824
var
operandType = VisitRvalueWithState(operand);
8828
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8833
Conversion conversion,
TypeWithState
operandType,
8838
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8848
var
resultType = VisitConversion(
8865
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8915
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8920
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8945
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8958
ImmutableArray<
TypeWithState
> types,
8988
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
9002
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
9096
var
convertedType = VisitUserDefinedConversion(
9269
private
TypeWithState
VisitConversion(
9274
TypeWithState
operandType,
9294
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9376
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9591
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9625
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9637
var
resultType =
TypeWithState
.Create(targetType, resultState);
9641
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9675
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9703
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9713
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9821
private
TypeWithState
VisitUserDefinedConversion(
9826
TypeWithState
operandType,
9846
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9878
TypeWithState
underlyingOperandType = default;
9986
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10009
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
10014
return
TypeWithState
.Create(type, state);
10017
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
10030
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
10042
private
TypeWithState
ClassifyAndVisitConversion(
10045
TypeWithState
operandType,
10120
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
10124
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
10126
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
10226
var
argState = VisitRvalueWithState(arg);
10279
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
10294
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
10296
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
10305
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
10423
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
10433
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10476
TypeWithState
rightState;
10499
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10519
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10528
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10622
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10652
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10666
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10675
var
rightResult = ResultType;
10767
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10790
TypeWithState
operandType;
10791
TypeWithState
valueType;
10843
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10900
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10953
TypeWithState
receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod);
10973
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
10977
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
10989
var
opType = VisitRvalueWithState(node.Operand);
10997
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11004
var
operandType = VisitRvalueWithState(node.Operand);
11048
TypeWithState
resultOfOperandConversionType;
11072
TypeWithState
resultOfIncrementType;
11098
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
11131
TypeWithState
receiverType = VisitAndCheckReceiver(node.Left, instanceMethod);
11151
SetResultType(node,
TypeWithState
.Create(receiverType.Type, NullableFlowState.NotNull));
11155
SetResultType(node,
TypeWithState
.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot)));
11168
var
opType = ResultType;
11179
SetResultType(node,
TypeWithState
.Create(opType.Type, NullableFlowState.NotNull));
11189
var
leftTypeWithState = ResultType;
11197
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
11204
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
11257
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
11350
TypeWithState
typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations);
11393
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
11451
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
11466
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
11476
resultType =
TypeWithState
.Create(resultType.Type, state);
11580
var
resultTypeWithState = VisitRvalueWithState(expr);
11645
var
convertedResult = VisitConversion(
11662
TypeWithState
currentPropertyGetterTypeWithState;
11703
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11759
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11776
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11790
TypeWithState
result = sourceState;
11791
TypeWithState
resultForType = sourceState;
11917
TypeWithState
resultType;
11949
var
operandResult = ResultType;
11951
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11982
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11983
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11989
private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand,
TypeWithState
operandType)
12124
TypeWithState
leftType = ResultType;
12133
TypeWithState
rightType = ResultType;
12140
TypeWithState
leftType = ResultType;
12155
var
rightType = ResultType;
12163
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
12164
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
12251
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12273
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
12293
SetResultType(node,
TypeWithState
.ForType(type));
12333
var
argumentType = VisitRvalueWithState(node.Operand);
12355
SetResultType(node,
TypeWithState
.Create(type, resultState));
12387
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
12462
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
12564
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
12586
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
12630
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
12671
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12686
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12735
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12741
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12748
var
rValueType =
TypeWithState
.ForType(node.Type);
12770
var
result = VisitRvalueWithState(expr);
12898
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;