Open boiiiboi opened 1 year ago
I'm running into this too while upgrading to Ruby 3.2.
After poking around a bit, it looks like the "unknown prefix" error is coming from Parlour:
Parlour appears to be struggling with "forward everything arguments" (https://bugs.ruby-lang.org/issues/16253) which ActiveJob uses for perform_now
and perform_later
. Notably, this syntax was introduced in Ruby 2.7.
The method Parlour is generating RBI for is re-constructed in sorbet-rails around:
That method is generating invalid Parlour Parameters:
# run with `rails runner repro.rb`
class Foo
def m(...); end
end
method_def = Foo.instance_method(:m)
params = SorbetRails::SorbetUtils.parameters_from_method_def(method_def)
params.each { |param| pp param }
Prints:
Warning: unable to parse the source of m
#<Parlour::RbiGenerator::Parameter:0x00007fc43a24d758
@default=nil,
@kind=:double_splat,
@name="**",
@type="T.untyped">
#<Parlour::RbiGenerator::Parameter:0x00007fc43a24d1b8
@default=nil,
@kind=:double_splat,
@name="****",
@type="T.untyped">
#<Parlour::RbiGenerator::Parameter:0x00007fc43a24cf38
@default=nil,
@kind=:block,
@name="&&",
@type="T.untyped">
This fix (which I'm hoping to have a PR for today if I don't get terribly sidetracked) appears to be updating parameters_from_method_def
so it generates Parlour Parameters with valid names.
This also happens when alias
and alias_method
are used because recent versions of ruby seem to use forward everything on the alias.
Describe the bug:
After running
rails_rbi:jobs
, following error occured.Steps to reproduce:
rails_rbi:jobs
Expected behavior:
Expect to generate sigs successfully.
Versions: