mirror of https://github.com/astral-sh/ruff
[red-knot] TypedDict: No errors for introspection dunder attributes (#17677)
## Summary Do not emit errors when accessing introspection dunder attributes such as `__required_keys__` on `TypedDict`s.
This commit is contained in:
parent
ceb2bf1168
commit
92f95ff494
|
|
@ -21,4 +21,7 @@ msg = Message(id=1, content="Hello")
|
||||||
|
|
||||||
# No errors for yet-unsupported features (`closed`):
|
# No errors for yet-unsupported features (`closed`):
|
||||||
OtherMessage = TypedDict("OtherMessage", {"id": int, "content": str}, closed=True)
|
OtherMessage = TypedDict("OtherMessage", {"id": int, "content": str}, closed=True)
|
||||||
|
|
||||||
|
reveal_type(Person.__required_keys__) # revealed: @Todo(TypedDict)
|
||||||
|
reveal_type(Message.__required_keys__) # revealed: @Todo(TypedDict)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -169,9 +169,7 @@ impl<'db> ClassBase<'db> {
|
||||||
KnownInstanceType::OrderedDict => {
|
KnownInstanceType::OrderedDict => {
|
||||||
Self::try_from_type(db, KnownClass::OrderedDict.to_class_literal(db))
|
Self::try_from_type(db, KnownClass::OrderedDict.to_class_literal(db))
|
||||||
}
|
}
|
||||||
KnownInstanceType::TypedDict => {
|
KnownInstanceType::TypedDict => Self::try_from_type(db, todo_type!("TypedDict")),
|
||||||
Self::try_from_type(db, KnownClass::Dict.to_class_literal(db))
|
|
||||||
}
|
|
||||||
KnownInstanceType::Callable => {
|
KnownInstanceType::Callable => {
|
||||||
Self::try_from_type(db, todo_type!("Support for Callable as a base class"))
|
Self::try_from_type(db, todo_type!("Support for Callable as a base class"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue