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;
333 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (332)
Binder\Binder_Patterns.cs (1)
1358var 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 (306)
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, 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) 2339private TypeWithState VisitRvalueWithState(BoundExpression? node) 2383/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2423TypeWithState valueType, 2478static bool isMaybeDefaultValue(TypeWithState valueType) 2515var valueState = GetParameterState( 2554var valueWhen = ApplyUnconditionalAnnotations( 2568static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2646TypeWithState valueType, 2687static 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; 3207SetResultType(node, TypeWithState.ForType(node.Type)); 3576var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3675TypeWithState valueType; 3724TypeWithState resultType = ResultType; 3734var result = resultType.WithNotNullState(); 3856SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3864SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3877var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/, TypeWithState>>.GetInstance(); 3899var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 3905void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> elementConversionCompletions) 3939var resultType = VisitConversion( 3997TypeWithState convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> completions) 4019var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4114TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4118TypeWithState setAnalyzedNullability( 4128var result = TypeWithState.Create(type, resultState); 4527Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4540(TypeWithState resultType, conversionCompletion) = 4560Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4668TypeWithState.Create(containingType, receiverResult.RValueType.State), 4688SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4693var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4782var argumentType = argumentTypes[i]; 4801SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4833SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4838SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 4872var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 4881var expressionType = VisitRvalueWithState(expressionNoConversion); 4915inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5114private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5126var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5157return TypeWithState.Create(resultType, resultState); 5174var leftType = ResultType; 5201var rightType = VisitRvalueWithState(rightOperand); 5244static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5279var leftResult = ResultType; 5332SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5340TypeWithState leftType, 5343TypeWithState rightType, 5346var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5350private TypeWithState ReinferAndVisitBinaryOperator( 5358TypeWithState leftType, 5362TypeWithState rightType) 5372TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5373TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5395TypeWithState operandType) 5428var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5438TypeWithState leftUnderlyingType, 5439TypeWithState rightUnderlyingType) 5504private TypeWithState VisitBinaryOperatorOperandConversion( 5505BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5529private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5532TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5548var leftType = ResultType; 5553var rightType = ResultType; 5907TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 5912TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5928var rightUnconditionalResult = ResultType; 5931SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 5936TypeWithState leftResult = ResultType; 5947TypeWithState rightResult = ResultType; 5965SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 5991var conversionResult = VisitConversion( 5998TypeWithState.Create(leftType, NullableFlowState.NotNull), 6030var operandType = ResultType; 6035var result = VisitConversion(boundConversion, 6182SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6218TypeWithState consequenceRValue; 6219TypeWithState alternativeRValue; 6258SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6322SetResultType(node, TypeWithState.Create(resultType, default)); 6333TypeWithState typeWithState = convertArms( 6340TypeWithState convertArms( 6342TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6348TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6357TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6367var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6380return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6390TypeWithState consequenceRValue, 6391TypeWithState alternativeRValue, 6409(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6422(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6439private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6444TypeWithState operandType, 6461var resultType = VisitConversion( 6505SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6531TypeWithState receiverType = visitAndCheckReceiver(node); 6586TypeWithState receiverType = visitAndCheckReceiver(node); 6614TypeWithState visitAndCheckReceiver(BoundCall node) 6619void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6637var returnState = GetReturnTypeWithState(method); 6648private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6650TypeWithState receiverType = default; 6665TypeWithState receiverType, 6783private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 6919void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7020private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7053private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7055return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7125private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7129return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7134return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7461TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7872var resultType = result.RValueType; 7890var stateAfterConversion = VisitConversion( 7945private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 7963private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8021var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8025parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8048var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8051var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8112void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8143static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8148return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8154return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8160static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8169return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8173return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8179static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8188return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8192return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8480if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8746private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8751return TypeWithState.Create(type.Type, state); 8907private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 8919private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 8929var operandType = VisitRvalueWithState(operand); 8933(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 8938Conversion conversion, TypeWithState operandType, 8943return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 8953var resultType = VisitConversion( 8970Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9020ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9025SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9050SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9063ImmutableArray<TypeWithState> types, 9093void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9107private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9201var convertedType = VisitUserDefinedConversion( 9374private TypeWithState VisitConversion( 9379TypeWithState operandType, 9399if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9481return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9696TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9730static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9742var resultType = TypeWithState.Create(targetType, resultState); 9746static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9780static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9808static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 9818static NullableFlowState getConversionResultState(TypeWithState operandType) 9934private TypeWithState VisitUserDefinedConversion( 9939TypeWithState operandType, 9959var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 9991TypeWithState underlyingOperandType = default; 10099private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10122private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10127return TypeWithState.Create(type, state); 10130private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10143private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10155private TypeWithState ClassifyAndVisitConversion( 10158TypeWithState operandType, 10233TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10237TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10239var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10339var argState = VisitRvalueWithState(arg); 10392private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10407private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10409_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10418if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10536var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10546var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10589TypeWithState rightState; 10612SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10632var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10641private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10735private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10765private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10779private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10788var rightResult = ResultType; 10880private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 10903TypeWithState operandType; 10904TypeWithState valueType; 10956var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11013private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11066TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11086SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11090SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11102var opType = VisitRvalueWithState(node.Operand); 11110SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11117var operandType = VisitRvalueWithState(node.Operand); 11161TypeWithState resultOfOperandConversionType; 11185TypeWithState resultOfIncrementType; 11211TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11244TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11264SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11268SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11281var opType = ResultType; 11292SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11302var leftTypeWithState = ResultType; 11310var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11317var resultTypeWithState = ReinferAndVisitBinaryOperator( 11370SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11469TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11512var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11570var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11585var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11595resultType = TypeWithState.Create(resultType.Type, state); 11699var resultTypeWithState = VisitRvalueWithState(expr); 11769var convertedResult = VisitConversion( 11787TypeWithState currentPropertyGetterTypeWithState; 11828var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 11884var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 11901VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 11915TypeWithState result = sourceState; 11916TypeWithState resultForType = sourceState; 12042TypeWithState resultType; 12074var operandResult = ResultType; 12076var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12107TypeWithState adjustForLifting(TypeWithState argumentResult) => 12108TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12114private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12249TypeWithState leftType = ResultType; 12258TypeWithState rightType = ResultType; 12265TypeWithState leftType = ResultType; 12280var rightType = ResultType; 12288TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12289TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12376SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12398SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12418SetResultType(node, TypeWithState.ForType(type)); 12458var argumentType = VisitRvalueWithState(node.Operand); 12480SetResultType(node, TypeWithState.Create(type, resultState)); 12512SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12587if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12689SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12711private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12755private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 12796SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12811SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12860SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12866SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 12873var rValueType = TypeWithState.ForType(node.Type); 12895var result = VisitRvalueWithState(expr); 13023Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (16)
298var expressionState = ResultType; 378TypeWithState expressionTypeWithState, 685var value = TypeWithState.Create(tempType, tempState); 697TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 893var expressionState = ResultType; 916var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 937var armType = VisitRvalueWithState(expression); 959TypeWithState resultType; 972resultType = TypeWithState.Create(inferredType, inferredState); 987TypeWithState convertArms( 991ArrayBuilder<TypeWithState> resultTypes, 1022TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1036ArrayBuilder<TypeWithState> resultTypes, 1061var 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(