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

[naga wgsl-in] Fill out error message for deep nesting. #5486

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions naga/src/front/wgsl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,10 @@ impl<'a> Error<'a> {
]
},
Error::ExceededLimitForNestedBraces { span, limit } => ParseError {
message: "brace nesting limit reached".into(),
labels: vec![(span, "limit reached at this brace".into())],
message: "Statements nested too deeply".into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The capitalized casing, for better or worse, is not consistent with other diagnostics.

Suggested change
message: "Statements nested too deeply".into(),
message: "statements nested too deeply".into(),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feedback also applies to the notes field.

labels: vec![(span, "nesting limit reached at this brace".into())],
notes: vec![
format!("nesting limit is currently set to {limit}"),
format!("The maximum nesting depth of brace-enclosed statements in a function is {limit}."),
Copy link
Member

@ErichDonGubler ErichDonGubler Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This new diagnostic takes pains to note that it is related to statements, but that's not true, AFAIK. The limit current works based on opening braces in any parsing rule (i.e., incl. loop, as you pointed out in the initial PR). Therefore, I think attributing this to statements is misleading.

],
},
}
Expand Down
Loading