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;
332 references to TypeWithState
Microsoft.CodeAnalysis.CSharp (331)
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 (303)
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) 2338private TypeWithState VisitRvalueWithState(BoundExpression? node) 2382/// This should often be checked together with <seealso cref="IsDisallowedNullAssignment(TypeWithState, FlowAnalysisAnnotations)"/> 2422TypeWithState valueType, 2477static bool isMaybeDefaultValue(TypeWithState valueType) 2514var valueState = GetParameterState( 2553var valueWhen = ApplyUnconditionalAnnotations( 2567static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations) 2645TypeWithState valueType, 2686static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) => 3031var resultType = VisitOptionalImplicitConversion( 3045internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations) 3049return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 3054return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 3085TypeWithState returnState; 3102var result = VisitRvalueWithState(expr); 3134private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType) 3137TypeWithState resultType = ResultType; 3204SetResultType(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)); 3907var visitResult = new VisitResult(TypeWithState.Create(resultType), resultType, 4112TypeWithState convertCollection( 4139var resultTypeWithState = TypeWithState.Create(strippedTargetCollectionType, resultState); 4245TypeWithState result = setAnalyzedNullability(node, type, argumentResults, argumentsCompletion, initialStateInferenceCompletion, initializerCompletion, resultState, isTargetTyped); 4249TypeWithState setAnalyzedNullability( 4259var result = TypeWithState.Create(type, resultState); 4681InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null) 4694(TypeWithState resultType, conversionCompletion) = 4714InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion) 4822TypeWithState.Create(containingType, receiverResult.RValueType.State), 4842SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4847var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4936var argumentType = argumentTypes[i]; 4955SetResultType(node, TypeWithState.Create(anonymousType, NullableFlowState.NotNull)); 4987SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4992SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); 5026var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n); 5035var expressionType = VisitRvalueWithState(expressionNoConversion); 5069inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5268private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5280var resultTypeWithState = GetReturnTypeWithState(methodOpt); 5311return TypeWithState.Create(resultType, resultState); 5328var leftType = ResultType; 5355var rightType = VisitRvalueWithState(rightOperand); 5398static bool isKnownNullOrNotNull(BoundExpression expr, TypeWithState resultType) 5433var leftResult = ResultType; 5486SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type)); 5494TypeWithState leftType, 5497TypeWithState rightType, 5500var inferredResult = ReinferAndVisitBinaryOperator(binary, binary.OperatorKind, binary.BinaryOperatorMethod, binary.Type, binary.Left, leftOperand, leftConversion, leftType, binary.Right, rightOperand, rightConversion, rightType); 5504private TypeWithState ReinferAndVisitBinaryOperator( 5512TypeWithState leftType, 5516TypeWithState rightType) 5526TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 5527TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 5549TypeWithState operandType) 5582var inferredResult = InferResultNullability(operatorKind, method, returnType, leftType, rightType); 5592TypeWithState leftUnderlyingType, 5593TypeWithState rightUnderlyingType) 5658private TypeWithState VisitBinaryOperatorOperandConversion( 5659BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted, 5683private void VisitBinaryOperatorOperandConversionAndPostConditions(BoundExpression expr, BoundExpression operand, Conversion conversion, ParameterSymbol parameter, TypeWithState operandType, bool isLifted) 5686TypeWithState resultType = VisitBinaryOperatorOperandConversion(expr, operand, conversion, parameter, operandType, isLifted, out parameterAnnotations); 5702var leftType = ResultType; 5707var rightType = ResultType; 6061TypeWithState rightResult = VisitOptionalImplicitConversion(rightOperand, targetType, useLegacyWarnings: UseLegacyWarnings(leftOperand), trackMembers: false, AssignmentKind.Assignment); 6066TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 6082var rightUnconditionalResult = ResultType; 6085SetResultType(node, TypeWithState.Create(node.Type, rightUnconditionalResult.State)); 6090TypeWithState leftResult = ResultType; 6101TypeWithState rightResult = ResultType; 6119SetResultType(node, TypeWithState.Create(resultType, rightResult.State.Join(leftState))); 6145var conversionResult = VisitConversion( 6152TypeWithState.Create(leftType, NullableFlowState.NotNull), 6184var operandType = ResultType; 6189var result = VisitConversion(boundConversion, 6336SetResultType(node, TypeWithState.Create(resultType, NullableFlowState.MaybeDefault)); 6372TypeWithState consequenceRValue; 6373TypeWithState alternativeRValue; 6412SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation)); 6476SetResultType(node, TypeWithState.Create(resultType, default)); 6487TypeWithState typeWithState = convertArms( 6494TypeWithState convertArms( 6496TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6502TypeWithState convertedConsequenceResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6511TypeWithState convertedAlternativeResult = ConvertConditionalOperandOrSwitchExpressionArmResult( 6521var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6534return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6544TypeWithState consequenceRValue, 6545TypeWithState alternativeRValue, 6563(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6576(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6593private TypeWithState ConvertConditionalOperandOrSwitchExpressionArmResult( 6598TypeWithState operandType, 6615var resultType = VisitConversion( 6659SetResultType(node, TypeWithState.Create(rvalueType, NullableFlowState.NotNull)); 6685TypeWithState receiverType = visitAndCheckReceiver(node); 6759TypeWithState receiverType = visitAndCheckReceiver(node); 6787TypeWithState visitAndCheckReceiver(BoundCall node) 6797void reinferMethodAndVisitArguments(BoundCall node, TypeWithState receiverType, VisitResult? firstArgumentResult = null) 6838var returnState = GetReturnTypeWithState(method); 6849private TypeWithState VisitAndCheckReceiver(BoundExpression? receiverOpt, MethodSymbol method) 6851TypeWithState receiverType = default; 6866TypeWithState receiverType, 6984private void LearnFromEqualsMethod(MethodSymbol method, BoundCall node, TypeWithState receiverType, ImmutableArray<VisitResult> results) 7120void learnFromEqualsMethodArguments(BoundExpression left, TypeWithState leftType, BoundExpression right, TypeWithState rightType) 7221private void CheckCallReceiver(BoundExpression? receiverOpt, TypeWithState receiverType, MethodSymbol method) 7254private TypeWithState GetReturnTypeWithState(MethodSymbol method) 7256return TypeWithState.Create(method.ReturnTypeWithAnnotations, GetRValueAnnotations(method)); 7326private static TypeWithState ApplyUnconditionalAnnotations(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 7330return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7335return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7655TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 8066var resultType = result.RValueType; 8084var stateAfterConversion = VisitConversion( 8139private bool CheckDisallowedNullAssignment(TypeWithState state, FlowAnalysisAnnotations annotations, SyntaxNode node, BoundExpression? boundValueOpt = null) 8157private static bool IsDisallowedNullAssignment(TypeWithState valueState, FlowAnalysisAnnotations targetAnnotations) 8215var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8219parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 8242var parameterWithState = TypeWithState.Create(parameterType, parameterAnnotations); 8245var worstCaseParameterWithState = applyPostConditionsUnconditionally(parameterWithState, parameterAnnotations); 8306void trackNullableStateForAssignment(BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations) 8337static TypeWithState applyPostConditionsUnconditionally(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8342return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8348return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8354static TypeWithState applyPostConditionsWhenTrue(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8363return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8367return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8373static TypeWithState applyPostConditionsWhenFalse(TypeWithState typeWithState, FlowAnalysisAnnotations annotations) 8382return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 8386return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8674if (_walker.TryGetMethodGroupReceiverNullability(group.ReceiverOpt, out TypeWithState receiverType)) 8951private TypeWithState GetAdjustedResult(TypeWithState type, int slot) 8956return TypeWithState.Create(type.Type, state); 9112private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind) 9124private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion( 9134var operandType = VisitRvalueWithState(operand); 9138(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion( 9143Conversion conversion, TypeWithState operandType, 9148return (TypeWithState.Create(targetTypeOpt), visitConversionAsContinuation(expr, useLegacyWarnings, trackMembers, assignmentKind, operand, conversion, operandType)); 9158var resultType = VisitConversion( 9175Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 9225ImmutableArray<TypeWithState> elementTypes = arguments.SelectAsArray((a, w) => w.VisitRvalueWithState(a), this); 9230SetResultType(node, TypeWithState.Create(null, NullableFlowState.NotNull)); 9255SetResultType(node, TypeWithState.Create(tupleOpt, NullableFlowState.NotNull)); 9268ImmutableArray<TypeWithState> types, 9298void trackState(BoundExpression value, FieldSymbol field, TypeWithState valueType) 9312private void TrackNullableStateOfNullableValue(int containingSlot, TypeSymbol containingType, BoundExpression? value, TypeWithState valueType, int valueSlot) 9406var convertedType = VisitUserDefinedConversion( 9579private TypeWithState VisitConversion( 9584TypeWithState operandType, 9604if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion)) 9686return TypeWithState.Create(targetType, NullableFlowState.NotNull); 9901TypeWithState resultType = calculateResultType(targetTypeWithNullability, fromExplicitCast, resultState, isSuppressed, targetType); 9935static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType) 9947var resultType = TypeWithState.Create(targetType, resultState); 9951static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 9985static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType) 10013static NullableFlowState getUnboxingConversionResultState(TypeWithState operandType) 10023static NullableFlowState getConversionResultState(TypeWithState operandType) 10139private TypeWithState VisitUserDefinedConversion( 10144TypeWithState operandType, 10163var resultType = TypeWithState.Create(targetType, NullableFlowState.NotNull); 10195TypeWithState underlyingOperandType = default; 10303private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode) 10326private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState) 10331return TypeWithState.Create(type, state); 10334private static TypeWithState GetNullableUnderlyingTypeIfNecessary(bool isLifted, TypeWithState typeWithState) 10347private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState) 10359private TypeWithState ClassifyAndVisitConversion( 10362TypeWithState operandType, 10437TypeWithState result = setAnalyzedNullability(node, delegateType, analysisCompletion, node.WasTargetTyped); 10441TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped) 10443var result = TypeWithState.Create(delegateType, NullableFlowState.NotNull); 10543var argState = VisitRvalueWithState(arg); 10596private bool TryGetMethodGroupReceiverNullability([NotNullWhen(true)] BoundExpression? receiverOpt, out TypeWithState type) 10611private void SetMethodGroupReceiverNullability(BoundExpression receiver, TypeWithState type) 10613_methodGroupReceiverMapOpt ??= PooledDictionary<BoundExpression, TypeWithState>.GetInstance(); 10622if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 10740var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10750var typeWithState = GetParameterState(parameterType, parameter.FlowAnalysisAnnotations); 10793TypeWithState rightState; 10816SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10836var rValueType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), annotations); 10845private void AdjustSetValue(BoundExpression left, ref TypeWithState rightState) 10939private BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node, TypeWithState? rightResultOpt) 10969private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10983private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10992var rightResult = ResultType; 11082private void VisitTupleDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo, BoundExpression right, TypeWithState? rightResultOpt) 11105TypeWithState operandType; 11106TypeWithState valueType; 11158var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 11215private ImmutableArray<BoundExpression> GetDeconstructionRightParts(BoundExpression expr, TypeWithState? rightResultOpt) 11268TypeWithState receiverType = VisitAndCheckReceiver(node.Operand, instanceMethod); 11291SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11295SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11307var opType = VisitRvalueWithState(node.Operand); 11315SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11322var operandType = VisitRvalueWithState(node.Operand); 11366TypeWithState resultOfOperandConversionType; 11390TypeWithState resultOfIncrementType; 11416TypeWithState resultType = (op == UnaryOperatorKind.PrefixIncrement || op == UnaryOperatorKind.PrefixDecrement) ? resultOfIncrementType : operandType; 11449TypeWithState receiverType = VisitAndCheckReceiver(node.Left, instanceMethod); 11472SetResultType(node, TypeWithState.Create(receiverType.Type, NullableFlowState.NotNull)); 11476SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11489var opType = ResultType; 11500SetResultType(node, TypeWithState.Create(opType.Type, NullableFlowState.NotNull)); 11510var leftTypeWithState = ResultType; 11518var rightTypeWithState = VisitRvalueWithState(rightConversionOperand); 11525var resultTypeWithState = ReinferAndVisitBinaryOperator( 11578SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11679TypeWithState typeWithState = ApplyUnconditionalAnnotations(typeWithAnnotations.ToTypeWithState(), memberAnnotations); 11722var resultType = ApplyUnconditionalAnnotations(indexer.TypeWithAnnotations.ToTypeWithState(), GetRValueAnnotations(indexer)); 11786var receiverType = (receiverOpt != null) ? VisitRvalueWithState(receiverOpt) : default; 11801var resultType = ApplyUnconditionalAnnotations(type.ToTypeWithState(), memberAnnotations); 11811resultType = TypeWithState.Create(resultType.Type, state); 11913var resultTypeWithState = VisitRvalueWithState(expr); 11983var convertedResult = VisitConversion( 12001TypeWithState currentPropertyGetterTypeWithState; 12042var enumeratorReturnType = GetReturnTypeWithState(reinferredGetEnumeratorMethod); 12098var sourceState = node.EnumeratorInfoOpt == null ? default : ResultType; 12115VisitDeconstructionAssignmentOperator(assignment, sourceState.HasNullType ? (TypeWithState?)null : sourceState); 12129TypeWithState result = sourceState; 12130TypeWithState resultForType = sourceState; 12221private TypeWithState VisitBadExpressionChild(BoundExpression? child) 12263TypeWithState resultType; 12295var operandResult = ResultType; 12297var operandType = GetNullableUnderlyingTypeIfNecessary(isLifted, operandResult); 12328TypeWithState adjustForLifting(TypeWithState argumentResult) => 12329TypeWithState.Create(node.Type, node.OperatorKind.IsLifted() ? argumentResult.State : NullableFlowState.NotNull); 12335private MethodSymbol ReInferUnaryOperator(SyntaxNode syntax, MethodSymbol method, BoundExpression operand, TypeWithState operandType) 12470TypeWithState leftType = ResultType; 12479TypeWithState rightType = ResultType; 12486TypeWithState leftType = ResultType; 12501var rightType = ResultType; 12509TypeWithState leftUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, leftType); 12510TypeWithState rightUnderlyingType = GetNullableUnderlyingTypeIfNecessary(isLifted, rightType); 12597SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12619SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.MaybeDefault)); 12639SetResultType(node, TypeWithState.ForType(type)); 12679var argumentType = VisitRvalueWithState(node.Operand); 12701SetResultType(node, TypeWithState.Create(type, resultState)); 12733SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12808if (TryGetMethodGroupReceiverNullability(receiverOpt, out TypeWithState receiverType)) 12910SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12932private bool CheckPossibleNullReceiver(BoundExpression? receiverOpt, TypeWithState resultType, bool checkNullableValueType) 12976private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result) 13017SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13032SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13081SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 13087SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); 13094var rValueType = TypeWithState.ForType(node.Type); 13116var result = VisitRvalueWithState(expr); 13246Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (18)
298var expressionState = ResultType; 378TypeWithState expressionTypeWithState, 523var inputTypeWithState = TypeWithState.Create(inputType, inputState); 630var value = TypeWithState.Create(tempType, tempState); 642TrackNullableStateForAssignment(valueOpt: null, inferredType, localSlot, TypeWithState.Create(tempType, tempState), tempSlot); 991var expressionState = ResultType; 1014var resultTypes = ArrayBuilder<TypeWithState>.GetInstance(numSwitchArms); 1035var armType = VisitRvalueWithState(expression); 1057TypeWithState resultType; 1070resultType = TypeWithState.Create(inferredType, inferredState); 1085TypeWithState convertArms( 1089ArrayBuilder<TypeWithState> resultTypes, 1120TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState); 1134ArrayBuilder<TypeWithState> resultTypes, 1159var expressionState = ResultType;
Symbols\TypeWithAnnotations.cs (2)
805internal TypeWithState ToTypeWithState() 811return TypeWithState.Create(Type, getFlowState(Type, NullableAnnotation));
Symbols\TypeWithState.cs (5)
23public static TypeWithState ForType(TypeSymbol? type) 28public static TypeWithState Create(TypeSymbol? type, NullableFlowState defaultState) 40public static TypeWithState Create(TypeWithAnnotations typeWithAnnotations, FlowAnalysisAnnotations annotations = FlowAnalysisAnnotations.None) 81public TypeWithState WithNotNullState() => new TypeWithState(Type, NullableFlowState.NotNull); 83public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.NotNull) : this;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
483var type = TypeWithState.Create(