Beef icon indicating copy to clipboard operation
Beef copied to clipboard

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

Open m910q opened this issue 1 year ago • 1 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;
    }
}

m910q avatar Mar 24 '24 13:03 m910q

Hm, that's a general issue with emitting code - we need a way to sanitize identifier names...

bfiete avatar Mar 24 '24 14:03 bfiete

Fixed at 79a67c2d0c6e61b828f3cd6b5125c7567d82ad23

bfiete avatar Apr 28 '24 11:04 bfiete