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)
99public readonly TypeWithState RValueType; 111public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType) 120public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda) 128RValueType = TypeWithState.Create(type, state); 137public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults) 216private static readonly TypeWithState _invalidType = TypeWithState.Create(new UnsupportedMetadataTypeSymbol(), NullableFlowState.NotNull); 237private PooledDictionary<BoundExpression, TypeWithState>? _methodGroupReceiverMapOpt; 248private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>? _targetTypedAnalysisCompletionOpt; 253/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional&lt;LocalState&gt;,bool, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 255private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>> TargetTypedAnalysisCompletion 256=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>.GetInstance(); 297private TypeWithState ResultType 302private void SetResultType(BoundExpression? expression, TypeWithState type, bool updateAnalyzedNullability = true) 307private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState type) 341private void SetResult(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null) 361private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null) 2319private TypeWithState VisitRvalueWithState(BoundExpression? node) 2363/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2403TypeWithState valueType, 2458static bool isMaybeDefaultValue(TypeWithState valueType) 2495var valueState = GetParameterState( 2534var valueWhen = ApplyUnconditionalAnnotations( 2548static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2626TypeWithState valueType, 2667static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3012var resultType = VisitOptionalImplicitConversion( 3026internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3030return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3035return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3066TypeWithState returnState; 3083var result = VisitRvalueWithState(expr); 3115private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3118TypeWithState resultType = ResultType; 3187SetResultType(node, TypeWithState.ForType(node.Type)); 3556var resultState = ApplyUnconditionalAnnotations(resultType.ToTypeWithState(), GetRValueAnnotations(withExpr.CloneMethod)); 3657TypeWithState valueType; 3706TypeWithState resultType = ResultType; 3716var result = resultType.WithNotNullState(); 3838SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3846SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 3859var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/, TypeWithState>>.GetInstance(); 3881var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 3887void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> elementConversionCompletions) 3921var resultType = VisitConversion( 3979TypeWithState convertCollection(BoundCollectionExpression node, TypeWithAnnotations targetCollectionType, ArrayBuilder<Func<TypeWithAnnotations, TypeSymbol, TypeWithState>> completions) 4001var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4096TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4100TypeWithState setAnalyzedNullability( 4110var result = TypeWithState.Create(type, resultState); 4472Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4485(TypeWithState resultType, conversionCompletion) = 4505Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4613TypeWithState.Create(containingType, receiverResult.RValueType.State), 4633SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4638var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4727var argumentType = argumentTypes[i]; 4746SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4778SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4783SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 4817var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 4826var expressionType = VisitRvalueWithState(expressionNoConversion); 4860inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5059private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5071var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5102return TypeWithState.Create(resultType, resultState); 5119var leftType = ResultType; 5146var rightType = VisitRvalueWithState(rightOperand); 5189static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5224var leftResult = ResultType; 5277SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5285TypeWithState leftType, 5288TypeWithState rightType, 5291var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.Method, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5295private TypeWithState ReinferAndVisitBinaryOperator( 5303TypeWithState leftType, 5307TypeWithState rightType) 5317TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5318TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5340TypeWithState operandType) 5373var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5383TypeWithState leftUnderlyingType, 5384TypeWithState rightUnderlyingType) 5449private TypeWithState VisitBinaryOperatorOperandConversion( 5450BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5474private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5477TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5493var leftType = ResultType; 5498var rightType = ResultType; 5852TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 5857TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5873var rightUnconditionalResult = ResultType; 5876SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 5881TypeWithState leftResult = ResultType; 5892TypeWithState rightResult = ResultType; 5910SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 5936var conversionResult = VisitConversion( 5943TypeWithState.Create(leftType, NullableFlowState.NotNull), 5975var operandType = ResultType; 5980var result = VisitConversion(boundConversion, 6127SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6163TypeWithState consequenceRValue; 6164TypeWithState alternativeRValue; 6203SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6267SetResultType(node, TypeWithState.Create(resultType, default)); 6278TypeWithState typeWithState = convertArms( 6285TypeWithState convertArms( 6287TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6293TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6302TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6312var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6325return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6335TypeWithState consequenceRValue, 6336TypeWithState alternativeRValue, 6354(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6367(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6384private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6389TypeWithState operandType, 6406var resultType = VisitConversion( 6450SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6476TypeWithState receiverType = visitAndCheckReceiver(node); 6531TypeWithState receiverType = visitAndCheckReceiver(node); 6559TypeWithState visitAndCheckReceiver(BoundCall node) 6564void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6582var returnState = GetReturnTypeWithState(method); 6593private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6595TypeWithState receiverType = default; 6610TypeWithState receiverType, 6728private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 6864void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 6965private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 6998private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7000return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7070private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7074return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7079return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7406TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7817var resultType = result.RValueType; 7835var stateAfterConversion = VisitConversion( 7890private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 7908private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 7966var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 7970parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 7993var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 7996var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8057void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8088static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8093return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8099return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8105static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8114return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8118return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8124static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8133return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8137return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8379if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8645private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8650return TypeWithState.Create(type.Type, state); 8806private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 8818private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 8828var operandType = VisitRvalueWithState(operand); 8832(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 8837Conversion conversion, TypeWithState operandType, 8842return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 8852var resultType = VisitConversion( 8869Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 8919ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 8924SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 8949SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 8962ImmutableArray<TypeWithState> types, 8992void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9006private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9100var convertedType = VisitUserDefinedConversion( 9273private TypeWithState VisitConversion( 9278TypeWithState operandType, 9298if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9380return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9595TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9629static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9641var resultType = TypeWithState.Create(targetType, resultState); 9645static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9679static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9707static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 9717static NullableFlowState getConversionResultState(TypeWithState operandType) 9833private TypeWithState VisitUserDefinedConversion( 9838TypeWithState operandType, 9858var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 9890TypeWithState underlyingOperandType = default; 9998private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10021private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10026return TypeWithState.Create(type, state); 10029private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10042private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10054private TypeWithState ClassifyAndVisitConversion( 10057TypeWithState operandType, 10132TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10136TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10138var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10238var argState = VisitRvalueWithState(arg); 10291private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10306private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10308_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10317if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10435var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10445var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10488TypeWithState rightState; 10511SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10531var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10540private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10634private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10664private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10678private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10687var rightResult = ResultType; 10779private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 10802TypeWithState operandType; 10803TypeWithState valueType; 10855var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 10912private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 10965TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 10985SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 10989SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11001var opType = VisitRvalueWithState(node.Operand); 11009SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11016var operandType = VisitRvalueWithState(node.Operand); 11060TypeWithState resultOfOperandConversionType; 11084TypeWithState resultOfIncrementType; 11110TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11143TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11163SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11167SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11180var opType = ResultType; 11191SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11201var leftTypeWithState = ResultType; 11209var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11216var resultTypeWithState = ReinferAndVisitBinaryOperator( 11269SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11368TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11411var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11469var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11484var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11494resultType = TypeWithState.Create(resultType.Type, state); 11598var resultTypeWithState = VisitRvalueWithState(expr); 11668var convertedResult = VisitConversion( 11686TypeWithState currentPropertyGetterTypeWithState; 11727var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 11783var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 11800VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 11814TypeWithState result = sourceState; 11815TypeWithState resultForType = sourceState; 11941TypeWithState resultType; 11973var operandResult = ResultType; 11975var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12006TypeWithState adjustForLifting(TypeWithState argumentResult) => 12007TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12013private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12148TypeWithState leftType = ResultType; 12157TypeWithState rightType = ResultType; 12164TypeWithState leftType = ResultType; 12179var rightType = ResultType; 12187TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12188TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12275SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12297SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12317SetResultType(node, TypeWithState.ForType(type)); 12357var argumentType = VisitRvalueWithState(node.Operand); 12379SetResultType(node, TypeWithState.Create(type, resultState)); 12411SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12486if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12588SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12610private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12654private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 12695SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12710SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12759SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12765SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 12772var rValueType = TypeWithState.ForType(node.Type); 12794var result = VisitRvalueWithState(expr); 12922Debug.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)
476var type = TypeWithState.Create(