tobi@happy ~/Desktop $ ruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d OpenJDK 64-Bit Server VM 24.95-b01 on 1.7.0_95-b00 +jit [linux-amd64]
tobi@happy ~/Desktop $ uname -a
Linux happy 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
tobi@happy ~/Desktop $ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
Actual Behavior
Sample script:
def b(a = a)
a
end
p b
Results in:
tobi@happy ~/Desktop $ ruby fail.rb
DEAD: marking instr dead!!
Unhandled Java exception: java.lang.RuntimeException: IR compiler/interpreter bug: org.jruby.ir.operands.UndefinedValue should not be used as a valid value during execution.
java.lang.RuntimeException: IR compiler/interpreter bug: org.jruby.ir.operands.UndefinedValue should not be used as a valid value during execution.
undefinedOperation at org/jruby/ir/operands/UndefinedValue.java:57
callMethod at org/jruby/ir/operands/UndefinedValue.java:63
rbInspect at org/jruby/RubyBasicObject.java:1090
p at org/jruby/RubyKernel.java:465
call at org/jruby/internal/runtime/methods/JavaMethod.java:717
call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:313
call at org/jruby/runtime/callsite/CachingCallSite.java:163
<top> at fail.rb:5
invokeWithArguments at java/lang/invoke/MethodHandle.java:599
load at org/jruby/ir/Compiler.java:111
runScript at org/jruby/Ruby.java:817
runScript at org/jruby/Ruby.java:809
runNormally at org/jruby/Ruby.java:747
runFromMain at org/jruby/Ruby.java:569
doRunFromMain at org/jruby/Main.java:415
internalRun at org/jruby/Main.java:310
run at org/jruby/Main.java:239
main at org/jruby/Main.java:201
It is possible to cary the undefined value quite a bit further (in my case setting it as a value for the stub - fix commit) - the error was raised quite a way further when the stubbed value was first called. That's also why in the sample I do p b, just b doesn't cause the error.
Expected Behavior
Probably what CRuby does:
tobi@happy ~/Desktop $ rvm use 2.2.4 # does the same on 2.3
Using /home/tobi/.rvm/gems/ruby-2.2.4
tobi@happy ~/Desktop $ ruby fail.rb
fail.rb:1: warning: circular argument reference - a
nil
This is also somewhat backwards incompatible, as JRuby 9.0.4.0 reacts differently:
tobi@happy ~/Desktop $ rvm use jruby-9.0.4.0
Using /home/tobi/.rvm/gems/jruby-9.0.4.0
tobi@happy ~/Desktop $ ruby fail.rb
NameError: undefined local variable or method `a' for main:Object
<top> at fail.rb:5
Also sort of sad that I didn't do a lot on shoes these past months, otherwise I'd caught this earlier, potentially already on head :| But well it's not too important, as it is effectively rather broken code ;)
The text was updated successfully, but these errors were encountered:
@PragTob can I ask why you did a = a as a pattern? I sort of knew this was broken but did not think anyone would ever use it (so it was not much of a priority).
@enebo classic programming error :D It was some old part of the code I just got the failing tests after upgrading to 9.0.5.0. So definitely a mistake, maybe after some rename or something...
Environment
Actual Behavior
Sample script:
Results in:
It is possible to cary the undefined value quite a bit further (in my case setting it as a value for the stub - fix commit) - the error was raised quite a way further when the stubbed value was first called. That's also why in the sample I do
p b
, justb
doesn't cause the error.Expected Behavior
Probably what CRuby does:
This is also somewhat backwards incompatible, as JRuby 9.0.4.0 reacts differently:
Finishing
Might be related to #3094
Also sort of sad that I didn't do a lot on shoes these past months, otherwise I'd caught this earlier, potentially already on head :| But well it's not too important, as it is effectively rather broken code ;)
The text was updated successfully, but these errors were encountered: