Binder\Binder_Statements.cs (2)
2546return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
2612return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true);
FlowAnalysis\NullableWalker.cs (37)
224/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
1987var conv = (BoundConversion)node;
2425var conversion = (BoundConversion)expr;
4224var expression = GetConversionIfApplicable(expressions[i], expressionNoConversion);
4246TrackAnalyzedNullabilityThroughConversionGroup(inferredType.ToTypeWithState(), expressions[i] as BoundConversion, expressionsNoConversions[i]);
4680expr as BoundConversion,
4714expr as BoundConversion,
4889operand = ((BoundConversion)operand).Operand;
5083var conversion = (BoundConversion)possiblyConversion;
5177if ((node.RightOperand as BoundConversion)?.ExplicitCastInCode != false &&
5231if (node is BoundConversion boundConversion)
5332Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
6324TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion);
6549BoundConversion? conversionOpt,
7218var conversion = (BoundConversion)expr;
7420public override BoundNode? VisitConversion(BoundConversion node)
7667BoundConversion? conversionOpt,
7878private static BoundConversion? GetConversionIfApplicable(BoundExpression? conversionOpt, BoundExpression convertedNode)
7885return conversionOpt == convertedNode ? null : (BoundConversion?)conversionOpt;
7908BoundConversion? conversionOpt,
8089if (useLegacyWarnings && conversionOperand is BoundConversion operandConversion && !operandConversion.ConversionKind.IsUserDefinedConversion())
8434BoundConversion? conversionOpt,
8585var conversionOpt = conversionExpression as BoundConversion;
8593conversionOpt = conversionOpt.Operand as BoundConversion;
8597private void TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState resultType, BoundConversion? conversionOpt, BoundExpression convertedNode)
8606conversionOpt = conversionOpt.Operand as BoundConversion;
9222var right = node.Right;
9501var conv = (BoundConversion)expr;
9546if (node.OperandConversion is BoundConversion { Conversion: var operandConversion } && operandConversion.IsUserDefined && operandConversion.Method?.ParameterCount == 1)
10099if (!reportedDiagnostic && !(node.Expression is BoundConversion { Operand: { IsSuppressed: true } }))
10347node.Operand as BoundConversion,
Generated\BoundNodes.xml.Generated.cs (17)
1846public BoundDeconstructionAssignmentOperator(SyntaxNode syntax, BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type, bool hasErrors = false)
1861public BoundConversion Right { get; }
1867public BoundDeconstructionAssignmentOperator Update(BoundTupleExpression left, BoundConversion right, bool isUsed, TypeSymbol type)
2870public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
2874var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, originalUserDefinedConversionsOpt, type, this.HasErrors);
8655return VisitConversion((BoundConversion)node, arg);
9040public virtual R VisitConversion(BoundConversion node, A arg) => this.DefaultVisit(node, arg);
9268public virtual BoundNode? VisitConversion(BoundConversion node) => this.DefaultVisit(node);
9682public override BoundNode? VisitConversion(BoundConversion node)
10680BoundConversion right = (BoundConversion)this.Visit(node.Right);
10843public override BoundNode? VisitConversion(BoundConversion node)
12373BoundConversion right = (BoundConversion)this.Visit(node.Right);
12798public override BoundNode? VisitConversion(BoundConversion node)
12802BoundConversion updatedNode;
15063public 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)
244var conversion = (BoundConversion)rewrittenNode;
256BoundConversion? oldNodeOpt,
291BoundConversion? oldNodeOpt,
865case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
870case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
977rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType);
990var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType);
1213return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1250return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType);
1369return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked, explicitCastInCode: explicitCastInCode, conversionGroupOpt: null, constantValueOpt, rewrittenType);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (17)
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 } }:
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)
530expression = BoundConversion.Synthesized(Syntax, expression, conversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, CurrentFunction.ReturnType);
1171? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type)