-
Notifications
You must be signed in to change notification settings - Fork 971
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
Detect a common syntax error case for diagnostic_directive #6718
Detect a common syntax error case for diagnostic_directive #6718
Conversation
If the user has a global_decl of the form `@diagnostic(...);`, display a note suggesting they remove the `@` to create a diagnostic_directive, if that is their intent.
Definitely want a note on the changelog, will also make sure you get listed as a contributor to the release :) |
…ticAttributeNotSupported` render logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a few tweaks to the original changes. @e-hat, did you have any thoughts on what I pushed up before merging?
@e-hat: Also welcome, and thanks for making diagnostics in |
If the user has a
global_decl
of the form@diagnostic(...);
, display a note suggesting they remove the@
to create a globaldiagnostic_directive
, which will apply the diagnostic filter to the entire module.Connections
Addresses #6536.
Description
Sometimes the user will intend to declare a
diagnostic_directive
to apply a diagnostic filter to the entire module using the following incorrect syntax, i.e.:The
@
symbol is used to declare a scoped diagnostic attribute (diagnostic_attr
) but not a globaldiagnostic_directive
. This change adds a note to the error message in this case to use the correct syntax:Testing
Added a test
front::wgsl::tests::diagnostic_filter::intended_global_directive
that tests the case described above against the expected error message + notes.Checklist
cargo fmt
.taplo format
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.Not sure about some steps in the checklist, maybe these checks are failing because of my local setup.
Also not sure if this small change belongs in the changelog.Thanks.