735 references to ConversionKind
Microsoft.CodeAnalysis.CSharp (734)
Binder\Binder.ValueChecks.cs (7)
762
if (conversion.ConversionKind ==
ConversionKind
.Unboxing)
4322
Debug.Assert(conversion.ConversionKind !=
ConversionKind
.StackAllocToSpanType, "StackAllocToSpanType unexpected");
4324
if (conversion.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
4329
if (conversion.ConversionKind ==
ConversionKind
.CollectionExpression)
5099
Debug.Assert(conversion.ConversionKind !=
ConversionKind
.StackAllocToSpanType, "StackAllocToSpanType unexpected");
5101
if (conversion.ConversionKind ==
ConversionKind
.InterpolatedStringHandler)
5106
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)
3276
return new BoundIsOperator(node, operand, typeExpression,
ConversionKind
.NoConversion, resultType, hasErrors: true);
3358
ConversionKind
conversionKind,
3393
ConversionKind
conversionKind,
3447
case
ConversionKind
.ImplicitSpan:
3448
case
ConversionKind
.ExplicitSpan:
3449
case
ConversionKind
.NoConversion:
3563
case
ConversionKind
.ImplicitNumeric:
3564
case
ConversionKind
.ExplicitNumeric:
3565
case
ConversionKind
.ImplicitEnumeration:
3567
case
ConversionKind
.ImplicitConstant:
3568
case
ConversionKind
.ImplicitUserDefined:
3569
case
ConversionKind
.ExplicitUserDefined:
3570
case
ConversionKind
.IntPtr:
3571
case
ConversionKind
.ExplicitTuple:
3572
case
ConversionKind
.ImplicitTuple:
3588
case
ConversionKind
.ExplicitEnumeration:
3593
goto case
ConversionKind
.NoConversion;
3598
case
ConversionKind
.ExplicitNullable:
3629
case
ConversionKind
.ImplicitReference:
3632
case
ConversionKind
.ExplicitReference:
3633
case
ConversionKind
.Unboxing:
3640
case
ConversionKind
.Identity:
3647
case
ConversionKind
.Boxing:
3664
case
ConversionKind
.ImplicitNullable:
3677
case
ConversionKind
.ImplicitDynamic:
3678
case
ConversionKind
.ExplicitDynamic:
3679
case
ConversionKind
.ExplicitPointerToInteger:
3680
case
ConversionKind
.ExplicitPointerToPointer:
3681
case
ConversionKind
.ImplicitPointerToVoid:
3682
case
ConversionKind
.ExplicitIntegerToPointer:
3683
case
ConversionKind
.ImplicitNullToPointer:
3684
case
ConversionKind
.AnonymousFunction:
3685
case
ConversionKind
.NullLiteral:
3686
case
ConversionKind
.DefaultLiteral:
3687
case
ConversionKind
.MethodGroup:
3855
ConversionKind
conversionKind,
3881
case
ConversionKind
.ImplicitReference:
3882
case
ConversionKind
.Boxing:
3883
case
ConversionKind
.ImplicitNullable:
3884
case
ConversionKind
.Identity:
3885
case
ConversionKind
.ExplicitNullable:
3886
case
ConversionKind
.ExplicitReference:
3887
case
ConversionKind
.Unboxing:
3917
ConversionKind
conversionKind,
3946
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)
1951
if (conversion.Kind !=
ConversionKind
.Identity)
2249
else if (conversion.Kind ==
ConversionKind
.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad &&
2677
if (conversion.Kind ==
ConversionKind
.Identity)
3164
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)
665
if (arg is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
948
Debug.Assert(conversion.Kind ==
ConversionKind
.Deconstruction);
1057
case
ConversionKind
.Identity:
1058
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)
614
private static bool IsEncompassingImplicitConversionKind(
ConversionKind
kind)
619
case
ConversionKind
.NoConversion:
623
case
ConversionKind
.ImplicitDynamic:
624
case
ConversionKind
.MethodGroup:
625
case
ConversionKind
.AnonymousFunction:
626
case
ConversionKind
.InterpolatedString:
627
case
ConversionKind
.SwitchExpression:
628
case
ConversionKind
.ConditionalExpression:
629
case
ConversionKind
.ImplicitEnumeration:
630
case
ConversionKind
.StackAllocToPointerType:
631
case
ConversionKind
.StackAllocToSpanType:
632
case
ConversionKind
.InterpolatedStringHandler:
635
case
ConversionKind
.ImplicitUserDefined:
636
case
ConversionKind
.ExplicitUserDefined:
637
case
ConversionKind
.FunctionType:
640
case
ConversionKind
.ExplicitNumeric:
641
case
ConversionKind
.ExplicitEnumeration:
642
case
ConversionKind
.ExplicitNullable:
643
case
ConversionKind
.ExplicitReference:
644
case
ConversionKind
.Unboxing:
645
case
ConversionKind
.ExplicitDynamic:
646
case
ConversionKind
.ExplicitPointerToPointer:
647
case
ConversionKind
.ExplicitPointerToInteger:
648
case
ConversionKind
.ExplicitIntegerToPointer:
649
case
ConversionKind
.IntPtr:
650
case
ConversionKind
.ExplicitTupleLiteral:
651
case
ConversionKind
.ExplicitTuple:
652
case
ConversionKind
.ExplicitSpan:
656
case
ConversionKind
.Identity:
657
case
ConversionKind
.ImplicitNumeric:
658
case
ConversionKind
.ImplicitNullable:
659
case
ConversionKind
.ImplicitReference:
660
case
ConversionKind
.Boxing:
661
case
ConversionKind
.ImplicitConstant:
662
case
ConversionKind
.ImplicitPointerToVoid:
665
case
ConversionKind
.NullLiteral:
666
case
ConversionKind
.ImplicitNullToPointer:
669
case
ConversionKind
.ImplicitTupleLiteral:
670
case
ConversionKind
.ImplicitTuple:
671
case
ConversionKind
.ImplicitThrow:
674
case
ConversionKind
.DefaultLiteral:
677
case
ConversionKind
.ImplicitPointer:
679
case
ConversionKind
.InlineArray:
681
case
ConversionKind
.ImplicitSpan:
Binder\Semantics\OverloadResolution\OverloadResolution.cs (20)
2199
if (allSame && Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2208
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2321
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind !=
ConversionKind
.Identity)
2598
return conversionsOpt.Any(static c => c.Kind ==
ConversionKind
.FunctionType);
2871
return conv1.Kind ==
ConversionKind
.Identity ? BetterResult.Left : BetterResult.Neither;
2875
return conv2.Kind ==
ConversionKind
.Identity ? BetterResult.Right : BetterResult.Neither;
2927
case (
ConversionKind
.InterpolatedStringHandler,
ConversionKind
.InterpolatedStringHandler):
2929
case (
ConversionKind
.InterpolatedStringHandler, _):
2931
case (_,
ConversionKind
.InterpolatedStringHandler):
2938
case (
ConversionKind
.FunctionType,
ConversionKind
.FunctionType):
2940
case (_,
ConversionKind
.FunctionType):
2942
case (
ConversionKind
.FunctionType, _):
2974
if (conv1.Kind ==
ConversionKind
.CollectionExpression &&
2975
conv2.Kind ==
ConversionKind
.CollectionExpression)
2982
case (
ConversionKind
.ImplicitSpan,
ConversionKind
.ImplicitSpan):
2997
case (_,
ConversionKind
.ImplicitSpan):
2999
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 (15)
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)
4298
if (conversion.ConversionKind ==
ConversionKind
.MethodGroup)
4302
else if (conversion.Operand is BoundConversion { ConversionKind:
ConversionKind
.MethodGroup } nestedMethodGroupConversion)
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)
2635
|| (expr is BoundConversion { ConversionKind:
ConversionKind
.ExplicitNullable or
ConversionKind
.ImplicitNullable } conv
FlowAnalysis\DefiniteAssignment.cs (1)
933
boundConversion.ConversionKind ==
ConversionKind
.IntPtr)
FlowAnalysis\NullableWalker.cs (87)
2099
case
ConversionKind
.ExplicitNullable:
2118
case
ConversionKind
.ConditionalExpression or
ConversionKind
.SwitchExpression or
ConversionKind
.ObjectCreation when
2121
case
ConversionKind
.Identity:
2122
case
ConversionKind
.DefaultLiteral:
2123
case
ConversionKind
.ImplicitReference:
2124
case
ConversionKind
.ImplicitTupleLiteral:
2125
case
ConversionKind
.Boxing:
2554
var
conversionKind = conversion.Conversion.Kind;
2555
return (conversionKind ==
ConversionKind
.DefaultLiteral || conversionKind ==
ConversionKind
.NullLiteral) &&
2783
Debug.Assert(conversion.Kind is
ConversionKind
.Identity or
ConversionKind
.ImplicitReference);
5593
case
ConversionKind
.ImplicitReference:
5594
case
ConversionKind
.ExplicitReference:
7426
if (conversion is { IsValid: true, Kind:
ConversionKind
.ImplicitUserDefined })
8593
Debug.Assert(conversion.Kind ==
ConversionKind
.ImplicitTuple || conversion.Kind ==
ConversionKind
.ExplicitTuple);
8616
case
ConversionKind
.Identity:
8617
case
ConversionKind
.NullLiteral:
8618
case
ConversionKind
.DefaultLiteral:
8619
case
ConversionKind
.ImplicitReference:
8620
case
ConversionKind
.ExplicitReference:
8621
case
ConversionKind
.Boxing:
8622
case
ConversionKind
.Unboxing:
8625
case
ConversionKind
.ImplicitTupleLiteral:
8626
case
ConversionKind
.ExplicitTupleLiteral:
8627
case
ConversionKind
.ImplicitTuple:
8628
case
ConversionKind
.ExplicitTuple:
8642
case
ConversionKind
.ImplicitNullable:
8643
case
ConversionKind
.ExplicitNullable:
8659
case
ConversionKind
.ImplicitUserDefined:
8660
case
ConversionKind
.ExplicitUserDefined:
8870
conversion = Conversion.MakeNullableConversion(
ConversionKind
.ImplicitNullable, Conversion.Identity);
8900
case
ConversionKind
.MethodGroup:
8930
case
ConversionKind
.AnonymousFunction:
8947
case
ConversionKind
.FunctionType:
8951
case
ConversionKind
.InterpolatedString:
8955
case
ConversionKind
.InterpolatedStringHandler:
8960
case
ConversionKind
.ObjectCreation:
8961
case
ConversionKind
.CollectionExpression:
8962
case
ConversionKind
.SwitchExpression:
8963
case
ConversionKind
.ConditionalExpression:
8967
case
ConversionKind
.ExplicitUserDefined:
8968
case
ConversionKind
.ImplicitUserDefined:
8971
case
ConversionKind
.ExplicitDynamic:
8972
case
ConversionKind
.ImplicitDynamic:
8976
case
ConversionKind
.Boxing:
8980
case
ConversionKind
.Unboxing:
8996
case
ConversionKind
.ImplicitThrow:
9000
case
ConversionKind
.NoConversion:
9004
case
ConversionKind
.NullLiteral:
9005
case
ConversionKind
.DefaultLiteral:
9007
goto case
ConversionKind
.Identity;
9009
case
ConversionKind
.Identity:
9031
goto case
ConversionKind
.ImplicitTuple;
9033
goto case
ConversionKind
.ImplicitReference;
9035
case
ConversionKind
.ImplicitReference:
9036
case
ConversionKind
.ExplicitReference:
9047
case
ConversionKind
.ImplicitNullable:
9073
case
ConversionKind
.ExplicitNullable:
9089
goto case
ConversionKind
.ImplicitNullable;
9091
case
ConversionKind
.ImplicitTuple:
9092
case
ConversionKind
.ImplicitTupleLiteral:
9093
case
ConversionKind
.ExplicitTupleLiteral:
9094
case
ConversionKind
.ExplicitTuple:
9100
case
ConversionKind
.ImplicitTuple:
9101
case
ConversionKind
.ExplicitTuple:
9124
case
ConversionKind
.Deconstruction:
9129
case
ConversionKind
.ExplicitEnumeration:
9133
case
ConversionKind
.InlineArray:
9141
case
ConversionKind
.ImplicitSpan:
9142
case
ConversionKind
.ExplicitSpan:
9145
var
previousKind = conversion.Kind;
9405
Debug.Assert(conversion.Kind ==
ConversionKind
.ExplicitUserDefined || conversion.Kind ==
ConversionKind
.ImplicitUserDefined);
10194
Debug.Assert(conversion.Kind ==
ConversionKind
.Deconstruction);
10374
underlyingConversion.Kind ==
ConversionKind
.ImplicitNullable &&
10449
case
ConversionKind
.Identity:
10450
case
ConversionKind
.ImplicitTupleLiteral:
10979
(conversion.Kind ==
ConversionKind
.ExplicitReference && resultType.SpecialType == SpecialType.System_String))
11184
if (conversion.Kind ==
ConversionKind
.NoConversion)
11606
case
ConversionKind
.Identity:
11607
case
ConversionKind
.ImplicitReference:
11608
case
ConversionKind
.Boxing:
11609
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)
2848
public BoundIsOperator(SyntaxNode syntax, BoundExpression operand, BoundTypeExpression targetType,
ConversionKind
conversionKind, TypeSymbol type, bool hasErrors = false)
2864
public
ConversionKind
ConversionKind { get; }
2869
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)
569
case
ConversionKind
.AnonymousFunction:
570
case
ConversionKind
.ImplicitConstant:
571
case
ConversionKind
.MethodGroup:
572
case
ConversionKind
.NullLiteral:
573
case
ConversionKind
.DefaultLiteral:
576
case
ConversionKind
.Boxing:
577
case
ConversionKind
.ImplicitDynamic:
578
case
ConversionKind
.ExplicitDynamic:
579
case
ConversionKind
.ExplicitEnumeration:
580
case
ConversionKind
.ExplicitNullable:
581
case
ConversionKind
.ExplicitNumeric:
582
case
ConversionKind
.ExplicitReference:
583
case
ConversionKind
.Identity:
584
case
ConversionKind
.ImplicitEnumeration:
585
case
ConversionKind
.ImplicitNullable:
586
case
ConversionKind
.ImplicitNumeric:
587
case
ConversionKind
.ImplicitReference:
588
case
ConversionKind
.Unboxing:
589
case
ConversionKind
.ExplicitPointerToInteger:
590
case
ConversionKind
.ExplicitPointerToPointer:
591
case
ConversionKind
.ImplicitPointerToVoid:
592
case
ConversionKind
.ImplicitNullToPointer:
593
case
ConversionKind
.ExplicitIntegerToPointer:
597
case
ConversionKind
.ExplicitUserDefined:
598
case
ConversionKind
.ImplicitUserDefined:
601
case
ConversionKind
.IntPtr:
602
case
ConversionKind
.ImplicitThrow:
835
if (argument is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
908
if (argument is BoundConversion { ConversionKind:
ConversionKind
.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion)
1395
=> expr is BoundConversion conv && conv.ConversionKind ==
ConversionKind
.AnonymousFunction;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (5)
33
Debug.Assert(conversion.Kind ==
ConversionKind
.CollectionExpression);
207
if (conversion.Kind is not (
ConversionKind
.Identity or
ConversionKind
.ImplicitReference))
214
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)
401
((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