4 instantiations of TypeWithState
Microsoft.CodeAnalysis.CSharp (4)
Symbols\TypeWithState.cs (4)
34return new TypeWithState(type, defaultState); 37return new TypeWithState(type, state); 81public TypeWithState WithNotNullState() => new TypeWithState(Type, NullableFlowState.NotNull); 83public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.NotNull) : this;
343 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (343)
Binder\Binder_Patterns.cs (1)
1978var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (2)
36public static NullableFlowState GetNullableState(ArrayBuilder<TypeWithState> types) 39foreach (var type in types)
FlowAnalysis\NullableWalker.cs (315)
118public readonly TypeWithState RValueType; 130public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType) 139public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda) 147RValueType = TypeWithState.Create(type, state); 156public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults) 235private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull); 256private PooledDictionary<BoundExpression, TypeWithState>? _methodGroupReceiverMapOpt; 267private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>? _targetTypedAnalysisCompletionOpt; 272/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional&lt;LocalState&gt;,bool, int, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 274private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>> TargetTypedAnalysisCompletion 275=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>.GetInstance(); 316private TypeWithState ResultType 321private void SetResultType(BoundExpression? expression, TypeWithState type, bool updateAnalyzedNullability = true) 326private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState type) 360private void SetResult(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null) 380private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null) 2374private TypeWithState VisitRvalueWithState(BoundExpression? node) 2418/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2458TypeWithState valueType, 2513static bool isMaybeDefaultValue(TypeWithState valueType) 2550var valueState = GetParameterState( 2589var valueWhen = ApplyUnconditionalAnnotations( 2603static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2681TypeWithState valueType, 2722static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3068var resultType = VisitOptionalImplicitConversion( 3082internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3086return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3091return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3122TypeWithState returnState; 3139var result = VisitRvalueWithState(expr); 3171private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3174TypeWithState resultType = ResultType; 3241SetResultType(node, TypeWithState.ForType(node.Type)); 3611var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3737TypeWithState valueType; 3786TypeWithState resultType = ResultType; 3796var result = resultType.WithNotNullState(); 3918SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3926SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3971var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4178TypeWithState convertCollection( 4205var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4311TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4315TypeWithState setAnalyzedNullability( 4325var result = TypeWithState.Create(type, resultState); 4494private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4792InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4805(TypeWithState resultType, conversionCompletion) = 4825InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4934TypeWithState.Create(containingType, receiverResult.RValueType.State), 4954SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4959var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5048var argumentType = argumentTypes[i]; 5067SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5099SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5104SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5138var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5147var expressionType = VisitRvalueWithState(expressionNoConversion); 5181inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5380private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5392var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5423return TypeWithState.Create(resultType, resultState); 5440var leftType = ResultType; 5467var rightType = VisitRvalueWithState(rightOperand); 5510static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5545var leftResult = ResultType; 5598SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5606TypeWithState leftType, 5609TypeWithState rightType, 5612var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5616private TypeWithState ReinferAndVisitBinaryOperator( 5624TypeWithState leftType, 5628TypeWithState rightType) 5638TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5639TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5661TypeWithState operandType) 5694var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5704TypeWithState leftUnderlyingType, 5705TypeWithState rightUnderlyingType) 5770private TypeWithState VisitBinaryOperatorOperandConversion( 5771BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5795private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5798TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5814var leftType = ResultType; 5819var rightType = ResultType; 6173TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6178TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6194var rightUnconditionalResult = ResultType; 6197SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6202TypeWithState leftResult = ResultType; 6213TypeWithState rightResult = ResultType; 6231SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6259var conversionResult = VisitConversion( 6266TypeWithState.Create(leftType, NullableFlowState.NotNull), 6298var operandType = ResultType; 6303var result = VisitConversion(boundConversion, 6450SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6486TypeWithState consequenceRValue; 6487TypeWithState alternativeRValue; 6526SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6590SetResultType(node, TypeWithState.Create(resultType, default)); 6601TypeWithState typeWithState = convertArms( 6608TypeWithState convertArms( 6610TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6616TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6625TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6635var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6648return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6658TypeWithState consequenceRValue, 6659TypeWithState alternativeRValue, 6677(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6690(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6707private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6712TypeWithState operandType, 6729var resultType = VisitConversion( 6773SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6799TypeWithState receiverType = visitAndCheckReceiver(node); 6873TypeWithState receiverType = visitAndCheckReceiver(node); 6901TypeWithState visitAndCheckReceiver(BoundCall node) 6911void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6952var returnState = GetReturnTypeWithState(method); 6963private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6965TypeWithState receiverType = default; 6980TypeWithState receiverType, 7098private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7234void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7335private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7368private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7370return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7440private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7444return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7449return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7776TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8207var resultType = result.RValueType; 8225var stateAfterConversion = VisitConversion( 8280private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8298private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8357var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8361parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8384var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8387var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8448void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8498static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8503return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8509return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8515static TypeWithState applyPostConditionsWhenTrue(TypeSymbol? receiverType, TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8524return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8528return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8534static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8543return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8547return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8835if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9112private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9117return TypeWithState.Create(type.Type, state); 9273private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9285private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9295var operandType = VisitRvalueWithState(operand); 9299(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9304Conversion conversion, TypeWithState operandType, 9309return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9319var resultType = VisitConversion( 9336Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9386ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9391SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9416SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9429ImmutableArray<TypeWithState> types, 9459void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9473private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9568var convertedType = VisitUserDefinedConversion( 9593TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField)); 9600valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9618TypeWithState convertedType = VisitUnionConversion( 9798private TypeWithState VisitConversion( 9803TypeWithState operandType, 9825if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9908return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10180TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10214static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10226var resultType = TypeWithState.Create(targetType, resultState); 10230static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10264static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10292static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10302static NullableFlowState getConversionResultState(TypeWithState operandType) 10418private TypeWithState VisitUserDefinedConversion( 10423TypeWithState operandType, 10442var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10474TypeWithState underlyingOperandType = default; 10550private TypeWithState GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState) 10553TypeWithState returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState); 10570private TypeWithState VisitUnionConversion( 10575TypeWithState operandType, 10594var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull); 10676TypeWithState unionTypeWithState; 10681unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10747private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10775private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10780return TypeWithState.Create(type, state); 10783private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10796private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10808private TypeWithState ClassifyAndVisitConversion( 10811TypeWithState operandType, 10886TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10890TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10892var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10992var argState = VisitRvalueWithState(arg); 11045private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11060private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11062_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11071if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11189var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11199var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11242TypeWithState rightState; 11265SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11285var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11294private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11388private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11418private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11432private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11441var rightResult = ResultType; 11532private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11555TypeWithState operandType; 11556TypeWithState valueType; 11608var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11665private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11718TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11741SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11745SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11757var opType = VisitRvalueWithState(node.Operand); 11765SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11772var operandType = VisitRvalueWithState(node.Operand); 11828TypeWithState resultOfOperandConversionType; 11852TypeWithState resultOfIncrementType; 11878TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11911TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11934SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11938SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11951var opType = ResultType; 11962SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11972var leftTypeWithState = ResultType; 11980var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11987var resultTypeWithState = ReinferAndVisitBinaryOperator( 12040SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12141TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12184var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 12248var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12272var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12282resultType = TypeWithState.Create(resultType.Type, state); 12394var resultTypeWithState = VisitRvalueWithState(expr); 12464var convertedResult = VisitConversion( 12482TypeWithState currentPropertyGetterTypeWithState; 12523var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12569var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12586VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12600TypeWithState result = sourceState; 12601TypeWithState resultForType = sourceState; 12692private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12734TypeWithState resultType; 12766var operandResult = ResultType; 12768var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12799TypeWithState adjustForLifting(TypeWithState argumentResult) => 12800TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12806private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12941TypeWithState leftType = ResultType; 12950TypeWithState rightType = ResultType; 12957TypeWithState leftType = ResultType; 12972var rightType = ResultType; 12980TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12981TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13066SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13088SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13108SetResultType(node, TypeWithState.ForType(type)); 13148var argumentType = VisitRvalueWithState(node.Operand); 13170SetResultType(node, TypeWithState.Create(type, resultState)); 13202SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13277if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13379SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13401private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13445private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13486SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13501SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13550SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13556SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13563var rValueType = TypeWithState.ForType(node.Type); 13585var result = VisitRvalueWithState(expr); 13766Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (18)
300var expressionState = ResultType; 380TypeWithState expressionTypeWithState, 525var inputTypeWithState = TypeWithState.Create(inputType, inputState); 632var value = TypeWithState.Create(tempType, tempState); 644TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 993var expressionState = ResultType; 1016var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 1037var armType = VisitRvalueWithState(expression); 1059TypeWithState resultType; 1072resultType = TypeWithState.Create(inferredType, inferredState); 1087TypeWithState convertArms( 1091ArrayBuilder<TypeWithState> resultTypes, 1122TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1136ArrayBuilder<TypeWithState> resultTypes, 1161var expressionState = ResultType;
Symbols\TypeWithAnnotations.cs (2)
805internal TypeWithState ToTypeWithState() 811return TypeWithState.Create(Type, getFlowState(Type, NullableAnnotation));
Symbols\TypeWithState.cs (5)
23public static TypeWithState ForType(TypeSymbol? type) 28public static TypeWithState Create(TypeSymbol? type, NullableFlowState defaultState) 40public static TypeWithState Create(TypeWithAnnotations typeWithAnnotations, FlowAnalysisAnnotations annotations = FlowAnalysisAnnotations.None) 81public TypeWithState WithNotNullState() => new TypeWithState(Type, NullableFlowState.NotNull); 83public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.NotNull) : this;