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)
1591var 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) 2362private TypeWithState VisitRvalueWithState(BoundExpression? node) 2406/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2446TypeWithState valueType, 2501static bool isMaybeDefaultValue(TypeWithState valueType) 2538var valueState = GetParameterState( 2577var valueWhen = ApplyUnconditionalAnnotations( 2591static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2669TypeWithState valueType, 2710static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3063var resultType = VisitOptionalImplicitConversion( 3077internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3081return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3086return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3117TypeWithState returnState; 3134var result = VisitRvalueWithState(expr); 3166private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3169TypeWithState resultType = ResultType; 3236SetResultType(node, TypeWithState.ForType(node.Type)); 3606var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3732TypeWithState valueType; 3781TypeWithState resultType = ResultType; 3791var result = resultType.WithNotNullState(); 3913SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3921SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3966var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4173TypeWithState convertCollection( 4200var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4306TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4310TypeWithState setAnalyzedNullability( 4320var result = TypeWithState.Create(type, resultState); 4489private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4724InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4737(TypeWithState resultType, conversionCompletion) = 4757InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4918TypeWithState.Create(containingType, receiverResult.RValueType.State), 4938SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4943var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5032var argumentType = argumentTypes[i]; 5051SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5083SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5088SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5122var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5131var expressionType = VisitRvalueWithState(expressionNoConversion); 5165inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5364private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5376var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5407return TypeWithState.Create(resultType, resultState); 5424var leftType = ResultType; 5451var rightType = VisitRvalueWithState(rightOperand); 5494static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5529var leftResult = ResultType; 5582SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5590TypeWithState leftType, 5593TypeWithState rightType, 5596var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5600private TypeWithState ReinferAndVisitBinaryOperator( 5608TypeWithState leftType, 5612TypeWithState rightType) 5622TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5623TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5645TypeWithState operandType) 5678var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5688TypeWithState leftUnderlyingType, 5689TypeWithState rightUnderlyingType) 5754private TypeWithState VisitBinaryOperatorOperandConversion( 5755BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5779private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5782TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5798var leftType = ResultType; 5803var rightType = ResultType; 6157TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6162TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6178var rightUnconditionalResult = ResultType; 6181SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6186TypeWithState leftResult = ResultType; 6197TypeWithState rightResult = ResultType; 6215SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6243var conversionResult = VisitConversion( 6250TypeWithState.Create(leftType, NullableFlowState.NotNull), 6282var operandType = ResultType; 6287var result = VisitConversion(boundConversion, 6434SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6470TypeWithState consequenceRValue; 6471TypeWithState alternativeRValue; 6510SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6574SetResultType(node, TypeWithState.Create(resultType, default)); 6585TypeWithState typeWithState = convertArms( 6592TypeWithState convertArms( 6594TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6600TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6609TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6619var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6632return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6642TypeWithState consequenceRValue, 6643TypeWithState alternativeRValue, 6661(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6674(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6691private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6696TypeWithState operandType, 6713var resultType = VisitConversion( 6757SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6783TypeWithState receiverType = visitAndCheckReceiver(node); 6857TypeWithState receiverType = visitAndCheckReceiver(node); 6885TypeWithState visitAndCheckReceiver(BoundCall node) 6895void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6936var returnState = GetReturnTypeWithState(method); 6947private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6949TypeWithState receiverType = default; 6964TypeWithState receiverType, 7103private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7239void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7340private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7373private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7375return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7445private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7449return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7454return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7789TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8220var resultType = result.RValueType; 8238var stateAfterConversion = VisitConversion( 8293private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8311private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8370var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8374parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8397var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8400var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8461void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8511static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8516return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8522return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8528static TypeWithState applyPostConditionsWhenTrue(TypeSymbol? receiverType, TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8537return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8541return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8547static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8556return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8560return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8848if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9125private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9130return TypeWithState.Create(type.Type, state); 9286private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9298private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9308var operandType = VisitRvalueWithState(operand); 9312(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9317Conversion conversion, TypeWithState operandType, 9322return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9332var resultType = VisitConversion( 9349Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9399ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9404SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9429SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9442ImmutableArray<TypeWithState> types, 9472void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9486private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9581var convertedType = VisitUserDefinedConversion( 9606TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField)); 9613valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9631TypeWithState convertedType = VisitUnionConversion( 9811private TypeWithState VisitConversion( 9816TypeWithState operandType, 9838if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9921return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10193TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10227static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10239var resultType = TypeWithState.Create(targetType, resultState); 10243static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10277static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10305static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10315static NullableFlowState getConversionResultState(TypeWithState operandType) 10431private TypeWithState VisitUserDefinedConversion( 10436TypeWithState operandType, 10455var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10487TypeWithState underlyingOperandType = default; 10563private TypeWithState GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState) 10566TypeWithState returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState); 10583private TypeWithState VisitUnionConversion( 10588TypeWithState operandType, 10607var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull); 10695TypeWithState unionTypeWithState; 10700unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10766private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10794private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10799return TypeWithState.Create(type, state); 10802private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10815private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10827private TypeWithState ClassifyAndVisitConversion( 10830TypeWithState operandType, 10905TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10909TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10911var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 11011var argState = VisitRvalueWithState(arg); 11064private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11079private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11081_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11090if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11208var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11218var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11261TypeWithState rightState; 11284SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11304var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11313private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11405private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11435private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11449private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11458var rightResult = ResultType; 11550private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11573TypeWithState operandType; 11574TypeWithState valueType; 11626var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11683private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11736TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11759SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11763SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11775var opType = VisitRvalueWithState(node.Operand); 11783SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11790var operandType = VisitRvalueWithState(node.Operand); 11846TypeWithState resultOfOperandConversionType; 11870TypeWithState resultOfIncrementType; 11896TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11929TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11952SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11956SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11969var opType = ResultType; 11980SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11990var leftTypeWithState = ResultType; 11998var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 12005var resultTypeWithState = ReinferAndVisitBinaryOperator( 12058SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12189TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12242var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 12306var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12330var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12340resultType = TypeWithState.Create(resultType.Type, state); 12452var resultTypeWithState = VisitRvalueWithState(expr); 12522var convertedResult = VisitConversion( 12540TypeWithState currentPropertyGetterTypeWithState; 12581var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12627var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12644VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12658TypeWithState result = sourceState; 12659TypeWithState resultForType = sourceState; 12750private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12792TypeWithState resultType; 12824var operandResult = ResultType; 12826var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12857TypeWithState adjustForLifting(TypeWithState argumentResult) => 12858TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12864private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12999TypeWithState leftType = ResultType; 13008TypeWithState rightType = ResultType; 13015TypeWithState leftType = ResultType; 13030var rightType = ResultType; 13038TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 13039TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13124SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13146SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13166SetResultType(node, TypeWithState.ForType(type)); 13206var argumentType = VisitRvalueWithState(node.Operand); 13228SetResultType(node, TypeWithState.Create(type, resultState)); 13260SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13335if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13437SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13459private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13503private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13544SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13559SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13608SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13614SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13621var rValueType = TypeWithState.ForType(node.Type); 13643var result = VisitRvalueWithState(expr); 13824Debug.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;