fix: add a check for if token in patterns parser

Closes #13776
This commit is contained in:
Dezhi Wu 2022-12-15 12:46:02 +08:00
parent 95671d53ea
commit 6a295fcd3b

View File

@ -126,7 +126,10 @@ fn pattern_single_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
// ^
// `[0..]`
// ^
if matches!(p.current(), T![=] | T![,] | T![:] | T![')'] | T!['}'] | T![']']) {
if matches!(
p.current(),
T![=] | T![,] | T![:] | T![')'] | T!['}'] | T![']'] | T![if]
) {
// test half_open_range_pat
// fn f() {
// let 0 .. = 1u32;