734 references to ConversionKind
Microsoft.CodeAnalysis.CSharp (733)
Binder\Binder.ValueChecks.cs (7)
785
if (conversion.ConversionKind ==
ConversionKind
.Unboxing)
4346
Debug.Assert(conversion.ConversionKind !=
ConversionKind
.StackAllocToSpanType, "StackAllocToSpanType unexpected");
4348
if (conversion.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
4353
if (conversion.ConversionKind ==
ConversionKind
.CollectionExpression)
5117
Debug.Assert(conversion.ConversionKind !=
ConversionKind
.StackAllocToSpanType, "StackAllocToSpanType unexpected");
5119
if (conversion.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
5124
if (conversion.ConversionKind ==
ConversionKind
.CollectionExpression)
Binder\Binder_Conversions.cs (8)
143
if (conversion.Kind ==
ConversionKind
.FunctionType)
159
if (conversion.Kind ==
ConversionKind
.SwitchExpression)
174
if (conversion.Kind ==
ConversionKind
.ConditionalExpression)
189
if (conversion.Kind ==
ConversionKind
.InterpolatedString)
196
if (conversion.Kind ==
ConversionKind
.InterpolatedStringHandler)
270
if (conversion.Kind ==
ConversionKind
.DefaultLiteral)
280
if (conversion.Kind is
ConversionKind
.ImplicitReference or
ConversionKind
.ExplicitReference &&
Binder\Binder_Deconstruct.cs (2)
308
Debug.Assert(nestedConversion.Kind ==
ConversionKind
.Deconstruction);
341
conversion = new Conversion(
ConversionKind
.Deconstruction, deconstructMethod, nestedConversions.ToImmutableAndFree());
Binder\Binder_Operators.cs (45)
3271
return new BoundIsOperator(node, operand, typeExpression,
ConversionKind
.NoConversion, resultType, hasErrors: true);
3353
ConversionKind
conversionKind,
3388
ConversionKind
conversionKind,
3442
case
ConversionKind
.ImplicitSpan:
3443
case
ConversionKind
.ExplicitSpan:
3444
case
ConversionKind
.NoConversion:
3558
case
ConversionKind
.ImplicitNumeric:
3559
case
ConversionKind
.ExplicitNumeric:
3560
case
ConversionKind
.ImplicitEnumeration:
3562
case
ConversionKind
.ImplicitConstant:
3563
case
ConversionKind
.ImplicitUserDefined:
3564
case
ConversionKind
.ExplicitUserDefined:
3565
case
ConversionKind
.IntPtr:
3566
case
ConversionKind
.ExplicitTuple:
3567
case
ConversionKind
.ImplicitTuple:
3583
case
ConversionKind
.ExplicitEnumeration:
3588
goto case
ConversionKind
.NoConversion;
3593
case
ConversionKind
.ExplicitNullable:
3624
case
ConversionKind
.ImplicitReference:
3627
case
ConversionKind
.ExplicitReference:
3628
case
ConversionKind
.Unboxing:
3635
case
ConversionKind
.Identity:
3642
case
ConversionKind
.Boxing:
3659
case
ConversionKind
.ImplicitNullable:
3672
case
ConversionKind
.ImplicitDynamic:
3673
case
ConversionKind
.ExplicitDynamic:
3674
case
ConversionKind
.ExplicitPointerToInteger:
3675
case
ConversionKind
.ExplicitPointerToPointer:
3676
case
ConversionKind
.ImplicitPointerToVoid:
3677
case
ConversionKind
.ExplicitIntegerToPointer:
3678
case
ConversionKind
.ImplicitNullToPointer:
3679
case
ConversionKind
.AnonymousFunction:
3680
case
ConversionKind
.NullLiteral:
3681
case
ConversionKind
.DefaultLiteral:
3682
case
ConversionKind
.MethodGroup:
3850
ConversionKind
conversionKind,
3876
case
ConversionKind
.ImplicitReference:
3877
case
ConversionKind
.Boxing:
3878
case
ConversionKind
.ImplicitNullable:
3879
case
ConversionKind
.Identity:
3880
case
ConversionKind
.ExplicitNullable:
3881
case
ConversionKind
.ExplicitReference:
3882
case
ConversionKind
.Unboxing:
3912
ConversionKind
conversionKind,
3941
internal static ConstantValue GetAsOperatorConstantResult(TypeSymbol operandType, TypeSymbol targetType,
ConversionKind
conversionKind, ConstantValue operandConstantValue)
Binder\Binder_Patterns.cs (4)
696
else if ((conversion.ConversionKind ==
ConversionKind
.Boxing || conversion.ConversionKind ==
ConversionKind
.ImplicitReference)
706
else if (conversion.ConversionKind ==
ConversionKind
.ImplicitNullToPointer ||
707
(conversion.ConversionKind ==
ConversionKind
.NoConversion && convertedExpression.Type?.IsErrorType() == true))
Binder\Binder_Statements.cs (4)
1948
if (conversion.Kind !=
ConversionKind
.Identity)
2246
else if (conversion.Kind ==
ConversionKind
.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad &&
2674
if (conversion.Kind ==
ConversionKind
.Identity)
3161
if (conversion.Kind !=
ConversionKind
.Identity)
Binder\ForEachLoopBinder.cs (2)
471
if (elementConversionClassification.Kind !=
ConversionKind
.Identity && IterationVariable.RefKind is RefKind.Ref or RefKind.RefReadOnly)
574
(collectionConversionClassification.Kind ==
ConversionKind
.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String));
Binder\RefSafetyAnalysis.cs (4)
640
if (arg is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
923
Debug.Assert(conversion.Kind ==
ConversionKind
.Deconstruction);
1032
case
ConversionKind
.Identity:
1033
case
ConversionKind
.ImplicitTupleLiteral:
Binder\Semantics\Conversions\Conversion.cs (146)
21
private readonly
ConversionKind
_kind;
135
ConversionKind
.CollectionExpression,
140
ConversionKind
kind,
150
?
ConversionKind
.NoConversion
151
: isImplicit ?
ConversionKind
.ImplicitUserDefined :
ConversionKind
.ExplicitUserDefined;
163
internal Conversion(
ConversionKind
kind, MethodSymbol conversionMethod, bool isExtensionMethod)
173
internal Conversion(
ConversionKind
kind, ImmutableArray<Conversion> nestedConversions)
180
internal Conversion(
ConversionKind
kind, DeconstructMethodInfo deconstructMethodInfo, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo)
182
Debug.Assert(kind ==
ConversionKind
.Deconstruction);
195
Debug.Assert(_kind is
ConversionKind
.MethodGroup or
ConversionKind
.IntPtr or
ConversionKind
.ImplicitUserDefined or
ConversionKind
.ExplicitUserDefined);
215
private static void AssertTrivialConversion(
ConversionKind
kind)
221
case
ConversionKind
.NoConversion:
222
case
ConversionKind
.Identity:
223
case
ConversionKind
.ImplicitConstant:
224
case
ConversionKind
.ImplicitNumeric:
225
case
ConversionKind
.ImplicitReference:
226
case
ConversionKind
.ImplicitEnumeration:
227
case
ConversionKind
.ImplicitThrow:
228
case
ConversionKind
.AnonymousFunction:
229
case
ConversionKind
.Boxing:
230
case
ConversionKind
.NullLiteral:
231
case
ConversionKind
.DefaultLiteral:
232
case
ConversionKind
.ImplicitNullToPointer:
233
case
ConversionKind
.ImplicitPointerToVoid:
234
case
ConversionKind
.ExplicitPointerToPointer:
235
case
ConversionKind
.ExplicitPointerToInteger:
236
case
ConversionKind
.ExplicitIntegerToPointer:
237
case
ConversionKind
.Unboxing:
238
case
ConversionKind
.ExplicitReference:
239
case
ConversionKind
.IntPtr:
240
case
ConversionKind
.ExplicitEnumeration:
241
case
ConversionKind
.ExplicitNumeric:
242
case
ConversionKind
.ImplicitDynamic:
243
case
ConversionKind
.ExplicitDynamic:
244
case
ConversionKind
.InterpolatedString:
245
case
ConversionKind
.InterpolatedStringHandler:
246
case
ConversionKind
.InlineArray:
247
case
ConversionKind
.ImplicitSpan:
248
case
ConversionKind
.ExplicitSpan:
260
internal static Conversion GetTrivialConversion(
ConversionKind
kind)
266
internal static Conversion UnsetConversion => new Conversion(
ConversionKind
.UnsetConversionKind);
267
internal static Conversion NoConversion => new Conversion(
ConversionKind
.NoConversion);
268
internal static Conversion Identity => new Conversion(
ConversionKind
.Identity);
269
internal static Conversion ImplicitConstant => new Conversion(
ConversionKind
.ImplicitConstant);
270
internal static Conversion ImplicitNumeric => new Conversion(
ConversionKind
.ImplicitNumeric);
271
internal static Conversion ImplicitReference => new Conversion(
ConversionKind
.ImplicitReference);
272
internal static Conversion ImplicitEnumeration => new Conversion(
ConversionKind
.ImplicitEnumeration);
273
internal static Conversion ImplicitThrow => new Conversion(
ConversionKind
.ImplicitThrow);
274
internal static Conversion ObjectCreation => new Conversion(
ConversionKind
.ObjectCreation);
275
internal static Conversion CollectionExpression => new Conversion(
ConversionKind
.CollectionExpression);
276
internal static Conversion AnonymousFunction => new Conversion(
ConversionKind
.AnonymousFunction);
277
internal static Conversion Boxing => new Conversion(
ConversionKind
.Boxing);
278
internal static Conversion NullLiteral => new Conversion(
ConversionKind
.NullLiteral);
279
internal static Conversion DefaultLiteral => new Conversion(
ConversionKind
.DefaultLiteral);
280
internal static Conversion NullToPointer => new Conversion(
ConversionKind
.ImplicitNullToPointer);
281
internal static Conversion PointerToVoid => new Conversion(
ConversionKind
.ImplicitPointerToVoid);
282
internal static Conversion PointerToPointer => new Conversion(
ConversionKind
.ExplicitPointerToPointer);
283
internal static Conversion PointerToInteger => new Conversion(
ConversionKind
.ExplicitPointerToInteger);
284
internal static Conversion IntegerToPointer => new Conversion(
ConversionKind
.ExplicitIntegerToPointer);
285
internal static Conversion Unboxing => new Conversion(
ConversionKind
.Unboxing);
286
internal static Conversion ExplicitReference => new Conversion(
ConversionKind
.ExplicitReference);
287
internal static Conversion IntPtr => new Conversion(
ConversionKind
.IntPtr);
288
internal static Conversion ExplicitEnumeration => new Conversion(
ConversionKind
.ExplicitEnumeration);
289
internal static Conversion ExplicitNumeric => new Conversion(
ConversionKind
.ExplicitNumeric);
290
internal static Conversion ImplicitDynamic => new Conversion(
ConversionKind
.ImplicitDynamic);
291
internal static Conversion ExplicitDynamic => new Conversion(
ConversionKind
.ExplicitDynamic);
292
internal static Conversion InterpolatedString => new Conversion(
ConversionKind
.InterpolatedString);
293
internal static Conversion InterpolatedStringHandler => new Conversion(
ConversionKind
.InterpolatedStringHandler);
294
internal static Conversion Deconstruction => new Conversion(
ConversionKind
.Deconstruction);
295
internal static Conversion PinnedObjectToPointer => new Conversion(
ConversionKind
.PinnedObjectToPointer);
296
internal static Conversion ImplicitPointer => new Conversion(
ConversionKind
.ImplicitPointer);
297
internal static Conversion FunctionType => new Conversion(
ConversionKind
.FunctionType);
298
internal static Conversion InlineArray => new Conversion(
ConversionKind
.InlineArray);
299
internal static Conversion ImplicitSpan => new Conversion(
ConversionKind
.ImplicitSpan);
300
internal static Conversion ExplicitSpan => new Conversion(
ConversionKind
.ExplicitSpan);
312
internal static readonly Conversion ExplicitNullableWithExplicitEnumerationUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, ExplicitEnumerationUnderlying);
313
internal static readonly Conversion ExplicitNullableWithPointerToIntegerUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, PointerToIntegerUnderlying);
314
internal static readonly Conversion ExplicitNullableWithIdentityUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, IdentityUnderlying);
315
internal static readonly Conversion ExplicitNullableWithImplicitNumericUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, ImplicitNumericUnderlying);
316
internal static readonly Conversion ExplicitNullableWithExplicitNumericUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, ExplicitNumericUnderlying);
317
internal static readonly Conversion ExplicitNullableWithImplicitConstantUnderlying = new Conversion(
ConversionKind
.ExplicitNullable, ImplicitConstantUnderlying);
319
internal static readonly Conversion ImplicitNullableWithExplicitEnumerationUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, ExplicitEnumerationUnderlying);
320
internal static readonly Conversion ImplicitNullableWithPointerToIntegerUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, PointerToIntegerUnderlying);
321
internal static readonly Conversion ImplicitNullableWithIdentityUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, IdentityUnderlying);
322
internal static readonly Conversion ImplicitNullableWithImplicitNumericUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, ImplicitNumericUnderlying);
323
internal static readonly Conversion ImplicitNullableWithExplicitNumericUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, ExplicitNumericUnderlying);
324
internal static readonly Conversion ImplicitNullableWithImplicitConstantUnderlying = new Conversion(
ConversionKind
.ImplicitNullable, ImplicitConstantUnderlying);
340
return new Conversion(
ConversionKind
.StackAllocToPointerType, ImmutableArray.Create(underlyingConversion));
345
return new Conversion(
ConversionKind
.StackAllocToSpanType, ImmutableArray.Create(underlyingConversion));
348
internal static Conversion MakeNullableConversion(
ConversionKind
kind, Conversion nestedConversion)
350
Debug.Assert(kind ==
ConversionKind
.ImplicitNullable || kind ==
ConversionKind
.ExplicitNullable);
354
ConversionKind
.Identity => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithIdentityUnderlying : ExplicitNullableWithIdentityUnderlying,
355
ConversionKind
.ImplicitConstant => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithImplicitConstantUnderlying : ExplicitNullableWithImplicitConstantUnderlying,
356
ConversionKind
.ImplicitNumeric => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithImplicitNumericUnderlying : ExplicitNullableWithImplicitNumericUnderlying,
357
ConversionKind
.ExplicitNumeric => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithExplicitNumericUnderlying : ExplicitNullableWithExplicitNumericUnderlying,
358
ConversionKind
.ExplicitEnumeration => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithExplicitEnumerationUnderlying : ExplicitNullableWithExplicitEnumerationUnderlying,
359
ConversionKind
.ExplicitPointerToInteger => kind ==
ConversionKind
.ImplicitNullable ? ImplicitNullableWithPointerToIntegerUnderlying : ExplicitNullableWithPointerToIntegerUnderlying,
366
return new Conversion(
ConversionKind
.SwitchExpression, innerConversions);
371
return new Conversion(
ConversionKind
.ConditionalExpression, innerConversions);
374
internal
ConversionKind
Kind
604
return Kind !=
ConversionKind
.NoConversion;
647
return Kind ==
ConversionKind
.Identity;
658
return Kind ==
ConversionKind
.StackAllocToPointerType || Kind ==
ConversionKind
.StackAllocToSpanType;
672
return Kind ==
ConversionKind
.ImplicitNumeric || Kind ==
ConversionKind
.ExplicitNumeric;
686
return Kind ==
ConversionKind
.ImplicitEnumeration || Kind ==
ConversionKind
.ExplicitEnumeration;
697
return Kind ==
ConversionKind
.ImplicitThrow;
708
return Kind ==
ConversionKind
.ObjectCreation;
715
public bool IsCollectionExpression => Kind ==
ConversionKind
.CollectionExpression;
724
return Kind ==
ConversionKind
.SwitchExpression;
735
return Kind ==
ConversionKind
.ConditionalExpression;
750
return Kind ==
ConversionKind
.InterpolatedString;
761
return Kind ==
ConversionKind
.InterpolatedStringHandler;
772
return Kind ==
ConversionKind
.InlineArray;
786
return Kind ==
ConversionKind
.ImplicitNullable || Kind ==
ConversionKind
.ExplicitNullable;
797
return Kind ==
ConversionKind
.ImplicitTupleLiteral || Kind ==
ConversionKind
.ExplicitTupleLiteral;
808
return Kind ==
ConversionKind
.ImplicitTuple || Kind ==
ConversionKind
.ExplicitTuple;
822
return Kind ==
ConversionKind
.ImplicitReference || Kind ==
ConversionKind
.ExplicitReference;
836
return Kind is
ConversionKind
.ImplicitSpan or
ConversionKind
.ExplicitSpan;
864
return Kind ==
ConversionKind
.Boxing;
878
return Kind ==
ConversionKind
.Unboxing;
892
return Kind ==
ConversionKind
.NullLiteral;
903
return Kind ==
ConversionKind
.DefaultLiteral;
931
return Kind ==
ConversionKind
.ImplicitConstant;
945
return Kind ==
ConversionKind
.AnonymousFunction;
959
return Kind ==
ConversionKind
.MethodGroup;
1005
return Kind ==
ConversionKind
.IntPtr;
1061
return this.Kind ==
ConversionKind
.NoConversion ? LookupResultKind.Empty : LookupResultKind.Viable;
Binder\Semantics\Conversions\ConversionEasyOut.cs (14)
23
const byte IDN = (byte)
ConversionKind
.Identity;
24
const byte IRF = (byte)
ConversionKind
.ImplicitReference;
25
const byte XRF = (byte)
ConversionKind
.ExplicitReference;
26
const byte XNM = (byte)
ConversionKind
.ExplicitNumeric;
27
const byte NOC = (byte)
ConversionKind
.NoConversion;
28
const byte BOX = (byte)
ConversionKind
.Boxing;
29
const byte UNB = (byte)
ConversionKind
.Unboxing;
30
const byte NUM = (byte)
ConversionKind
.ImplicitNumeric;
31
const byte NUL = (byte)
ConversionKind
.ImplicitNullable;
32
const byte XNL = (byte)
ConversionKind
.ExplicitNullable;
72
public static
ConversionKind
ClassifyConversion(TypeSymbol source, TypeSymbol target)
77
return
ConversionKind
.NoConversion;
82
return
ConversionKind
.NoConversion;
84
return (
ConversionKind
)s_convkind[sourceIndex, targetIndex];
Binder\Semantics\Conversions\ConversionKindExtensions.cs (7)
6
using static Microsoft.CodeAnalysis.CSharp.
ConversionKind
;
12
public static bool IsDynamic(this
ConversionKind
conversionKind)
18
public static bool IsImplicitConversion(this
ConversionKind
conversionKind)
41
case
ConversionKind
.MethodGroup:
42
case
ConversionKind
.FunctionType:
81
public static bool IsUserDefinedConversion(this
ConversionKind
conversionKind)
94
public static bool IsPointerConversion(this
ConversionKind
kind)
Binder\Semantics\Conversions\Conversions.cs (1)
481
return new Conversion(
ConversionKind
.MethodGroup, method, methodGroup.IsExtensionMethodGroup);
Binder\Semantics\Conversions\ConversionsBase.cs (76)
490
ConversionKind
convKind = ConversionEasyOut.ClassifyConversion(source, target);
491
if (convKind !=
ConversionKind
.ImplicitNullable && convKind !=
ConversionKind
.ExplicitNullable)
585
private static bool IsStandardImplicitConversionFromType(
ConversionKind
kind)
589
case
ConversionKind
.Identity:
590
case
ConversionKind
.ImplicitNumeric:
591
case
ConversionKind
.ImplicitNullable:
592
case
ConversionKind
.ImplicitReference:
593
case
ConversionKind
.Boxing:
594
case
ConversionKind
.ImplicitConstant:
595
case
ConversionKind
.ImplicitPointer:
596
case
ConversionKind
.ImplicitPointerToVoid:
597
case
ConversionKind
.ImplicitTuple:
598
case
ConversionKind
.ImplicitSpan:
662
{ Kind:
ConversionKind
.CollectionExpression } => true,
663
{ Kind:
ConversionKind
.ImplicitNullable, UnderlyingConversions: [{ Kind:
ConversionKind
.CollectionExpression }] } => true,
668
static bool isStandardImplicitConversionFromExpression(
ConversionKind
kind)
677
case
ConversionKind
.NullLiteral:
678
case
ConversionKind
.AnonymousFunction:
679
case
ConversionKind
.MethodGroup:
680
case
ConversionKind
.ImplicitEnumeration:
681
case
ConversionKind
.ImplicitDynamic:
682
case
ConversionKind
.ImplicitNullToPointer:
683
case
ConversionKind
.ImplicitTupleLiteral:
684
case
ConversionKind
.StackAllocToPointerType:
685
case
ConversionKind
.StackAllocToSpanType:
686
case
ConversionKind
.InlineArray:
687
case
ConversionKind
.InterpolatedString:
698
Debug.Assert(conversion.Kind ==
ConversionKind
.NoConversion || IsStandardImplicitConversionFromType(conversion.Kind));
890
case
ConversionKind
.Identity:
893
case
ConversionKind
.ImplicitNumeric:
896
case
ConversionKind
.ImplicitReference:
899
case
ConversionKind
.Boxing:
902
case
ConversionKind
.NoConversion:
905
case
ConversionKind
.ImplicitPointerToVoid:
909
case
ConversionKind
.ImplicitTuple:
915
case
ConversionKind
.ImplicitNullable:
923
Conversion.MakeNullableConversion(
ConversionKind
.ExplicitNullable, underlyingConversion) :
928
case
ConversionKind
.ImplicitSpan:
1014
case
ConversionKind
.ImplicitUserDefined:
1015
case
ConversionKind
.ImplicitDynamic:
1016
case
ConversionKind
.ImplicitTuple:
1017
case
ConversionKind
.ImplicitTupleLiteral:
1018
case
ConversionKind
.ImplicitNullable:
1019
case
ConversionKind
.ConditionalExpression:
1020
case
ConversionKind
.ImplicitSpan:
1176
return new Conversion(
ConversionKind
.ImplicitNullable, ImmutableArray.Create(underlyingConversion));
1312
return new Conversion(
ConversionKind
.ImplicitNullable, ImmutableArray.Create(underlyingTupleConversion));
1341
return new Conversion(
ConversionKind
.ExplicitNullable, ImmutableArray.Create(underlyingTupleConversion));
1896
ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).Kind !=
ConversionKind
.NoConversion;
1960
ConversionKind
.ImplicitTupleLiteral,
1977
ConversionKind
.ImplicitTuple,
2007
case
ConversionKind
.Identity:
2008
case
ConversionKind
.Boxing:
2009
case
ConversionKind
.ImplicitReference:
2010
case
ConversionKind
.ImplicitSpan:
2013
case
ConversionKind
.ImplicitTuple:
2014
case
ConversionKind
.ImplicitTupleLiteral:
2027
Debug.Assert(conversion.Kind ==
ConversionKind
.NoConversion);
2034
private static
ConversionKind
GetNumericConversion(TypeSymbol source, TypeSymbol destination)
2041
return
ConversionKind
.UnsetConversionKind;
2048
return
ConversionKind
.UnsetConversionKind;
2051
var
conversionKind = ConversionEasyOut.ClassifyConversion(source, destination);
2052
Debug.Assert(conversionKind is
ConversionKind
.ImplicitNumeric or
ConversionKind
.ExplicitNumeric);
2058
return GetNumericConversion(source, destination) ==
ConversionKind
.ImplicitNumeric;
2065
return GetNumericConversion(source, destination) ==
ConversionKind
.ExplicitNumeric;
2275
return new Conversion(
ConversionKind
.ImplicitNullable, ImmutableArray.Create(tupleConversion));
2295
ConversionKind
.ImplicitTupleLiteral,
2313
ConversionKind
.ExplicitTupleLiteral,
2324
ConversionKind
kind,
2366
ConversionKind
.ImplicitTuple,
2385
ConversionKind
.ExplicitTuple,
2402
ConversionKind
kind,
2472
return new Conversion(
ConversionKind
.ExplicitNullable, ImmutableArray.Create(tupleConversion));
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (44)
609
private static bool IsEncompassingImplicitConversionKind(
ConversionKind
kind)
614
case
ConversionKind
.NoConversion:
618
case
ConversionKind
.ImplicitDynamic:
619
case
ConversionKind
.MethodGroup:
620
case
ConversionKind
.AnonymousFunction:
621
case
ConversionKind
.InterpolatedString:
622
case
ConversionKind
.SwitchExpression:
623
case
ConversionKind
.ConditionalExpression:
624
case
ConversionKind
.ImplicitEnumeration:
625
case
ConversionKind
.StackAllocToPointerType:
626
case
ConversionKind
.StackAllocToSpanType:
627
case
ConversionKind
.InterpolatedStringHandler:
630
case
ConversionKind
.ImplicitUserDefined:
631
case
ConversionKind
.ExplicitUserDefined:
632
case
ConversionKind
.FunctionType:
635
case
ConversionKind
.ExplicitNumeric:
636
case
ConversionKind
.ExplicitEnumeration:
637
case
ConversionKind
.ExplicitNullable:
638
case
ConversionKind
.ExplicitReference:
639
case
ConversionKind
.Unboxing:
640
case
ConversionKind
.ExplicitDynamic:
641
case
ConversionKind
.ExplicitPointerToPointer:
642
case
ConversionKind
.ExplicitPointerToInteger:
643
case
ConversionKind
.ExplicitIntegerToPointer:
644
case
ConversionKind
.IntPtr:
645
case
ConversionKind
.ExplicitTupleLiteral:
646
case
ConversionKind
.ExplicitTuple:
647
case
ConversionKind
.ExplicitSpan:
651
case
ConversionKind
.Identity:
652
case
ConversionKind
.ImplicitNumeric:
653
case
ConversionKind
.ImplicitNullable:
654
case
ConversionKind
.ImplicitReference:
655
case
ConversionKind
.Boxing:
656
case
ConversionKind
.ImplicitConstant:
657
case
ConversionKind
.ImplicitPointerToVoid:
660
case
ConversionKind
.NullLiteral:
661
case
ConversionKind
.ImplicitNullToPointer:
664
case
ConversionKind
.ImplicitTupleLiteral:
665
case
ConversionKind
.ImplicitTuple:
666
case
ConversionKind
.ImplicitThrow:
669
case
ConversionKind
.DefaultLiteral:
672
case
ConversionKind
.ImplicitPointer:
674
case
ConversionKind
.InlineArray:
676
case
ConversionKind
.ImplicitSpan:
Binder\Semantics\OverloadResolution\OverloadResolution.cs (20)
2191
if (allSame && Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2200
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2313
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2590
return conversionsOpt.Any(static c => c.Kind ==
ConversionKind
.FunctionType);
2863
return conv1.Kind ==
ConversionKind
.Identity ? BetterResult.Left : BetterResult.Neither;
2867
return conv2.Kind ==
ConversionKind
.Identity ? BetterResult.Right : BetterResult.Neither;
2919
case (
ConversionKind
.InterpolatedStringHandler,
ConversionKind
.InterpolatedStringHandler):
2921
case (
ConversionKind
.InterpolatedStringHandler, _):
2923
case (_,
ConversionKind
.InterpolatedStringHandler):
2930
case (
ConversionKind
.FunctionType,
ConversionKind
.FunctionType):
2932
case (_,
ConversionKind
.FunctionType):
2934
case (
ConversionKind
.FunctionType, _):
2966
if (conv1.Kind ==
ConversionKind
.CollectionExpression &&
2967
conv2.Kind ==
ConversionKind
.CollectionExpression)
2974
case (
ConversionKind
.ImplicitSpan,
ConversionKind
.ImplicitSpan):
2976
case (_,
ConversionKind
.ImplicitSpan):
2978
case (
ConversionKind
.ImplicitSpan, _):
Binder\SwitchBinder.cs (1)
417
Debug.Assert(conversion.Kind ==
ConversionKind
.ImplicitUserDefined);
BoundTree\BoundExpression.cs (7)
453
public
ConversionKind
ConversionKind
495
case
ConversionKind
.Identity:
498
case
ConversionKind
.ImplicitNumeric:
499
case
ConversionKind
.ImplicitEnumeration:
501
case
ConversionKind
.ImplicitReference:
502
case
ConversionKind
.Boxing:
506
case
ConversionKind
.ExplicitNumeric:
CodeGen\EmitConversion.cs (31)
44
case
ConversionKind
.MethodGroup:
46
case
ConversionKind
.ImplicitNullToPointer:
95
case
ConversionKind
.Identity:
98
case
ConversionKind
.ImplicitNumeric:
99
case
ConversionKind
.ExplicitNumeric:
102
case
ConversionKind
.ImplicitReference:
103
case
ConversionKind
.Boxing:
109
case
ConversionKind
.ExplicitReference:
110
case
ConversionKind
.Unboxing:
116
case
ConversionKind
.ImplicitEnumeration:
117
case
ConversionKind
.ExplicitEnumeration:
120
case
ConversionKind
.ImplicitUserDefined:
121
case
ConversionKind
.ExplicitUserDefined:
122
case
ConversionKind
.AnonymousFunction:
123
case
ConversionKind
.MethodGroup:
124
case
ConversionKind
.ImplicitTupleLiteral:
125
case
ConversionKind
.ImplicitTuple:
126
case
ConversionKind
.ExplicitTupleLiteral:
127
case
ConversionKind
.ExplicitTuple:
128
case
ConversionKind
.ImplicitDynamic:
129
case
ConversionKind
.ExplicitDynamic:
130
case
ConversionKind
.ImplicitThrow:
133
case
ConversionKind
.ImplicitPointerToVoid:
134
case
ConversionKind
.ExplicitPointerToPointer:
135
case
ConversionKind
.ImplicitPointer:
137
case
ConversionKind
.ExplicitPointerToInteger:
138
case
ConversionKind
.ExplicitIntegerToPointer:
167
case
ConversionKind
.PinnedObjectToPointer:
173
case
ConversionKind
.ImplicitNullToPointer:
175
case
ConversionKind
.ImplicitNullable:
176
case
ConversionKind
.ExplicitNullable:
CodeGen\EmitExpression.cs (13)
1234
if (conversion.ConversionKind ==
ConversionKind
.Unboxing)
1273
if (receiver.Kind == BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind ==
ConversionKind
.Unboxing)
1540
case
ConversionKind
.Boxing:
1545
case
ConversionKind
.MethodGroup:
1546
case
ConversionKind
.AnonymousFunction:
1549
case
ConversionKind
.ExplicitReference:
1550
case
ConversionKind
.ImplicitReference:
3920
var
conversionKind = conversion.ConversionKind;
3921
Debug.Assert(conversionKind !=
ConversionKind
.NullLiteral && conversionKind !=
ConversionKind
.DefaultLiteral);
3924
conversionKind !=
ConversionKind
.MethodGroup &&
3925
conversionKind !=
ConversionKind
.NullLiteral &&
3926
conversionKind !=
ConversionKind
.DefaultLiteral)
CodeGen\EmitOperators.cs (1)
375
if (comparand is BoundConversion { Type.SpecialType: SpecialType.System_Object, ConversionKind:
ConversionKind
.Boxing, Operand.Type: TypeParameterSymbol { AllowsRefLikeType: true } } &&
Compilation\CSharpSemanticModel.cs (14)
2101
conversion = new Conversion(
ConversionKind
.AnonymousFunction, lambda.Symbol, false);
2131
if (highestBoundExpr is BoundConversion { ConversionKind:
ConversionKind
.SwitchExpression, Conversion: var convertedSwitchConversion })
2149
if (highestBoundExpr is BoundConversion { ConversionKind:
ConversionKind
.ConditionalExpression })
2168
if (highestBoundExpr is BoundConversion { ConversionKind:
ConversionKind
.CollectionExpression or
ConversionKind
.NoConversion, Conversion: var convertedCollectionConversion })
2174
else if (highestBoundExpr is BoundConversion { ConversionKind:
ConversionKind
.ImplicitNullable, Conversion.UnderlyingConversions: [{ Kind:
ConversionKind
.CollectionExpression }] } boundConversion)
2198
if (conversion.Kind ==
ConversionKind
.AnonymousFunction)
2222
conversion = new Conversion(
ConversionKind
.MethodGroup, delegateCreation.MethodOpt, delegateCreation.IsExtensionMethod);
2228
conversion = new Conversion(
ConversionKind
.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod);
2234
conversion = new Conversion(
ConversionKind
.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod);
2242
else if (boundExpr is BoundConversion { ConversionKind:
ConversionKind
.MethodGroup, Conversion: var exprConversion, Type: { TypeKind: TypeKind.FunctionPointer }, SymbolOpt: var symbol })
3528
if ((conversion.ConversionKind ==
ConversionKind
.MethodGroup) && conversion.IsExtensionMethod)
4300
Debug.Assert(conversion.ConversionKind ==
ConversionKind
.MethodGroup);
Compilation\DeconstructionInfo.cs (3)
38
return _conversion.Kind ==
ConversionKind
.Deconstruction
51
return _conversion.Kind ==
ConversionKind
.Deconstruction
64
if (_conversion.Kind !=
ConversionKind
.Deconstruction)
FlowAnalysis\AbstractFlowPass.cs (3)
1736
if (node.ConversionKind ==
ConversionKind
.MethodGroup)
2631
|| (expr is BoundConversion { ConversionKind:
ConversionKind
.ExplicitNullable or
ConversionKind
.ImplicitNullable } conv
FlowAnalysis\DefiniteAssignment.cs (1)
933
boundConversion.ConversionKind ==
ConversionKind
.IntPtr)
FlowAnalysis\NullableWalker.cs (87)
2038
case
ConversionKind
.ExplicitNullable:
2057
case
ConversionKind
.ConditionalExpression or
ConversionKind
.SwitchExpression or
ConversionKind
.ObjectCreation when
2060
case
ConversionKind
.Identity:
2061
case
ConversionKind
.DefaultLiteral:
2062
case
ConversionKind
.ImplicitReference:
2063
case
ConversionKind
.ImplicitTupleLiteral:
2064
case
ConversionKind
.Boxing:
2493
var
conversionKind = conversion.Conversion.Kind;
2494
return (conversionKind ==
ConversionKind
.DefaultLiteral || conversionKind ==
ConversionKind
.NullLiteral) &&
2722
Debug.Assert(conversion.Kind is
ConversionKind
.Identity or
ConversionKind
.ImplicitReference);
5532
case
ConversionKind
.ImplicitReference:
5533
case
ConversionKind
.ExplicitReference:
7368
if (conversion is { IsValid: true, Kind:
ConversionKind
.ImplicitUserDefined })
8535
Debug.Assert(conversion.Kind ==
ConversionKind
.ImplicitTuple || conversion.Kind ==
ConversionKind
.ExplicitTuple);
8558
case
ConversionKind
.Identity:
8559
case
ConversionKind
.NullLiteral:
8560
case
ConversionKind
.DefaultLiteral:
8561
case
ConversionKind
.ImplicitReference:
8562
case
ConversionKind
.ExplicitReference:
8563
case
ConversionKind
.Boxing:
8564
case
ConversionKind
.Unboxing:
8567
case
ConversionKind
.ImplicitTupleLiteral:
8568
case
ConversionKind
.ExplicitTupleLiteral:
8569
case
ConversionKind
.ImplicitTuple:
8570
case
ConversionKind
.ExplicitTuple:
8584
case
ConversionKind
.ImplicitNullable:
8585
case
ConversionKind
.ExplicitNullable:
8601
case
ConversionKind
.ImplicitUserDefined:
8602
case
ConversionKind
.ExplicitUserDefined:
8812
conversion = Conversion.MakeNullableConversion(
ConversionKind
.ImplicitNullable, Conversion.Identity);
8842
case
ConversionKind
.MethodGroup:
8872
case
ConversionKind
.AnonymousFunction:
8889
case
ConversionKind
.FunctionType:
8893
case
ConversionKind
.InterpolatedString:
8897
case
ConversionKind
.InterpolatedStringHandler:
8902
case
ConversionKind
.ObjectCreation:
8903
case
ConversionKind
.CollectionExpression:
8904
case
ConversionKind
.SwitchExpression:
8905
case
ConversionKind
.ConditionalExpression:
8909
case
ConversionKind
.ExplicitUserDefined:
8910
case
ConversionKind
.ImplicitUserDefined:
8913
case
ConversionKind
.ExplicitDynamic:
8914
case
ConversionKind
.ImplicitDynamic:
8918
case
ConversionKind
.Boxing:
8922
case
ConversionKind
.Unboxing:
8938
case
ConversionKind
.ImplicitThrow:
8942
case
ConversionKind
.NoConversion:
8946
case
ConversionKind
.NullLiteral:
8947
case
ConversionKind
.DefaultLiteral:
8949
goto case
ConversionKind
.Identity;
8951
case
ConversionKind
.Identity:
8973
goto case
ConversionKind
.ImplicitTuple;
8975
goto case
ConversionKind
.ImplicitReference;
8977
case
ConversionKind
.ImplicitReference:
8978
case
ConversionKind
.ExplicitReference:
8989
case
ConversionKind
.ImplicitNullable:
9015
case
ConversionKind
.ExplicitNullable:
9031
goto case
ConversionKind
.ImplicitNullable;
9033
case
ConversionKind
.ImplicitTuple:
9034
case
ConversionKind
.ImplicitTupleLiteral:
9035
case
ConversionKind
.ExplicitTupleLiteral:
9036
case
ConversionKind
.ExplicitTuple:
9042
case
ConversionKind
.ImplicitTuple:
9043
case
ConversionKind
.ExplicitTuple:
9066
case
ConversionKind
.Deconstruction:
9071
case
ConversionKind
.ExplicitEnumeration:
9075
case
ConversionKind
.InlineArray:
9083
case
ConversionKind
.ImplicitSpan:
9084
case
ConversionKind
.ExplicitSpan:
9087
var
previousKind = conversion.Kind;
9347
Debug.Assert(conversion.Kind ==
ConversionKind
.ExplicitUserDefined || conversion.Kind ==
ConversionKind
.ImplicitUserDefined);
10136
Debug.Assert(conversion.Kind ==
ConversionKind
.Deconstruction);
10316
underlyingConversion.Kind ==
ConversionKind
.ImplicitNullable &&
10391
case
ConversionKind
.Identity:
10392
case
ConversionKind
.ImplicitTupleLiteral:
10921
(conversion.Kind ==
ConversionKind
.ExplicitReference && resultType.SpecialType == SpecialType.System_String))
11126
if (conversion.Kind ==
ConversionKind
.NoConversion)
11548
case
ConversionKind
.Identity:
11549
case
ConversionKind
.ImplicitReference:
11550
case
ConversionKind
.Boxing:
11551
case
ConversionKind
.ImplicitNullable:
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
397
if (node.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
FlowAnalysis\NullableWalker_Patterns.cs (6)
466
case
ConversionKind
.Identity:
467
case
ConversionKind
.ImplicitReference:
470
case
ConversionKind
.ExplicitNullable when AreNullableAndUnderlyingTypes(inputType, e.Type, out _):
765
ConversionKind
.Identity => true,
766
ConversionKind
.ImplicitReference => true,
767
ConversionKind
.Boxing => true,
Generated\BoundNodes.xml.Generated.cs (3)
2847
public BoundIsOperator(SyntaxNode syntax, BoundExpression operand, BoundTypeExpression targetType,
ConversionKind
conversionKind, TypeSymbol type, bool hasErrors = false)
2863
public
ConversionKind
ConversionKind { get; }
2868
public BoundIsOperator Update(BoundExpression operand, BoundTypeExpression targetType,
ConversionKind
conversionKind, TypeSymbol type)
Lowering\ClosureConversion\ClosureConversion.cs (2)
1394
Debug.Assert(conversion.ConversionKind !=
ConversionKind
.MethodGroup);
1395
if (conversion.ConversionKind ==
ConversionKind
.AnonymousFunction)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (13)
538
conversion.ConversionKind !=
ConversionKind
.NullLiteral &&
621
var
kind = _bound.Compilation.Conversions.ClassifyConversionFromType(oldType, newType, isChecked: false, ref useSiteInfo).Kind;
627
case
ConversionKind
.Identity:
629
case
ConversionKind
.ExplicitNumeric:
690
case
ConversionKind
.MethodGroup:
695
case
ConversionKind
.ExplicitUserDefined:
696
case
ConversionKind
.ImplicitUserDefined:
697
case
ConversionKind
.IntPtr:
705
!TypeSymbol.Equals(strippedOperandType, ((node.ConversionKind ==
ConversionKind
.ExplicitUserDefined) ? conversionInputType : conversionInputType.StrippedType()), TypeCompareKind.ConsiderEverything2);
718
case
ConversionKind
.ImplicitReference:
719
case
ConversionKind
.Identity:
724
case
ConversionKind
.ImplicitNullable:
737
case
ConversionKind
.NullLiteral:
Lowering\DiagnosticsPass_ExpressionTrees.cs (10)
790
case
ConversionKind
.MethodGroup:
795
case
ConversionKind
.AnonymousFunction:
804
case
ConversionKind
.ImplicitDynamic:
805
case
ConversionKind
.ExplicitDynamic:
812
case
ConversionKind
.ExplicitTuple:
813
case
ConversionKind
.ExplicitTupleLiteral:
814
case
ConversionKind
.ImplicitTuple:
815
case
ConversionKind
.ImplicitTupleLiteral:
822
case
ConversionKind
.InlineArray:
829
case
ConversionKind
.InterpolatedStringHandler:
Lowering\DiagnosticsPass_Warnings.cs (8)
435
if (conversion.ConversionKind !=
ConversionKind
.ImplicitNumeric &&
436
conversion.ConversionKind !=
ConversionKind
.ImplicitConstant)
580
if (conv.ConversionKind ==
ConversionKind
.ImplicitNullable)
868
if (conv.ConversionKind ==
ConversionKind
.ExplicitNullable || conv.ConversionKind ==
ConversionKind
.ImplicitNullable)
894
case
ConversionKind
.Deconstruction:
895
case
ConversionKind
.ImplicitTupleLiteral:
896
case
ConversionKind
.Identity:
Lowering\Extensions.cs (7)
61
case
ConversionKind
.ImplicitNullable:
62
case
ConversionKind
.ExplicitNullable:
66
case
ConversionKind
.ImplicitEnumeration:
108
case
ConversionKind
.NullLiteral:
112
case
ConversionKind
.DefaultLiteral:
115
case
ConversionKind
.ImplicitNullable:
116
case
ConversionKind
.ExplicitNullable:
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
215
case
ConversionKind
.MethodGroup:
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (2)
218
if (conversion.Kind ==
ConversionKind
.ExplicitNullable &&
485
(conv.IsIdentity || conv.Kind ==
ConversionKind
.ImplicitReference || conv.IsBoxing) &&
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (1)
716
if (conversion.ConversionKind ==
ConversionKind
.Boxing)
Lowering\LocalRewriter\LocalRewriter_Call.cs (30)
570
case
ConversionKind
.AnonymousFunction:
571
case
ConversionKind
.ImplicitConstant:
572
case
ConversionKind
.MethodGroup:
573
case
ConversionKind
.NullLiteral:
574
case
ConversionKind
.DefaultLiteral:
577
case
ConversionKind
.Boxing:
578
case
ConversionKind
.ImplicitDynamic:
579
case
ConversionKind
.ExplicitDynamic:
580
case
ConversionKind
.ExplicitEnumeration:
581
case
ConversionKind
.ExplicitNullable:
582
case
ConversionKind
.ExplicitNumeric:
583
case
ConversionKind
.ExplicitReference:
584
case
ConversionKind
.Identity:
585
case
ConversionKind
.ImplicitEnumeration:
586
case
ConversionKind
.ImplicitNullable:
587
case
ConversionKind
.ImplicitNumeric:
588
case
ConversionKind
.ImplicitReference:
589
case
ConversionKind
.Unboxing:
590
case
ConversionKind
.ExplicitPointerToInteger:
591
case
ConversionKind
.ExplicitPointerToPointer:
592
case
ConversionKind
.ImplicitPointerToVoid:
593
case
ConversionKind
.ImplicitNullToPointer:
594
case
ConversionKind
.ExplicitIntegerToPointer:
598
case
ConversionKind
.ExplicitUserDefined:
599
case
ConversionKind
.ImplicitUserDefined:
602
case
ConversionKind
.IntPtr:
603
case
ConversionKind
.ImplicitThrow:
836
if (argument is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
909
if (argument is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
1396
=> expr is BoundConversion conv && conv.ConversionKind ==
ConversionKind
.AnonymousFunction;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (5)
33
Debug.Assert(conversion.Kind ==
ConversionKind
.CollectionExpression);
204
if (conversion.Kind is not (
ConversionKind
.Identity or
ConversionKind
.ImplicitReference))
211
return conversion.Kind is
ConversionKind
.Identity or
ConversionKind
.ImplicitReference;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (60)
22
case
ConversionKind
.InterpolatedString:
24
case
ConversionKind
.InterpolatedStringHandler:
37
case
ConversionKind
.SwitchExpression:
41
case
ConversionKind
.ConditionalExpression:
45
case
ConversionKind
.ObjectCreation:
61
case
ConversionKind
.ImplicitNullable when node.Conversion.UnderlyingConversions[0].Kind is
ConversionKind
.CollectionExpression:
65
case
ConversionKind
.CollectionExpression:
72
_inExpressionLambda = _inExpressionLambda || (node.ConversionKind ==
ConversionKind
.AnonymousFunction && !wasInExpressionLambda && rewrittenType.IsExpressionTree());
252
return conversion.ConversionKind ==
ConversionKind
.Identity && !conversion.ExplicitCastInCode;
319
case
ConversionKind
.Identity:
352
case
ConversionKind
.ExplicitUserDefined:
353
case
ConversionKind
.ImplicitUserDefined:
361
case
ConversionKind
.IntPtr:
365
case
ConversionKind
.ImplicitNullable:
366
case
ConversionKind
.ExplicitNullable:
375
case
ConversionKind
.Boxing:
399
case
ConversionKind
.NullLiteral:
400
case
ConversionKind
.DefaultLiteral:
408
case
ConversionKind
.ImplicitReference:
409
case
ConversionKind
.ExplicitReference:
417
case
ConversionKind
.ImplicitConstant:
424
goto case
ConversionKind
.ImplicitNumeric;
426
case
ConversionKind
.ImplicitNumeric:
427
case
ConversionKind
.ExplicitNumeric:
440
case
ConversionKind
.ImplicitTupleLiteral:
441
case
ConversionKind
.ExplicitTupleLiteral:
450
case
ConversionKind
.ImplicitThrow:
457
case
ConversionKind
.ImplicitEnumeration:
486
goto case
ConversionKind
.ExplicitEnumeration;
488
case
ConversionKind
.ExplicitEnumeration:
533
case
ConversionKind
.ImplicitDynamic:
534
case
ConversionKind
.ExplicitDynamic:
538
return _dynamicFactory.MakeDynamicConversion(rewrittenOperand, explicitCastInCode || conversion.Kind ==
ConversionKind
.ExplicitDynamic, conversion.IsArrayIndex, @checked, rewrittenType).ToExpression();
540
case
ConversionKind
.ImplicitTuple:
541
case
ConversionKind
.ExplicitTuple:
550
case
ConversionKind
.MethodGroup when oldNodeOpt is { Type: { TypeKind: TypeKind.FunctionPointer } funcPtrType }:
561
case
ConversionKind
.MethodGroup:
594
case
ConversionKind
.InlineArray:
617
case
ConversionKind
.ImplicitSpan:
618
case
ConversionKind
.ExplicitSpan:
649
Debug.Assert(conversion.Kind is
ConversionKind
.ImplicitSpan);
681
Debug.Assert(conversion.Kind is
ConversionKind
.ImplicitSpan);
700
Debug.Assert(conversion.Kind is
ConversionKind
.ImplicitSpan);
1007
case BoundConversion { Conversion: { Kind:
ConversionKind
.ImplicitNullable }, Operand: var convertedArgument }
1012
case BoundConversion { Conversion: { Kind:
ConversionKind
.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1013
when underlying.Length == 1 && underlying[0].Kind ==
ConversionKind
.ImplicitTuple && !convertedArgument.Type!.IsNullableType():
1131
var
conversionKind = conversion.Kind.IsImplicitConversion() ?
ConversionKind
.ImplicitUserDefined :
ConversionKind
.ExplicitUserDefined;
1737
ConversionKind
conversionKind = isImplicit ?
ConversionKind
.ImplicitUserDefined :
ConversionKind
.ExplicitUserDefined;
1756
case
ConversionKind
.ExplicitUserDefined:
1757
case
ConversionKind
.ImplicitUserDefined:
1788
case
ConversionKind
.IntPtr:
1800
case
ConversionKind
.ImplicitNumeric:
1801
case
ConversionKind
.ExplicitNumeric:
1815
case
ConversionKind
.ImplicitEnumeration:
1816
case
ConversionKind
.ExplicitEnumeration:
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
20
Debug.Assert(right.Conversion.Kind ==
ConversionKind
.Deconstruction);
219
Debug.Assert(conversion.Kind ==
ConversionKind
.Deconstruction);
307
if ((tupleConversion.Conversion.Kind ==
ConversionKind
.ImplicitTupleLiteral || tupleConversion.Conversion.Kind ==
ConversionKind
.Identity)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
30
ConversionKind
conversionKind,
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
92
BoundNode.GetConversion(leftConversion, leftPlaceholder) is { Kind:
ConversionKind
.Identity or
ConversionKind
.ImplicitReference })
99
if (BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsIdentity: true } or { Kind:
ConversionKind
.ExplicitNullable })
224
if (boundConversion.ConversionKind !=
ConversionKind
.Identity)
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
618
if (conv.ConversionKind ==
ConversionKind
.Boxing)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
18
Debug.Assert(conversion.ConversionKind ==
ConversionKind
.InterpolatedString);
240
if (arg is BoundConversion { Conversion: { Kind:
ConversionKind
.InterpolatedStringHandler }, ExplicitCastInCode: false, Operand: var operand })
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (16)
49
case BoundConversion { Conversion: { Kind:
ConversionKind
.Identity }, Operand: var o }:
51
case BoundConversion { Conversion: { Kind:
ConversionKind
.ImplicitTupleLiteral }, Operand: var o }:
89
(kind ==
ConversionKind
.ImplicitNullable || kind ==
ConversionKind
.ExplicitNullable) &&
103
if (expr is BoundConversion { ConversionKind:
ConversionKind
.ImplicitTuple, Conversion: var conversion } boundConversion)
190
case BoundConversion { Conversion: { Kind:
ConversionKind
.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting.
211
var conversion = Conversion.MakeNullableConversion(
ConversionKind
.ImplicitNullable, Conversion.Identity);
224
bool conversionMustBePerformedOnOriginalExpression(
ConversionKind
kind)
230
case
ConversionKind
.AnonymousFunction: // a lambda cannot be saved without a target type
231
case
ConversionKind
.MethodGroup: // similarly for a method group
232
case
ConversionKind
.InterpolatedString: // an interpolated string must be saved in interpolated form
233
case
ConversionKind
.SwitchExpression: // a switch expression must have its arms converted
234
case
ConversionKind
.StackAllocToPointerType: // a stack alloc is not well-defined without an enclosing conversion
235
case
ConversionKind
.ConditionalExpression: // a conditional expression must have its alternatives converted
236
case
ConversionKind
.StackAllocToSpanType:
237
case
ConversionKind
.ObjectCreation:
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
508
Debug.Assert(methodArgumentInfo.Arguments.All(arg => arg is not BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler }));
Lowering\SpillSequenceSpiller.cs (1)
1176
if (node.ConversionKind ==
ConversionKind
.AnonymousFunction && node.Type.IsExpressionTree())
Lowering\SyntheticBoundNodeFactory.cs (4)
558
Debug.Assert(conversion.Kind !=
ConversionKind
.NoConversion);
559
if (conversion.Kind !=
ConversionKind
.Identity)
1501
if (conversion.Kind ==
ConversionKind
.ImplicitReference && arg.IsLiteralNull())
1507
if (conversion.Kind ==
ConversionKind
.ExplicitNullable &&
Operations\CSharpOperationFactory.cs (2)
1021
if (boundConversion.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
1028
if (boundConversion.ConversionKind == CSharp.
ConversionKind
.MethodGroup)
Operations\CSharpOperationFactory_Methods.cs (1)
145
if (boundConversion.ConversionKind ==
ConversionKind
.MethodGroup)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
400
((BoundConversion)convertedExpression).ConversionKind !=
ConversionKind
.DefaultLiteral)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
1367
return conversions.ClassifyImplicitConversionFromType(sourceType, targetType, ref discardedUseSiteInfo).Kind !=
ConversionKind
.NoConversion;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
FunctionPointerUtilities.cs (1)
185
var
expectedConversionKind = (expectedType, expectedConvertedType, expectedSymbol) switch