mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
[ty] Fix panics when pulling types for ClassVar
or Final
parameterized with >1 argument (#18824)
This commit is contained in:
parent
073a71ca9a
commit
dc160c4a49
3 changed files with 28 additions and 20 deletions
|
@ -84,13 +84,11 @@ d.a = 2
|
|||
|
||||
## Too many arguments
|
||||
|
||||
<!-- pull-types:skip -->
|
||||
|
||||
```py
|
||||
from typing import ClassVar
|
||||
|
||||
class C:
|
||||
# error: [invalid-type-form] "Type qualifier `typing.ClassVar` expects exactly one type parameter"
|
||||
# error: [invalid-type-form] "Type qualifier `typing.ClassVar` expected exactly 1 argument, got 2"
|
||||
x: ClassVar[int, str] = 1
|
||||
```
|
||||
|
||||
|
|
|
@ -45,13 +45,11 @@ reveal_type(FINAL_E) # revealed: int
|
|||
|
||||
## Too many arguments
|
||||
|
||||
<!-- pull-types:skip -->
|
||||
|
||||
```py
|
||||
from typing import Final
|
||||
|
||||
class C:
|
||||
# error: [invalid-type-form] "Type qualifier `typing.Final` expects exactly one type parameter"
|
||||
# error: [invalid-type-form] "Type qualifier `typing.Final` expected exactly 1 argument, got 2"
|
||||
x: Final[int, str] = 1
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue