mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
fix: Fix incorrect parsing error on method call on range
This commit is contained in:
parent
af40101841
commit
72200641c1
3 changed files with 62 additions and 1 deletions
|
@ -371,7 +371,15 @@ fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLik
|
|||
if p.at(op) {
|
||||
m = p.start();
|
||||
p.bump(op);
|
||||
if p.at_ts(EXPR_FIRST) && !(r.forbid_structs && p.at(T!['{'])) {
|
||||
|
||||
// test closure_range_method_call
|
||||
// fn foo() {
|
||||
// || .. .method();
|
||||
// || .. .field;
|
||||
// }
|
||||
let has_access_after = p.at(T![.]) && p.nth_at(1, SyntaxKind::IDENT);
|
||||
let struct_forbidden = r.forbid_structs && p.at(T!['{']);
|
||||
if p.at_ts(EXPR_FIRST) && !has_access_after && !struct_forbidden {
|
||||
expr_bp(p, None, r, 2);
|
||||
}
|
||||
let cm = m.complete(p, RANGE_EXPR);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue