mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
[red-knot] Type::SubclassOf(SubclassOfType { base: ClassBase::Unknown }).to_instance()
should be Unknown
, not Any
(#15269)
This commit is contained in:
parent
f144b9684d
commit
eb82089551
1 changed files with 6 additions and 4 deletions
|
@ -1952,10 +1952,12 @@ impl<'db> Type<'db> {
|
|||
Type::Unknown => Type::Unknown,
|
||||
Type::Never => Type::Never,
|
||||
Type::ClassLiteral(ClassLiteralType { class }) => Type::instance(*class),
|
||||
Type::SubclassOf(SubclassOfType {
|
||||
base: ClassBase::Class(class),
|
||||
}) => Type::instance(*class),
|
||||
Type::SubclassOf(_) => Type::Any,
|
||||
Type::SubclassOf(SubclassOfType { base }) => match base {
|
||||
ClassBase::Class(class) => Type::instance(*class),
|
||||
ClassBase::Any => Type::Any,
|
||||
ClassBase::Unknown => Type::Unknown,
|
||||
ClassBase::Todo(todo) => Type::Todo(*todo),
|
||||
},
|
||||
Type::Union(union) => union.map(db, |element| element.to_instance(db)),
|
||||
Type::Intersection(_) => todo_type!("Type::Intersection.to_instance()"),
|
||||
// TODO: calling `.to_instance()` on any of these should result in a diagnostic,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue