Skip to content

Optional args that self-reference must resolve #2124

@headius

Description

@headius

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions