[ty]: Consider a class with a dynamic element in its MRO assignable to any subtype of type (#18205)
This commit is contained in:
@@ -1542,6 +1542,14 @@ impl<'db> Type<'db> {
|
||||
true
|
||||
}
|
||||
|
||||
(Type::ClassLiteral(class), Type::SubclassOf(_))
|
||||
if class
|
||||
.iter_mro(db, None)
|
||||
.any(class_base::ClassBase::is_dynamic) =>
|
||||
{
|
||||
true
|
||||
}
|
||||
|
||||
// Every `type[...]` is assignable to `type`
|
||||
(Type::SubclassOf(_), _)
|
||||
if KnownClass::Type
|
||||
|
||||
@@ -303,6 +303,10 @@ impl<'db> ClassBase<'db> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const fn is_dynamic(self) -> bool {
|
||||
matches!(self, Self::Dynamic(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'db> From<ClassType<'db>> for ClassBase<'db> {
|
||||
|
||||
Reference in New Issue
Block a user