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)
1580var 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_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;
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) 2411private TypeWithState VisitRvalueWithState(BoundExpression? node) 2455/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2495TypeWithState valueType, 2550static bool isMaybeDefaultValue(TypeWithState valueType) 2587var valueState = GetParameterState( 2626var valueWhen = ApplyUnconditionalAnnotations( 2640static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2718TypeWithState valueType, 2759static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3112var resultType = VisitOptionalImplicitConversion( 3126internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3130return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3135return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3166TypeWithState returnState; 3183var result = VisitRvalueWithState(expr); 3215private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3218TypeWithState resultType = ResultType; 3285SetResultType(node, TypeWithState.ForType(node.Type)); 3655var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: withExpr.CloneMethod)); 3781TypeWithState valueType; 3830TypeWithState resultType = ResultType; 3840var result = resultType.WithNotNullState(); 3962SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3970SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 4015var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4222TypeWithState convertCollection( 4249var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4356TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4360TypeWithState setAnalyzedNullability( 4370var result = TypeWithState.Create(type, resultState); 4550private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4790InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4803(TypeWithState resultType, conversionCompletion) = 4823InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4984TypeWithState.Create(containingType, receiverResult.RValueType.State), 5004SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5009var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5098var argumentType = argumentTypes[i]; 5117SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5149SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5154SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5188var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5197var expressionType = VisitRvalueWithState(expressionNoConversion); 5231inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5430private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5442var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5473return TypeWithState.Create(resultType, resultState); 5490var leftType = ResultType; 5517var rightType = VisitRvalueWithState(rightOperand); 5560static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5595var leftResult = ResultType; 5664SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5672TypeWithState leftType, 5675TypeWithState rightType, 5678var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5682private TypeWithState ReinferAndVisitBinaryOperator( 5690TypeWithState leftType, 5694TypeWithState rightType) 5704TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5705TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5727TypeWithState operandType) 5760var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5770TypeWithState leftUnderlyingType, 5771TypeWithState rightUnderlyingType) 5836private TypeWithState VisitBinaryOperatorOperandConversion( 5837BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5861private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5864TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5880var leftType = ResultType; 5885var rightType = ResultType; 6239TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6244TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6260var rightUnconditionalResult = ResultType; 6263SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6268TypeWithState leftResult = ResultType; 6279TypeWithState rightResult = ResultType; 6297SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6325var conversionResult = VisitConversion( 6332TypeWithState.Create(leftType, NullableFlowState.NotNull), 6364var operandType = ResultType; 6369var result = VisitConversion(boundConversion, 6516SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6552TypeWithState consequenceRValue; 6553TypeWithState alternativeRValue; 6592SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6656SetResultType(node, TypeWithState.Create(resultType, default)); 6667TypeWithState typeWithState = convertArms( 6674TypeWithState convertArms( 6676TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6682TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6691TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6701var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6714return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6724TypeWithState consequenceRValue, 6725TypeWithState alternativeRValue, 6743(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6756(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6773private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6778TypeWithState operandType, 6795var resultType = VisitConversion( 6839SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6865TypeWithState receiverType = visitAndCheckReceiver(node); 6939TypeWithState receiverType = visitAndCheckReceiver(node); 6967TypeWithState visitAndCheckReceiver(BoundCall node) 6977void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 7018var returnState = GetReturnTypeWithState(method); 7029private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 7031TypeWithState receiverType = default; 7046TypeWithState receiverType, 7185private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7321void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7422private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7455private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7457return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: method)); 7535private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7539return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7544return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7878TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8309var resultType = result.RValueType; 8327var stateAfterConversion = VisitConversion( 8382private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8400private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8459var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8463parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8486var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8489var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8550void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8600static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8605return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8611return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8617static TypeWithState applyPostConditionsWhenTrue(TypeSymbol? receiverType, TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8626return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8630return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8636static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8645return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8649return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8937if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9214private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9219return TypeWithState.Create(type.Type, state); 9375private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9387private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9397var operandType = VisitRvalueWithState(operand); 9401(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9406Conversion conversion, TypeWithState operandType, 9411return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9421var resultType = VisitConversion( 9438Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9488ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9493SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9518SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9531ImmutableArray<TypeWithState> types, 9561void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9575private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9670var convertedType = VisitUserDefinedConversion( 9695TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: null, symbol: valueField)); 9702valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9720TypeWithState convertedType = VisitUnionConversion( 9900private TypeWithState VisitConversion( 9905TypeWithState operandType, 9927if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 10010return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10282TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10316static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10328var resultType = TypeWithState.Create(targetType, resultState); 10332static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10366static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10394static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10404static NullableFlowState getConversionResultState(TypeWithState operandType) 10520private TypeWithState VisitUserDefinedConversion( 10525TypeWithState operandType, 10544var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10576TypeWithState underlyingOperandType = default; 10652private TypeWithState GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState) 10655TypeWithState returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState); 10672private TypeWithState VisitUnionConversion( 10677TypeWithState operandType, 10696var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull); 10784TypeWithState unionTypeWithState; 10789unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10855private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10883private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10888return TypeWithState.Create(type, state); 10891private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10904private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10916private TypeWithState ClassifyAndVisitConversion( 10919TypeWithState operandType, 10994TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10998TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 11000var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 11100var argState = VisitRvalueWithState(arg); 11153private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11168private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11170_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11179if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11297var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11307var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11350TypeWithState rightState; 11373SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11400var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11409private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11501private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11531private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11545private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11554var rightResult = ResultType; 11646private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11669TypeWithState operandType; 11670TypeWithState valueType; 11722var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11779private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11832TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11855SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11859SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11871var opType = VisitRvalueWithState(node.Operand); 11879SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11886var operandType = VisitRvalueWithState(node.Operand); 11942TypeWithState resultOfOperandConversionType; 11966TypeWithState resultOfIncrementType; 11992TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 12025TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 12048SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 12052SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 12065var opType = ResultType; 12076SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 12086var leftTypeWithState = ResultType; 12094var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 12101var resultTypeWithState = ReinferAndVisitBinaryOperator( 12154SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12285TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12338var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: receiverOpt?.Type, symbol: indexer)); 12402var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12426var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12436resultType = TypeWithState.Create(resultType.Type, state); 12557var resultTypeWithState = VisitRvalueWithState(expr); 12627var convertedResult = VisitConversion( 12645TypeWithState currentPropertyGetterTypeWithState; 12686var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12732var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12749VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12763TypeWithState result = sourceState; 12764TypeWithState resultForType = sourceState; 12855private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12897TypeWithState resultType; 12929var operandResult = ResultType; 12931var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12962TypeWithState adjustForLifting(TypeWithState argumentResult) => 12963TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12969private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 13104TypeWithState leftType = ResultType; 13113TypeWithState rightType = ResultType; 13120TypeWithState leftType = ResultType; 13135var rightType = ResultType; 13143TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 13144TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13229SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13251SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13271SetResultType(node, TypeWithState.ForType(type)); 13311var argumentType = VisitRvalueWithState(node.Operand); 13333SetResultType(node, TypeWithState.Create(type, resultState)); 13365SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13440if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13542SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13564private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13608private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13649SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13664SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13713SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13719SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13726var rValueType = TypeWithState.ForType(node.Type); 13748var result = VisitRvalueWithState(expr); 13937Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
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;