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

Skip parentheses on singleton class declaration #867

Merged
merged 1 commit into from Feb 9, 2022

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Feb 8, 2022

Parsing Ruby code with singleton class declaration with assignment generates a class name with (.

This is the example of the source code.

module DidYouMean
  class << (NameErrorCheckers = Object.new)
  end
end

This generates DidYouMean::(NameErrorCheckers class, and raises an error during load.

.../rdoc/lib/rdoc/store.rb:530:in `block in load_all': end pattern with unmatched parenthesis: /^DidYouMean::(NameErrorCheckers::[^:]+$/ (RegexpError)

This PR fixes the issue by ignoring surrounding parentheses.

@soutaro
Copy link
Member Author

soutaro commented Feb 8, 2022

I found the problem with the rbs annotate command which calls RDoc::Store#load_all. ri shows a problem related to this with the following output:

$ make rdoc RDOCFLAGS="--visibility=nodoc"
$ ri --no-system -d .ext/rdoc DidYouMean::NameErrorCheckers
Nothing known about DidYouMean::NameErrorCheckers
Did you mean?  DidYouMean::(NameErrorCheckers
               DidYouMean::KeyErrorChecker

@nobu nobu added the Bug label Feb 9, 2022
@nobu nobu merged commit b335a73 into ruby:master Feb 9, 2022
@soutaro soutaro deleted the fix-module-name branch April 28, 2022 07:18
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.

None yet

2 participants