steep
steep copied to clipboard
bug: steep check raises unhandled exceptions
Reproduction Steps
- Install Ruby with rbenv at 3.0.4
-
gem install steep
- Create a signature file
target :app do
signature "sig"
check "*.rb"
end
- Create a file to check
class Foo
def bar
"bar"
end
end
- Create foo.rbs in the
./sig
directory
class Foo
end
Run `steep check`
https://gist.github.com/chozandrias76/34e5789b877326eeac29203e159830b0
I have the same thing happening on Ruby 3.1.3.
Before the output listed in the above gist, I also have:
W, [2023-03-02T15:50:49.916383 #1845] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.919457 #1846] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.922623 #1847] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.932749 #1848] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.936870 #1849] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.941086 #1850] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.945363 #1851] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.961166 #1852] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.985545 #1853] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:49.997700 #1854] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
W, [2023-03-02T15:50:50.331215 #1829] WARN -- rbs: `set` has been moved to core library, so it is always loaded. Remove explicit loading `set`
And after the above gist, I see one .
and it just hangs until I abort it. Here's the output after aborting:
https://gist.github.com/MECU/384404a33b9ffb9e6475188dc4595e33
Ah, this is caused by the incompatible changes introduced in RBS 3.0.
Please pin RBS in your Gemfile gem "rbs", "~> 2.8.0"
for a while.
I've been working to make Steep compatible with RBS 3.0, but it's not completed yet. (I also found some (non-trivial) problems in RBS 3.0.2 and working for it before Steep...)
Ah, this is caused by the incompatible changes introduced in RBS 3.0.
Please pin RBS in your Gemfile
gem "rbs", "~> 2.8.0"
for a while. I've been working to make Steep compatible with RBS 3.0, but it's not completed yet. (I also found some (non-trivial) problems in RBS 3.0.2 and working for it before Steep...)
Adding that line to my gemfile does not allow steep check to complete successfully when passed the Steepfile contains
target :test do
signature "sig", "sig-private"
check "app/models/*.rb"
# library "pathname", "set" # Standard libraries
end
and user.rbs
class User < ApplicationRecord
end
Adding that line to my gemfile does not allow steep check to complete successfully when passed the Steepfile contains
@chozandrias76 Could you share the error messages?
I will make another release -- 1.3.1 -- that requires rbs-2.8.x (< 3.0.0) to avoid this confusion.
Released Steep 1.3.1 that requires rbs ~> 2.8.0
. I notice RBS > 2.8.2
has a regression that fails the tests on CI. You may want to add an explicit requirement in your Gemfile
.
gem "rbs", "<=2.8.1"
Adding that line to my gemfile does not allow steep check to complete successfully when passed the Steepfile contains
@chozandrias76 Could you share the error messages?
I will make another release -- 1.3.1 -- that requires rbs-2.8.x (< 3.0.0) to avoid this confusion.
Its the hidden link on my first post
@chozandrias76 Thanks. So, the error is:
[Steep 1.3.0] [typecheck:typecheck@0] [background] Unexpected error: #<NoMethodError: undefined method `reject' for #<RBS::Environment @declarations=(921 items) @class_decls=(312 items) @class_alias_decls=(0 items) @interface_decls=(29 items) @type_alias_decls=(20 items) @constant_decls=(569 items) @global_decls=(51 items)>>
It looks like this is because RBS 3.0 is loaded while Steep 1.3.0 doesn't support the version. (Environment#reject
is removed in 3.0.)
How is the result of bundle info rbs
?
@soutaro
Installing rbs 2.8.1 (was 2.8.4) with native extensions
Using steep 1.3.0
Using syntax_tree-rbs 0.5.1
Using prettier 3.2.2
Cleaning all the gems on your system is dangerous! If you're sure you want to remove every system gem not in this bundle, run `bundle clean --force`.
/Users/crashoverride/work/ledger [git::PROD-2499-add-steep-to-our-application *] [crashoverride@Colins-MacBook-Pro] [13:33]
> bundle info rbs
* rbs (2.8.1)
Summary: Type signature for Ruby.
Homepage: https://github.com/ruby/rbs
Source Code: https://github.com/ruby/rbs.git
Changelog: https://github.com/ruby/rbs/blob/master/CHANGELOG.md
Path: /Users/crashoverride/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rbs-2.8.1
/Users/crashoverride/work/ledger [git::PROD-2499-add-steep-to-our-application *] [crashoverride@Colins-MacBook-Pro] [13:33]
> steep check sig/user.rbs
# Type checking files:
[Steep 1.3.0] [typecheck:typecheck@0] [background] Unexpected error: #<NoMethodError: undefined method `reject' for #<RBS::Environment @declarations=(921 items) @class_decls=(312 items) @class_alias_decls=(0 items) @interface_decls=(29 items) @type_alias_decls=(20 items) @constant_decls=(569 items) @global_decls=(51 items)>>
@soutaro any updates or anything else I can provide to help?