[syntax-errors] Type parameter lists before Python 3.12 (#16479)

Summary
--

Another simple one, just detect type parameter lists in functions
and classes. Like pyright, we don't emit a second diagnostic for
`type` alias statements, which were also introduced in 3.12.

Test Plan
--
Inline tests.
This commit is contained in:
Brent Westbrook 2025-03-05 08:19:09 -05:00 committed by GitHub
parent d94a78a134
commit 81bcdcebd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 557 additions and 0 deletions

View file

@ -0,0 +1,2 @@
# parse_options: {"target-version": "3.12"}
class Foo[S: (str, bytes), T: float, *Ts, **P]: ...

View file

@ -0,0 +1,2 @@
# parse_options: {"target-version": "3.12"}
def foo[T](): ...