mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 19:00:26 +08:00
## Summary `match` is a soft keyword. It can name a variable, a function, or the target of an annotated assignment, including after a semicolon. ```python first(); match = value first(); match(value) first(); match[0]: int ``` The parser reported a compound-statement error as soon as it saw the `match` token. We now check the preceding separator when parsing a match statement. If the token turns out to be an identifier, speculative parsing discards the diagnostic. A genuine `match` statement on the same logical line still produces the original error.