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;
312 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (312)
Binder\Binder_Patterns.cs (1)
1357
var declType =
TypeWithState
.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (1)
36
public static NullableFlowState GetNullableState(ArrayBuilder<
TypeWithState
> types)
FlowAnalysis\NullableWalker.cs (287)
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)
210
private static readonly
TypeWithState
_invalidType =
TypeWithState
.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull);
231
private PooledDictionary<BoundExpression,
TypeWithState
>? _methodGroupReceiverMapOpt;
242
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>? _targetTypedAnalysisCompletionOpt;
247
/// 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>)"/>.
249
private PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>> TargetTypedAnalysisCompletion
250
=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
291
private
TypeWithState
ResultType
296
private void SetResultType(BoundExpression? expression,
TypeWithState
type, bool updateAnalyzedNullability = true)
301
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
type)
335
private void SetResult(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null)
355
private void SetAnalyzedNullability(BoundExpression? expression,
TypeWithState
resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null)
2276
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2320
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2360
TypeWithState
valueType,
2415
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2452
var
valueState = GetParameterState(
2491
var
valueWhen = ApplyUnconditionalAnnotations(
2505
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2583
TypeWithState
valueType,
2624
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
2910
var
resultType = VisitOptionalImplicitConversion(
2924
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
2928
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
2933
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
2964
TypeWithState
returnState;
2981
var
result = VisitRvalueWithState(expr);
3012
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3015
TypeWithState
resultType = ResultType;
3084
SetResultType(node,
TypeWithState
.ForType(node.Type));
3453
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3554
TypeWithState
valueType;
3603
TypeWithState
resultType = ResultType;
3613
var
result = resultType.WithNotNullState();
3735
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3743
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3756
var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
3821
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
3827
TypeWithState
convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>> completions)
3849
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
3938
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
3942
TypeWithState
setAnalyzedNullability(
3952
var
result =
TypeWithState
.Create(type, resultState);
4311
Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4324
(
TypeWithState
resultType, conversionCompletion) =
4344
Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4452
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4471
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4476
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
4584
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
4616
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4621
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
4655
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
4664
var
expressionType = VisitRvalueWithState(expressionNoConversion);
4698
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
4896
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
4908
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
4939
return
TypeWithState
.Create(resultType, resultState);
4956
var
leftType = ResultType;
4983
var
rightType = VisitRvalueWithState(rightOperand);
5026
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5061
var
leftResult = ResultType;
5114
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5122
TypeWithState
leftType,
5125
TypeWithState
rightType,
5128
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5132
private
TypeWithState
ReinferAndVisitBinaryOperator(
5140
TypeWithState
leftType,
5144
TypeWithState
rightType)
5156
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5157
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5173
TypeWithState
operandType)
5183
var
resultType = VisitConversion(
5213
TypeWithState
operandType)
5246
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5273
var
leftType = ResultType;
5278
var
rightType = ResultType;
5632
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
5637
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
5653
var
rightUnconditionalResult = ResultType;
5656
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
5661
TypeWithState
leftResult = ResultType;
5672
TypeWithState
rightResult = ResultType;
5690
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
5716
var
conversionResult = VisitConversion(
5723
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
5755
var
operandType = ResultType;
5760
var
result = VisitConversion(boundConversion,
5906
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
5942
TypeWithState
consequenceRValue;
5943
TypeWithState
alternativeRValue;
5982
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6046
SetResultType(node,
TypeWithState
.Create(resultType, default));
6057
TypeWithState
typeWithState = convertArms(
6064
TypeWithState
convertArms(
6066
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6072
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6081
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6091
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6104
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6114
TypeWithState
consequenceRValue,
6115
TypeWithState
alternativeRValue,
6133
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6146
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6163
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6168
TypeWithState
operandType,
6185
var
resultType = VisitConversion(
6229
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6255
TypeWithState
receiverType = visitAndCheckReceiver(node);
6295
TypeWithState
receiverType = visitAndCheckReceiver(node);
6323
TypeWithState
visitAndCheckReceiver(BoundCall node)
6325
TypeWithState
receiverType = default;
6336
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6355
var
returnState = GetReturnTypeWithState(method);
6366
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
6502
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
6603
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
6631
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
6633
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
6703
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
6707
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
6712
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7020
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7419
var
resultType = result.RValueType;
7437
var
stateAfterConversion = VisitConversion(
7492
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7510
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7568
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7572
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7595
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7598
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
7659
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
7690
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7695
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7701
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7707
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7716
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7720
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7726
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7735
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7739
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7976
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8209
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8214
return
TypeWithState
.Create(type.Type, state);
8368
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8380
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8390
var
operandType = VisitRvalueWithState(operand);
8394
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8399
Conversion conversion,
TypeWithState
operandType,
8404
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8414
var
resultType = VisitConversion(
8431
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8481
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8486
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8511
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8524
ImmutableArray<
TypeWithState
> types,
8554
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
8568
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
8662
var
convertedType = VisitUserDefinedConversion(
8835
private
TypeWithState
VisitConversion(
8840
TypeWithState
operandType,
8860
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
8942
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9157
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9191
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9203
var
resultType =
TypeWithState
.Create(targetType, resultState);
9207
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9241
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9269
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9279
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9387
private
TypeWithState
VisitUserDefinedConversion(
9392
TypeWithState
operandType,
9412
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9444
TypeWithState
underlyingOperandType = default;
9552
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9575
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
9580
return
TypeWithState
.Create(type, state);
9583
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
9596
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
9608
private
TypeWithState
ClassifyAndVisitConversion(
9611
TypeWithState
operandType,
9686
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
9690
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9692
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
9792
var
argState = VisitRvalueWithState(arg);
9845
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
9860
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
9862
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
9869
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
9977
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
9987
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10016
TypeWithState
rightState;
10039
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10059
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10068
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10162
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10192
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10206
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10215
var
rightResult = ResultType;
10304
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10327
TypeWithState
operandType;
10328
TypeWithState
valueType;
10380
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10437
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10477
var
operandType = VisitRvalueWithState(node.Operand);
10507
TypeWithState
resultOfOperandConversionType;
10531
TypeWithState
resultOfIncrementType;
10557
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
10582
var
leftTypeWithState = ResultType;
10590
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
10593
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
10646
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
10659
private void ReportArgumentWarnings(BoundExpression argument,
TypeWithState
argumentType, ParameterSymbol parameter)
10763
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
10820
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
10835
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
10845
resultType =
TypeWithState
.Create(resultType.Type, state);
10949
var
resultTypeWithState = VisitRvalueWithState(expr);
11014
var
convertedResult = VisitConversion(
11031
TypeWithState
currentPropertyGetterTypeWithState;
11072
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11128
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11145
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11159
TypeWithState
result = sourceState;
11160
TypeWithState
resultForType = sourceState;
11286
TypeWithState
resultType;
11318
var
operandResult = ResultType;
11320
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11350
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11351
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11392
private
TypeWithState
InferResultNullability(BoundUserDefinedConditionalLogicalOperator node)
11398
return
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11416
TypeWithState
leftType = ResultType;
11460
TypeWithState
rightType = ResultType;
11472
private
TypeWithState
InferResultNullabilityOfBinaryLogicalOperator(BoundExpression node,
TypeWithState
leftType,
TypeWithState
rightType)
11516
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11538
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
11558
SetResultType(node,
TypeWithState
.ForType(type));
11598
var
argumentType = VisitRvalueWithState(node.Operand);
11620
SetResultType(node,
TypeWithState
.Create(type, resultState));
11652
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
11727
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11829
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
11851
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
11895
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
11936
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11951
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12000
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12006
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12013
var
rValueType =
TypeWithState
.ForType(node.Type);
12035
var
result = VisitRvalueWithState(expr);
12163
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;