Binder\Binder_Statements.cs (2)
2686return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2750return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (41)
272/// 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>)"/>.
2157var conv = (BoundConversion)node;
2614var conversion = (BoundConversion)expr;
4063if (node.Conversion is BoundConversion { Conversion: var conversion })
4904var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5401expr as BoundConversion,
5514expr as BoundConversion,
5668operand = ((BoundConversion)operand).Operand;
5862var conversion = (BoundConversion)possiblyConversion;
5971if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
6025if (node is BoundConversion boundConversion)
6127Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
7499TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7557elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
7895BoundConversion? conversionOpt,
8686var conversion = (BoundConversion)expr;
8898public override BoundNode? VisitConversion(BoundConversion node)
9159BoundConversion? conversionOpt,
9383private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
9390return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
9413BoundConversion? conversionOpt,
9594if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
9973BoundConversion? conversionOpt,
10125var conversionOpt = conversionExpression as BoundConversion;
10133conversionOpt = conversionOpt.Operand as BoundConversion;
10137private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10153conversionOpt = conversionOpt.Operand as BoundConversion;
10778var right = node.Right;
11058var conv = (BoundConversion)expr;
11174if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
11356node.LeftConversion as BoundConversion ?? node.Left,
11863if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
11951if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
11988isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
12121node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1848public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1863public BoundConversion Right { get; }
1869public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
2981public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, TypeSymbol type)
2985var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, type, this.HasErrors);
9017return VisitConversion((BoundConversion)node, arg);
9415public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9651public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10079public override BoundNode? VisitConversion(BoundConversion node)
11124BoundConversion right = (BoundConversion)this.Visit(node.Right);
11318public override BoundNode? VisitConversion(BoundConversion node)
12973BoundConversion right = (BoundConversion)this.Visit(node.Right);
13441public override BoundNode? VisitConversion(BoundConversion node)
13444BoundConversion updatedNode;
15801public 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,
1009case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1014case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1121rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1134var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType);
1362return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1404return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1525return 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)
575expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1252? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)