Skip to content

Files set at beforeProgramValidate stage are no longer picked up during validation of other real .bs files #1450

@iBicha

Description

@iBicha

Context: https://rokudevelopers.slack.com/archives/CKF1QQGTY/p1739742183565309
Creating an issue in case we lose access to Slack post after a while

I believe this was introduced here #993

repro project
https://github.com/iBicha/bsc-sample-repro

I was able to simplfy the sample even further to be very minimalist. It comes down to this: from 0.68.5 to 0.69.0, .bs files set at beforeProgramValidate stage are no longer picked up during validation of other real .bs files. Here's the full example:
main.bs

import "pkg:/source/AsyncTask/Tasks.bs"

sub main()
    print Tasks.MyTask
end sub

plugin

export class AsyncTaskPlugin implements CompilerPlugin {
    public name = 'AsyncTaskPlugin';

    beforeProgramValidate(program: Program) {
        const fileContent = `enum Tasks
    MyTask = "_AsyncTask"
end enum
`
        program.setFile('source/AsyncTask/Tasks.bs', fileContent);
    }
}

Works with 0.68.5 but with 0.69.0 Tasks is not defined in the source scope
Does this ring any bells?

I can see running bslint that some things are now running out of order (or perhaps is a race condition)
E.g.
with 0.68.5 Validating project finished was printed after afterProgramValidate, with 0.69.0 Validating project finished is printed before afterProgramValidate 0.69.0.txt 0.68.5.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions