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)
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)
2298
private
TypeWithState
VisitRvalueWithState(BoundExpression? node)
2342
/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(
TypeWithState
, FlowAnalysisAnnotations)"/>
2382
TypeWithState
valueType,
2437
static bool isMaybeDefaultValue(
TypeWithState
valueType)
2474
var
valueState = GetParameterState(
2513
var
valueWhen = ApplyUnconditionalAnnotations(
2527
static bool isBadAssignment(
TypeWithState
valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2605
TypeWithState
valueType,
2646
static bool areEquivalentTypes(TypeWithAnnotations target,
TypeWithState
assignedValue) =>
2991
var
resultType = VisitOptionalImplicitConversion(
3005
internal static
TypeWithState
GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3009
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.MaybeDefault);
3014
return
TypeWithState
.Create(parameterType.Type, NullableFlowState.NotNull);
3045
TypeWithState
returnState;
3062
var
result = VisitRvalueWithState(expr);
3093
private
TypeWithState
VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3096
TypeWithState
resultType = ResultType;
3165
SetResultType(node,
TypeWithState
.ForType(node.Type));
3534
var
resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod));
3635
TypeWithState
valueType;
3684
TypeWithState
resultType = ResultType;
3694
var
result = resultType.WithNotNullState();
3816
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3824
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
3837
var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>>.GetInstance();
3902
var visitResult = new VisitResult(
TypeWithState
.Create(resultType), resultType,
3908
TypeWithState
convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations,
TypeWithState
>> completions)
3930
var
resultTypeWithState =
TypeWithState
.Create(strippedTargetCollectionType, resultState);
4020
TypeWithState
result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped);
4024
TypeWithState
setAnalyzedNullability(
4034
var
result =
TypeWithState
.Create(type, resultState);
4395
Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations,
TypeWithState
>? conversionCompletion = null)
4408
(
TypeWithState
resultType, conversionCompletion) =
4428
Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations,
TypeWithState
> conversionCompletion)
4536
TypeWithState
.Create(containingType, receiverResult.RValueType.State),
4556
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4561
var
resultType =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
4669
SetResultType(node,
TypeWithState
.Create(anonymousType, NullableFlowState.NotNull));
4701
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
4706
SetResultType(node,
TypeWithState
.Create(arrayType, NullableFlowState.NotNull));
4740
var expressionTypes = ArrayBuilder<
TypeWithState
>.GetInstance(n);
4749
var
expressionType = VisitRvalueWithState(expressionNoConversion);
4783
inferredType =
TypeWithState
.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation);
4982
private
TypeWithState
InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType,
TypeWithState
leftType,
TypeWithState
rightType)
4994
var
resultTypeWithState = GetReturnTypeWithState(methodOpt);
5025
return
TypeWithState
.Create(resultType, resultState);
5042
var
leftType = ResultType;
5069
var
rightType = VisitRvalueWithState(rightOperand);
5112
static bool isKnownNullOrNotNull(BoundExpression expr,
TypeWithState
resultType)
5147
var
leftResult = ResultType;
5200
SetResult(binary,
TypeWithState
.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5208
TypeWithState
leftType,
5211
TypeWithState
rightType,
5214
var
inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType);
5218
private
TypeWithState
ReinferAndVisitBinaryOperator(
5226
TypeWithState
leftType,
5230
TypeWithState
rightType)
5242
TypeWithState
leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType);
5243
TypeWithState
rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType);
5259
TypeWithState
operandType)
5269
var
resultType = VisitConversion(
5299
TypeWithState
operandType)
5332
var
inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType);
5359
var
leftType = ResultType;
5364
var
rightType = ResultType;
5718
TypeWithState
rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment);
5723
TypeWithState
resultType =
TypeWithState
.Create(targetType.Type, rightResult.State);
5739
var
rightUnconditionalResult = ResultType;
5742
SetResultType(node,
TypeWithState
.Create(node.Type, rightUnconditionalResult.State));
5747
TypeWithState
leftResult = ResultType;
5758
TypeWithState
rightResult = ResultType;
5776
SetResultType(node,
TypeWithState
.Create(resultType, rightResult.State.Join(leftState)));
5802
var
conversionResult = VisitConversion(
5809
TypeWithState
.Create(leftType, NullableFlowState.NotNull),
5841
var
operandType = ResultType;
5846
var
result = VisitConversion(boundConversion,
5992
SetResultType(node,
TypeWithState
.Create(resultType, NullableFlowState.MaybeDefault));
6028
TypeWithState
consequenceRValue;
6029
TypeWithState
alternativeRValue;
6068
SetResult(node,
TypeWithState
.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6132
SetResultType(node,
TypeWithState
.Create(resultType, default));
6143
TypeWithState
typeWithState = convertArms(
6150
TypeWithState
convertArms(
6152
TypeWithState
consequenceRValue,
TypeWithState
alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable,
6158
TypeWithState
convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6167
TypeWithState
convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult(
6177
var
typeWithState =
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6190
return
TypeWithState
.Create(resultTypeWithAnnotations.Type, resultState);
6200
TypeWithState
consequenceRValue,
6201
TypeWithState
alternativeRValue,
6219
(BoundExpression, Conversion,
TypeWithState
) visitConditionalOperand(LocalState state, BoundExpression operand)
6232
(TypeWithAnnotations LValueType,
TypeWithState
RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6249
private
TypeWithState
ConvertConditionalOperandOrSwitchExpressionArmResult(
6254
TypeWithState
operandType,
6271
var
resultType = VisitConversion(
6315
SetResultType(node,
TypeWithState
.Create(rvalueType, NullableFlowState.NotNull));
6341
TypeWithState
receiverType = visitAndCheckReceiver(node);
6382
TypeWithState
receiverType = visitAndCheckReceiver(node);
6410
TypeWithState
visitAndCheckReceiver(BoundCall node)
6412
TypeWithState
receiverType = default;
6423
void reinferMethodAndVisitArguments(BoundCall node,
TypeWithState
receiverType, VisitResult? firstArgumentResult = null)
6443
var
returnState = GetReturnTypeWithState(method);
6454
private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node,
TypeWithState
receiverType, ImmutableArray<VisitResult> results)
6590
void learnFromEqualsMethodArguments(BoundExpression left,
TypeWithState
leftType, BoundExpression right,
TypeWithState
rightType)
6691
private void CheckCallReceiver(BoundExpression? receiverOpt,
TypeWithState
receiverType, MethodSymbol method)
6719
private
TypeWithState
GetReturnTypeWithState(MethodSymbol method)
6721
return
TypeWithState
.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method));
6797
private static
TypeWithState
ApplyUnconditionalAnnotations(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
6801
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
6806
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7114
TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7519
var
resultType = result.RValueType;
7537
var
stateAfterConversion = VisitConversion(
7592
private bool CheckDisallowedNullAssignment(
TypeWithState
state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null)
7610
private static bool IsDisallowedNullAssignment(
TypeWithState
valueState, FlowAnalysisAnnotations targetAnnotations)
7668
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7672
parameterWithState =
TypeWithState
.Create(parameterType.Type, adjustedState);
7695
var
parameterWithState =
TypeWithState
.Create(parameterType, parameterAnnotations);
7698
var
worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations);
7759
void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot,
TypeWithState
parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations)
7790
static
TypeWithState
applyPostConditionsUnconditionally(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7795
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7801
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7807
static
TypeWithState
applyPostConditionsWhenTrue(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7816
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7820
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
7826
static
TypeWithState
applyPostConditionsWhenFalse(
TypeWithState
typeWithState, FlowAnalysisAnnotations annotations)
7835
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.MaybeDefault);
7839
return
TypeWithState
.Create(typeWithState.Type, NullableFlowState.NotNull);
8076
if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out
TypeWithState
receiverType))
8309
private
TypeWithState
GetAdjustedResult(
TypeWithState
type, int slot)
8314
return
TypeWithState
.Create(type.Type, state);
8470
private
TypeWithState
VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
8482
private (
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) VisitOptionalImplicitConversion(
8492
var
operandType = VisitRvalueWithState(operand);
8496
(
TypeWithState
resultType, Func<TypeWithAnnotations,
TypeWithState
>? completion) visitConversion(
8501
Conversion conversion,
TypeWithState
operandType,
8506
return (
TypeWithState
.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType));
8516
var
resultType = VisitConversion(
8533
Func<TypeWithAnnotations,
TypeWithState
> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion,
TypeWithState
operandType)
8583
ImmutableArray<
TypeWithState
> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this);
8588
SetResultType(node,
TypeWithState
.Create(null, NullableFlowState.NotNull));
8613
SetResultType(node,
TypeWithState
.Create(tupleOpt, NullableFlowState.NotNull));
8626
ImmutableArray<
TypeWithState
> types,
8656
void trackState(BoundExpression value, FieldSymbol field,
TypeWithState
valueType)
8670
private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value,
TypeWithState
valueType, int valueSlot)
8764
var
convertedType = VisitUserDefinedConversion(
8937
private
TypeWithState
VisitConversion(
8942
TypeWithState
operandType,
8962
if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations,
TypeWithState
>? completion))
9046
return
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9261
TypeWithState
resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType);
9295
static
TypeWithState
calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
9307
var
resultType =
TypeWithState
.Create(targetType, resultState);
9311
static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9345
static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType,
TypeWithState
operandType)
9373
static NullableFlowState getUnboxingConversionResultState(
TypeWithState
operandType)
9383
static NullableFlowState getConversionResultState(
TypeWithState
operandType)
9491
private
TypeWithState
VisitUserDefinedConversion(
9496
TypeWithState
operandType,
9516
var
resultType =
TypeWithState
.Create(targetType, NullableFlowState.NotNull);
9548
TypeWithState
underlyingOperandType = default;
9656
private void TrackAnalyzedNullabilityThroughConversionGroup(
TypeWithState
resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9679
private
TypeWithState
GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
9684
return
TypeWithState
.Create(type, state);
9687
private static
TypeWithState
GetNullableUnderlyingTypeIfNecessary(bool isLifted,
TypeWithState
typeWithState)
9700
private
TypeWithState
GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
9712
private
TypeWithState
ClassifyAndVisitConversion(
9715
TypeWithState
operandType,
9790
TypeWithState
result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped);
9794
TypeWithState
setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9796
var
result =
TypeWithState
.Create(delegateType, NullableFlowState.NotNull);
9896
var
argState = VisitRvalueWithState(arg);
9949
private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out
TypeWithState
type)
9964
private void SetMethodGroupReceiverNullability(BoundExpression receiver,
TypeWithState
type)
9966
_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression,
TypeWithState
>.GetInstance();
9973
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
10082
var
rvalueResult =
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
10092
var
typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations);
10135
TypeWithState
rightState;
10158
SetResult(node,
TypeWithState
.Create(leftLValueType.Type, rightState.State), leftLValueType);
10178
var
rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations);
10187
private void AdjustSetValue(BoundExpression left, ref
TypeWithState
rightState)
10281
private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node,
TypeWithState
? rightResultOpt)
10311
private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt = null)
10325
private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right,
TypeWithState
? rightResultOpt)
10334
var
rightResult = ResultType;
10424
private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right,
TypeWithState
? rightResultOpt)
10447
TypeWithState
operandType;
10448
TypeWithState
valueType;
10500
var
valueBeforeNullableWrapping =
TypeWithState
.Create(underlyingType.Type, NullableFlowState.NotNull);
10557
private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr,
TypeWithState
? rightResultOpt)
10597
var
operandType = VisitRvalueWithState(node.Operand);
10627
TypeWithState
resultOfOperandConversionType;
10651
TypeWithState
resultOfIncrementType;
10677
TypeWithState
resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType;
10702
var
leftTypeWithState = ResultType;
10710
var
rightTypeWithState = VisitRvalueWithState(rightConversionOperand);
10713
var
resultTypeWithState = ReinferAndVisitBinaryOperator(
10766
SetResultType(node.Expression,
TypeWithState
.Create(node.Expression.Type, ResultType.State));
10779
private void ReportArgumentWarnings(BoundExpression argument,
TypeWithState
argumentType, ParameterSymbol parameter)
10883
var
resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer));
10940
var
receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default;
10955
var
resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations);
10965
resultType =
TypeWithState
.Create(resultType.Type, state);
11069
var
resultTypeWithState = VisitRvalueWithState(expr);
11134
var
convertedResult = VisitConversion(
11151
TypeWithState
currentPropertyGetterTypeWithState;
11192
var
enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod);
11248
var
sourceState = node.EnumeratorInfoOpt == null ? default : ResultType;
11265
VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (
TypeWithState
?)null : sourceState);
11279
TypeWithState
result = sourceState;
11280
TypeWithState
resultForType = sourceState;
11406
TypeWithState
resultType;
11438
var
operandResult = ResultType;
11440
var
operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult);
11470
TypeWithState
adjustForLifting(
TypeWithState
argumentResult) =>
11471
TypeWithState
.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull);
11512
private
TypeWithState
InferResultNullability(BoundUserDefinedConditionalLogicalOperator node)
11518
return
TypeWithState
.Create(node.Type, NullableFlowState.NotNull);
11536
TypeWithState
leftType = ResultType;
11580
TypeWithState
rightType = ResultType;
11592
private
TypeWithState
InferResultNullabilityOfBinaryLogicalOperator(BoundExpression node,
TypeWithState
leftType,
TypeWithState
rightType)
11636
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
11658
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.MaybeDefault));
11678
SetResultType(node,
TypeWithState
.ForType(type));
11718
var
argumentType = VisitRvalueWithState(node.Operand);
11740
SetResultType(node,
TypeWithState
.Create(type, resultState));
11772
SetResultType(node,
TypeWithState
.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull));
11847
if (TryGetMethodGroupReceiverNullability(receiverOpt, out
TypeWithState
receiverType))
11949
SetResultType(expression,
TypeWithState
.Create(expression.Type, default));
11971
private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt,
TypeWithState
resultType, bool checkNullableValueType)
12015
private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter,
TypeWithState
result)
12056
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12071
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12120
SetResultType(node,
TypeWithState
.Create(node.Type, NullableFlowState.NotNull));
12126
SetResultType(node,
TypeWithState
.Create(type, NullableFlowState.NotNull));
12133
var
rValueType =
TypeWithState
.ForType(node.Type);
12155
var
result = VisitRvalueWithState(expr);
12283
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;