Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: steep check raises unhandled exceptions #725

Open
chozandrias76 opened this issue Mar 1, 2023 · 9 comments
Open

bug: steep check raises unhandled exceptions #725

chozandrias76 opened this issue Mar 1, 2023 · 9 comments

Comments

@chozandrias76
Copy link

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
@MECU
Copy link

MECU commented Mar 2, 2023

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

@chozandrias76 chozandrias76 changed the title bug: steep check raises unhanled exceptions bug: steep check raises unhandled exceptions Mar 5, 2023
@soutaro
Copy link
Owner

soutaro commented Mar 6, 2023

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...)

@chozandrias76
Copy link
Author

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

kachick added a commit to kachick/ruby-ulid that referenced this issue Mar 7, 2023
kachick added a commit to kachick/ruby-ulid that referenced this issue Mar 7, 2023
@soutaro
Copy link
Owner

soutaro commented Mar 8, 2023

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.

@soutaro
Copy link
Owner

soutaro commented Mar 8, 2023

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"

@chozandrias76
Copy link
Author

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

@soutaro
Copy link
Owner

soutaro commented Mar 10, 2023

@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?

@chozandrias76
Copy link
Author

@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)>>

@chozandrias76
Copy link
Author

@soutaro any updates or anything else I can provide to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants