Correctly parse <_> paths in patterns

closes #3659
This commit is contained in:
Aleksey Kladov 2020-06-09 13:45:18 +02:00
parent 16943e533c
commit e8d50578ab
4 changed files with 80 additions and 39 deletions

View file

@ -88,7 +88,9 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> {
_ => bind_pat(p, true),
},
_ if paths::is_use_path_start(p) => path_or_macro_pat(p),
// test type_path_in_pattern
// fn main() { let <_>::Foo = (); }
_ if paths::is_path_start(p) => path_or_macro_pat(p),
_ if is_literal_pat_start(p) => literal_pat(p),
T![.] if p.at(T![..]) => dot_dot_pat(p),
@ -138,7 +140,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker {
// let Bar(..) = ();
// }
fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker {
assert!(paths::is_use_path_start(p));
assert!(paths::is_path_start(p));
let m = p.start();
paths::expr_path(p);
let kind = match p.current() {