Skip to content

Commit 77aa03c

Browse files
committed
ssr/matching: Ignore trailing semicolon in let stmt
1 parent 071b14e commit 77aa03c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/ssr/src/matching.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
307307
);
308308
}
309309
None => {
310+
if code.kind() == SyntaxKind::SEMICOLON
311+
&& code.parent().kind() == SyntaxKind::LET_STMT
312+
{
313+
// If the pattern ends but the code still has a trailing semicolon, accept the match.
314+
// Allows to match `let x = y; ...` with `let $a = $b`.
315+
return Ok(());
316+
}
317+
310318
fail_match!("Pattern exhausted, while code remains: `{}`", code.text());
311319
}
312320
}

0 commit comments

Comments
 (0)