Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling bslib_ternary from an independent roku library #1343

Open
elliot-nelson opened this issue Nov 1, 2024 · 1 comment
Open

Calling bslib_ternary from an independent roku library #1343

elliot-nelson opened this issue Nov 1, 2024 · 1 comment

Comments

@elliot-nelson
Copy link
Contributor

elliot-nelson commented Nov 1, 2024

Question here... we've got an independent Roku library that we are compiling with the brightscript compiler. Unfortunately this has some legacy .brs files in it, and those .brs files are calling bslib_ternary() directly (as opposed to a .bs file that can use the ternary syntax sugar).

This used to just work fine, but on the latest compiler version, it produces the error:

132:11 - error BS1140: Cannot find function 'bslib_ternary'

(This makes total sense, as nothing about this build would indicate the function should exist! It just happens to work, because when we build our application and include this library, the bslib_ternary function is already globally available.)


Is there a supported way to "declare" somewhere in the file that "bslib_ternary" will be available at runtime? Or is the best I can do to suppress these errors is inserting a line comment 'bs:disable-next-line?

@TwitchBronBron
Copy link
Member

Since v0.67.0, we separated "can't find variable" and "can't find function" into separate diagnostics. It's possible your codebase was already ignoring bs1001, and now need to ignore bs1140 instead for this situation (either in 'bs:disable-line comments or in bsconfig.json diagnosticFilters).

You can ignore specific error codes for a library by using the bsconfig.json diagnosticFilters collection. Something like this:

{
    "diagnosticFilters": [{
           //ignore ALL diagnostics from vendor libraries. (or add a "codes" section to ignore specific codes)
           "src": "vendor/**/*"
    }]
}

We don't currently have a way to declare that some function will be available globally. Would be a nice enhancemet eventually, I envision there being some type of global.d.bs file you could specific somewhere with extra syntax to do that. We just haven't gotten a chance to think through some of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants