1
Fork 0

added improved diagnostic for a function defined with an invalid qualifier

This commit is contained in:
akabinds 2022-08-18 16:14:04 -05:00
parent 801821d156
commit 1b54ad0585
9 changed files with 89 additions and 0 deletions

View file

@ -611,6 +611,15 @@ impl<'a> Parser<'a> {
appl,
);
}
if ["def", "fun", "func", "function"].contains(&symbol.as_str()) {
err.span_suggestion_short(
self.prev_token.span,
&format!("write `fn` instead of `{symbol}` to declare a function"),
"fn",
appl,
);
}
}
// Add suggestion for a missing closing angle bracket if '>' is included in expected_tokens