Skip to content

Conversation

Little-Rubyist
Copy link

Proposal

  • The library type should read and use gem_rbs_collection.
  • Methods whose types do not match are overloaded. If the gem_rbs_collection type is sufficient, the handwritten type definitions can be freely deleted.
    example:
# rbs in stdlib
def hoge: () -> Integer

# rbs in handwritten
def hoge: () -> string | ... # <- Overloaded

Background

Syntax error in RBS during development. Perhaps you are defining a type definition in this gem that did not exist in stdlib in the past.

❯ bundle exec steep check
# Type checking files:

../../.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/openapi_parser-2.0.0/sig/types.rbs:11:2: [error] Non-overloading method definition of `safe_load` in `::Psych` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└   def self.safe_load: (untyped content, untyped parmitted_classes) -> Hash[bot, bot]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Detected 1 problem from 1 file

The relevant duplicate section is here.
https://github.com/ruby/rbs/blob/master/stdlib/psych/0/psych.rbs#L351

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

Successfully merging this pull request may close these issues.

1 participant