Beef
Beef copied to clipboard
[Bug] Enum.Parse<T> not working with keyword members
After the recent changes, Enum.Parse<T> compilation fails when enum members contain keyword with @ prefix.
The code generation ends up outputting .public, which is seen as a keyword.
I was not able to find a property on FieldInfo to tell them apart, to make a fix.
Example:
using System;
namespace Playground;
enum TestEnum { @public }
class Program
{
public static int Main(String[] args)
{
let test = Enum.Parse<TestEnum>("public");
return 0;
}
}
Hm, that's a general issue with emitting code - we need a way to sanitize identifier names...
Fixed at 79a67c2d0c6e61b828f3cd6b5125c7567d82ad23