Binder\Binder_Statements.cs (2)
2647return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2713return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (41)
247/// 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>)"/>.
2096var conv = (BoundConversion)node;
2553var conversion = (BoundConversion)expr;
3890if (node.Conversion is BoundConversion { Conversion: var conversion })
4690var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5184expr as BoundConversion,
5222expr as BoundConversion,
5396operand = ((BoundConversion)operand).Operand;
5590var conversion = (BoundConversion)possiblyConversion;
5699if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
5753if (node is BoundConversion boundConversion)
5854Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
7020TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7078elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
7404BoundConversion? conversionOpt,
8111var conversion = (BoundConversion)expr;
8321public override BoundNode? VisitConversion(BoundConversion node)
8582BoundConversion? conversionOpt,
8806private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
8813return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
8836BoundConversion? conversionOpt,
9017if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
9388BoundConversion? conversionOpt,
9540var conversionOpt = conversionExpression as BoundConversion;
9548conversionOpt = conversionOpt.Operand as BoundConversion;
9552private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
9568conversionOpt = conversionOpt.Operand as BoundConversion;
10167var right = node.Right;
10446var conv = (BoundConversion)expr;
10491if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
10598node.LeftConversion as BoundConversion ?? node.Left,
11076if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
11164if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
11201isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
11326node.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)
2982public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
2986var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, originalUserDefinedConversionsOpt, type, this.HasErrors);
9016return VisitConversion((BoundConversion)node, arg);
9414public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9650public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10076public override BoundNode? VisitConversion(BoundConversion node)
11096BoundConversion right = (BoundConversion)this.Visit(node.Right);
11275public override BoundNode? VisitConversion(BoundConversion node)
12844BoundConversion right = (BoundConversion)this.Visit(node.Right);
13302public override BoundNode? VisitConversion(BoundConversion node)
13306BoundConversion updatedNode;
15660public 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)
251var conversion = (BoundConversion)rewrittenNode;
263BoundConversion? oldNodeOpt,
298BoundConversion? oldNodeOpt,
1007case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1012case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1119rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1132var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType);
1360return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1402return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1523return 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)