rokucommunity / brighterscript

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

bogus brs 1001 error when using m in constructor argument on a class field #775

Open georgejecook opened 1 year ago

georgejecook commented 1 year ago

image

TwitchBronBron commented 1 year ago

@georgejecook I'm unable to reproduce this. Could you please create a unit test in brighterscript that reproduces the issue? Then I'm happy to figure out how to fix it.

image

Here's the source code for my current test:

it.only('supports using `m` in field initializers', () => {
    program.setFile('source/main.bs', `
        class TestClass
            private m = m
            private someProp = someFunc(m)
            private z = new humanoids.Zombie(m)
        end class

        function someFunc(p1)
        end function

        namespace humanoids
            class Zombie
                sub new(outerInstance)
                end sub
            end class
        end namespace
    `);

    expectZeroDiagnostics(program);
});