Binder\Binder_Statements.cs (2)
2663return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2729return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (41)
253/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
2117var conv = (BoundConversion)node;
2574var conversion = (BoundConversion)expr;
3944if (node.Conversion is BoundConversion { Conversion: var conversion })
4747var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5242expr as BoundConversion,
5280expr as BoundConversion,
5454operand = ((BoundConversion)operand).Operand;
5648var conversion = (BoundConversion)possiblyConversion;
5757if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
5811if (node is BoundConversion boundConversion)
5912Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
7078TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7136elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
7468BoundConversion? conversionOpt,
8175var conversion = (BoundConversion)expr;
8385public override BoundNode? VisitConversion(BoundConversion node)
8646BoundConversion? conversionOpt,
8870private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
8877return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
8900BoundConversion? conversionOpt,
9081if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
9452BoundConversion? conversionOpt,
9604var conversionOpt = conversionExpression as BoundConversion;
9612conversionOpt = conversionOpt.Operand as BoundConversion;
9616private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9632conversionOpt = conversionOpt.Operand as BoundConversion;
10245var right = node.Right;
10524var conv = (BoundConversion)expr;
10569if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
10676node.LeftConversion as BoundConversion ?? node.Left,
11154if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
11242if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
11279isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
11404node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1859public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1874public BoundConversion Right { get; }
1880public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
2980public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, TypeSymbol type)
2984var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, type, this.HasErrors);
9014return VisitConversion((BoundConversion)node, arg);
9412public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9648public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10074public override BoundNode? VisitConversion(BoundConversion node)
11094BoundConversion right = (BoundConversion)this.Visit(node.Right);
11273public override BoundNode? VisitConversion(BoundConversion node)
12842BoundConversion right = (BoundConversion)this.Visit(node.Right);
13300public override BoundNode? VisitConversion(BoundConversion node)
13303BoundConversion updatedNode;
15657public override TreeDumperNode VisitConversion(BoundConversion node, object? arg) => new TreeDumperNode("conversion", null, new TreeDumperNode[]
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (12)
18public override BoundNode VisitConversion(BoundConversion node)
249var conversion = (BoundConversion)rewrittenNode;
261BoundConversion? oldNodeOpt,
296BoundConversion? oldNodeOpt,
1005case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1010case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1117rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1130var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType);
1358return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1400return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1521return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked, explicitCastInCode: explicitCastInCode, conversionGroupOpt: null, constantValueOpt, rewrittenType);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (18)
49case BoundConversion { Conversion: { Kind: ConversionKind.Identity }, Operand: var o }:
51case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitTupleLiteral }, Operand: var o }:
56case BoundConversion { Conversion: { Kind: var kind } c, Operand: var o } conversion when
70var newArgument = new BoundConversion(
88case BoundConversion { Conversion: { Kind: var kind }, Operand: var o } when
103if (expr is BoundConversion { ConversionKind: ConversionKind.ImplicitTuple, Conversion: var conversion } boundConversion)
120var convertedFieldAccess = new BoundConversion(
190case BoundConversion { Conversion: { Kind: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting.
191case BoundConversion { Conversion.IsTupleConversion: true }: // If we were not able to push this conversion down the tree before getting here, it must be performed early, otherwise it won't be properly lowered by this machinery.
193case BoundConversion { Conversion: { Kind: var conversionKind } conversion } when conversionMustBePerformedOnOriginalExpression(conversionKind):
196case BoundConversion { Conversion: { IsUserDefined: true } } conv when conv.ExplicitCastInCode || enclosingConversionWasExplicit:
199case BoundConversion conv:
401case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
403case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var underlying } conversion, Operand: var o }
435case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
437case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var nested }, Operand: var o } conv when
472BoundExpression MakeBoundConversion(BoundExpression expr, Conversion conversion, TypeWithAnnotations type, BoundConversion enclosing)
608return (expr is BoundConversion conv)
Lowering\SyntheticBoundNodeFactory.cs (2)
570expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1242? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)