Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Jul 9, 2024
1 parent db7f8e0 commit dd7260b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/tapioca/dsl/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def processable_constants
sig { returns(T::Enumerable[T::Class[T.anything]]) }
def all_classes
@all_classes ||= T.let(
T.cast(ObjectSpace.each_object(Class), T::Enumerable[T::Class[T.anything]]).each,
ObjectSpace.each_object(Class).each,
T.nilable(T::Enumerable[T::Class[T.anything]]),
)
end

sig { returns(T::Enumerable[Module]) }
def all_modules
@all_modules ||= T.let(
T.cast(ObjectSpace.each_object(Module), T::Enumerable[Module]).each,
ObjectSpace.each_object(Module).each,
T.nilable(T::Enumerable[Module]),
)
end
Expand Down
4 changes: 1 addition & 3 deletions lib/tapioca/dsl/compilers/protobuf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ class << self
def gather_constants
marker = Google::Protobuf::MessageExts::ClassMethods

enum_modules = ObjectSpace.each_object(Google::Protobuf::EnumDescriptor).map do |desc|
T.cast(desc, Google::Protobuf::EnumDescriptor).enummodule
end
enum_modules = ObjectSpace.each_object(Google::Protobuf::EnumDescriptor).map(&:enummodule)

results = if Google::Protobuf.const_defined?(:AbstractMessage)
abstract_message_const = ::Google::Protobuf.const_get(:AbstractMessage)
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/runtime/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def method_of(constant, method)
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
k.singleton_class? || T.unsafe(k) == klass
end

T.unsafe(result)
Expand Down

0 comments on commit dd7260b

Please sign in to comment.