Binder\Binder_Statements.cs (2)
2693return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true);
2761return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (42)
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>)"/>.
2158var conv = (BoundConversion)node;
2615var conversion = (BoundConversion)expr;
4142while (collectionCreation is BoundConversion conversion)
4195if (node.Conversion is BoundConversion { Conversion: var conversion })
5061var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5558expr as BoundConversion,
5671expr as BoundConversion,
5825operand = ((BoundConversion)operand).Operand;
6019var conversion = (BoundConversion)possiblyConversion;
6128if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
6182if (node is BoundConversion boundConversion)
6284Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
7655TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7713elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
8051BoundConversion? conversionOpt,
8853var conversion = (BoundConversion)expr;
9065public override BoundNode? VisitConversion(BoundConversion node)
9326BoundConversion? conversionOpt,
9550private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
9557return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
9580BoundConversion? conversionOpt,
9761if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
10140BoundConversion? conversionOpt,
10291var conversionOpt = conversionExpression as BoundConversion;
10299conversionOpt = conversionOpt.Operand as BoundConversion;
10303private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10319conversionOpt = conversionOpt.Operand as BoundConversion;
10944var right = node.Right;
11224var conv = (BoundConversion)expr;
11344if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
11530node.LeftConversion as BoundConversion ?? node.Left,
12046if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
12134if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
12171isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
12304node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1895public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1910public BoundConversion Right { get; }
1916public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
3034public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, InConversionGroupFlags inConversionGroupFlags, TypeSymbol type)
3038var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, inConversionGroupFlags, type, this.HasErrors);
9124return VisitConversion((BoundConversion)node, arg);
9525public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9763public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10193public override BoundNode? VisitConversion(BoundConversion node)
11251BoundConversion right = (BoundConversion)this.Visit(node.Right);
11445public override BoundNode? VisitConversion(BoundConversion node)
13122BoundConversion right = (BoundConversion)this.Visit(node.Right);
13590public override BoundNode? VisitConversion(BoundConversion node)
13593BoundConversion updatedNode;
15948public 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,
297BoundConversion? oldNodeOpt,
1020case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1025case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1131rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1145var result = new BoundConversion(
1375return BoundConversion.Synthesized(
1419return BoundConversion.Synthesized(
1542return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked, explicitCastInCode: explicitCastInCode, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, 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(
89case BoundConversion { Conversion: { Kind: var kind }, Operand: var o } when
104if (expr is BoundConversion { ConversionKind: ConversionKind.ImplicitTuple, Conversion: var conversion } boundConversion)
121var convertedFieldAccess = new BoundConversion(
193case BoundConversion { Conversion: { Kind: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting.
194case 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.
196case BoundConversion { Conversion: { Kind: var conversionKind } conversion } when conversionMustBePerformedOnOriginalExpression(conversionKind):
199case BoundConversion { Conversion: { IsUserDefined: true } } conv when conv.ExplicitCastInCode || enclosingConversionWasExplicit:
202case BoundConversion conv:
406case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
408case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var underlying } conversion, Operand: var o }
440case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
442case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var nested }, Operand: var o } conv when
477BoundExpression MakeBoundConversion(BoundExpression expr, Conversion conversion, TypeWithAnnotations type, BoundConversion enclosing)
613return (expr is BoundConversion conv)
Lowering\SyntheticBoundNodeFactory.cs (2)
576expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1268? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)