Could not find super class: ::Rails::Generators::Base (RBS::NoSuperclassFoundError)
POPPIN-FUMI opened this issue ยท 3 comments
Gemfile
source "https://rubygems.org"
gem "dotenv", "2.7.6"
gem "activesupport", "7.0.0"
gem "sinatra", "2.1.0"
gem "sinatra-activerecord", "2.0.25"
rbs validates
gets error when I use
gem "sinatra-activerecord", "2.0.25"
command
bundle
rbs collection init
rbs collection install
rbs validate
error
Validating class/module definition: `::ActiveRecord::Generators::ApplicationRecordGenerator`...
/Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/errors.rb:149:in `check!': .gem_rbs_collection/activerecord/6.1/activerecord-generated.rbs:24958:4...24965:7: Could not find super class: ::Rails::Generators::Base (RBS::NoSuperclassFoundError)
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/definition_builder/ancestor_builder.rb:211:in `one_instance_ancestors'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/definition_builder/ancestor_builder.rb:397:in `instance_ancestors'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/definition_builder.rb:142:in `block in build_instance'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/definition_builder.rb:794:in `try_cache'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/definition_builder.rb:136:in `build_instance'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/cli.rb:435:in `block in run_validate'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/cli.rb:433:in `each'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/cli.rb:433:in `run_validate'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/lib/rbs/cli.rb:125:in `run'
from /Users/fumi/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbs-2.0.0/exe/rbs:7:in `<top (required)>'
from /Users/fumi/.rbenv/versions/3.1.0/bin/rbs:25:in `load'
from /Users/fumi/.rbenv/versions/3.1.0/bin/rbs:25:in `<main>'
Thanks for reporting the issue. I've transfered this issue from ruby/rbs to this repository because the problem is related to the type definition in this repository.
Currently activerecord depends on railties type definitions, but it shouldn't.
I'll consider how to fix this problem.
Probably I can add an empty class type definition of ::Rails::Generators::Base
to AR gem to avoid this problem.
I've fixed activerecord type definition. Previsouly we need to reuiqre railties
type definition also to use activerecord RBS, but now you can use activerecord type definition without railties.
Note that it still depends on activemodel
and activesupport
, but the dependencies appear in Gemfile.lock, so you don't need to care them if you use rbs collection
.
Please try it ๐ If you have any problem, feel free to comment or open a new issue. Thanks.
Thank you for your rapid fix!!
I tried it and rbs validate
works!
But an error comes from steep
now...
So I made a comment here;
soutaro/steep#466 (comment)