steep icon indicating copy to clipboard operation
steep copied to clipboard

`steep check` raises error when method from Module are used inside static method

Open chloelbn opened this issue 4 years ago • 1 comments

When making use of a method from an Module inside a static method, steep check raises an error

method

class Client
  include Helpers
  def self.generate_secured_api_key(parent_key, restrictions)
        url_encoded_restrictions = to_query_string(symbolize_hash(restrictions))
       [...]
  end
end

module Helpers
 def to_query_string(params)
    params.map do |key, value|
      "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
    end.join('&')
  end

  def self.included(base)
     base.extend(Helpers)
  end
end

raised error

lib/algolia/search_client.rb:409:35: NoMethodError: type=singleton(::Client), method=to_query_string (to_query_string(symbolize_hash(restrictions)))

chloelbn avatar Sep 22 '20 09:09 chloelbn

This is similar to #216. Steep doesn't know what included method is doing...

I know this pattern using included method to extend self is common. There may be possible to add RBS support for this pattern.

soutaro avatar Sep 28 '20 14:09 soutaro