You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jensnockert narrowed in this defect that happens to define_method usages with this strange usage of a block argument named _ combined with another argument called _.
Environment
JRuby 9.1.6.0
Operating system and platform: OS X, Darwin Olles-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64
jruby-9.1.6.0 :004 > define_method(:a) { |*_, &_| puts "Trollolol!" }
=> :a
jruby-9.1.6.0 :005 > a
Java::JavaLang::RuntimeException: org.jruby.runtime.scopes.DynamicScope1 only supports scopes with 1 variables
from org.jruby.runtime.scopes.DynamicScope1.sizeError(Unknown Source)
from org.jruby.runtime.scopes.DynamicScope1.setValueVoid(Unknown Source)
from org.jruby.ir.interpreter.InterpreterEngine.setResult(InterpreterEngine.java:570)
from org.jruby.ir.interpreter.InterpreterEngine.setResult(InterpreterEngine.java:576)
from org.jruby.ir.interpreter.StartupInterpreterEngine.processOtherOp(StartupInterpreterEngine.java:187)
from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:111)
from org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
from org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
from org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:69)
from org.jruby.runtime.Block.call(Block.java:126)
from org.jruby.RubyProc.call(RubyProc.java:324)
from org.jruby.internal.runtime.methods.ProcMethod.call(ProcMethod.java:63)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:196)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
... 247 levels...
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:220)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:216)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:378)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:227)
from Users.olle.$_dot_rvm.gems.jruby_minus_9_dot_1_dot_6_dot_0.bin.jruby_executable_hooks.invokeOther16:eval(/Users/olle/.rvm/gems/jruby-9.1.6.0/bin/jruby_executable_hooks:15)
from Users.olle.$_dot_rvm.gems.jruby_minus_9_dot_1_dot_6_dot_0.bin.jruby_executable_hooks.RUBY$script(/Users/olle/.rvm/gems/jruby-9.1.6.0/bin/jruby_executable_hooks:15)
from java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
from org.jruby.ir.Compiler$1.load(Compiler.java:111)
from org.jruby.Ruby.runScript(Ruby.java:846)
from org.jruby.Ruby.runNormally(Ruby.java:761)
from org.jruby.Ruby.runNormally(Ruby.java:779)
from org.jruby.Ruby.runFromMain(Ruby.java:592)
from org.jruby.Main.doRunFromMain(Main.java:425)
from org.jruby.Main.internalRun(Main.java:313)
from org.jruby.Main.run(Main.java:242)
from org.jruby.Main.main(Main.java:204)
The text was updated successfully, but these errors were encountered:
I fixed this. We wallpapered over our code years ago to ignore $0 but only in staticscope whereas we should have also just removed this extra logic in the parser. The result is that staticscope only registers _ and ignores all 'fake' names ($0, _$1...) but the AST still gives that name to IRBuilder.
There is still an issue with zsuper and _ variables but I opened up #4342 for that since they exhibit different visible behavior (e.g. we don't crash in that one)/.
@jensnockert narrowed in this defect that happens to
define_method
usages with this strange usage of a block argument named_
combined with another argument called_
.Environment
Darwin Olles-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64
Expected Behavior
JRuby to output the same as MRI.
It also works in 9.1.5.0:
Actual Behavior
The text was updated successfully, but these errors were encountered: