enforce parsing invariant for patterns

This commit is contained in:
Aleksey Kladov 2022-01-02 17:32:15 +03:00
parent 7989d567e2
commit e78424846e
4 changed files with 42 additions and 2 deletions

View file

@ -146,6 +146,33 @@ fn macro_pattern() {
R_PAREN ")"
"#]],
);
check(
TopEntryPoint::Pattern,
"None leftover tokens",
expect![[r#"
ERROR
IDENT_PAT
NAME
IDENT "None"
WHITESPACE " "
IDENT "leftover"
WHITESPACE " "
IDENT "tokens"
"#]],
);
check(
TopEntryPoint::Pattern,
"@err",
expect![[r#"
ERROR
ERROR
AT "@"
IDENT "err"
error 0: expected pattern
"#]],
);
}
#[track_caller]