fix for inherited not supporting subclassing
the arg of inherited is a subclass of the current class, not (just) a ::Class.
There's also a similar limitation in Kernel#class definition, where def class: () -> Class should map out to something more useful, i.e. def class: () -> instance_class, but that would require support for a new keyword, and there may be other limitations?
There's also a similar limitation in
Kernel#classdefinition, wheredef class: () -> Classshould map out to something more useful, i.e.def class: () -> instance_class, but that would require support for a new keyword, and there may be other limitations?
- Perhaps #1542?
Unfortunately, it doesn't work with the current instance type semantics.
This is an output to type check def Object.inherited(klass) = klass.fooo.
test.rb:1:36: [error] Type `::Object` does not have method `fooo`
│ Diagnostic ID: Ruby::NoMethod
│
└ def Object.inherited(klass) = klass.fooo
~~~~
The instance type is resolved to Object, not singleton(Object).
test.rb:1:36: [error] Type `::Object` does not have method `fooo` │ Diagnostic ID: Ruby::NoMethod │ └ def Object.inherited(klass) = klass.fooo ~~~~The
instancetype is resolved toObject, notsingleton(Object).
This hints that singleton(Object) only reads from Object RBS and doesn’t consider itself an instance of Class; this is an oversight.