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)
2278
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2322
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2362
TypeWithState
valueType,
2417
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2454
var
valueState = GetParameterState(
2493
var
valueWhen = ApplyUnconditionalAnnotations(
2507
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2585
TypeWithState
valueType,
2626
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
2912
var
resultType = VisitOptionalImplicitConversion(
2926
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
2930
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
2935
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
2966
TypeWithState
returnState;
2983
var
result = VisitRvalueWithState(expr);
3014
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3017
TypeWithState
resultType = ResultType;
3086
SetResultType(node,
TypeWithState
.ForType(node.Type));
3455
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3556
TypeWithState
valueType;
3605
TypeWithState
resultType = ResultType;
3615
var
result = resultType.WithNotNullState();
3737
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3745
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3758
var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
3823
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
3829
TypeWithState
convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>> completions)
3851
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
3941
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
3945
TypeWithState
setAnalyzedNullability(
3955
var
result =
TypeWithState
.Create(type, resultState);
4316
Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4329
(
TypeWithState
resultType, conversionCompletion) =
4349
Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4457
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4476
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4481
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
4589
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
4621
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4626
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
4660
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
4669
var
expressionType = VisitRvalueWithState(expressionNoConversion);
4703
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
4901
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
4913
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
4944
return
TypeWithState
.Create(resultType, resultState);
4961
var
leftType = ResultType;
4988
var
rightType = VisitRvalueWithState(rightOperand);
5031
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5066
var
leftResult = ResultType;
5119
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5127
TypeWithState
leftType,
5130
TypeWithState
rightType,
5133
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5137
private
TypeWithState
ReinferAndVisitBinaryOperator(
5145
TypeWithState
leftType,
5149
TypeWithState
rightType)
5161
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5162
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5178
TypeWithState
operandType)
5188
var
resultType = VisitConversion(
5218
TypeWithState
operandType)
5251
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5278
var
leftType = ResultType;
5283
var
rightType = ResultType;
5637
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
5642
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
5658
var
rightUnconditionalResult = ResultType;
5661
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
5666
TypeWithState
leftResult = ResultType;
5677
TypeWithState
rightResult = ResultType;
5695
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
5721
var
conversionResult = VisitConversion(
5728
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
5760
var
operandType = ResultType;
5765
var
result = VisitConversion(boundConversion,
5911
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
5947
TypeWithState
consequenceRValue;
5948
TypeWithState
alternativeRValue;
5987
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6051
SetResultType(node,
TypeWithState
.Create(resultType, default));
6062
TypeWithState
typeWithState = convertArms(
6069
TypeWithState
convertArms(
6071
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6077
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6086
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6096
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6109
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6119
TypeWithState
consequenceRValue,
6120
TypeWithState
alternativeRValue,
6138
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6151
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6168
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6173
TypeWithState
operandType,
6190
var
resultType = VisitConversion(
6234
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6260
TypeWithState
receiverType = visitAndCheckReceiver(node);
6300
TypeWithState
receiverType = visitAndCheckReceiver(node);
6328
TypeWithState
visitAndCheckReceiver(BoundCall node)
6330
TypeWithState
receiverType = default;
6341
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6360
var
returnState = GetReturnTypeWithState(method);
6371
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
6507
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
6608
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
6636
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
6638
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
6708
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
6712
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
6717
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7025
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7430
var
resultType = result.RValueType;
7448
var
stateAfterConversion = VisitConversion(
7503
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7521
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7579
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7583
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7606
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7609
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
7670
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
7701
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7706
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7712
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7718
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7727
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7731
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7737
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7746
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7750
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7987
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8220
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8225
return
TypeWithState
.Create(type.Type, state);
8379
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8391
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8401
var
operandType = VisitRvalueWithState(operand);
8405
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8410
Conversion conversion,
TypeWithState
operandType,
8415
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8425
var
resultType = VisitConversion(
8442
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8492
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8497
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8522
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8535
ImmutableArray<
TypeWithState
> types,
8565
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
8579
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
8673
var
convertedType = VisitUserDefinedConversion(
8846
private
TypeWithState
VisitConversion(
8851
TypeWithState
operandType,
8871
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
8953
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9168
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9202
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9214
var
resultType =
TypeWithState
.Create(targetType, resultState);
9218
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9252
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9280
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9290
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9398
private
TypeWithState
VisitUserDefinedConversion(
9403
TypeWithState
operandType,
9423
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9455
TypeWithState
underlyingOperandType = default;
9563
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9586
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
9591
return
TypeWithState
.Create(type, state);
9594
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
9607
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
9619
private
TypeWithState
ClassifyAndVisitConversion(
9622
TypeWithState
operandType,
9697
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
9701
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9703
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
9803
var
argState = VisitRvalueWithState(arg);
9856
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
9871
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
9873
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
9880
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
9988
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
9998
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10027
TypeWithState
rightState;
10050
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10070
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10079
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10173
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10203
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10217
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10226
var
rightResult = ResultType;
10315
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10338
TypeWithState
operandType;
10339
TypeWithState
valueType;
10391
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10448
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10488
var
operandType = VisitRvalueWithState(node.Operand);
10518
TypeWithState
resultOfOperandConversionType;
10542
TypeWithState
resultOfIncrementType;
10568
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
10593
var
leftTypeWithState = ResultType;
10601
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
10604
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
10657
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
10670
private void ReportArgumentWarnings(BoundExpression argument,
TypeWithState
argumentType, ParameterSymbol parameter)
10774
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
10831
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
10846
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
10856
resultType =
TypeWithState
.Create(resultType.Type, state);
10960
var
resultTypeWithState = VisitRvalueWithState(expr);
11025
var
convertedResult = VisitConversion(
11042
TypeWithState
currentPropertyGetterTypeWithState;
11083
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11139
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11156
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11170
TypeWithState
result = sourceState;
11171
TypeWithState
resultForType = sourceState;
11297
TypeWithState
resultType;
11329
var
operandResult = ResultType;
11331
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11361
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11362
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11403
private
TypeWithState
InferResultNullability(BoundUserDefinedConditionalLogicalOperator node)
11409
return
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11427
TypeWithState
leftType = ResultType;
11471
TypeWithState
rightType = ResultType;
11483
private
TypeWithState
InferResultNullabilityOfBinaryLogicalOperator(BoundExpression node,
TypeWithState
leftType,
TypeWithState
rightType)
11527
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11549
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
11569
SetResultType(node,
TypeWithState
.ForType(type));
11609
var
argumentType = VisitRvalueWithState(node.Operand);
11631
SetResultType(node,
TypeWithState
.Create(type, resultState));
11663
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
11738
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11840
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
11862
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
11906
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
11947
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11962
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12011
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12017
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12024
var
rValueType =
TypeWithState
.ForType(node.Type);
12046
var
result = VisitRvalueWithState(expr);
12174
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;