Skip to content

Commit

Permalink
Adjust priority for enum typed constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Dec 13, 2024
1 parent 49786ff commit 3241ea5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public static bool TryCreate(IOperation operation, [NotNullWhen(true)] out Typed
{
({ SpecialType: SpecialType.System_String }, string text) => new Primitive.String(text),
({ SpecialType: SpecialType.System_Boolean}, bool flag) => new Primitive.Boolean(flag),
(INamedTypeSymbol { TypeKind: TypeKind.Enum }, object value) => new Enum(operationType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), value),
(_, byte b) => new Primitive.Of<byte>(b),
(_, char c) => new Primitive.Of<char>(c),
(_, double d) => new Primitive.Of<double>(d),
Expand All @@ -99,7 +100,6 @@ public static bool TryCreate(IOperation operation, [NotNullWhen(true)] out Typed
(_, ulong ul) => new Primitive.Of<ulong>(ul),
(_, ushort ush) => new Primitive.Of<ushort>(ush),
(_, ITypeSymbol type) => new Type(type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)),
(INamedTypeSymbol { TypeKind: TypeKind.Enum}, object value) => new Enum(operationType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), value),
_ => throw new ArgumentException("Invalid typed constant type"),
};

Expand Down

0 comments on commit 3241ea5

Please sign in to comment.