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;
330 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (330)
Binder\Binder_Patterns.cs (1)
1358var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (1)
36public static NullableFlowState GetNullableState(ArrayBuilder<TypeWithState> types)
FlowAnalysis\NullableWalker.cs (305)
99public readonly TypeWithState RValueType; 111public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType) 120public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda) 128RValueType = TypeWithState.Create(type, state); 137public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults) 216private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull); 237private PooledDictionary<BoundExpression, TypeWithState>? _methodGroupReceiverMapOpt; 248private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>? _targetTypedAnalysisCompletionOpt; 253/// 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, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 255private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>> TargetTypedAnalysisCompletion 256=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>.GetInstance(); 297private TypeWithState ResultType 302private void SetResultType(BoundExpression? expression, TypeWithState type, bool updateAnalyzedNullability = true) 307private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState type) 341private void SetResult(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null) 361private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null) 2313private TypeWithState VisitRvalueWithState(BoundExpression? node) 2357/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2397TypeWithState valueType, 2452static bool isMaybeDefaultValue(TypeWithState valueType) 2489var valueState = GetParameterState( 2528var valueWhen = ApplyUnconditionalAnnotations( 2542static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2620TypeWithState valueType, 2661static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3006var resultType = VisitOptionalImplicitConversion( 3020internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3024return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3029return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3060TypeWithState returnState; 3077var result = VisitRvalueWithState(expr); 3109private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3112TypeWithState resultType = ResultType; 3181SetResultType(node, TypeWithState.ForType(node.Type)); 3550var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3651TypeWithState valueType; 3700TypeWithState resultType = ResultType; 3710var result = resultType.WithNotNullState(); 3832SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3840SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3853var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/, TypeWithState>>.GetInstance(); 3875var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 3881void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> elementConversionCompletions) 3915var resultType = VisitConversion( 3973TypeWithState convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> completions) 3995var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4090TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4094TypeWithState setAnalyzedNullability( 4104var result = TypeWithState.Create(type, resultState); 4465Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4478(TypeWithState resultType, conversionCompletion) = 4498Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4606TypeWithState.Create(containingType, receiverResult.RValueType.State), 4626SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4631var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4739SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4771SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4776SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 4810var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 4819var expressionType = VisitRvalueWithState(expressionNoConversion); 4853inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5052private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5064var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5095return TypeWithState.Create(resultType, resultState); 5112var leftType = ResultType; 5139var rightType = VisitRvalueWithState(rightOperand); 5182static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5217var leftResult = ResultType; 5270SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5278TypeWithState leftType, 5281TypeWithState rightType, 5284var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5288private TypeWithState ReinferAndVisitBinaryOperator( 5296TypeWithState leftType, 5300TypeWithState rightType) 5310TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5311TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5333TypeWithState operandType) 5366var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5376TypeWithState leftUnderlyingType, 5377TypeWithState rightUnderlyingType) 5442private TypeWithState VisitBinaryOperatorOperandConversion( 5443BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5467private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5470TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5486var leftType = ResultType; 5491var rightType = ResultType; 5845TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 5850TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5866var rightUnconditionalResult = ResultType; 5869SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 5874TypeWithState leftResult = ResultType; 5885TypeWithState rightResult = ResultType; 5903SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 5929var conversionResult = VisitConversion( 5936TypeWithState.Create(leftType, NullableFlowState.NotNull), 5968var operandType = ResultType; 5973var result = VisitConversion(boundConversion, 6120SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6156TypeWithState consequenceRValue; 6157TypeWithState alternativeRValue; 6196SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6260SetResultType(node, TypeWithState.Create(resultType, default)); 6271TypeWithState typeWithState = convertArms( 6278TypeWithState convertArms( 6280TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6286TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6295TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6305var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6318return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6328TypeWithState consequenceRValue, 6329TypeWithState alternativeRValue, 6347(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6360(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6377private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6382TypeWithState operandType, 6399var resultType = VisitConversion( 6443SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6469TypeWithState receiverType = visitAndCheckReceiver(node); 6524TypeWithState receiverType = visitAndCheckReceiver(node); 6552TypeWithState visitAndCheckReceiver(BoundCall node) 6557void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6575var returnState = GetReturnTypeWithState(method); 6586private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6588TypeWithState receiverType = default; 6603TypeWithState receiverType, 6720private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 6856void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 6957private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 6990private TypeWithState GetReturnTypeWithState(MethodSymbol method) 6992return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7062private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7066return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7071return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7403TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7814var resultType = result.RValueType; 7832var stateAfterConversion = VisitConversion( 7887private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 7905private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 7963var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 7967parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 7990var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 7993var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8054void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8085static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8090return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8096return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8102static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8111return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8115return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8121static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8130return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8134return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8376if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8642private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8647return TypeWithState.Create(type.Type, state); 8802private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 8814private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 8824var operandType = VisitRvalueWithState(operand); 8828(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 8833Conversion conversion, TypeWithState operandType, 8838return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 8848var resultType = VisitConversion( 8865Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 8915ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 8920SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 8945SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 8958ImmutableArray<TypeWithState> types, 8988void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9002private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9096var convertedType = VisitUserDefinedConversion( 9269private TypeWithState VisitConversion( 9274TypeWithState operandType, 9294if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9376return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9591TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9625static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9637var resultType = TypeWithState.Create(targetType, resultState); 9641static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9675static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9703static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 9713static NullableFlowState getConversionResultState(TypeWithState operandType) 9821private TypeWithState VisitUserDefinedConversion( 9826TypeWithState operandType, 9846var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 9878TypeWithState underlyingOperandType = default; 9986private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10009private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10014return TypeWithState.Create(type, state); 10017private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10030private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10042private TypeWithState ClassifyAndVisitConversion( 10045TypeWithState operandType, 10120TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10124TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10126var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10226var argState = VisitRvalueWithState(arg); 10279private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10294private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10296_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10305if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10423var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10433var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10476TypeWithState rightState; 10499SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10519var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10528private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10622private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10652private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10666private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10675var rightResult = ResultType; 10767private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 10790TypeWithState operandType; 10791TypeWithState valueType; 10843var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 10900private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 10953TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 10973SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 10977SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 10989var opType = VisitRvalueWithState(node.Operand); 10997SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11004var operandType = VisitRvalueWithState(node.Operand); 11048TypeWithState resultOfOperandConversionType; 11072TypeWithState resultOfIncrementType; 11098TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11131TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11151SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11155SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11168var opType = ResultType; 11179SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11189var leftTypeWithState = ResultType; 11197var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11204var resultTypeWithState = ReinferAndVisitBinaryOperator( 11257SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11350TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11393var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11451var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11466var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11476resultType = TypeWithState.Create(resultType.Type, state); 11580var resultTypeWithState = VisitRvalueWithState(expr); 11645var convertedResult = VisitConversion( 11662TypeWithState currentPropertyGetterTypeWithState; 11703var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 11759var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 11776VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 11790TypeWithState result = sourceState; 11791TypeWithState resultForType = sourceState; 11917TypeWithState resultType; 11949var operandResult = ResultType; 11951var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 11982TypeWithState adjustForLifting(TypeWithState argumentResult) => 11983TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 11989private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12124TypeWithState leftType = ResultType; 12133TypeWithState rightType = ResultType; 12140TypeWithState leftType = ResultType; 12155var rightType = ResultType; 12163TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12164TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12251SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12273SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12293SetResultType(node, TypeWithState.ForType(type)); 12333var argumentType = VisitRvalueWithState(node.Operand); 12355SetResultType(node, TypeWithState.Create(type, resultState)); 12387SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12462if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12564SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12586private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12630private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 12671SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12686SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12735SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12741SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 12748var rValueType = TypeWithState.ForType(node.Type); 12770var result = VisitRvalueWithState(expr); 12898Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (16)
298var expressionState = ResultType; 378TypeWithState expressionTypeWithState, 683var value = TypeWithState.Create(tempType, tempState); 695TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 891var expressionState = ResultType; 914var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 935var armType = VisitRvalueWithState(expression); 957TypeWithState resultType; 970resultType = TypeWithState.Create(inferredType, inferredState); 985TypeWithState convertArms( 989ArrayBuilder<TypeWithState> resultTypes, 1020TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1034ArrayBuilder<TypeWithState> resultTypes, 1059var 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;