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

Yard exposing something which MRI does not have an issue with (cref magic?) #3706

Open
enebo opened this issue Feb 29, 2016 · 1 comment
Open

Comments

@enebo
Copy link
Member

enebo commented Feb 29, 2016

Environment

I went back to at least 9.0.3.0 but I am unsure if this is a regression or somehow is related to a change yard made at some point.

Expected Behavior

The provided script:

require 'yard'

YARD::Parser::SourceParser.parse_string("class Foo\nend")

def options(serializer)
  options = { :serializer => serializer,
            :onefile => true, :format => :html, :files => [] }
  options = YARD::Templates::Engine.send(:set_default_options, options)
  options.objects = YARD::Registry.all(:class)
  options.object = YARD::Registry.root
  options
end

template = YARD::Templates::Engine.template(:default, :fulldoc, :html)

options = options(YARD::Serializers::FileSystemSerializer.new)
template.run(options)
options = options(YARD::Serializers::Base.new)
template.run(options)

should execute to completion. To try and run check out Yard and execute via:

jruby -Ilib foo.rb > output

If I run this with MRI it runs fine.

Actual Behavior

NameError: undefined local variable or method `basepath' for #<YARD::Serializers::Base:0x5dd6264 @options={}>
                 serialize at /Users/enebo/work/gems/yard/lib/yard/serializers/file_system_serializer.rb:38
                 serialize at /Users/enebo/work/gems/yard/templates/default/onefile/html/setup.rb:55
  block in with_serializer at /Users/enebo/work/gems/yard/lib/yard/templates/engine.rb:127
                   capture at /Users/enebo/work/gems/yard/lib/yard/logging.rb:70
           with_serializer at /Users/enebo/work/gems/yard/lib/yard/templates/engine.rb:123
         serialize_onefile at /Users/enebo/work/gems/yard/templates/default/fulldoc/html/setup.rb:42
                      init at /Users/enebo/work/gems/yard/templates/default/fulldoc/html/setup.rb:6
                initialize at /Users/enebo/work/gems/yard/lib/yard/templates/template.rb:185
                       new at /Users/enebo/work/gems/yard/lib/yard/templates/template.rb:130
                       run at /Users/enebo/work/gems/yard/lib/yard/templates/template.rb:135
                     <top> at foo.rb:26

I originally thought this was a problem with zsuper since I can see html/setup.rb executing a super. On reflection, I think something is resolving the singleton wrongly and executing the previous serializer. How it does this may be getting wrong @Serializer ivar OR it might be in how some of the Object.new and Module.new stuff happens in Yard. We have some open issues regarding constants not getting their own namespace in newly created modules.

@enebo
Copy link
Member Author

enebo commented Feb 29, 2016

So I just bothered to test jruby 1.7.x and it works fine so this is a bit more mysterious to me atm :|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant