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;
344 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (344)
Binder\Binder_Patterns.cs (1)
2094var 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) 2376private TypeWithState VisitRvalueWithState(BoundExpression? node) 2420/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2460TypeWithState valueType, 2515static bool isMaybeDefaultValue(TypeWithState valueType) 2552var valueState = GetParameterState( 2591var valueWhen = ApplyUnconditionalAnnotations( 2605static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2683TypeWithState valueType, 2724static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3077var resultType = VisitOptionalImplicitConversion( 3091internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3095return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3100return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3131TypeWithState returnState; 3148var result = VisitRvalueWithState(expr); 3180private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3183TypeWithState resultType = ResultType; 3250SetResultType(node, TypeWithState.ForType(node.Type)); 3620var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3746TypeWithState valueType; 3795TypeWithState resultType = ResultType; 3805var result = resultType.WithNotNullState(); 3927SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3935SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3980var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4187TypeWithState convertCollection( 4214var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4320TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4324TypeWithState setAnalyzedNullability( 4334var result = TypeWithState.Create(type, resultState); 4503private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4738InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4751(TypeWithState resultType, conversionCompletion) = 4771InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4932TypeWithState.Create(containingType, receiverResult.RValueType.State), 4952SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4957var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5046var argumentType = argumentTypes[i]; 5065SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5097SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5102SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5136var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5145var expressionType = VisitRvalueWithState(expressionNoConversion); 5179inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5378private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5390var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5421return TypeWithState.Create(resultType, resultState); 5438var leftType = ResultType; 5465var rightType = VisitRvalueWithState(rightOperand); 5508static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5543var leftResult = ResultType; 5596SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5604TypeWithState leftType, 5607TypeWithState rightType, 5610var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5614private TypeWithState ReinferAndVisitBinaryOperator( 5622TypeWithState leftType, 5626TypeWithState rightType) 5636TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5637TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5659TypeWithState operandType) 5692var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5702TypeWithState leftUnderlyingType, 5703TypeWithState rightUnderlyingType) 5768private TypeWithState VisitBinaryOperatorOperandConversion( 5769BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5793private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5796TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5812var leftType = ResultType; 5817var rightType = ResultType; 6171TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6176TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6192var rightUnconditionalResult = ResultType; 6195SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6200TypeWithState leftResult = ResultType; 6211TypeWithState rightResult = ResultType; 6229SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6257var conversionResult = VisitConversion( 6264TypeWithState.Create(leftType, NullableFlowState.NotNull), 6296var operandType = ResultType; 6301var result = VisitConversion(boundConversion, 6448SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6484TypeWithState consequenceRValue; 6485TypeWithState alternativeRValue; 6524SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6588SetResultType(node, TypeWithState.Create(resultType, default)); 6599TypeWithState typeWithState = convertArms( 6606TypeWithState convertArms( 6608TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6614TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6623TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6633var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6646return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6656TypeWithState consequenceRValue, 6657TypeWithState alternativeRValue, 6675(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6688(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6705private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6710TypeWithState operandType, 6727var resultType = VisitConversion( 6771SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6797TypeWithState receiverType = visitAndCheckReceiver(node); 6871TypeWithState receiverType = visitAndCheckReceiver(node); 6899TypeWithState visitAndCheckReceiver(BoundCall node) 6909void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6950var returnState = GetReturnTypeWithState(method); 6961private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6963TypeWithState receiverType = default; 6978TypeWithState receiverType, 7117private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7253void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7354private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7387private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7389return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7459private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7463return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7468return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7803TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8234var resultType = result.RValueType; 8252var stateAfterConversion = VisitConversion( 8307private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8325private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8384var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8388parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8411var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8414var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8475void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8525static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8530return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8536return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8542static TypeWithState applyPostConditionsWhenTrue(TypeSymbol? receiverType, TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8551return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8555return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8561static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8570return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8574return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8862if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9139private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9144return TypeWithState.Create(type.Type, state); 9300private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9312private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9322var operandType = VisitRvalueWithState(operand); 9326(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9331Conversion conversion, TypeWithState operandType, 9336return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9346var resultType = VisitConversion( 9363Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9413ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9418SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9443SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9456ImmutableArray<TypeWithState> types, 9486void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9500private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9595var convertedType = VisitUserDefinedConversion( 9620TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField)); 9627valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9645TypeWithState convertedType = VisitUnionConversion( 9825private TypeWithState VisitConversion( 9830TypeWithState operandType, 9852if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9935return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10207TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10241static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10253var resultType = TypeWithState.Create(targetType, resultState); 10257static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10291static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10319static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10329static NullableFlowState getConversionResultState(TypeWithState operandType) 10445private TypeWithState VisitUserDefinedConversion( 10450TypeWithState operandType, 10469var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10501TypeWithState underlyingOperandType = default; 10577private TypeWithState GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState) 10580TypeWithState returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState); 10597private TypeWithState VisitUnionConversion( 10602TypeWithState operandType, 10621var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull); 10705TypeWithState unionTypeWithState; 10710unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10776private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10804private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10809return TypeWithState.Create(type, state); 10812private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10825private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10837private TypeWithState ClassifyAndVisitConversion( 10840TypeWithState operandType, 10915TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10919TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10921var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 11021var argState = VisitRvalueWithState(arg); 11074private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11089private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11091_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11100if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11218var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11228var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11271TypeWithState rightState; 11294SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11314var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11323private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11415private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11445private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11459private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11468var rightResult = ResultType; 11560private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11583TypeWithState operandType; 11584TypeWithState valueType; 11636var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11693private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11746TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11769SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11773SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11785var opType = VisitRvalueWithState(node.Operand); 11793SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11800var operandType = VisitRvalueWithState(node.Operand); 11856TypeWithState resultOfOperandConversionType; 11880TypeWithState resultOfIncrementType; 11906TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11939TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11962SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11966SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11979var opType = ResultType; 11990SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 12000var leftTypeWithState = ResultType; 12008var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 12015var resultTypeWithState = ReinferAndVisitBinaryOperator( 12068SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12199TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12252var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 12316var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12340var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12350resultType = TypeWithState.Create(resultType.Type, state); 12462var resultTypeWithState = VisitRvalueWithState(expr); 12532var convertedResult = VisitConversion( 12550TypeWithState currentPropertyGetterTypeWithState; 12591var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12637var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12654VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12668TypeWithState result = sourceState; 12669TypeWithState resultForType = sourceState; 12760private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12802TypeWithState resultType; 12834var operandResult = ResultType; 12836var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12867TypeWithState adjustForLifting(TypeWithState argumentResult) => 12868TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12874private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 13009TypeWithState leftType = ResultType; 13018TypeWithState rightType = ResultType; 13025TypeWithState leftType = ResultType; 13040var rightType = ResultType; 13048TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 13049TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13134SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13156SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13176SetResultType(node, TypeWithState.ForType(type)); 13216var argumentType = VisitRvalueWithState(node.Operand); 13238SetResultType(node, TypeWithState.Create(type, resultState)); 13270SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13345if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13447SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13469private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13513private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13554SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13569SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13618SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13624SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13631var rValueType = TypeWithState.ForType(node.Type); 13653var result = VisitRvalueWithState(expr); 13834Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (19)
301var expressionState = ResultType; 381TypeWithState expressionTypeWithState, 527var inputTypeWithState = TypeWithState.Create(inputType, inputState); 634var value = TypeWithState.Create(tempType, tempState); 646TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 999receiverType: TypeWithState.Create(inputType, NullableFlowState.NotNull), 1080var expressionState = ResultType; 1108var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 1129var armType = VisitRvalueWithState(expression); 1151TypeWithState resultType; 1164resultType = TypeWithState.Create(inferredType, inferredState); 1179TypeWithState convertArms( 1183ArrayBuilder<TypeWithState> resultTypes, 1214TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1228ArrayBuilder<TypeWithState> resultTypes, 1253var 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;