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

[prototype runtime] Fix error if direct inherited #1590

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Nov 1, 2023

rbs: 3.3.0.pre.1

When trying to analyze the faraday gem using rbs prototype runtime, an error occurs.
This is due to StructGenerator not considering patterns like class Option < Struct.
In this case, I made a modification to exclude it from the generator target.

repro

$ bundle exec rbs prototype runtime -r faraday Faraday::Options

before

bundler: failed to load command: rbs (/bundle/ruby/3.2.0/bin/rbs)
/bundle/ruby/3.2.0/gems/rbs-3.3.0.pre.1/lib/rbs/prototype/runtime/value_object_generator.rb:107:in `block in build_s_new': undefined method `keyword_init?' for Faraday::Options:Class (NoMethodError)

            if CAN_CALL_KEYWORD_INIT_P ? (@target_class.keyword_init? == false || @target_class.keyword_init? == nil) : true
                                                       ^^^^^^^^^^^^^^

after

module Faraday
  class Options < ::Struct[untyped]
  end
end

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@soutaro soutaro added this pull request to the merge queue Nov 1, 2023
@soutaro soutaro added this to the RBS 3.3 milestone Nov 1, 2023
Merged via the queue into ruby:master with commit ff0f38c Nov 1, 2023
23 checks passed
@ksss ksss deleted the fix-runtime-struct branch November 1, 2023 08:41
@soutaro soutaro added the Released PRs already included in the released version label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants