Skip to content

Commit

Permalink
Move defined? check out of process_overload
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Oct 1, 2024
1 parent c00f2bc commit 9b1c291
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module RubyIndexer
class RBSIndexer
extend T::Sig

HAS_UNTYPED_FUNCTION = T.let(!!defined?(RBS::Types::UntypedFunction), T::Boolean)

sig { params(index: Index).void }
def initialize(index)
@index = index
Expand Down Expand Up @@ -161,7 +163,7 @@ def process_overload(overload)

# Untyped functions are a new RBS feature (since v3.6.0) to declare methods that accept any parameters. For our
# purposes, accepting any argument is equivalent to `...`
if defined?(RBS::Types::UntypedFunction) && function.is_a?(RBS::Types::UntypedFunction)
if HAS_UNTYPED_FUNCTION && function.is_a?(RBS::Types::UntypedFunction)
[Entry::ForwardingParameter.new]
else
[]
Expand Down

0 comments on commit 9b1c291

Please sign in to comment.