Improve switch's diagnostics

This commit is contained in:
dkanus 2026-05-02 19:40:37 +07:00
commit f695f8a52e
17 changed files with 2702 additions and 231 deletions

View file

@ -9,6 +9,7 @@ mod block_items;
mod control_flow_expressions;
mod primary_expressions;
mod selector_expressions;
mod switch_expressions;
#[derive(Debug)]
pub(super) struct ExpectedLabel {

View file

@ -397,7 +397,7 @@ pub(super) const P0033_FIXTURES: &[Fixture] = &[
},
Fixture {
label: "files/P0033_02.uc",
source: "{\n Func\n (A\n :,\n B);\n Log(\"after\");\n}\n",
source: "{\n Func\n (A\n #,\n B);\n Log(\"after\");\n}\n",
},
Fixture {
label: "files/P0033_03.uc",
@ -670,7 +670,7 @@ fn check_p0033_fixtures() {
assert_diagnostic(
&runs.get_any("files/P0033_02.uc"),
&ExpectedDiagnostic {
headline: "expected `,` or `)` after argument, found `:`",
headline: "expected `,` or `)` after argument, found `#`",
severity: Severity::Error,
code: Some("P0033"),
primary_label: Some(ExpectedLabel {
@ -678,7 +678,7 @@ fn check_p0033_fixtures() {
start: TokenPosition(10),
end: TokenPosition(10),
},
message: "unexpected `:`",
message: "unexpected `#`",
}),
secondary_labels: &[
ExpectedLabel {

File diff suppressed because it is too large Load diff