sorbet: `bundle exec srb init` crashes in Ruby 3.0.0
Input
.ruby-version
3.0.0
Gemfile
source 'https://rubygems.org'
gem 'sorbet
test.rb
class A
end
Observed output
Run bundle install
and then
$ bundle exec srb init
Hey there!
This script will get this project ready to use with Sorbet by creating a
sorbet/ folder for your project. It will contain:
- a config file
- a bunch of 'RBI files'
RBI stands for 'Ruby Interface'; these files define classes, methods, and
constants that exist, but which Sorbet doesn't always know about.
Heads up:
To set up your project, this script will take two potentially destructive
actions:
1. It will require every file in your project. Specifically, every script in
your project will be run, unless that script checks if __FILE__ == $PROGRAM_NAME
before running any code, or has the magic comment # typed: ignore in it.
2. It will add a comment to the top of every file (like # typed: false or
# typed: true, depending on how many errors were found in that file.)
Would you like to continue? [Y/n]
Generating: sorbet/config
Reusing existing config file: sorbet/config
Generating: sorbet/rbi/sorbet-typed/
Generating: sorbet/rbi/gems/
LoadError: cannot load such file -- sorbet
LoadError: cannot load such file -- sorbet-static
/home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/lib/gem-generator-tracepoint/tracepoint_serializer.rb:35:in `initialize': wrong number of arguments (given 1, expected 0; required keywords: files, delegate_classes) (ArgumentError)
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/lib/gem-generator-tracepoint/tracer.rb:40:in `new'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/lib/gem-generator-tracepoint/tracer.rb:40:in `new'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/lib/gem-generator-tracepoint.rb:43:in `main'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/bin/srb-rbi:232:in `block in make_step'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/bin/srb-rbi:118:in `init'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/bin/srb-rbi:196:in `main'
from /home/dee-see/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorbet-0.5.6111/bin/srb-rbi:237:in `<main>'
Expected behavior
It shouldn’t crash 😃
It works as expected in 2.7.2
I really expected this issue to exist and I looked for duplicates but couldn’t find any. Sorry if this is known!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 15 (9 by maintainers)
This is still a problem with Sorbet 0.5.9633 and Ruby 3.1.0p0:
I’m having this same issue as well. Ruby 3.0.0, Sorbet 0.5.6292. Is there a workaround or do I switch to Tapioca to get these files generated? I switched to Tapioca, seems to work great.
I’m facing the same issue using sorbet
0.5.9553
and ruby3.0.1p64
I was able to fix it locally by changingTracepointSerializer.new(trace_results).serialize(output_dir)
toTracepointSerializer.new(**trace_results).serialize(output_dir)
onlib/gem-generator-tracepoint.rb
not sure if thats the a actual fix or it just works for me. I’m runningbundle exec srb rbi gems
Getting the same problem as @dee-see , on
0.5.9318
, alsoruby 3.0.1p64
.Hi @jez 👋
Are the changes supposed to be included in https://github.com/sorbet/sorbet/releases/tag/0.5.6249.20210126165344-49e284886 ?
It didn’t solve the problem for me, running the same steps as the original issue
I’ve opened #3851
I’ll open a generic ‘support ruby 3.0’ ticket 😃