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