Binder\Binder_Statements.cs (2)
2694return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true);
2762return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (45)
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, int, Location, ArrayBuilder<VisitResult>)"/>.
2196var conv = (BoundConversion)node;
2653var conversion = (BoundConversion)expr;
4217while (collectionCreation is BoundConversion conversion)
4270if (node.Conversion is BoundConversion { Conversion: var conversion })
5171var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
5668expr as BoundConversion,
5781expr as BoundConversion,
5935operand = ((BoundConversion)operand).Operand;
6129var conversion = (BoundConversion)possiblyConversion;
6238if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
6294if (node is BoundConversion boundConversion)
6396Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
7803TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
7863elements = ((BoundCollectionExpression)((BoundConversion)argument).Operand).UnconvertedCollectionExpression.Elements.CastArray<BoundExpression>();
8219BoundConversion? conversionOpt,
9041var conversion = (BoundConversion)expr;
9253public override BoundNode? VisitConversion(BoundConversion node)
9514BoundConversion? conversionOpt,
9796private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
9803return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
9826BoundConversion? conversionOpt,
10041if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion()) // Based on behavior of NullableT_NullableStructToClass unit-test we don't need to specially handle Union conversions here
10446BoundConversion? conversionOpt,
10598BoundConversion? conversionOpt,
10636BoundConversion? sourceToParameterConversion = null;
10637BoundConversion? unionConstructionConversion = null;
10764var conversionOpt = conversionExpression as BoundConversion;
10772conversionOpt = conversionOpt.Operand as BoundConversion;
10776private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
10797conversionOpt = conversionOpt.Operand as BoundConversion;
11420var right = node.Right;
11702var conv = (BoundConversion)expr;
11822if (node.OperandConversion is BoundConversion { Conversion: ({ IsUserDefined: true } or { IsUnion: true }) and { Method.ParameterCount: 1 } operandConversion })
12020node.LeftConversion as BoundConversion ?? node.Left,
12595if (!reportedDiagnostic && !(collectionExpression is BoundConversion { Operand: { IsSuppressed: true } }))
12673if (node.Expression is not BoundConversion { Operand.IsSuppressed: true } &&
12710isSuppressed: node.Expression is BoundConversion { Operand.IsSuppressed: true },
12843node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1892public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1907public BoundConversion Right { get; }
1913public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
3031public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, InConversionGroupFlags inConversionGroupFlags, TypeSymbol type)
3035var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, inConversionGroupFlags, type, this.HasErrors);
9238return VisitConversion((BoundConversion)node, arg);
9645public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9886public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
10323public override BoundNode? VisitConversion(BoundConversion node)
11399BoundConversion right = (BoundConversion)this.Visit(node.Right);
11593public override BoundNode? VisitConversion(BoundConversion node)
13296BoundConversion right = (BoundConversion)this.Visit(node.Right);
13764public override BoundNode? VisitConversion(BoundConversion node)
13767BoundConversion updatedNode;
16151public 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,
1076case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1081case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1187rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
1201var result = new BoundConversion(
1431return BoundConversion.Synthesized(
1475return BoundConversion.Synthesized(
1637return 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 } or { IsUnion: true } } conv when conv.ExplicitCastInCode || enclosingConversionWasExplicit:
202case BoundConversion conv:
407case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
409case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var underlying } conversion, Operand: var o }
442case BoundConversion { Conversion: { IsIdentity: true }, Operand: var o }:
444case BoundConversion { Conversion: { IsNullable: true, UnderlyingConversions: var nested }, Operand: var o } conv when
479BoundExpression MakeBoundConversion(BoundExpression expr, Conversion conversion, TypeWithAnnotations type, BoundConversion enclosing)
615return (expr is BoundConversion conv)
Lowering\SyntheticBoundNodeFactory.cs (2)
581expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, InConversionGroupFlags.Unspecified, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1273? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)