There's an issue with watch mode where field initialisers will trigger diagnostic errors after their scope is transpiled. This only happens after the app has already been transpiled.
Here's a unit test that shows the issue:
it('does not pollute the AST after validation', () => {
const file = program.setFile<BrsFile>('source/lib.bs', `
class HasPropertyInitialiser
name as string = createObject("roString")
sub new()
super()
end sub
end class
`);
program.validate();
file.transpile();
program.setFile<BrsFile>('source/another.bs', `
class AnotherClassJustToInvalidateScope
end class
`);
program.validate();
expectZeroDiagnostics(program.getDiagnostics());
});
There's an issue with watch mode where field initialisers will trigger diagnostic errors after their scope is transpiled. This only happens after the app has already been transpiled.
Here's a unit test that shows the issue: