Last active
July 1, 2019 20:29
-
-
Save jasnow/b80a18c9acfcf9a3e6817987f5540973 to your computer and use it in GitHub Desktop.
"srb init" produces stack trace with "unexpected errors" message on rails_app5_2 sample app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"srb init" produces stack trace with "unexpected errors" message on rails_app5_2 sample app | |
#### Versions | |
- Ruby: ruby 2.4.6p354 (2019-04-01 revision 67394) [x86_64-darwin16] | |
- Rails: Rails 5.2.3 | |
- Sorbet: Sorbet typechecker 0.4.4358 git 1beae38af163add1e13e897e4771727a0a40c338 built on 2019-06-30 00:44:42 GMT with debug symbols | |
- Sorbet-Rails: 0.2.0 | |
- OS/Hardware: Mac OS 10.12.6 (Sierra) on Mid-2014 MacBookPro. | |
#### Input | |
When I run "srb init" on this repo (https://github.com/jasnow/rails_app5_2), | |
I produces a stack trace with "unexpected errors" message. | |
Before this step, I ran the 3 commands listed in the "Adopting Sorbet" web page to verify installation. | |
https://sorbet.org/docs/adopting | |
#### Observed output | |
"SRB_YES=1 srb init 2>&1 |tee output" output: | |
``` | |
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.) | |
SRB_YES set, continuing | |
Generating: sorbet/config | |
Generating: sorbet/rbi/sorbet-typed/ | |
Generating: sorbet/rbi/gems/ | |
[12/32] require_relative './config/boot.rb' | |
[24/32] require_relative './config/puma.rb' | |
[27/32] require_relative './db/migrate/20190620001234_create_wizards.rb' | |
[28/32] require_relative './db/migrate/20190620003037_create_wands.rb' | |
[29/32] require_relative './db/migrate/20190620003739_create_spell_books.rb' | |
[30/32] require_relative './db/schema.rb' | |
-- create_table("spell_books", {:force=>:cascade}) | |
-> 0.0099s | |
-- create_table("wands", {:force=>:cascade}) | |
-> 0.0039s | |
-- create_table("wizards", {:force=>:cascade}) | |
-> 0.0027s | |
[31/32] require_relative './db/seeds.rb' | |
[32/32] require_relative './test/test_helper.rb' | |
Generating: sorbet/rbi/hidden-definitions/ | |
Requiring all of your code | |
Naming all Modules | |
Failed to load ActionCable::Server::ActiveRecordConnectionManagement | |
Failed to load ActionController::Middleware | |
Failed to load ActionDispatch::SystemTestCase | |
Failed to load ActionDispatch::Http::Upload | |
You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install | |
Failed to load ActionDispatch::Session::MemCacheStore | |
Failed to load ActiveJob::QueueAdapters::BackburnerAdapter | |
Failed to load ActiveJob::QueueAdapters::DelayedJobAdapter | |
Failed to load ActiveJob::QueueAdapters::QuAdapter | |
Failed to load ActiveJob::QueueAdapters::QueAdapter | |
Failed to load ActiveJob::QueueAdapters::QueueClassicAdapter | |
Failed to load ActiveJob::QueueAdapters::ResqueAdapter | |
Failed to load ActiveJob::QueueAdapters::SidekiqAdapter | |
Failed to load ActiveJob::QueueAdapters::SneakersAdapter | |
Failed to load ActiveJob::QueueAdapters::SuckerPunchAdapter | |
You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install | |
Failed to load ActiveSupport::Cache::MemCacheStore | |
The Redis cache store requires the redis gem, version 4.0.1 or later. Please add it to your Gemfile: `gem "redis", "~> 4.0"` | |
Failed to load ActiveSupport::Cache::RedisCacheStore | |
Failed to load I18n::Tests::Pluralization | |
Failed to load I18n::Tests::Basics | |
Failed to load I18n::Tests::Defaults | |
Failed to load I18n::Tests::Interpolation | |
Failed to load I18n::Tests::Link | |
Failed to load I18n::Tests::Lookup | |
Failed to load I18n::Tests::Procs | |
Failed to load I18n::Tests::Localization::Time | |
Failed to load I18n::Tests::Localization::Date | |
Failed to load I18n::Tests::Localization::DateTime | |
Failed to load I18n::Tests::Localization::Procs | |
Failed to load Rack::Handler::FastCGI | |
Failed to load Rack::Handler::LSWS | |
Failed to load Rack::Handler::SCGI | |
Failed to load Rack::Handler::Thin | |
Failed to load Rack::Session::Memcache | |
Failed to load Rails::Application::Railties | |
Failed to load ThreadSafe::JRubyCacheBackend | |
Generating /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi with 3755 modules and 102 aliases | |
Printing your code's symbol table into /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/from-source.json | |
Printing /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi's symbol table into /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.json | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/lib/hidden-definition-finder.rb:145:in `write_constants': /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi had unexpected errors. Check this file for a clue: /var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.json.err (RuntimeError) | |
from /Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/lib/hidden-definition-finder.rb:47:in `main' | |
from /Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/lib/hidden-definition-finder.rb:38:in `main' | |
from /Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/bin/srb-rbi:227:in `block in make_step' | |
from /Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/bin/srb-rbi:101:in `main' | |
from /Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-0.4.4358/bin/srb-rbi:232:in `<main>' | |
``` | |
The reflection.json.err file follows: | |
``` | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi:36166: Type `Elem` declared by parent `T.class_of(ActiveRecord::Base)` must be re-declared in `T.class_of(ActiveRecord::InternalMetadata)` https://srb.help/5014 | |
36166 |class ActiveRecord::InternalMetadata < ActiveRecord::Base | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-rails-0.2.0/rbi/activerecord.rbi:144: `Elem` declared in parent here | |
144 | Elem = type_template(fixed: ActiveRecord::Base) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi:42217: Type `Elem` declared by parent `T.class_of(ActiveRecord::Base)` must be re-declared in `T.class_of(ActiveRecord::SchemaMigration)` https://srb.help/5014 | |
42217 |class ActiveRecord::SchemaMigration < ActiveRecord::Base | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-rails-0.2.0/rbi/activerecord.rbi:144: `Elem` declared in parent here | |
144 | Elem = type_template(fixed: ActiveRecord::Base) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi:156261: Type `Elem` declared by parent `T.class_of(ApplicationRecord)` must be re-declared in `T.class_of(SpellBook)` https://srb.help/5014 | |
156261 |class SpellBook < ApplicationRecord | |
^^^^^^^^^ | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-rails-0.2.0/rbi/activerecord.rbi:149: `Elem` declared in parent here | |
149 | Elem = type_template(fixed: ApplicationRecord) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi:169247: Type `Elem` declared by parent `T.class_of(ApplicationRecord)` must be re-declared in `T.class_of(Wand)` https://srb.help/5014 | |
169247 |class Wand < ApplicationRecord | |
^^^^ | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-rails-0.2.0/rbi/activerecord.rbi:149: `Elem` declared in parent here | |
149 | Elem = type_template(fixed: ApplicationRecord) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi:169385: Type `Elem` declared by parent `T.class_of(ApplicationRecord)` must be re-declared in `T.class_of(Wizard)` https://srb.help/5014 | |
169385 |class Wizard < ApplicationRecord | |
^^^^^^ | |
/Users/USER/.rvm/gems/ruby-2.4.6@ruby2.4-rails5.2/gems/sorbet-rails-0.2.0/rbi/activerecord.rbi:149: `Elem` declared in parent here | |
149 | Elem = type_template(fixed: ApplicationRecord) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
``` | |
### Expected behavior | |
I expect to not get these errors | |
``` | |
.../sorbet-0.4.4358/lib/hidden-definition-finder.rb:145:in `write_constants': | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.rbi | |
had unexpected errors. Check this file for a clue: | |
/var/folders/lc/72klfq0j6x9dq5hysj5nsc7w0000gn/T/d20190701-37833-yqwyf/reflection.json.err | |
(RuntimeError) | |
.../sorbet-0.4.4358/lib/hidden-definition-finder.rb:47:in `main' | |
``` | |
Thanks for this new toolset. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment