rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
152 stars 47 forks source link

Enum usage in namespaces transpiling broken in v1.0.0-alpha.30 #1215

Closed TwitchBronBron closed 1 month ago

TwitchBronBron commented 1 month ago

Here's a unit test showing the issue.

it.only('enum stuff works', async () => {
    program.setFile('components/Colors.bs', `
        namespace Colors
            enum Primary
                red = "#FF0000"
            end enum
        end namespace
    `);

    program.setFile('components/Button.xml', `
        <component name="Button" extends="Group">
            <script type="text/brightscript" uri="pkg:/components/Button.bs" />
        </component>
    `);
    const file = program.setFile('components/Button.bs', `
        import "Colors.bs"

        namespace alpha
            sub testIt()
                print Colors.Primary.red
                aa = {
                    value: Colors.Primary.red
                }
            end sub
        end namespace
    `);
    program.validate();
    expectZeroDiagnostics(program);
    await testTranspile(file, `put expected code here, but it should transpile enums and it doesnt right now`);
});