[red-knot] a few metaclass cleanups (#14142)

Just cleaning up a few small things I noticed in post-land review.
This commit is contained in:
Carl Meyer 2024-11-06 14:13:39 -08:00 committed by GitHub
parent 626f716de6
commit 03a5788aa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View file

@ -2100,8 +2100,10 @@ impl<'db> Class<'db> {
};
let Type::ClassLiteral(mut candidate) = metaclass else {
// If the metaclass is not a class, return it directly.
return Ok(metaclass);
// TODO: If the metaclass is not a class, we should verify that it's a callable
// which accepts the same arguments as `type.__new__` (otherwise error), and return
// the meta-type of its return type. (And validate that is a class type?)
return Ok(Type::Todo);
};
// Reconcile all base classes' metaclasses with the candidate metaclass.