pocke / rbs_rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generate_rbs_for_models errors on scopes with rest arg

grncdr opened this issue · comments

Running rbs_rails:generate_rbs_for_models with the following app/models/example.rb fails:

class Example < ActiveRecord::Base
   scope :foo, ->(*bars) { where(bar: bars) }
end

The error is unexpected: (restarg :bars). I can work around the crash by changing the scope to a class method, but then it will not be included in the generated .rbs file.

Version info:

 bundle info rbs_rails
  * rbs_rails (0.7.0)
        Summary: A RBS files generator for Rails application
        Homepage: https://github.com/pocke/rbs_rails
        Path: <snip>/lib/ruby/gems/2.6.0/gems/rbs_rails-0.7.0

I am not sure but it seems like this is the signature that needs to be updated:

def self.scope: (Symbol, ^(*untyped) -> untyped ) -> void
| (Symbol) { (*untyped) -> untyped } -> void
and it might even be fixed already but not released?