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

Fix prism_ruby superclass resolve order #1267

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

tompng
Copy link
Member

@tompng tompng commented Jan 2, 2025

Fixes #1249

Running RDOC_USE_PRISM_PARSER=1 make html in ruby/ruby fails with 'RDoc::ClassModule#superclass': stack level too deep (SystemStackError).
Parsing the OpenSSL::Cipher::Cipher in the code below succeeds, but with recursive superclass.

class OpenSSL
  class Cipher
    # Defines class OpenSSL::Cipher::Cipher with superclass=OpenSSL::Cipher
    # But PrismRuby parses it as class OpenSSL::Cipher::Cipher with superclass=OpenSSL::Cipher::Cipher
    class Cipher < Cipher; end
  end
end

In class definition, superclass part is evaluated before constant definition.
PrismRuby should do the same: resolve superclass first, then add class with the given classname.

RDoc::Parser::PrismRuby wrongly resolves superclass of `class Cipher < Cipher; end` that exist in openssl.
Superclass resolve should be done before adding class.
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@st0012 st0012 added the bug label Jan 3, 2025
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Thanks!

@st0012 st0012 merged commit 57a4615 into ruby:master Jan 3, 2025
24 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Jan 3, 2025
(ruby/rdoc#1267)

RDoc::Parser::PrismRuby wrongly resolves superclass of `class Cipher < Cipher; end` that exist in openssl.
Superclass resolve should be done before adding class.

ruby/rdoc@57a4615a92
@tompng tompng deleted the fix_superclass_resolve_order branch January 3, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Prism-based parser crashes when building ruby/ruby's doc
3 participants