mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-21 07:41:53 +00:00
[ty] Fix error message for invalidly providing type arguments to NamedTuple
when it occurs in a type expression (#19940)
This commit is contained in:
parent
527a690a73
commit
f4d8826428
2 changed files with 6 additions and 2 deletions
|
@ -312,6 +312,9 @@ def expects_named_tuple(x: typing.NamedTuple):
|
|||
|
||||
def _(y: type[typing.NamedTuple]):
|
||||
reveal_type(y) # revealed: @Todo(unsupported type[X] special form)
|
||||
|
||||
# error: [invalid-type-form] "Special form `typing.NamedTuple` expected no type parameter"
|
||||
def _(z: typing.NamedTuple[int]): ...
|
||||
```
|
||||
|
||||
Any instance of a `NamedTuple` class can therefore be passed for a function parameter that is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue