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

"Not in scope" warnings are shown even though the function/etc is defined in a parent component #556

Open
simon-grantham opened this issue Mar 25, 2024 · 4 comments

Comments

@simon-grantham
Copy link

"Not in scope" warnings are underlined in code and percolated to file explorer even thought the definition is in scope in a parent component ( ie. current component defined as extending a parent, and so on up the derivation chain.)

@TwitchBronBron
Copy link
Member

Can you provide a sample project or zip reproducing the issue? Typically are valid issues, due to some OTHER scope not having the required imports.

@simon-grantham
Copy link
Author

Will do...

@simon-grantham
Copy link
Author

simon-grantham commented Mar 25, 2024

We see this one scattered enormously through our code base, but in creating an example, I realize it is due to us creating "Abstract Components" (or abstract derivations thereof). That is, the Abstract Component is invoking methods it expects to be defined in components that are extensions of the "Abstract Component". We do not create dummy (empty) definitions in the "Abstract Component" because, like all good compilers ;) , we want to have an error thrown at compile time.

Regardless, I have attached an example as promised.

simple-videoplayer-channel.zip

grep -rin --include=*.brs "issues/556"

@TwitchBronBron
Copy link
Member

Yeah, that's the exact issue I was expecting to see. So you currently have 2 options at this point:

  • define the function in the base component...all the errors will go away
  • add a 'bs:disable-line comment after the function, which will suppress the diagnostic

I also just finished chatting with @chrisdp, and we think we have a way to make this slightly less annoying by using runtime checks. See rokucommunity/brighterscript#1121. Would something like that be acceptable?

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