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

Optional args that self-reference must resolve #2124

Closed
headius opened this issue Nov 6, 2014 · 5 comments
Closed

Optional args that self-reference must resolve #2124

headius opened this issue Nov 6, 2014 · 5 comments

Comments

@headius
Copy link
Member

headius commented Nov 6, 2014

See https://bugs.ruby-lang.org/issues/9593

The cases in question are in mri/ruby/test_syntax and look basically like this:

def foo(var = var) ...
def foo(var: defined?(var)) ...

...and so on. This will likely require parser changes. I am excluding test_keyword_self_reference and test_optional_self_reference now.

Note that test_keyword_self_reference actually triggers a Java exception inside IR:

TestSyntax#test_keyword_self_reference:
Java::JavaLang::ClassCastException: org.jruby.ir.operands.UndefinedValue cannot be cast to org.jruby.RubyBasicObject
    org.jruby.runtime.callsite.CachingCallSite.getClass(CachingCallSite.java:401)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:125)
    org.jruby.ir.interpreter.Interpreter.processCall(Interpreter.java:360)
    org.jruby.ir.interpreter.Interpreter.interpret(Interpreter.java:595)
    org.jruby.ir.interpreter.Interpreter.INTERPRET_METHOD(Interpreter.java:697)
    org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:116)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:255)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
@headius headius added this to the JRuby 9000 milestone Nov 6, 2014
@subbuss
Copy link
Contributor

subbuss commented Nov 7, 2014

That seems weird ...

@headius
Copy link
Member Author

headius commented Nov 7, 2014

Ignore the missing parser warning commit. It was meant for #2147.

@headius
Copy link
Member Author

headius commented Jan 15, 2015

Coming back to this, I don't think it's an IR issue (at least, it's not anymore)...I think it's a parsing issue.

If the RHS in def foo(var = var) parsed properly, as a local variable load, IR should fall in line and compile it just fine.

@headius headius removed this from the JRuby 9.0.0.0 milestone Jan 15, 2015
@enebo
Copy link
Member

enebo commented Jul 15, 2015

I should have commented on this a long time ago but minimal case for this is 'var = var'. Opt arg is unrelated here. This is something I have always considered as a bug in MRI so I never fixed it but perhaps I should...

@enebo enebo removed the JRuby 1.7.x label Apr 1, 2016
@enebo
Copy link
Member

enebo commented Apr 1, 2016

I am removing 1.7 as support item here as I am starting to wind down on very unlikely to ever be fixed issues. This has been fixed a while on 9000. Closing.

@enebo enebo closed this as completed Apr 1, 2016
@enebo enebo added this to the JRuby 9.1.0.0 milestone Apr 1, 2016
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

3 participants