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

Add directives to set of expected values in unexpected-expected error for global items #6421

Open
ErichDonGubler opened this issue Oct 17, 2024 · 0 comments
Labels
area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator type: bug Something isn't working

Comments

@ErichDonGubler
Copy link
Member

Is your feature request related to a problem? Please describe.

#6352 adds/added parsing for directives, which only happen before global declarations. However, it did not add any diagnostic adjustments for the final, fatal diagnostic presented when Naga simply did not find any sentinel tokens indicating a deeper parse path to try than Parser::global_decl. To be painfully concrete, I'm referring to the code here:

ExpectedToken::GlobalItem => concat!(
"global item ('struct', 'const', 'var', 'alias', ';', 'fn') ",
"or the end of the file"
)

Describe the solution you'd like

We should also suggest directive identifiers in the set of sentinels that begin a global item for this diagnostic.

Describe alternatives you've considered

We could simply not do this. However, this feels like hiding functionality in a way that hurts, rather than helps, users.

Additional context

-

@ErichDonGubler ErichDonGubler added type: bug Something isn't working naga Shader Translator area: naga front-end lang: WGSL WebGPU Shading Language labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator type: bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

1 participant