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)
1369var 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; 3203SetResultType(node, TypeWithState.ForType(node.Type)); 3573var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3672TypeWithState valueType; 3721TypeWithState resultType = ResultType; 3731var result = resultType.WithNotNullState(); 3853SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3861SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3874var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/, TypeWithState>>.GetInstance(); 3896var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 3902void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> elementConversionCompletions) 3936var resultType = VisitConversion( 3994TypeWithState convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> completions) 4016var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4110TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4114TypeWithState setAnalyzedNullability( 4124var result = TypeWithState.Create(type, resultState); 4523Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4536(TypeWithState resultType, conversionCompletion) = 4556Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4664TypeWithState.Create(containingType, receiverResult.RValueType.State), 4684SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4689var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4778var argumentType = argumentTypes[i]; 4797SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4829SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4834SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 4868var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 4877var expressionType = VisitRvalueWithState(expressionNoConversion); 4911inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5110private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5122var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5153return TypeWithState.Create(resultType, resultState); 5170var leftType = ResultType; 5197var rightType = VisitRvalueWithState(rightOperand); 5240static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5275var leftResult = ResultType; 5328SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5336TypeWithState leftType, 5339TypeWithState rightType, 5342var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5346private TypeWithState ReinferAndVisitBinaryOperator( 5354TypeWithState leftType, 5358TypeWithState rightType) 5368TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5369TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5391TypeWithState operandType) 5424var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5434TypeWithState leftUnderlyingType, 5435TypeWithState rightUnderlyingType) 5500private TypeWithState VisitBinaryOperatorOperandConversion( 5501BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5525private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5528TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5544var leftType = ResultType; 5549var rightType = ResultType; 5903TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 5908TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5924var rightUnconditionalResult = ResultType; 5927SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 5932TypeWithState leftResult = ResultType; 5943TypeWithState rightResult = ResultType; 5961SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 5987var conversionResult = VisitConversion( 5994TypeWithState.Create(leftType, NullableFlowState.NotNull), 6026var operandType = ResultType; 6031var result = VisitConversion(boundConversion, 6178SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6214TypeWithState consequenceRValue; 6215TypeWithState alternativeRValue; 6254SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6318SetResultType(node, TypeWithState.Create(resultType, default)); 6329TypeWithState typeWithState = convertArms( 6336TypeWithState convertArms( 6338TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6344TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6353TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6363var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6376return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6386TypeWithState consequenceRValue, 6387TypeWithState alternativeRValue, 6405(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6418(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6435private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6440TypeWithState operandType, 6457var resultType = VisitConversion( 6501SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6527TypeWithState receiverType = visitAndCheckReceiver(node); 6601TypeWithState receiverType = visitAndCheckReceiver(node); 6629TypeWithState visitAndCheckReceiver(BoundCall node) 6639void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6675var returnState = GetReturnTypeWithState(method); 6686private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6688TypeWithState receiverType = default; 6703TypeWithState receiverType, 6820private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 6956void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7057private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7090private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7092return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7162private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7166return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7171return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7498TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7909var resultType = result.RValueType; 7927var stateAfterConversion = VisitConversion( 7982private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8000private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8058var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8062parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8085var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8088var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8149void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8180static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8185return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8191return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8197static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8206return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8210return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8216static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8225return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8229return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8517if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8783private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8788return TypeWithState.Create(type.Type, state); 8944private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 8956private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 8966var operandType = VisitRvalueWithState(operand); 8970(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 8975Conversion conversion, TypeWithState operandType, 8980return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 8990var resultType = VisitConversion( 9007Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9057ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9062SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9087SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9100ImmutableArray<TypeWithState> types, 9130void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9144private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9238var convertedType = VisitUserDefinedConversion( 9411private TypeWithState VisitConversion( 9416TypeWithState operandType, 9436if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9518return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9733TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9767static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9779var resultType = TypeWithState.Create(targetType, resultState); 9783static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9817static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9845static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 9855static NullableFlowState getConversionResultState(TypeWithState operandType) 9971private TypeWithState VisitUserDefinedConversion( 9976TypeWithState operandType, 9996var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10028TypeWithState underlyingOperandType = default; 10136private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10159private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10164return TypeWithState.Create(type, state); 10167private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10180private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10192private TypeWithState ClassifyAndVisitConversion( 10195TypeWithState operandType, 10270TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10274TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10276var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10376var argState = VisitRvalueWithState(arg); 10429private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10444private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10446_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10455if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10573var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10583var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10626TypeWithState rightState; 10649SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10669var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10678private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10772private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10802private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10816private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10825var rightResult = ResultType; 10915private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 10938TypeWithState operandType; 10939TypeWithState valueType; 10991var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11048private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11101TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11120SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11124SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11136var opType = VisitRvalueWithState(node.Operand); 11144SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11151var operandType = VisitRvalueWithState(node.Operand); 11195TypeWithState resultOfOperandConversionType; 11219TypeWithState resultOfIncrementType; 11245TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11278TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11297SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11301SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11314var opType = ResultType; 11325SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11335var leftTypeWithState = ResultType; 11343var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11350var resultTypeWithState = ReinferAndVisitBinaryOperator( 11403SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11502TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11545var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11603var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11618var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11628resultType = TypeWithState.Create(resultType.Type, state); 11730var resultTypeWithState = VisitRvalueWithState(expr); 11799var convertedResult = VisitConversion( 11817TypeWithState currentPropertyGetterTypeWithState; 11858var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 11914var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 11931VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 11945TypeWithState result = sourceState; 11946TypeWithState resultForType = sourceState; 12037private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12079TypeWithState resultType; 12111var operandResult = ResultType; 12113var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12144TypeWithState adjustForLifting(TypeWithState argumentResult) => 12145TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12151private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12286TypeWithState leftType = ResultType; 12295TypeWithState rightType = ResultType; 12302TypeWithState leftType = ResultType; 12317var rightType = ResultType; 12325TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12326TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12413SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12435SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12455SetResultType(node, TypeWithState.ForType(type)); 12495var argumentType = VisitRvalueWithState(node.Operand); 12517SetResultType(node, TypeWithState.Create(type, resultState)); 12549SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12624if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12726SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12748private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12792private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 12833SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12848SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12897SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12903SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 12910var rValueType = TypeWithState.ForType(node.Type); 12932var result = VisitRvalueWithState(expr); 13062Debug.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(