beefytech/Beef

[Bug] Enum.Parse<T> not working with keyword members

Closed this issue · 2 comments

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 79a67c2