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) 2418private TypeWithState VisitRvalueWithState(BoundExpression? node) 2462/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2502TypeWithState valueType, 2557static bool isMaybeDefaultValue(TypeWithState valueType) 2594var valueState = GetParameterState( 2633var valueWhen = ApplyUnconditionalAnnotations( 2647static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2725TypeWithState valueType, 2766static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3119var resultType = VisitOptionalImplicitConversion( 3133internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3137return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3142return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3173TypeWithState returnState; 3190var result = VisitRvalueWithState(expr); 3222private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3225TypeWithState resultType = ResultType; 3292SetResultType(node, TypeWithState.ForType(node.Type)); 3662var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3788TypeWithState valueType; 3837TypeWithState resultType = ResultType; 3847var result = resultType.WithNotNullState(); 3969SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3977SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 4022var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4229TypeWithState convertCollection( 4256var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4362TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4366TypeWithState setAnalyzedNullability( 4376var result = TypeWithState.Create(type, resultState); 4545private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4780InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4793(TypeWithState resultType, conversionCompletion) = 4813InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4974TypeWithState.Create(containingType, receiverResult.RValueType.State), 4994SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4999var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5088var argumentType = argumentTypes[i]; 5107SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5139SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5144SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5178var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5187var expressionType = VisitRvalueWithState(expressionNoConversion); 5221inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5420private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5432var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5463return TypeWithState.Create(resultType, resultState); 5480var leftType = ResultType; 5507var rightType = VisitRvalueWithState(rightOperand); 5550static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5585var leftResult = ResultType; 5654SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5662TypeWithState leftType, 5665TypeWithState rightType, 5668var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5672private TypeWithState ReinferAndVisitBinaryOperator( 5680TypeWithState leftType, 5684TypeWithState rightType) 5694TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5695TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5717TypeWithState operandType) 5750var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5760TypeWithState leftUnderlyingType, 5761TypeWithState rightUnderlyingType) 5826private TypeWithState VisitBinaryOperatorOperandConversion( 5827BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5851private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5854TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5870var leftType = ResultType; 5875var rightType = ResultType; 6229TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6234TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6250var rightUnconditionalResult = ResultType; 6253SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6258TypeWithState leftResult = ResultType; 6269TypeWithState rightResult = ResultType; 6287SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6315var conversionResult = VisitConversion( 6322TypeWithState.Create(leftType, NullableFlowState.NotNull), 6354var operandType = ResultType; 6359var result = VisitConversion(boundConversion, 6506SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6542TypeWithState consequenceRValue; 6543TypeWithState alternativeRValue; 6582SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6646SetResultType(node, TypeWithState.Create(resultType, default)); 6657TypeWithState typeWithState = convertArms( 6664TypeWithState convertArms( 6666TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6672TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6681TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6691var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6704return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6714TypeWithState consequenceRValue, 6715TypeWithState alternativeRValue, 6733(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6746(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6763private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6768TypeWithState operandType, 6785var resultType = VisitConversion( 6829SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6855TypeWithState receiverType = visitAndCheckReceiver(node); 6929TypeWithState receiverType = visitAndCheckReceiver(node); 6957TypeWithState visitAndCheckReceiver(BoundCall node) 6967void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 7008var returnState = GetReturnTypeWithState(method); 7019private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 7021TypeWithState receiverType = default; 7036TypeWithState receiverType, 7175private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7311void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7412private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7445private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7447return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7517private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7521return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7526return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7861TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8292var resultType = result.RValueType; 8310var stateAfterConversion = VisitConversion( 8365private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8383private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8442var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8446parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8469var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8472var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8533void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8583static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8588return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8594return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8600static TypeWithState applyPostConditionsWhenTrue(TypeSymbol? receiverType, TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8609return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8613return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8619static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8628return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8632return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8920if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9197private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9202return TypeWithState.Create(type.Type, state); 9358private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9370private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9380var operandType = VisitRvalueWithState(operand); 9384(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9389Conversion conversion, TypeWithState operandType, 9394return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9404var resultType = VisitConversion( 9421Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9471ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9476SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9501SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9514ImmutableArray<TypeWithState> types, 9544void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9558private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9653var convertedType = VisitUserDefinedConversion( 9678TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField)); 9685valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9703TypeWithState convertedType = VisitUnionConversion( 9883private TypeWithState VisitConversion( 9888TypeWithState operandType, 9910if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9993return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10265TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10299static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10311var resultType = TypeWithState.Create(targetType, resultState); 10315static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10349static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10377static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10387static NullableFlowState getConversionResultState(TypeWithState operandType) 10503private TypeWithState VisitUserDefinedConversion( 10508TypeWithState operandType, 10527var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10559TypeWithState underlyingOperandType = default; 10635private TypeWithState GetConversionReturnTypeWithState(MethodSymbol method, bool isLiftedConversion, NullableFlowState operandState) 10638TypeWithState returnType = GetLiftedReturnTypeIfNecessary(isLiftedConversion, methodReturnType, operandState); 10655private TypeWithState VisitUnionConversion( 10660TypeWithState operandType, 10679var resultType = TypeWithState.Create(targetTypeWithNullability.Type, NullableFlowState.NotNull); 10767TypeWithState unionTypeWithState; 10772unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10838private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10866private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10871return TypeWithState.Create(type, state); 10874private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10887private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10899private TypeWithState ClassifyAndVisitConversion( 10902TypeWithState operandType, 10977TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10981TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10983var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 11083var argState = VisitRvalueWithState(arg); 11136private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11151private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11153_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11162if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11280var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11290var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11333TypeWithState rightState; 11356SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11383var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11392private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11484private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11514private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11528private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11537var rightResult = ResultType; 11629private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11652TypeWithState operandType; 11653TypeWithState valueType; 11705var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11762private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11815TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11838SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11842SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11854var opType = VisitRvalueWithState(node.Operand); 11862SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11869var operandType = VisitRvalueWithState(node.Operand); 11925TypeWithState resultOfOperandConversionType; 11949TypeWithState resultOfIncrementType; 11975TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 12008TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 12031SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 12035SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 12048var opType = ResultType; 12059SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 12069var leftTypeWithState = ResultType; 12077var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 12084var resultTypeWithState = ReinferAndVisitBinaryOperator( 12137SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12268TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12321var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 12385var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12409var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12419resultType = TypeWithState.Create(resultType.Type, state); 12540var resultTypeWithState = VisitRvalueWithState(expr); 12610var convertedResult = VisitConversion( 12628TypeWithState currentPropertyGetterTypeWithState; 12669var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12715var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12732VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12746TypeWithState result = sourceState; 12747TypeWithState resultForType = sourceState; 12838private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12880TypeWithState resultType; 12912var operandResult = ResultType; 12914var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12945TypeWithState adjustForLifting(TypeWithState argumentResult) => 12946TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12952private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 13087TypeWithState leftType = ResultType; 13096TypeWithState rightType = ResultType; 13103TypeWithState leftType = ResultType; 13118var rightType = ResultType; 13126TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 13127TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13212SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13234SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13254SetResultType(node, TypeWithState.ForType(type)); 13294var argumentType = VisitRvalueWithState(node.Operand); 13316SetResultType(node, TypeWithState.Create(type, resultState)); 13348SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13423if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13525SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13547private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13591private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13632SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13647SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13696SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13702SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13709var rValueType = TypeWithState.ForType(node.Type); 13731var result = VisitRvalueWithState(expr); 13912Debug.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;