diff options
Diffstat (limited to 'crates')
3 files changed, 31 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index ed4f93347..272661b1d 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs | |||
@@ -114,8 +114,11 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
114 | // test fn_pointer_param_ident_path | 114 | // test fn_pointer_param_ident_path |
115 | // type Foo = fn(Bar::Baz); | 115 | // type Foo = fn(Bar::Baz); |
116 | // type Qux = fn(baz: Bar::Baz); | 116 | // type Qux = fn(baz: Bar::Baz); |
117 | |||
118 | // test fn_pointer_unnamed_arg | ||
119 | // type Foo = fn(_: bar); | ||
117 | Flavor::FnPointer => { | 120 | Flavor::FnPointer => { |
118 | if p.at(IDENT) && p.nth(1) == T![:] && !p.nth_at(1, T![::]) { | 121 | if (p.at(IDENT) || p.at(UNDERSCORE)) && p.nth(1) == T![:] && !p.nth_at(1, T![::]) { |
119 | patterns::pattern_single(p); | 122 | patterns::pattern_single(p); |
120 | types::ascription(p); | 123 | types::ascription(p); |
121 | } else { | 124 | } else { |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs new file mode 100644 index 000000000..1ebbe5b03 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs | |||
@@ -0,0 +1 @@ | |||
type Foo = fn(_: bar); | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.txt new file mode 100644 index 000000000..52d8f21a4 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.txt | |||
@@ -0,0 +1,26 @@ | |||
1 | SOURCE_FILE@[0; 23) | ||
2 | TYPE_ALIAS_DEF@[0; 22) | ||
3 | TYPE_KW@[0; 4) "type" | ||
4 | WHITESPACE@[4; 5) " " | ||
5 | NAME@[5; 8) | ||
6 | IDENT@[5; 8) "Foo" | ||
7 | WHITESPACE@[8; 9) " " | ||
8 | EQ@[9; 10) "=" | ||
9 | WHITESPACE@[10; 11) " " | ||
10 | FN_POINTER_TYPE@[11; 21) | ||
11 | FN_KW@[11; 13) "fn" | ||
12 | PARAM_LIST@[13; 21) | ||
13 | L_PAREN@[13; 14) "(" | ||
14 | PARAM@[14; 20) | ||
15 | PLACEHOLDER_PAT@[14; 15) | ||
16 | UNDERSCORE@[14; 15) "_" | ||
17 | COLON@[15; 16) ":" | ||
18 | WHITESPACE@[16; 17) " " | ||
19 | PATH_TYPE@[17; 20) | ||
20 | PATH@[17; 20) | ||
21 | PATH_SEGMENT@[17; 20) | ||
22 | NAME_REF@[17; 20) | ||
23 | IDENT@[17; 20) "bar" | ||
24 | R_PAREN@[20; 21) ")" | ||
25 | SEMI@[21; 22) ";" | ||
26 | WHITESPACE@[22; 23) "\n" | ||