File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed
crates/cairo-lang-semantic/src Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -216,3 +216,35 @@ fn unstable_function_with_note() -> felt252 {
216216//! > function_body
217217
218218//! > expected_diagnostics
219+
220+ //! > ==========================================================================
221+
222+ //! > Declarative macro with parameter missing kind specifier.
223+
224+ //! > test_runner_name
225+ test_function_diagnostics(expect_diagnostics: true)
226+
227+ //! > function_code
228+ fn foo() {
229+ m!(1);
230+ }
231+
232+ //! > function_name
233+ foo
234+
235+ //! > module_code
236+ macro m {
237+ ($x) => { 0 };
238+ }
239+
240+ //! > expected_diagnostics
241+ error[E1010]: Macro parameter must have a kind.
242+ --> lib.cairo:2:7
243+ ($x) => { 0 };
244+ ^
245+
246+ error[E2158]: No matching rule found in inline macro `m`.
247+ --> lib.cairo:5:5
248+ m!(1);
249+ ^^^^^
250+
Original file line number Diff line number Diff line change @@ -295,10 +295,7 @@ fn is_macro_rule_match_ex<'db>(
295295 if let ast:: OptionParamKind :: ParamKind ( param_kind) = param. kind ( db) {
296296 param_kind. kind ( db) . into ( )
297297 } else {
298- unreachable ! (
299- "Missing macro rule param kind, should have been handled by the \
300- parser."
301- )
298+ return None ;
302299 } ;
303300 let placeholder_name = param. name ( db) . as_syntax_node ( ) . get_text_without_trivia ( db) ;
304301 match placeholder_kind {
You can’t perform that action at this time.
0 commit comments