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;
334 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (333)
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 (307)
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) 2337private TypeWithState VisitRvalueWithState(BoundExpression? node) 2381/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2421TypeWithState valueType, 2476static bool isMaybeDefaultValue(TypeWithState valueType) 2513var valueState = GetParameterState( 2552var valueWhen = ApplyUnconditionalAnnotations( 2566static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2644TypeWithState valueType, 2685static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3030var resultType = VisitOptionalImplicitConversion( 3044internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3048return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3053return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3084TypeWithState returnState; 3101var result = VisitRvalueWithState(expr); 3133private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3136TypeWithState resultType = ResultType; 3205SetResultType(node, TypeWithState.ForType(node.Type)); 3574var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3673TypeWithState valueType; 3722TypeWithState resultType = ResultType; 3732var result = resultType.WithNotNullState(); 3854SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3862SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3875var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/, TypeWithState>>.GetInstance(); 3897var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 3903void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> elementConversionCompletions) 3937var resultType = VisitConversion( 3995TypeWithState convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> completions) 4017var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4111TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4115TypeWithState setAnalyzedNullability( 4125var result = TypeWithState.Create(type, resultState); 4524Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4537(TypeWithState resultType, conversionCompletion) = 4557Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4665TypeWithState.Create(containingType, receiverResult.RValueType.State), 4685SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4690var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4779var argumentType = argumentTypes[i]; 4798SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4830SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4835SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 4869var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 4878var expressionType = VisitRvalueWithState(expressionNoConversion); 4912inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5111private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5123var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5154return TypeWithState.Create(resultType, resultState); 5171var leftType = ResultType; 5198var rightType = VisitRvalueWithState(rightOperand); 5241static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5276var leftResult = ResultType; 5329SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5337TypeWithState leftType, 5340TypeWithState rightType, 5343var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5347private TypeWithState ReinferAndVisitBinaryOperator( 5355TypeWithState leftType, 5359TypeWithState rightType) 5369TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5370TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5392TypeWithState operandType) 5425var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5435TypeWithState leftUnderlyingType, 5436TypeWithState rightUnderlyingType) 5501private TypeWithState VisitBinaryOperatorOperandConversion( 5502BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5526private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5529TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5545var leftType = ResultType; 5550var rightType = ResultType; 5904TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 5909TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5925var rightUnconditionalResult = ResultType; 5928SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 5933TypeWithState leftResult = ResultType; 5944TypeWithState rightResult = ResultType; 5962SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 5988var conversionResult = VisitConversion( 5995TypeWithState.Create(leftType, NullableFlowState.NotNull), 6027var operandType = ResultType; 6032var result = VisitConversion(boundConversion, 6179SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6215TypeWithState consequenceRValue; 6216TypeWithState alternativeRValue; 6255SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6319SetResultType(node, TypeWithState.Create(resultType, default)); 6330TypeWithState typeWithState = convertArms( 6337TypeWithState convertArms( 6339TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6345TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6354TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6364var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6377return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6387TypeWithState consequenceRValue, 6388TypeWithState alternativeRValue, 6406(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6419(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6436private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6441TypeWithState operandType, 6458var resultType = VisitConversion( 6502SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6528TypeWithState receiverType = visitAndCheckReceiver(node); 6602TypeWithState receiverType = visitAndCheckReceiver(node); 6630TypeWithState visitAndCheckReceiver(BoundCall node) 6640void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6676var returnState = GetReturnTypeWithState(method); 6687private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6689TypeWithState receiverType = default; 6704TypeWithState receiverType, 6821private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 6957void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7058private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7091private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7093return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7163private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7167return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7172return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7499TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7910var resultType = result.RValueType; 7928var stateAfterConversion = VisitConversion( 7983private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8001private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8059var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8063parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8086var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8089var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8150void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8181static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8186return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8192return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8198static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8207return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8211return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8217static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8226return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8230return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8518if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8784private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8789return TypeWithState.Create(type.Type, state); 8945private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 8957private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 8967var operandType = VisitRvalueWithState(operand); 8971(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 8976Conversion conversion, TypeWithState operandType, 8981return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 8991var resultType = VisitConversion( 9008Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9058ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9063SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9088SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9101ImmutableArray<TypeWithState> types, 9131void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9145private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9239var convertedType = VisitUserDefinedConversion( 9412private TypeWithState VisitConversion( 9417TypeWithState operandType, 9437if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9519return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9734TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9768static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9780var resultType = TypeWithState.Create(targetType, resultState); 9784static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9818static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9846static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 9856static NullableFlowState getConversionResultState(TypeWithState operandType) 9972private TypeWithState VisitUserDefinedConversion( 9977TypeWithState operandType, 9997var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10029TypeWithState underlyingOperandType = default; 10137private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10160private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10165return TypeWithState.Create(type, state); 10168private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10181private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10193private TypeWithState ClassifyAndVisitConversion( 10196TypeWithState operandType, 10271TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10275TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10277var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10377var argState = VisitRvalueWithState(arg); 10430private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10445private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10447_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10456if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10574var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10584var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10627TypeWithState rightState; 10650SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10670var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10679private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10773private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10803private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10817private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10826var rightResult = ResultType; 10916private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 10939TypeWithState operandType; 10940TypeWithState valueType; 10992var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11049private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11102TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11121SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11125SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11137var opType = VisitRvalueWithState(node.Operand); 11145SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11152var operandType = VisitRvalueWithState(node.Operand); 11196TypeWithState resultOfOperandConversionType; 11220TypeWithState resultOfIncrementType; 11246TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11279TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11298SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11302SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11315var opType = ResultType; 11326SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11336var leftTypeWithState = ResultType; 11344var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11351var resultTypeWithState = ReinferAndVisitBinaryOperator( 11404SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11503TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11546var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11604var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11619var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11629resultType = TypeWithState.Create(resultType.Type, state); 11731var resultTypeWithState = VisitRvalueWithState(expr); 11800var convertedResult = VisitConversion( 11818TypeWithState currentPropertyGetterTypeWithState; 11859var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 11915var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 11932VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 11946TypeWithState result = sourceState; 11947TypeWithState resultForType = sourceState; 12038private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12080TypeWithState resultType; 12112var operandResult = ResultType; 12114var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12145TypeWithState adjustForLifting(TypeWithState argumentResult) => 12146TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12152private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12287TypeWithState leftType = ResultType; 12296TypeWithState rightType = ResultType; 12303TypeWithState leftType = ResultType; 12318var rightType = ResultType; 12326TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12327TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12414SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12436SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12456SetResultType(node, TypeWithState.ForType(type)); 12496var argumentType = VisitRvalueWithState(node.Operand); 12518SetResultType(node, TypeWithState.Create(type, resultState)); 12550SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12625if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12727SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12749private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12793private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 12834SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12849SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12898SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12904SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 12911var rValueType = TypeWithState.ForType(node.Type); 12933var result = VisitRvalueWithState(expr); 13061Debug.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(