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;
341 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (340)
Binder\Binder_Patterns.cs (1)
1739var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Semantics\BestTypeInferrer.cs (2)
36public static NullableFlowState GetNullableState(ArrayBuilder<TypeWithState> types) 39foreach (var type in types)
FlowAnalysis\NullableWalker.cs (312)
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) 2338private TypeWithState VisitRvalueWithState(BoundExpression? node) 2382/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2422TypeWithState valueType, 2477static bool isMaybeDefaultValue(TypeWithState valueType) 2514var valueState = GetParameterState( 2553var valueWhen = ApplyUnconditionalAnnotations( 2567static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2645TypeWithState valueType, 2686static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3032var resultType = VisitOptionalImplicitConversion( 3046internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3050return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3055return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3086TypeWithState returnState; 3103var result = VisitRvalueWithState(expr); 3135private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3138TypeWithState resultType = ResultType; 3205SetResultType(node, TypeWithState.ForType(node.Type)); 3575var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3701TypeWithState valueType; 3750TypeWithState resultType = ResultType; 3760var result = resultType.WithNotNullState(); 3882SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3890SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3935var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4140TypeWithState convertCollection( 4167var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4273TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4277TypeWithState setAnalyzedNullability( 4287var result = TypeWithState.Create(type, resultState); 4455private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty) 4753InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4766(TypeWithState resultType, conversionCompletion) = 4786InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4894TypeWithState.Create(containingType, receiverResult.RValueType.State), 4914SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4919var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 5008var argumentType = argumentTypes[i]; 5027SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 5059SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 5064SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5098var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5107var expressionType = VisitRvalueWithState(expressionNoConversion); 5141inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5340private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5352var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5383return TypeWithState.Create(resultType, resultState); 5400var leftType = ResultType; 5427var rightType = VisitRvalueWithState(rightOperand); 5470static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5505var leftResult = ResultType; 5558SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5566TypeWithState leftType, 5569TypeWithState rightType, 5572var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5576private TypeWithState ReinferAndVisitBinaryOperator( 5584TypeWithState leftType, 5588TypeWithState rightType) 5598TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5599TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5621TypeWithState operandType) 5654var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5664TypeWithState leftUnderlyingType, 5665TypeWithState rightUnderlyingType) 5730private TypeWithState VisitBinaryOperatorOperandConversion( 5731BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5755private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5758TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5774var leftType = ResultType; 5779var rightType = ResultType; 6133TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6138TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6154var rightUnconditionalResult = ResultType; 6157SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6162TypeWithState leftResult = ResultType; 6173TypeWithState rightResult = ResultType; 6191SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6219var conversionResult = VisitConversion( 6226TypeWithState.Create(leftType, NullableFlowState.NotNull), 6258var operandType = ResultType; 6263var result = VisitConversion(boundConversion, 6410SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6446TypeWithState consequenceRValue; 6447TypeWithState alternativeRValue; 6486SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6550SetResultType(node, TypeWithState.Create(resultType, default)); 6561TypeWithState typeWithState = convertArms( 6568TypeWithState convertArms( 6570TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6576TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6585TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6595var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6608return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6618TypeWithState consequenceRValue, 6619TypeWithState alternativeRValue, 6637(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6650(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6667private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6672TypeWithState operandType, 6689var resultType = VisitConversion( 6733SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6759TypeWithState receiverType = visitAndCheckReceiver(node); 6833TypeWithState receiverType = visitAndCheckReceiver(node); 6861TypeWithState visitAndCheckReceiver(BoundCall node) 6871void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6912var returnState = GetReturnTypeWithState(method); 6923private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6925TypeWithState receiverType = default; 6940TypeWithState receiverType, 7058private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7194void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7295private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7328private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7330return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7400private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7404return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7409return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7729TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8165var resultType = result.RValueType; 8183var stateAfterConversion = VisitConversion( 8238private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8256private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8314var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8318parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8341var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8344var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8405void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter) 8461static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8466return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8472return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8478static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations, RefKind refKind, ParameterSymbol parameter) 8487return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8491return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8497static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8506return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8510return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8798if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 9075private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 9080return TypeWithState.Create(type.Type, state); 9236private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9248private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9258var operandType = VisitRvalueWithState(operand); 9262(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9267Conversion conversion, TypeWithState operandType, 9272return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9282var resultType = VisitConversion( 9299Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9349ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9354SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9379SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9392ImmutableArray<TypeWithState> types, 9422void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9436private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9531var convertedType = VisitUserDefinedConversion( 9556TypeWithState valueFieldType = ApplyUnconditionalAnnotations(valueField.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(valueField)); 9563valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9581TypeWithState convertedType = VisitUnionConversion( 9762private TypeWithState VisitConversion( 9767TypeWithState operandType, 9789if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9872return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10145TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 10179static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 10191var resultType = TypeWithState.Create(targetType, resultState); 10195static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10229static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10257static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10267static NullableFlowState getConversionResultState(TypeWithState operandType) 10383private TypeWithState VisitUserDefinedConversion( 10388TypeWithState operandType, 10407var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10439TypeWithState underlyingOperandType = default; 10528private TypeWithState VisitUnionConversion( 10533TypeWithState operandType, 10637var unionTypeWithState = TypeWithState.Create(toType, NullableFlowState.NotNull); 10675return TypeWithState.Create(targetType, NullableFlowState.NotNull); 10697private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10725private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10730return TypeWithState.Create(type, state); 10733private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10746private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10758private TypeWithState ClassifyAndVisitConversion( 10761TypeWithState operandType, 10836TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10840TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10842var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10942var argState = VisitRvalueWithState(arg); 10995private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 11010private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 11012_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 11021if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 11139var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 11149var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 11192TypeWithState rightState; 11215SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 11235var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 11244private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 11338private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 11368private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 11382private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 11391var rightResult = ResultType; 11481private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11504TypeWithState operandType; 11505TypeWithState valueType; 11557var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11614private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11667TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11690SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11694SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11706var opType = VisitRvalueWithState(node.Operand); 11714SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11721var operandType = VisitRvalueWithState(node.Operand); 11773TypeWithState resultOfOperandConversionType; 11797TypeWithState resultOfIncrementType; 11823TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11856TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11879SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11883SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11896var opType = ResultType; 11907SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11917var leftTypeWithState = ResultType; 11925var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11932var resultTypeWithState = ReinferAndVisitBinaryOperator( 11985SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 12086TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 12129var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 12193var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 12217var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 12227resultType = TypeWithState.Create(resultType.Type, state); 12339var resultTypeWithState = VisitRvalueWithState(expr); 12409var convertedResult = VisitConversion( 12427TypeWithState currentPropertyGetterTypeWithState; 12468var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12514var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12531VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12545TypeWithState result = sourceState; 12546TypeWithState resultForType = sourceState; 12637private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12679TypeWithState resultType; 12711var operandResult = ResultType; 12713var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12744TypeWithState adjustForLifting(TypeWithState argumentResult) => 12745TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12751private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12886TypeWithState leftType = ResultType; 12895TypeWithState rightType = ResultType; 12902TypeWithState leftType = ResultType; 12917var rightType = ResultType; 12925TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12926TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 13018SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13040SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 13060SetResultType(node, TypeWithState.ForType(type)); 13100var argumentType = VisitRvalueWithState(node.Operand); 13122SetResultType(node, TypeWithState.Create(type, resultState)); 13154SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 13229if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 13331SetResultType(expression, TypeWithState.Create(expression.Type, default)); 13353private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 13397private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13438SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13453SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13502SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13508SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13515var rValueType = TypeWithState.ForType(node.Type); 13537var result = VisitRvalueWithState(expr); 13718Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (18)
298var expressionState = ResultType; 378TypeWithState expressionTypeWithState, 523var inputTypeWithState = TypeWithState.Create(inputType, inputState); 630var value = TypeWithState.Create(tempType, tempState); 642TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 991var expressionState = ResultType; 1014var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 1035var armType = VisitRvalueWithState(expression); 1057TypeWithState resultType; 1070resultType = TypeWithState.Create(inferredType, inferredState); 1085TypeWithState convertArms( 1089ArrayBuilder<TypeWithState> resultTypes, 1120TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1134ArrayBuilder<TypeWithState> resultTypes, 1159var 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;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
483var type = TypeWithState.Create(