1 write to Conversion
Microsoft.CodeAnalysis.CSharp (1)
Generated\BoundNodes.xml.Generated.cs (1)
3011this.Conversion = conversion;
149 references to Conversion
Microsoft.CodeAnalysis.CSharp (148)
Binder\Binder.ValueChecks.cs (16)
3937((!conversion.Conversion.IsUserDefined && !conversion.Conversion.IsUnion) || 3938conversion.Conversion.Method.HasUnsupportedMetadata || 3939conversion.Conversion.Method.RefKind == RefKind.None)); 4270if (conversion.Conversion == Conversion.ImplicitThrow) 4275Debug.Assert((!conversion.Conversion.IsUserDefined && !conversion.Conversion.IsUnion) || 4276conversion.Conversion.Method.HasUnsupportedMetadata || 4277conversion.Conversion.Method.RefKind == RefKind.None); 4612if (conversion.Conversion.IsInlineArray) 4623if (conversion.Conversion is { IsUserDefined: true } or { IsUnion: true }) 4625var operatorMethod = conversion.Conversion.Method; 5356if (conversion.Conversion.IsInlineArray) 5371if (conversion.Conversion is { IsUserDefined: true } or { IsUnion: true }) 5373var operatorMethod = conversion.Conversion.Method; 5730Debug.Assert(conversion.Conversion.IsInlineArray);
Binder\Binder_Attributes.cs (2)
922if (node.Conversion.IsCollectionExpression 923&& node.Conversion.GetCollectionExpressionTypeKind(out _, out _, out _) == CollectionExpressionTypeKind.Array)
Binder\Binder_Expressions.cs (2)
5232case BoundConversion { Conversion.IsIdentity: true, Operand: BoundParameter param }: 6137if (argument is BoundConversion { Conversion.IsInterpolatedStringHandler: true, Operand: var operand })
Binder\Binder_Operators.cs (2)
80conversion = conversion.Update(conversion.Operand, conversion.Conversion, conversion.IsBaseConversion, conversion.Checked, 290else if (final.Conversion.IsExplicit &&
Binder\RefSafetyAnalysis.cs (2)
1116VisitDeconstructionArguments(variables, right.Syntax, right.Conversion, right.Operand); 1261inlineArray: node.Expression is not BoundConversion { Conversion.IsIdentity: true, ExplicitCastInCode: false, Operand: BoundExpression operand } ? node.Expression : operand,
BoundTree\BoundConversion.cs (35)
16if (Conversion.IsTupleLiteralConversion || 17(Conversion.IsNullable && Conversion.UnderlyingConversions[0].IsTupleLiteralConversion)) 24Debug.Assert(Conversion.IsTupleLiteralConversion || 25(Conversion.IsNullable && Conversion.UnderlyingConversions[0].IsTupleLiteralConversion)); 31Debug.Assert(Conversion.IsIdentity); 39if (Conversion.IsUserDefined) 53if (Conversion.IsUserDefined) 55Debug.Assert(Conversion == ConversionGroupOpt.Conversion); 72Debug.Assert(Conversion.UserDefinedFromConversion.IsIdentity || 73(Conversion.UserDefinedFromConversion.IsTupleLiteralConversion && 85Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind) || 86(Conversion.IsExplicit && Conversion.IsNullable && 95Debug.Assert(Conversion == ConversionGroupOpt.Conversion.UserDefinedFromConversion); 100Debug.Assert(Conversion.IsNullable); 101Debug.Assert(Conversion.IsExplicit); 102Debug.Assert(Conversion.UnderlyingConversions[0].IsIdentity); 118Debug.Assert(Conversion.IsNullable); 119Debug.Assert(Conversion.IsImplicit); 120Debug.Assert(!Conversion.UnderlyingConversions[0].IsIdentity); 123operandAsConversion.Conversion.IsUserDefined); 131(operandAsConversion.Conversion.IsUserDefined || 145if (Conversion.IsUnion) 159if (Conversion.IsUnion) 161Debug.Assert(Conversion == ConversionGroupOpt.Conversion); 180Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind)); 187Debug.Assert(Conversion == ConversionGroupOpt.Conversion.BestUnionConversionAnalysis.SourceConversion); 192Debug.Assert(Conversion.IsNullable); 193Debug.Assert(Conversion.IsImplicit); 194Debug.Assert(Conversion.UnderlyingConversions[0].IsIdentity); 197operandAsConversion.Conversion.IsUnion); 198Debug.Assert(Conversion == ConversionGroupOpt.Conversion.BestUnionConversionAnalysis.TargetConversion); 228if (current?.ConversionGroupOpt == ConversionGroupOpt && current.Conversion.IsUnion)
BoundTree\BoundExpression.cs (4)
473get { return this.Conversion.Kind; } 478get { return this.Conversion.IsExtensionMethod; } 483get { return this.Conversion.Method; } 498return this.Update(operand: operand, this.Conversion, this.IsBaseConversion, this.Checked, this.ExplicitCastInCode, this.ConstantValueOpt, this.ConversionGroupOpt, this.InConversionGroupFlags, this.Type);
BoundTree\BoundExpressionExtensions.cs (1)
256return conversionNode.Conversion;
BoundTree\BoundNode.cs (10)
454return boundConversion.Conversion; 461while (possiblyUserDefined?.Conversion.IsUserDefined == false) 468Debug.Assert(possiblyUserDefined.Conversion.IsUserDefined); 478return possiblyUserDefined.Conversion; 488while (possiblyUnion?.Conversion.IsUnion == false) 495Debug.Assert(possiblyUnion.Conversion.IsUnion); 505return possiblyUnion.Conversion; 512if (!boundConversion.Conversion.IsUserDefined) 517if (boundConversion.Conversion.IsUserDefined) 526return boundConversion.Conversion;
BoundTree\BoundNode_Source.cs (1)
310append($" {conversion.Conversion} ");
Compilation\CSharpSemanticModel.cs (9)
2114else if ((highestBoundExpr as BoundConversion)?.Conversion.IsTupleLiteralConversion == true) 2129conversion = tupleLiteralConversion.Conversion; 2142if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.SwitchExpression, Conversion: var convertedSwitchConversion }) 2179if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.CollectionExpression or ConversionKind.NoConversion, Conversion: var convertedCollectionConversion }) 2185else if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.ImplicitNullable, Conversion.UnderlyingConversions: [{ Kind: ConversionKind.CollectionExpression }] } boundConversion) 2189conversion = boundConversion.Conversion; 2253else if (boundExpr is BoundConversion { ConversionKind: ConversionKind.MethodGroup, Conversion: var exprConversion, Type: { TypeKind: TypeKind.FunctionPointer }, SymbolOpt: var symbol }) 3550GetSymbolsAndResultKind(conversion, conversion.SymbolOpt, conversion.Conversion.OriginalUserDefinedConversions, out symbols, out resultKind); 3560conversion.Operand is BoundConversion { Conversion.IsUnion: true } unionConversion &&
Compilation\MemberSemanticModel.cs (2)
1051return new DeconstructionInfo(boundConversion.Conversion); 1069return new DeconstructionInfo(boundDeconstruction.DeconstructionAssignment.Right.Conversion);
FlowAnalysis\AbstractFlowPass.cs (1)
3058BoundConversion { Conversion: Conversion conversion, Operand: BoundConditionalAccess ca } when CanPropagateStateWhenNotNull(conversion) => ca,
FlowAnalysis\DefiniteAssignment.cs (1)
2768if (node.Conversion.IsInlineArray &&
FlowAnalysis\NullableWalker.cs (7)
2159switch (conv.Conversion.Kind) 2616var conversionKind = conversion.Conversion.Kind; 4223if (node.Conversion is BoundConversion { Conversion: var conversion }) 8999return (expr, conversion.Conversion); 9961if (conversion.IsIdentity && trackMembers && (conversionOpt is { } ? !conversionOpt.Conversion.IsIdentity : (targetInstanceSlotOpt > 0))) 11354VisitDeconstructionArguments(variables, right.Conversion, right.Operand, rightResultOpt); 11743if (node.OperandConversion is BoundConversion { Conversion: ({ IsUserDefined: true } or { IsUnion: true }) and { Method.ParameterCount: 1 } operandConversion })
Generated\BoundNodes.xml.Generated.cs (5)
3039if (operand != this.Operand || conversion != this.Conversion || isBaseConversion != this.IsBaseConversion || @checked != this.Checked || explicitCastInCode != this.ExplicitCastInCode || constantValueOpt != this.ConstantValueOpt || conversionGroupOpt != this.ConversionGroupOpt || inConversionGroupFlags != this.InConversionGroupFlags || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 11600return node.Update(operand, node.Conversion, node.IsBaseConversion, node.Checked, node.ExplicitCastInCode, node.ConstantValueOpt, node.ConversionGroupOpt, node.InConversionGroupFlags, type); 13769updatedNode = node.Update(operand, node.Conversion, node.IsBaseConversion, node.Checked, node.ExplicitCastInCode, node.ConstantValueOpt, node.ConversionGroupOpt, node.InConversionGroupFlags, infoAndType.Type!); 13774updatedNode = node.Update(operand, node.Conversion, node.IsBaseConversion, node.Checked, node.ExplicitCastInCode, node.ConstantValueOpt, node.ConversionGroupOpt, node.InConversionGroupFlags, node.Type); 16151new TreeDumperNode("conversion", node.Conversion, null),
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (1)
171var conversion = node.Conversion;
Lowering\ClosureConversion\ClosureConversion.cs (2)
1395Debug.Assert(_inExpressionLambda || conversion.Conversion.MethodSymbol is null); 1407conversion: conversion.Conversion,
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
681conversion.Conversion,
Lowering\DiagnosticsPass_ExpressionTrees.cs (2)
853CheckMethodGroup((BoundMethodGroup)node.Operand, node.Conversion.Method, node.IsExtensionMethod, parentIsConversion: true, node.Type); 907if (_inExpressionLambda && node.Conversion.Method is MethodSymbol method && (method.IsAbstract || method.IsVirtual) && method.IsStatic)
Lowering\DiagnosticsPass_Warnings.cs (1)
288if (!node.Operator.Kind.IsDynamic() && node.LeftConversion is BoundConversion { Conversion: { IsIdentity: false, Exists: true } conversion })
Lowering\LocalRewriter\LocalRewriter.cs (1)
1131return expr is BoundConversion { Conversion: { IsInterpolatedStringHandler: true }, Type: { IsValueType: true } };
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
206visitConversion(node.Conversion);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
763var spreadElementConversion = expressionStatement.Expression is BoundConversion { Conversion: var actualConversion } ? actualConversion : Conversion.Identity;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (7)
61case ConversionKind.ImplicitNullable when node.Conversion.UnderlyingConversions[0].Kind is ConversionKind.CollectionExpression: 62var rewrittenCollection = RewriteCollectionExpressionConversion(node.Conversion.UnderlyingConversions[0], (BoundCollectionExpression)node.Operand); 66return RewriteCollectionExpressionConversion(node.Conversion, (BoundCollectionExpression)node.Operand); 79var result = MakeConversionNode(node, node.Syntax, rewrittenOperand, node.Conversion, node.Checked, node.ExplicitCastInCode, node.ConstantValueOpt, rewrittenType); 1073case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument } 1078case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion 1081conversion.Conversion.AssertUnderlyingConversionsChecked();
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
20Debug.Assert(right.Conversion.Kind == ConversionKind.Deconstruction); 22return RewriteDeconstruction(node.Left, right.Conversion, right.Operand, node.IsUsed); 307if ((tupleConversion.Conversion.Kind == ConversionKind.ImplicitTupleLiteral || tupleConversion.Conversion.Kind == ConversionKind.Identity)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (2)
166var receiver = ConvertReceiverForInvocation(forEachSyntax, rewrittenExpression, getEnumeratorInfo.Method, convertedCollection.Conversion, enumeratorInfo.CollectionType); 1227collectionConversion = boundConversion.Conversion;
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
44if (leftConversion is BoundConversion { Conversion: { IsIdentity: false } }) 50if (leftConversion is not BoundConversion { Conversion: { Exists: true } })
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
240if (arg is BoundConversion { Conversion: { Kind: ConversionKind.InterpolatedStringHandler }, ExplicitCastInCode: false, Operand: var operand }) 251Debug.Assert(arguments.All(arg => arg is not BoundConversion { Conversion: { IsInterpolatedStringHandler: true }, ExplicitCastInCode: false }));
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (15)
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 89case BoundConversion { Conversion: { Kind: var kind }, Operand: var o } when 104if (expr is BoundConversion { ConversionKind: ConversionKind.ImplicitTuple, Conversion: var conversion } 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: // https://github.com/dotnet/roslyn/issues/82636: Add coverage 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 446conv.Conversion.AssertUnderlyingConversionsChecked(); 616conversion: conv.Conversion, @checked: conv.Checked, explicitCastInCode: conv.ExplicitCastInCode,
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (1)
769if (!conversion.Conversion.IsIdentity)
Operations\CSharpOperationFactory.cs (4)
1118Conversion conversion = boundConversion.Conversion; 1149conversion = nestedConversion.Conversion; 2044boundForEachStatement.Expression is not BoundConversion { Conversion.IsIdentity: true, ExplicitCastInCode: false, Operand: BoundExpression operand } ? 2485Debug.Assert(conversion.Conversion.IsInterpolatedStringHandler);
Symbols\Source\ParameterHelpers.cs (1)
1115return conversion is { Conversion.IsObjectCreation: true, Operand: BoundObjectCreationExpression { WasTargetTyped: true } operand } &&
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\ForEachTests.cs (1)
1742return ((BoundConversion)boundNode.Expression).Conversion;