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

Treat Proc#call syntax sugar for constant correctly #753

Merged
merged 1 commit into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rdoc/parser/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ def get_class_or_module container, ignore_constants = false

get_tk
skip_tkspace_without_nl
if :on_lparen == peek_tk[:kind] # ProcObjectInConstant::()
parse_method_or_yield_parameters
break
end
name_t = get_tk
unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]
raise RDoc::Error, "Invalid class or module definition: #{given_name}"
Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_parser_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,17 @@ class Foo
assert_equal @top_level, blah.file
end

def test_parse_call_syntax_sugar_for_constant
util_parser <<-CODE
Foo = proc{}
Foo::()
CODE

assert_nothing_raised do
@parser.scan
end
end

def test_parse_class_multi_ghost_methods
util_parser <<-'CLASS'
class Foo
Expand Down