rdoc
rdoc copied to clipboard
Including modules creates an infinite loop between methods
Hi! I think RDoc sometimes wrongly infers module ancestry and then methods can have cyclical see references.
I encountered this error in the docs for GrpahQL-Ruby (fix: https://github.com/rmosolgo/graphql-ruby/pull/4819) and I created this script to replicate it:
# rdoc_bug.rb
module DoSomething
def self.generate_module
Module.new do
include DoSomethingExtra
end
end
def do_something
1 + 1
end
module DoSomethingExtra
include DoSomething
def do_something
super + 1
end
end
end
For me, that script ends in "stack level too deep":
$ rdoc rdoc_bug.rb
Parsing sources...
100% [ 1/ 1] rdoc_bug.rb
Generating Darkfish format into /Users/rmosolgo/code/graphql-ruby/doc...
uh-oh! RDoc had a problem:
stack level too deep
run with --debug for full backtrace
I was able to work around it, so this bug is not blocking me, but I thought I'd open it here in case its helpful to anyone else.