[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:
@@ -0,0 +1,3 @@
|
||||
# parse_options: {"target-version": "3.11"}
|
||||
class Foo[S: (str, bytes), T: float, *Ts, **P]: ...
|
||||
class Foo[]: ...
|
||||
@@ -0,0 +1,3 @@
|
||||
# parse_options: {"target-version": "3.11"}
|
||||
def foo[T](): ...
|
||||
def foo[](): ...
|
||||
@@ -0,0 +1,2 @@
|
||||
# parse_options: {"target-version": "3.12"}
|
||||
class Foo[S: (str, bytes), T: float, *Ts, **P]: ...
|
||||
@@ -0,0 +1,2 @@
|
||||
# parse_options: {"target-version": "3.12"}
|
||||
def foo[T](): ...
|
||||
Reference in New Issue
Block a user