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

Super class should be absolute paths. #1415

Merged
merged 1 commit into from
Aug 11, 2023
Merged

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Aug 8, 2023

Problem

The signature generated by the rbs prototype runtime for the ActiveSupport::Logger as follows is unreadable due to an error.
Detected recursive ancestors: ::ActiveSupport::Logger < ::ActiveSupport::Logger (RBS::RecursiveAncestorError)

$ bundle exec rbs prototype runtime -r active_support/all ActiveSupport::Logger
module ActiveSupport
  class Logger < Logger
...snip...

In the actual Rails code, super class are specified by absolute paths, as shown below.

https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/activesupport/lib/active_support/logger.rb#L7-L8

Proposal

I propose to solve this problem by specifying the superclass as an absolute path even in the rbs prototype runtime.
There may be other similar problems, but I have limited the impact to specifying the superclass only.

$ bundle exec rbs prototype runtime -r active_support/all ActiveSupport::Logger
module ActiveSupport
  class Logger < ::Logger
...snip...

to suppress RBS::RecursiveAncestorError.
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.

👍

@soutaro soutaro added this to the RBS 3.2 milestone Aug 11, 2023
@soutaro soutaro added this pull request to the merge queue Aug 11, 2023
Merged via the queue into ruby:master with commit 0041bc6 Aug 11, 2023
@ksss ksss deleted the runtime-superclass branch August 11, 2023 14:06
@soutaro soutaro added the Released PRs already included in the released version label Aug 18, 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