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

Does the rbs collection be included in the steep check is default behavior? #991

Open
elct9620 opened this issue Jan 12, 2024 · 7 comments
Labels
Milestone

Comments

@elct9620
Copy link

Does the .gem_rbs_collection should be included in the steep check without include it?

Steepfile

# frozen_string_literal: true

D = Steep::Diagnostic

target :lib do
  signature "sig"

  check "lib"

  library(
    "rack",
  )
end

Output

# Type checking files:

....................................................................................................F....................................................................................................................F............................................................................................................................................................................................................

.gem_rbs_collection/parser/3.2/parser.rbs:39:6: [error] Non-overloading method definition of `location` in `::Parser::AST::Node` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└       attr_reader location: Source::Map
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.gem_rbs_collection/parser/3.2/parser.rbs:56:6: [error] Non-overloading method definition of `line` in `::Parser::Source::Map` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└       def line: () -> Integer
        ~~~~~~~~~~~~~~~~~~~~~~~

.gem_rbs_collection/parser/3.2/parser.rbs:65:6: [error] Non-overloading method definition of `location` in `::Parser::Source::Comment` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└       def location: () -> Map
        ~~~~~~~~~~~~~~~~~~~~~~~

.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs:2:2: [error] Non-overloading method definition of `physical_processor_count` in `::Concurrent` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└   def self.physical_processor_count: () -> Integer
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Detected 4 problems from 2 files

@elct9620 elct9620 changed the title The rbs collection is included in the steep check is default behavior? Does the rbs collection be included in the steep check is default behavior? Jan 12, 2024
@soutaro soutaro added this to the Steep 1.7 milestone Jan 15, 2024
@soutaro soutaro added the bug label Jan 15, 2024
@soutaro
Copy link
Owner

soutaro commented Jan 15, 2024

@elct9620 Wow... looks like a bug. It's strange that you have check "lib" call, but looks like it's not working. Can you confirm if the project configuration is correctly loaded with steep project command?

@elct9620
Copy link
Author

elct9620 commented Jan 15, 2024

Currently, I add the gems to the ignore list to make it work. The steep project shows my config is loaded correctly.

The bundle exec steep project output:

steep project output
Target:
  lib:
    sources:
      patterns:
        - lib
      ignores:
      files:
        - lib/hanami/lambda/application.rb
        - lib/hanami/lambda/dispatcher.rb
        - lib/hanami/lambda/event.rb
        - lib/hanami/lambda/events/base.rb
        - lib/hanami/lambda/events/event_bridge.rb
        - lib/hanami/lambda/function.rb
        - lib/hanami/lambda/rack.rb
        - lib/hanami/lambda/types.rb
        - lib/hanami/lambda/version.rb
        - lib/hanami/lambda.rb
        - lib/hanami-lambda.rb
    signatures:
      patterns:
        - sig
      files:
        - sig/hanami/lambda/application.rbs
        - sig/hanami/lambda/dispatcher.rbs
        - sig/hanami/lambda/errors.rbs
        - sig/hanami/lambda/event.rbs
        - sig/hanami/lambda/events/base.rbs
        - sig/hanami/lambda/events/event_bridge.rbs
        - sig/hanami/lambda/function.rbs
        - sig/hanami/lambda/rack.rbs
        - sig/hanami/lambda/types.rbs
        - sig/hanami/lambda.rbs
        - sig/shims/dry.rbs
        - sig/shims/hanami.rbs
        - sig/shims/rack.rbs
        - sig/shims/zeitwerk.rbs
    libraries:
      - rack
    library dirs:
      - core: /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/core
      - rack(): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/rack/2.2
      - abbrev(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/abbrev/0
      - activesupport(7.0): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/activesupport/7.0
      - base64(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/base64/0
      - bigdecimal(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/bigdecimal/0
      - cgi(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/cgi/0
      - connection_pool(2.4): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/connection_pool/2.4
      - csv(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/csv/0
      - date(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/date/0
      - erb(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/erb/0
      - fileutils(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/fileutils/0
      - forwardable(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/forwardable/0
      - i18n(1.10): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/i18n/1.10
      - json(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/json/0
      - listen(3.2): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/listen/3.2
      - logger(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/logger/0
      - minitest(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/minitest/0
      - monitor(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/monitor/0
      - mutex_m(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/mutex_m/0
      - optparse(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/optparse/0
      - pathname(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/pathname/0
      - rack(2.2): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/rack/2.2
      - rainbow(3.0): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/rainbow/3.0
      - rake(13.0): /Users/elct9620/Workspace/Ruby/hanami/hanami-lambda/.gem_rbs_collection/rake/13.0
      - rbs(3.4.1): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/sig
      - rdoc(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/rdoc/0
      - securerandom(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/securerandom/0
      - singleton(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/singleton/0
      - steep(1.6.0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/steep-1.6.0/sig
      - strscan(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/strscan/0
      - tempfile(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/tempfile/0
      - time(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/time/0
      - timeout(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/timeout/0
      - tsort(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/tsort/0
      - uri(0): /Users/elct9620/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rbs-3.4.1/stdlib/uri/0

@andykimchris
Copy link

Getting the same issue here

@soutaro
Copy link
Owner

soutaro commented Jan 15, 2024

Is it intentional to include steep in your project? Having gem "steep", require: false in Gemfile (and rbs collection install) may solve the problem.

https://github.com/ruby/rbs/wiki/Release-Note-3.0#rbs-collection-skips-loading-application-gems

@soutaro
Copy link
Owner

soutaro commented Jan 15, 2024

The RBS files of steep project ships with bundled parser and concurrent-ruby type signatures. So, also having the RBS files of the gems from gem_rbs_collection would be the source of the problem.

And steep should move to gem_rbs_collection version of the RBS files.

@elct9620
Copy link
Author

Use gem "steep", require: false is solved the problem.

The original place is put the steep as a dependency in the gemspec

spec.add_development_dependency "steep", "~> 1.6.0"

@soutaro
Copy link
Owner

soutaro commented Jan 15, 2024

Hmm, that's the thing... We may want to skip the development dependencies too.

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

No branches or pull requests

3 participants