lib/tapioca/runtime/reflection.rb in tapioca-0.7.1 vs lib/tapioca/runtime/reflection.rb in tapioca-0.7.2
- old
+ new
@@ -138,10 +138,14 @@
# class A < B; end
# descendants_of(C) # => [B, A]
#
# class D < C; end
# descendants_of(C) # => [B, A, D]
- sig { type_parameters(:U).params(klass: T.type_parameter(:U)).returns(T::Array[T.type_parameter(:U)]) }
+ sig do
+ type_parameters(:U)
+ .params(klass: T.all(Class, T.type_parameter(:U)))
+ .returns(T::Array[T.type_parameter(:U)])
+ end
def descendants_of(klass)
result = ObjectSpace.each_object(klass.singleton_class).reject do |k|
T.cast(k, Module).singleton_class? || T.unsafe(k) == klass
end