735 references to ConversionKind
Microsoft.CodeAnalysis.CSharp (734)
Binder\Binder.ValueChecks.cs (7)
762if (conversion.ConversionKind == ConversionKind.Unboxing) 4322Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected"); 4324if (conversion.ConversionKind == ConversionKind.InterpolatedStringHandler) 4329if (conversion.ConversionKind == ConversionKind.CollectionExpression) 5099Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected"); 5101if (conversion.ConversionKind == ConversionKind.InterpolatedStringHandler) 5106if (conversion.ConversionKind == ConversionKind.CollectionExpression)
Binder\Binder_Conversions.cs (8)
143if (conversion.Kind == ConversionKind.FunctionType) 159if (conversion.Kind == ConversionKind.SwitchExpression) 174if (conversion.Kind == ConversionKind.ConditionalExpression) 189if (conversion.Kind == ConversionKind.InterpolatedString) 196if (conversion.Kind == ConversionKind.InterpolatedStringHandler) 270if (conversion.Kind == ConversionKind.DefaultLiteral) 280if (conversion.Kind is ConversionKind.ImplicitReference or ConversionKind.ExplicitReference &&
Binder\Binder_Deconstruct.cs (2)
308Debug.Assert(nestedConversion.Kind == ConversionKind.Deconstruction); 341conversion = new Conversion(ConversionKind.Deconstruction, deconstructMethod, nestedConversions.ToImmutableAndFree());
Binder\Binder_Operators.cs (45)
3276return new BoundIsOperator(node, operand, typeExpression, ConversionKind.NoConversion, resultType, hasErrors: true); 3358ConversionKind conversionKind, 3393ConversionKind conversionKind, 3447case ConversionKind.ImplicitSpan: 3448case ConversionKind.ExplicitSpan: 3449case ConversionKind.NoConversion: 3563case ConversionKind.ImplicitNumeric: 3564case ConversionKind.ExplicitNumeric: 3565case ConversionKind.ImplicitEnumeration: 3567case ConversionKind.ImplicitConstant: 3568case ConversionKind.ImplicitUserDefined: 3569case ConversionKind.ExplicitUserDefined: 3570case ConversionKind.IntPtr: 3571case ConversionKind.ExplicitTuple: 3572case ConversionKind.ImplicitTuple: 3588case ConversionKind.ExplicitEnumeration: 3593goto case ConversionKind.NoConversion; 3598case ConversionKind.ExplicitNullable: 3629case ConversionKind.ImplicitReference: 3632case ConversionKind.ExplicitReference: 3633case ConversionKind.Unboxing: 3640case ConversionKind.Identity: 3647case ConversionKind.Boxing: 3664case ConversionKind.ImplicitNullable: 3677case ConversionKind.ImplicitDynamic: 3678case ConversionKind.ExplicitDynamic: 3679case ConversionKind.ExplicitPointerToInteger: 3680case ConversionKind.ExplicitPointerToPointer: 3681case ConversionKind.ImplicitPointerToVoid: 3682case ConversionKind.ExplicitIntegerToPointer: 3683case ConversionKind.ImplicitNullToPointer: 3684case ConversionKind.AnonymousFunction: 3685case ConversionKind.NullLiteral: 3686case ConversionKind.DefaultLiteral: 3687case ConversionKind.MethodGroup: 3855ConversionKind conversionKind, 3881case ConversionKind.ImplicitReference: 3882case ConversionKind.Boxing: 3883case ConversionKind.ImplicitNullable: 3884case ConversionKind.Identity: 3885case ConversionKind.ExplicitNullable: 3886case ConversionKind.ExplicitReference: 3887case ConversionKind.Unboxing: 3917ConversionKind conversionKind, 3946internal static ConstantValue GetAsOperatorConstantResult(TypeSymbol operandType, TypeSymbol targetType, ConversionKind conversionKind, ConstantValue operandConstantValue)
Binder\Binder_Patterns.cs (4)
696else if ((conversion.ConversionKind == ConversionKind.Boxing || conversion.ConversionKind == ConversionKind.ImplicitReference) 706else if (conversion.ConversionKind == ConversionKind.ImplicitNullToPointer || 707(conversion.ConversionKind == ConversionKind.NoConversion && convertedExpression.Type?.IsErrorType() == true))
Binder\Binder_Statements.cs (4)
1951if (conversion.Kind != ConversionKind.Identity) 2249else if (conversion.Kind == ConversionKind.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad && 2677if (conversion.Kind == ConversionKind.Identity) 3164if (conversion.Kind != ConversionKind.Identity)
Binder\ForEachLoopBinder.cs (2)
471if (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)
665if (arg is BoundConversion { ConversionKind: ConversionKind.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion) 948Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 1057case ConversionKind.Identity: 1058case ConversionKind.ImplicitTupleLiteral:
Binder\Semantics\Conversions\Conversion.cs (146)
21private readonly ConversionKind _kind; 135ConversionKind.CollectionExpression, 140ConversionKind kind, 150? ConversionKind.NoConversion 151: isImplicit ? ConversionKind.ImplicitUserDefined : ConversionKind.ExplicitUserDefined; 163internal Conversion(ConversionKind kind, MethodSymbol conversionMethod, bool isExtensionMethod) 173internal Conversion(ConversionKind kind, ImmutableArray<Conversion> nestedConversions) 180internal Conversion(ConversionKind kind, DeconstructMethodInfo deconstructMethodInfo, ImmutableArray<(BoundValuePlaceholder? placeholder, BoundExpression? conversion)> deconstructConversionInfo) 182Debug.Assert(kind == ConversionKind.Deconstruction); 195Debug.Assert(_kind is ConversionKind.MethodGroup or ConversionKind.IntPtr or ConversionKind.ImplicitUserDefined or ConversionKind.ExplicitUserDefined); 215private static void AssertTrivialConversion(ConversionKind kind) 221case ConversionKind.NoConversion: 222case ConversionKind.Identity: 223case ConversionKind.ImplicitConstant: 224case ConversionKind.ImplicitNumeric: 225case ConversionKind.ImplicitReference: 226case ConversionKind.ImplicitEnumeration: 227case ConversionKind.ImplicitThrow: 228case ConversionKind.AnonymousFunction: 229case ConversionKind.Boxing: 230case ConversionKind.NullLiteral: 231case ConversionKind.DefaultLiteral: 232case ConversionKind.ImplicitNullToPointer: 233case ConversionKind.ImplicitPointerToVoid: 234case ConversionKind.ExplicitPointerToPointer: 235case ConversionKind.ExplicitPointerToInteger: 236case ConversionKind.ExplicitIntegerToPointer: 237case ConversionKind.Unboxing: 238case ConversionKind.ExplicitReference: 239case ConversionKind.IntPtr: 240case ConversionKind.ExplicitEnumeration: 241case ConversionKind.ExplicitNumeric: 242case ConversionKind.ImplicitDynamic: 243case ConversionKind.ExplicitDynamic: 244case ConversionKind.InterpolatedString: 245case ConversionKind.InterpolatedStringHandler: 246case ConversionKind.InlineArray: 247case ConversionKind.ImplicitSpan: 248case ConversionKind.ExplicitSpan: 260internal static Conversion GetTrivialConversion(ConversionKind kind) 266internal static Conversion UnsetConversion => new Conversion(ConversionKind.UnsetConversionKind); 267internal static Conversion NoConversion => new Conversion(ConversionKind.NoConversion); 268internal static Conversion Identity => new Conversion(ConversionKind.Identity); 269internal static Conversion ImplicitConstant => new Conversion(ConversionKind.ImplicitConstant); 270internal static Conversion ImplicitNumeric => new Conversion(ConversionKind.ImplicitNumeric); 271internal static Conversion ImplicitReference => new Conversion(ConversionKind.ImplicitReference); 272internal static Conversion ImplicitEnumeration => new Conversion(ConversionKind.ImplicitEnumeration); 273internal static Conversion ImplicitThrow => new Conversion(ConversionKind.ImplicitThrow); 274internal static Conversion ObjectCreation => new Conversion(ConversionKind.ObjectCreation); 275internal static Conversion CollectionExpression => new Conversion(ConversionKind.CollectionExpression); 276internal static Conversion AnonymousFunction => new Conversion(ConversionKind.AnonymousFunction); 277internal static Conversion Boxing => new Conversion(ConversionKind.Boxing); 278internal static Conversion NullLiteral => new Conversion(ConversionKind.NullLiteral); 279internal static Conversion DefaultLiteral => new Conversion(ConversionKind.DefaultLiteral); 280internal static Conversion NullToPointer => new Conversion(ConversionKind.ImplicitNullToPointer); 281internal static Conversion PointerToVoid => new Conversion(ConversionKind.ImplicitPointerToVoid); 282internal static Conversion PointerToPointer => new Conversion(ConversionKind.ExplicitPointerToPointer); 283internal static Conversion PointerToInteger => new Conversion(ConversionKind.ExplicitPointerToInteger); 284internal static Conversion IntegerToPointer => new Conversion(ConversionKind.ExplicitIntegerToPointer); 285internal static Conversion Unboxing => new Conversion(ConversionKind.Unboxing); 286internal static Conversion ExplicitReference => new Conversion(ConversionKind.ExplicitReference); 287internal static Conversion IntPtr => new Conversion(ConversionKind.IntPtr); 288internal static Conversion ExplicitEnumeration => new Conversion(ConversionKind.ExplicitEnumeration); 289internal static Conversion ExplicitNumeric => new Conversion(ConversionKind.ExplicitNumeric); 290internal static Conversion ImplicitDynamic => new Conversion(ConversionKind.ImplicitDynamic); 291internal static Conversion ExplicitDynamic => new Conversion(ConversionKind.ExplicitDynamic); 292internal static Conversion InterpolatedString => new Conversion(ConversionKind.InterpolatedString); 293internal static Conversion InterpolatedStringHandler => new Conversion(ConversionKind.InterpolatedStringHandler); 294internal static Conversion Deconstruction => new Conversion(ConversionKind.Deconstruction); 295internal static Conversion PinnedObjectToPointer => new Conversion(ConversionKind.PinnedObjectToPointer); 296internal static Conversion ImplicitPointer => new Conversion(ConversionKind.ImplicitPointer); 297internal static Conversion FunctionType => new Conversion(ConversionKind.FunctionType); 298internal static Conversion InlineArray => new Conversion(ConversionKind.InlineArray); 299internal static Conversion ImplicitSpan => new Conversion(ConversionKind.ImplicitSpan); 300internal static Conversion ExplicitSpan => new Conversion(ConversionKind.ExplicitSpan); 312internal static readonly Conversion ExplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitEnumerationUnderlying); 313internal static readonly Conversion ExplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ExplicitNullable, PointerToIntegerUnderlying); 314internal static readonly Conversion ExplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ExplicitNullable, IdentityUnderlying); 315internal static readonly Conversion ExplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitNumericUnderlying); 316internal static readonly Conversion ExplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitNumericUnderlying); 317internal static readonly Conversion ExplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitConstantUnderlying); 319internal static readonly Conversion ImplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitEnumerationUnderlying); 320internal static readonly Conversion ImplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ImplicitNullable, PointerToIntegerUnderlying); 321internal static readonly Conversion ImplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ImplicitNullable, IdentityUnderlying); 322internal static readonly Conversion ImplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitNumericUnderlying); 323internal static readonly Conversion ImplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitNumericUnderlying); 324internal static readonly Conversion ImplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitConstantUnderlying); 340return new Conversion(ConversionKind.StackAllocToPointerType, ImmutableArray.Create(underlyingConversion)); 345return new Conversion(ConversionKind.StackAllocToSpanType, ImmutableArray.Create(underlyingConversion)); 348internal static Conversion MakeNullableConversion(ConversionKind kind, Conversion nestedConversion) 350Debug.Assert(kind == ConversionKind.ImplicitNullable || kind == ConversionKind.ExplicitNullable); 354ConversionKind.Identity => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithIdentityUnderlying : ExplicitNullableWithIdentityUnderlying, 355ConversionKind.ImplicitConstant => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithImplicitConstantUnderlying : ExplicitNullableWithImplicitConstantUnderlying, 356ConversionKind.ImplicitNumeric => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithImplicitNumericUnderlying : ExplicitNullableWithImplicitNumericUnderlying, 357ConversionKind.ExplicitNumeric => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithExplicitNumericUnderlying : ExplicitNullableWithExplicitNumericUnderlying, 358ConversionKind.ExplicitEnumeration => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithExplicitEnumerationUnderlying : ExplicitNullableWithExplicitEnumerationUnderlying, 359ConversionKind.ExplicitPointerToInteger => kind == ConversionKind.ImplicitNullable ? ImplicitNullableWithPointerToIntegerUnderlying : ExplicitNullableWithPointerToIntegerUnderlying, 366return new Conversion(ConversionKind.SwitchExpression, innerConversions); 371return new Conversion(ConversionKind.ConditionalExpression, innerConversions); 374internal ConversionKind Kind 604return Kind != ConversionKind.NoConversion; 647return Kind == ConversionKind.Identity; 658return Kind == ConversionKind.StackAllocToPointerType || Kind == ConversionKind.StackAllocToSpanType; 672return Kind == ConversionKind.ImplicitNumeric || Kind == ConversionKind.ExplicitNumeric; 686return Kind == ConversionKind.ImplicitEnumeration || Kind == ConversionKind.ExplicitEnumeration; 697return Kind == ConversionKind.ImplicitThrow; 708return Kind == ConversionKind.ObjectCreation; 715public bool IsCollectionExpression => Kind == ConversionKind.CollectionExpression; 724return Kind == ConversionKind.SwitchExpression; 735return Kind == ConversionKind.ConditionalExpression; 750return Kind == ConversionKind.InterpolatedString; 761return Kind == ConversionKind.InterpolatedStringHandler; 772return Kind == ConversionKind.InlineArray; 786return Kind == ConversionKind.ImplicitNullable || Kind == ConversionKind.ExplicitNullable; 797return Kind == ConversionKind.ImplicitTupleLiteral || Kind == ConversionKind.ExplicitTupleLiteral; 808return Kind == ConversionKind.ImplicitTuple || Kind == ConversionKind.ExplicitTuple; 822return Kind == ConversionKind.ImplicitReference || Kind == ConversionKind.ExplicitReference; 836return Kind is ConversionKind.ImplicitSpan or ConversionKind.ExplicitSpan; 864return Kind == ConversionKind.Boxing; 878return Kind == ConversionKind.Unboxing; 892return Kind == ConversionKind.NullLiteral; 903return Kind == ConversionKind.DefaultLiteral; 931return Kind == ConversionKind.ImplicitConstant; 945return Kind == ConversionKind.AnonymousFunction; 959return Kind == ConversionKind.MethodGroup; 1005return Kind == ConversionKind.IntPtr; 1061return this.Kind == ConversionKind.NoConversion ? LookupResultKind.Empty : LookupResultKind.Viable;
Binder\Semantics\Conversions\ConversionEasyOut.cs (14)
23const byte IDN = (byte)ConversionKind.Identity; 24const byte IRF = (byte)ConversionKind.ImplicitReference; 25const byte XRF = (byte)ConversionKind.ExplicitReference; 26const byte XNM = (byte)ConversionKind.ExplicitNumeric; 27const byte NOC = (byte)ConversionKind.NoConversion; 28const byte BOX = (byte)ConversionKind.Boxing; 29const byte UNB = (byte)ConversionKind.Unboxing; 30const byte NUM = (byte)ConversionKind.ImplicitNumeric; 31const byte NUL = (byte)ConversionKind.ImplicitNullable; 32const byte XNL = (byte)ConversionKind.ExplicitNullable; 72public static ConversionKind ClassifyConversion(TypeSymbol source, TypeSymbol target) 77return ConversionKind.NoConversion; 82return ConversionKind.NoConversion; 84return (ConversionKind)s_convkind[sourceIndex, targetIndex];
Binder\Semantics\Conversions\ConversionKindExtensions.cs (7)
6using static Microsoft.CodeAnalysis.CSharp.ConversionKind; 12public static bool IsDynamic(this ConversionKind conversionKind) 18public static bool IsImplicitConversion(this ConversionKind conversionKind) 41case ConversionKind.MethodGroup: 42case ConversionKind.FunctionType: 81public static bool IsUserDefinedConversion(this ConversionKind conversionKind) 94public static bool IsPointerConversion(this ConversionKind kind)
Binder\Semantics\Conversions\Conversions.cs (1)
481return new Conversion(ConversionKind.MethodGroup, method, methodGroup.IsExtensionMethodGroup);
Binder\Semantics\Conversions\ConversionsBase.cs (76)
490ConversionKind convKind = ConversionEasyOut.ClassifyConversion(source, target); 491if (convKind != ConversionKind.ImplicitNullable && convKind != ConversionKind.ExplicitNullable) 585private static bool IsStandardImplicitConversionFromType(ConversionKind kind) 589case ConversionKind.Identity: 590case ConversionKind.ImplicitNumeric: 591case ConversionKind.ImplicitNullable: 592case ConversionKind.ImplicitReference: 593case ConversionKind.Boxing: 594case ConversionKind.ImplicitConstant: 595case ConversionKind.ImplicitPointer: 596case ConversionKind.ImplicitPointerToVoid: 597case ConversionKind.ImplicitTuple: 598case ConversionKind.ImplicitSpan: 662{ Kind: ConversionKind.CollectionExpression } => true, 663{ Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: [{ Kind: ConversionKind.CollectionExpression }] } => true, 668static bool isStandardImplicitConversionFromExpression(ConversionKind kind) 677case ConversionKind.NullLiteral: 678case ConversionKind.AnonymousFunction: 679case ConversionKind.MethodGroup: 680case ConversionKind.ImplicitEnumeration: 681case ConversionKind.ImplicitDynamic: 682case ConversionKind.ImplicitNullToPointer: 683case ConversionKind.ImplicitTupleLiteral: 684case ConversionKind.StackAllocToPointerType: 685case ConversionKind.StackAllocToSpanType: 686case ConversionKind.InlineArray: 687case ConversionKind.InterpolatedString: 698Debug.Assert(conversion.Kind == ConversionKind.NoConversion || IsStandardImplicitConversionFromType(conversion.Kind)); 890case ConversionKind.Identity: 893case ConversionKind.ImplicitNumeric: 896case ConversionKind.ImplicitReference: 899case ConversionKind.Boxing: 902case ConversionKind.NoConversion: 905case ConversionKind.ImplicitPointerToVoid: 909case ConversionKind.ImplicitTuple: 915case ConversionKind.ImplicitNullable: 923Conversion.MakeNullableConversion(ConversionKind.ExplicitNullable, underlyingConversion) : 928case ConversionKind.ImplicitSpan: 1014case ConversionKind.ImplicitUserDefined: 1015case ConversionKind.ImplicitDynamic: 1016case ConversionKind.ImplicitTuple: 1017case ConversionKind.ImplicitTupleLiteral: 1018case ConversionKind.ImplicitNullable: 1019case ConversionKind.ConditionalExpression: 1020case ConversionKind.ImplicitSpan: 1176return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(underlyingConversion)); 1312return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(underlyingTupleConversion)); 1341return new Conversion(ConversionKind.ExplicitNullable, ImmutableArray.Create(underlyingTupleConversion)); 1896ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion; 1960ConversionKind.ImplicitTupleLiteral, 1977ConversionKind.ImplicitTuple, 2007case ConversionKind.Identity: 2008case ConversionKind.Boxing: 2009case ConversionKind.ImplicitReference: 2010case ConversionKind.ImplicitSpan: 2013case ConversionKind.ImplicitTuple: 2014case ConversionKind.ImplicitTupleLiteral: 2027Debug.Assert(conversion.Kind == ConversionKind.NoConversion); 2034private static ConversionKind GetNumericConversion(TypeSymbol source, TypeSymbol destination) 2041return ConversionKind.UnsetConversionKind; 2048return ConversionKind.UnsetConversionKind; 2051var conversionKind = ConversionEasyOut.ClassifyConversion(source, destination); 2052Debug.Assert(conversionKind is ConversionKind.ImplicitNumeric or ConversionKind.ExplicitNumeric); 2058return GetNumericConversion(source, destination) == ConversionKind.ImplicitNumeric; 2065return GetNumericConversion(source, destination) == ConversionKind.ExplicitNumeric; 2275return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(tupleConversion)); 2295ConversionKind.ImplicitTupleLiteral, 2313ConversionKind.ExplicitTupleLiteral, 2324ConversionKind kind, 2366ConversionKind.ImplicitTuple, 2385ConversionKind.ExplicitTuple, 2402ConversionKind kind, 2472return new Conversion(ConversionKind.ExplicitNullable, ImmutableArray.Create(tupleConversion));
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (44)
614private static bool IsEncompassingImplicitConversionKind(ConversionKind kind) 619case ConversionKind.NoConversion: 623case ConversionKind.ImplicitDynamic: 624case ConversionKind.MethodGroup: 625case ConversionKind.AnonymousFunction: 626case ConversionKind.InterpolatedString: 627case ConversionKind.SwitchExpression: 628case ConversionKind.ConditionalExpression: 629case ConversionKind.ImplicitEnumeration: 630case ConversionKind.StackAllocToPointerType: 631case ConversionKind.StackAllocToSpanType: 632case ConversionKind.InterpolatedStringHandler: 635case ConversionKind.ImplicitUserDefined: 636case ConversionKind.ExplicitUserDefined: 637case ConversionKind.FunctionType: 640case ConversionKind.ExplicitNumeric: 641case ConversionKind.ExplicitEnumeration: 642case ConversionKind.ExplicitNullable: 643case ConversionKind.ExplicitReference: 644case ConversionKind.Unboxing: 645case ConversionKind.ExplicitDynamic: 646case ConversionKind.ExplicitPointerToPointer: 647case ConversionKind.ExplicitPointerToInteger: 648case ConversionKind.ExplicitIntegerToPointer: 649case ConversionKind.IntPtr: 650case ConversionKind.ExplicitTupleLiteral: 651case ConversionKind.ExplicitTuple: 652case ConversionKind.ExplicitSpan: 656case ConversionKind.Identity: 657case ConversionKind.ImplicitNumeric: 658case ConversionKind.ImplicitNullable: 659case ConversionKind.ImplicitReference: 660case ConversionKind.Boxing: 661case ConversionKind.ImplicitConstant: 662case ConversionKind.ImplicitPointerToVoid: 665case ConversionKind.NullLiteral: 666case ConversionKind.ImplicitNullToPointer: 669case ConversionKind.ImplicitTupleLiteral: 670case ConversionKind.ImplicitTuple: 671case ConversionKind.ImplicitThrow: 674case ConversionKind.DefaultLiteral: 677case ConversionKind.ImplicitPointer: 679case ConversionKind.InlineArray: 681case ConversionKind.ImplicitSpan:
Binder\Semantics\OverloadResolution\OverloadResolution.cs (20)
2199if (allSame && Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2208if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2321if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2598return conversionsOpt.Any(static c => c.Kind == ConversionKind.FunctionType); 2871return conv1.Kind == ConversionKind.Identity ? BetterResult.Left : BetterResult.Neither; 2875return conv2.Kind == ConversionKind.Identity ? BetterResult.Right : BetterResult.Neither; 2927case (ConversionKind.InterpolatedStringHandler, ConversionKind.InterpolatedStringHandler): 2929case (ConversionKind.InterpolatedStringHandler, _): 2931case (_, ConversionKind.InterpolatedStringHandler): 2938case (ConversionKind.FunctionType, ConversionKind.FunctionType): 2940case (_, ConversionKind.FunctionType): 2942case (ConversionKind.FunctionType, _): 2974if (conv1.Kind == ConversionKind.CollectionExpression && 2975conv2.Kind == ConversionKind.CollectionExpression) 2982case (ConversionKind.ImplicitSpan, ConversionKind.ImplicitSpan): 2997case (_, ConversionKind.ImplicitSpan): 2999case (ConversionKind.ImplicitSpan, _):
Binder\SwitchBinder.cs (1)
417Debug.Assert(conversion.Kind == ConversionKind.ImplicitUserDefined);
BoundTree\BoundExpression.cs (7)
453public ConversionKind ConversionKind 495case ConversionKind.Identity: 498case ConversionKind.ImplicitNumeric: 499case ConversionKind.ImplicitEnumeration: 501case ConversionKind.ImplicitReference: 502case ConversionKind.Boxing: 506case ConversionKind.ExplicitNumeric:
CodeGen\EmitConversion.cs (31)
44case ConversionKind.MethodGroup: 46case ConversionKind.ImplicitNullToPointer: 95case ConversionKind.Identity: 98case ConversionKind.ImplicitNumeric: 99case ConversionKind.ExplicitNumeric: 102case ConversionKind.ImplicitReference: 103case ConversionKind.Boxing: 109case ConversionKind.ExplicitReference: 110case ConversionKind.Unboxing: 116case ConversionKind.ImplicitEnumeration: 117case ConversionKind.ExplicitEnumeration: 120case ConversionKind.ImplicitUserDefined: 121case ConversionKind.ExplicitUserDefined: 122case ConversionKind.AnonymousFunction: 123case ConversionKind.MethodGroup: 124case ConversionKind.ImplicitTupleLiteral: 125case ConversionKind.ImplicitTuple: 126case ConversionKind.ExplicitTupleLiteral: 127case ConversionKind.ExplicitTuple: 128case ConversionKind.ImplicitDynamic: 129case ConversionKind.ExplicitDynamic: 130case ConversionKind.ImplicitThrow: 133case ConversionKind.ImplicitPointerToVoid: 134case ConversionKind.ExplicitPointerToPointer: 135case ConversionKind.ImplicitPointer: 137case ConversionKind.ExplicitPointerToInteger: 138case ConversionKind.ExplicitIntegerToPointer: 167case ConversionKind.PinnedObjectToPointer: 173case ConversionKind.ImplicitNullToPointer: 175case ConversionKind.ImplicitNullable: 176case ConversionKind.ExplicitNullable:
CodeGen\EmitExpression.cs (13)
1234if (conversion.ConversionKind == ConversionKind.Unboxing) 1273if (receiver.Kind == BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing) 1540case ConversionKind.Boxing: 1545case ConversionKind.MethodGroup: 1546case ConversionKind.AnonymousFunction: 1549case ConversionKind.ExplicitReference: 1550case ConversionKind.ImplicitReference: 3920var conversionKind = conversion.ConversionKind; 3921Debug.Assert(conversionKind != ConversionKind.NullLiteral && conversionKind != ConversionKind.DefaultLiteral); 3924conversionKind != ConversionKind.MethodGroup && 3925conversionKind != ConversionKind.NullLiteral && 3926conversionKind != ConversionKind.DefaultLiteral)
CodeGen\EmitOperators.cs (1)
375if (comparand is BoundConversion { Type.SpecialType: SpecialType.System_Object, ConversionKind: ConversionKind.Boxing, Operand.Type: TypeParameterSymbol { AllowsRefLikeType: true } } &&
Compilation\CSharpSemanticModel.cs (15)
2101conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, false); 2131if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.SwitchExpression, Conversion: var convertedSwitchConversion }) 2149if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.ConditionalExpression }) 2168if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.CollectionExpression or ConversionKind.NoConversion, Conversion: var convertedCollectionConversion }) 2174else if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.ImplicitNullable, Conversion.UnderlyingConversions: [{ Kind: ConversionKind.CollectionExpression }] } boundConversion) 2198if (conversion.Kind == ConversionKind.AnonymousFunction) 2222conversion = new Conversion(ConversionKind.MethodGroup, delegateCreation.MethodOpt, delegateCreation.IsExtensionMethod); 2228conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod); 2234conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod); 2242else if (boundExpr is BoundConversion { ConversionKind: ConversionKind.MethodGroup, Conversion: var exprConversion, Type: { TypeKind: TypeKind.FunctionPointer }, SymbolOpt: var symbol }) 3528if ((conversion.ConversionKind == ConversionKind.MethodGroup) && conversion.IsExtensionMethod) 4298if (conversion.ConversionKind == ConversionKind.MethodGroup) 4302else if (conversion.Operand is BoundConversion { ConversionKind: ConversionKind.MethodGroup } nestedMethodGroupConversion)
Compilation\DeconstructionInfo.cs (3)
38return _conversion.Kind == ConversionKind.Deconstruction 51return _conversion.Kind == ConversionKind.Deconstruction 64if (_conversion.Kind != ConversionKind.Deconstruction)
FlowAnalysis\AbstractFlowPass.cs (3)
1736if (node.ConversionKind == ConversionKind.MethodGroup) 2635|| (expr is BoundConversion { ConversionKind: ConversionKind.ExplicitNullable or ConversionKind.ImplicitNullable } conv
FlowAnalysis\DefiniteAssignment.cs (1)
933boundConversion.ConversionKind == ConversionKind.IntPtr)
FlowAnalysis\NullableWalker.cs (87)
2099case ConversionKind.ExplicitNullable: 2118case ConversionKind.ConditionalExpression or ConversionKind.SwitchExpression or ConversionKind.ObjectCreation when 2121case ConversionKind.Identity: 2122case ConversionKind.DefaultLiteral: 2123case ConversionKind.ImplicitReference: 2124case ConversionKind.ImplicitTupleLiteral: 2125case ConversionKind.Boxing: 2554var conversionKind = conversion.Conversion.Kind; 2555return (conversionKind == ConversionKind.DefaultLiteral || conversionKind == ConversionKind.NullLiteral) && 2783Debug.Assert(conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference); 5593case ConversionKind.ImplicitReference: 5594case ConversionKind.ExplicitReference: 7426if (conversion is { IsValid: true, Kind: ConversionKind.ImplicitUserDefined }) 8593Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ExplicitTuple); 8616case ConversionKind.Identity: 8617case ConversionKind.NullLiteral: 8618case ConversionKind.DefaultLiteral: 8619case ConversionKind.ImplicitReference: 8620case ConversionKind.ExplicitReference: 8621case ConversionKind.Boxing: 8622case ConversionKind.Unboxing: 8625case ConversionKind.ImplicitTupleLiteral: 8626case ConversionKind.ExplicitTupleLiteral: 8627case ConversionKind.ImplicitTuple: 8628case ConversionKind.ExplicitTuple: 8642case ConversionKind.ImplicitNullable: 8643case ConversionKind.ExplicitNullable: 8659case ConversionKind.ImplicitUserDefined: 8660case ConversionKind.ExplicitUserDefined: 8870conversion = Conversion.MakeNullableConversion(ConversionKind.ImplicitNullable, Conversion.Identity); 8900case ConversionKind.MethodGroup: 8930case ConversionKind.AnonymousFunction: 8947case ConversionKind.FunctionType: 8951case ConversionKind.InterpolatedString: 8955case ConversionKind.InterpolatedStringHandler: 8960case ConversionKind.ObjectCreation: 8961case ConversionKind.CollectionExpression: 8962case ConversionKind.SwitchExpression: 8963case ConversionKind.ConditionalExpression: 8967case ConversionKind.ExplicitUserDefined: 8968case ConversionKind.ImplicitUserDefined: 8971case ConversionKind.ExplicitDynamic: 8972case ConversionKind.ImplicitDynamic: 8976case ConversionKind.Boxing: 8980case ConversionKind.Unboxing: 8996case ConversionKind.ImplicitThrow: 9000case ConversionKind.NoConversion: 9004case ConversionKind.NullLiteral: 9005case ConversionKind.DefaultLiteral: 9007goto case ConversionKind.Identity; 9009case ConversionKind.Identity: 9031goto case ConversionKind.ImplicitTuple; 9033goto case ConversionKind.ImplicitReference; 9035case ConversionKind.ImplicitReference: 9036case ConversionKind.ExplicitReference: 9047case ConversionKind.ImplicitNullable: 9073case ConversionKind.ExplicitNullable: 9089goto case ConversionKind.ImplicitNullable; 9091case ConversionKind.ImplicitTuple: 9092case ConversionKind.ImplicitTupleLiteral: 9093case ConversionKind.ExplicitTupleLiteral: 9094case ConversionKind.ExplicitTuple: 9100case ConversionKind.ImplicitTuple: 9101case ConversionKind.ExplicitTuple: 9124case ConversionKind.Deconstruction: 9129case ConversionKind.ExplicitEnumeration: 9133case ConversionKind.InlineArray: 9141case ConversionKind.ImplicitSpan: 9142case ConversionKind.ExplicitSpan: 9145var previousKind = conversion.Kind; 9405Debug.Assert(conversion.Kind == ConversionKind.ExplicitUserDefined || conversion.Kind == ConversionKind.ImplicitUserDefined); 10194Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 10374underlyingConversion.Kind == ConversionKind.ImplicitNullable && 10449case ConversionKind.Identity: 10450case ConversionKind.ImplicitTupleLiteral: 10979(conversion.Kind == ConversionKind.ExplicitReference && resultType.SpecialType == SpecialType.System_String)) 11184if (conversion.Kind == ConversionKind.NoConversion) 11606case ConversionKind.Identity: 11607case ConversionKind.ImplicitReference: 11608case ConversionKind.Boxing: 11609case ConversionKind.ImplicitNullable:
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
397if (node.ConversionKind == ConversionKind.InterpolatedStringHandler)
FlowAnalysis\NullableWalker_Patterns.cs (6)
466case ConversionKind.Identity: 467case ConversionKind.ImplicitReference: 470case ConversionKind.ExplicitNullable when AreNullableAndUnderlyingTypes(inputType, e.Type, out _): 765ConversionKind.Identity => true, 766ConversionKind.ImplicitReference => true, 767ConversionKind.Boxing => true,
Generated\BoundNodes.xml.Generated.cs (3)
2848public BoundIsOperator(SyntaxNode syntax, BoundExpression operand, BoundTypeExpression targetType, ConversionKind conversionKind, TypeSymbol type, bool hasErrors = false) 2864public ConversionKind ConversionKind { get; } 2869public BoundIsOperator Update(BoundExpression operand, BoundTypeExpression targetType, ConversionKind conversionKind, TypeSymbol type)
Lowering\ClosureConversion\ClosureConversion.cs (2)
1394Debug.Assert(conversion.ConversionKind != ConversionKind.MethodGroup); 1395if (conversion.ConversionKind == ConversionKind.AnonymousFunction)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (13)
538conversion.ConversionKind != ConversionKind.NullLiteral && 621var kind = _bound.Compilation.Conversions.ClassifyConversionFromType(oldType, newType, isChecked: false, ref useSiteInfo).Kind; 627case ConversionKind.Identity: 629case ConversionKind.ExplicitNumeric: 690case ConversionKind.MethodGroup: 695case ConversionKind.ExplicitUserDefined: 696case ConversionKind.ImplicitUserDefined: 697case ConversionKind.IntPtr: 705!TypeSymbol.Equals(strippedOperandType, ((node.ConversionKind == ConversionKind.ExplicitUserDefined) ? conversionInputType : conversionInputType.StrippedType()), TypeCompareKind.ConsiderEverything2); 718case ConversionKind.ImplicitReference: 719case ConversionKind.Identity: 724case ConversionKind.ImplicitNullable: 737case ConversionKind.NullLiteral:
Lowering\DiagnosticsPass_ExpressionTrees.cs (10)
790case ConversionKind.MethodGroup: 795case ConversionKind.AnonymousFunction: 804case ConversionKind.ImplicitDynamic: 805case ConversionKind.ExplicitDynamic: 812case ConversionKind.ExplicitTuple: 813case ConversionKind.ExplicitTupleLiteral: 814case ConversionKind.ImplicitTuple: 815case ConversionKind.ImplicitTupleLiteral: 822case ConversionKind.InlineArray: 829case ConversionKind.InterpolatedStringHandler:
Lowering\DiagnosticsPass_Warnings.cs (8)
435if (conversion.ConversionKind != ConversionKind.ImplicitNumeric && 436conversion.ConversionKind != ConversionKind.ImplicitConstant) 580if (conv.ConversionKind == ConversionKind.ImplicitNullable) 868if (conv.ConversionKind == ConversionKind.ExplicitNullable || conv.ConversionKind == ConversionKind.ImplicitNullable) 894case ConversionKind.Deconstruction: 895case ConversionKind.ImplicitTupleLiteral: 896case ConversionKind.Identity:
Lowering\Extensions.cs (7)
61case ConversionKind.ImplicitNullable: 62case ConversionKind.ExplicitNullable: 66case ConversionKind.ImplicitEnumeration: 108case ConversionKind.NullLiteral: 112case ConversionKind.DefaultLiteral: 115case ConversionKind.ImplicitNullable: 116case ConversionKind.ExplicitNullable:
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
215case ConversionKind.MethodGroup:
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (2)
218if (conversion.Kind == ConversionKind.ExplicitNullable && 485(conv.IsIdentity || conv.Kind == ConversionKind.ImplicitReference || conv.IsBoxing) &&
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (1)
716if (conversion.ConversionKind == ConversionKind.Boxing)
Lowering\LocalRewriter\LocalRewriter_Call.cs (30)
569case ConversionKind.AnonymousFunction: 570case ConversionKind.ImplicitConstant: 571case ConversionKind.MethodGroup: 572case ConversionKind.NullLiteral: 573case ConversionKind.DefaultLiteral: 576case ConversionKind.Boxing: 577case ConversionKind.ImplicitDynamic: 578case ConversionKind.ExplicitDynamic: 579case ConversionKind.ExplicitEnumeration: 580case ConversionKind.ExplicitNullable: 581case ConversionKind.ExplicitNumeric: 582case ConversionKind.ExplicitReference: 583case ConversionKind.Identity: 584case ConversionKind.ImplicitEnumeration: 585case ConversionKind.ImplicitNullable: 586case ConversionKind.ImplicitNumeric: 587case ConversionKind.ImplicitReference: 588case ConversionKind.Unboxing: 589case ConversionKind.ExplicitPointerToInteger: 590case ConversionKind.ExplicitPointerToPointer: 591case ConversionKind.ImplicitPointerToVoid: 592case ConversionKind.ImplicitNullToPointer: 593case ConversionKind.ExplicitIntegerToPointer: 597case ConversionKind.ExplicitUserDefined: 598case ConversionKind.ImplicitUserDefined: 601case ConversionKind.IntPtr: 602case ConversionKind.ImplicitThrow: 835if (argument is BoundConversion { ConversionKind: ConversionKind.InterpolatedStringHandler, Operand: BoundInterpolatedString or BoundBinaryOperator } conversion) 908if (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)
33Debug.Assert(conversion.Kind == ConversionKind.CollectionExpression); 207if (conversion.Kind is not (ConversionKind.Identity or ConversionKind.ImplicitReference)) 214return conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (60)
22case ConversionKind.InterpolatedString: 24case ConversionKind.InterpolatedStringHandler: 37case ConversionKind.SwitchExpression: 41case ConversionKind.ConditionalExpression: 45case ConversionKind.ObjectCreation: 61case ConversionKind.ImplicitNullable when node.Conversion.UnderlyingConversions[0].Kind is ConversionKind.CollectionExpression: 65case ConversionKind.CollectionExpression: 72_inExpressionLambda = _inExpressionLambda || (node.ConversionKind == ConversionKind.AnonymousFunction && !wasInExpressionLambda && rewrittenType.IsExpressionTree()); 252return conversion.ConversionKind == ConversionKind.Identity && !conversion.ExplicitCastInCode; 319case ConversionKind.Identity: 352case ConversionKind.ExplicitUserDefined: 353case ConversionKind.ImplicitUserDefined: 361case ConversionKind.IntPtr: 365case ConversionKind.ImplicitNullable: 366case ConversionKind.ExplicitNullable: 375case ConversionKind.Boxing: 399case ConversionKind.NullLiteral: 400case ConversionKind.DefaultLiteral: 408case ConversionKind.ImplicitReference: 409case ConversionKind.ExplicitReference: 417case ConversionKind.ImplicitConstant: 424goto case ConversionKind.ImplicitNumeric; 426case ConversionKind.ImplicitNumeric: 427case ConversionKind.ExplicitNumeric: 440case ConversionKind.ImplicitTupleLiteral: 441case ConversionKind.ExplicitTupleLiteral: 450case ConversionKind.ImplicitThrow: 457case ConversionKind.ImplicitEnumeration: 486goto case ConversionKind.ExplicitEnumeration; 488case ConversionKind.ExplicitEnumeration: 533case ConversionKind.ImplicitDynamic: 534case ConversionKind.ExplicitDynamic: 538return _dynamicFactory.MakeDynamicConversion(rewrittenOperand, explicitCastInCode || conversion.Kind == ConversionKind.ExplicitDynamic, conversion.IsArrayIndex, @checked, rewrittenType).ToExpression(); 540case ConversionKind.ImplicitTuple: 541case ConversionKind.ExplicitTuple: 550case ConversionKind.MethodGroup when oldNodeOpt is { Type: { TypeKind: TypeKind.FunctionPointer } funcPtrType }: 561case ConversionKind.MethodGroup: 594case ConversionKind.InlineArray: 617case ConversionKind.ImplicitSpan: 618case ConversionKind.ExplicitSpan: 649Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 681Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 700Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 1007case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument } 1012case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion 1013when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1131var conversionKind = conversion.Kind.IsImplicitConversion() ? ConversionKind.ImplicitUserDefined : ConversionKind.ExplicitUserDefined; 1737ConversionKind conversionKind = isImplicit ? ConversionKind.ImplicitUserDefined : ConversionKind.ExplicitUserDefined; 1756case ConversionKind.ExplicitUserDefined: 1757case ConversionKind.ImplicitUserDefined: 1788case ConversionKind.IntPtr: 1800case ConversionKind.ImplicitNumeric: 1801case ConversionKind.ExplicitNumeric: 1815case ConversionKind.ImplicitEnumeration: 1816case ConversionKind.ExplicitEnumeration:
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
20Debug.Assert(right.Conversion.Kind == ConversionKind.Deconstruction); 219Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 307if ((tupleConversion.Conversion.Kind == ConversionKind.ImplicitTupleLiteral || tupleConversion.Conversion.Kind == ConversionKind.Identity)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
30ConversionKind conversionKind,
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (4)
92BoundNode.GetConversion(leftConversion, leftPlaceholder) is { Kind: ConversionKind.Identity or ConversionKind.ImplicitReference }) 99if (BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsIdentity: true } or { Kind: ConversionKind.ExplicitNullable }) 224if (boundConversion.ConversionKind != ConversionKind.Identity)
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
618if (conv.ConversionKind == ConversionKind.Boxing)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
18Debug.Assert(conversion.ConversionKind == ConversionKind.InterpolatedString); 240if (arg is BoundConversion { Conversion: { Kind: ConversionKind.InterpolatedStringHandler }, ExplicitCastInCode: false, Operand: var operand })
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (16)
49case BoundConversion { Conversion: { Kind: ConversionKind.Identity }, Operand: var o }: 51case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitTupleLiteral }, Operand: var o }: 89(kind == ConversionKind.ImplicitNullable || kind == ConversionKind.ExplicitNullable) && 103if (expr is BoundConversion { ConversionKind: ConversionKind.ImplicitTuple, Conversion: var conversion } boundConversion) 190case BoundConversion { Conversion: { Kind: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting. 211var conversion = Conversion.MakeNullableConversion(ConversionKind.ImplicitNullable, Conversion.Identity); 224bool conversionMustBePerformedOnOriginalExpression(ConversionKind kind) 230case ConversionKind.AnonymousFunction: // a lambda cannot be saved without a target type 231case ConversionKind.MethodGroup: // similarly for a method group 232case ConversionKind.InterpolatedString: // an interpolated string must be saved in interpolated form 233case ConversionKind.SwitchExpression: // a switch expression must have its arms converted 234case ConversionKind.StackAllocToPointerType: // a stack alloc is not well-defined without an enclosing conversion 235case ConversionKind.ConditionalExpression: // a conditional expression must have its alternatives converted 236case ConversionKind.StackAllocToSpanType: 237case ConversionKind.ObjectCreation:
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
508Debug.Assert(methodArgumentInfo.Arguments.All(arg => arg is not BoundConversion { ConversionKind: ConversionKind.InterpolatedStringHandler }));
Lowering\SpillSequenceSpiller.cs (1)
1176if (node.ConversionKind == ConversionKind.AnonymousFunction && node.Type.IsExpressionTree())
Lowering\SyntheticBoundNodeFactory.cs (4)
558Debug.Assert(conversion.Kind != ConversionKind.NoConversion); 559if (conversion.Kind != ConversionKind.Identity) 1501if (conversion.Kind == ConversionKind.ImplicitReference && arg.IsLiteralNull()) 1507if (conversion.Kind == ConversionKind.ExplicitNullable &&
Operations\CSharpOperationFactory.cs (2)
1021if (boundConversion.ConversionKind == ConversionKind.InterpolatedStringHandler) 1028if (boundConversion.ConversionKind == CSharp.ConversionKind.MethodGroup)
Operations\CSharpOperationFactory_Methods.cs (1)
145if (boundConversion.ConversionKind == ConversionKind.MethodGroup)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
401((BoundConversion)convertedExpression).ConversionKind != ConversionKind.DefaultLiteral)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
1367return conversions.ClassifyImplicitConversionFromType(sourceType, targetType, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
FunctionPointerUtilities.cs (1)
185var expectedConversionKind = (expectedType, expectedConvertedType, expectedSymbol) switch