mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Auto merge of #16493 - Young-Flash:method_call_parser, r=Veykril
fix: emit parser error for missing argument list close https://github.com/rust-lang/rust-analyzer/issues/16362
This commit is contained in:
commit
cb37fcc616
3 changed files with 69 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
SOURCE_FILE
|
||||
FN
|
||||
FN_KW "fn"
|
||||
WHITESPACE " "
|
||||
NAME
|
||||
IDENT "func"
|
||||
PARAM_LIST
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
BLOCK_EXPR
|
||||
STMT_LIST
|
||||
L_CURLY "{"
|
||||
WHITESPACE "\n "
|
||||
EXPR_STMT
|
||||
METHOD_CALL_EXPR
|
||||
PATH_EXPR
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "foo"
|
||||
DOT "."
|
||||
NAME_REF
|
||||
IDENT "bar"
|
||||
GENERIC_ARG_LIST
|
||||
COLON2 "::"
|
||||
L_ANGLE "<"
|
||||
R_ANGLE ">"
|
||||
WHITESPACE "\n "
|
||||
EXPR_STMT
|
||||
METHOD_CALL_EXPR
|
||||
PATH_EXPR
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "foo"
|
||||
DOT "."
|
||||
NAME_REF
|
||||
IDENT "bar"
|
||||
GENERIC_ARG_LIST
|
||||
COLON2 "::"
|
||||
L_ANGLE "<"
|
||||
TYPE_ARG
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "i32"
|
||||
R_ANGLE ">"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
R_CURLY "}"
|
||||
WHITESPACE "\n"
|
||||
error 27: expected argument list
|
||||
error 27: expected SEMICOLON
|
||||
error 46: expected argument list
|
|
@ -0,0 +1,4 @@
|
|||
fn func() {
|
||||
foo.bar::<>
|
||||
foo.bar::<i32>;
|
||||
}
|
Loading…
Reference in a new issue