Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/expressions.rs')
| -rw-r--r-- | crates/parser/src/grammar/expressions.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs index c862611114..f40c515fa0 100644 --- a/crates/parser/src/grammar/expressions.rs +++ b/crates/parser/src/grammar/expressions.rs @@ -530,6 +530,15 @@ fn method_call_expr<const FLOAT_RECOVERY: bool>( generic_args::opt_generic_arg_list(p, true); if p.at(T!['(']) { arg_list(p); + } else { + // emit an error when argument list is missing + + // test_err method_call_missing_argument_list + // fn func() { + // foo.bar::<> + // foo.bar::<i32>; + // } + p.error("expected argument list"); } m.complete(p, METHOD_CALL_EXPR) } @@ -602,6 +611,7 @@ fn cast_expr(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { // foo(bar::); // foo(bar:); // foo(bar+); +// foo(a, , b); // } fn arg_list(p: &mut Parser<'_>) { assert!(p.at(T!['('])); @@ -615,8 +625,9 @@ fn arg_list(p: &mut Parser<'_>) { T!['('], T![')'], T![,], + || "expected expression".into(), EXPR_FIRST.union(ATTRIBUTE_FIRST), - |p: &mut Parser<'_>| expr(p).is_some(), + |p| expr(p).is_some(), ); m.complete(p, ARG_LIST); } |