-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment
user_name@ ~/dev/scripts$ jruby --version
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]
user_name@ ~/dev/scripts$ uname -a
Darwin MACHINE_NAME 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64
Test Code
def lambda_calls_block
lambda { yield }.call
end
f = nil
lambda_calls_block do
f = 'a'
break
end
puts f
Expected Behavior
I expect the above code to print a to the console.
Actual Behavior
MRI Ruby 2.3.0
user_name@ ~/dev/scripts$ rvm use ruby-2.3.0
Using /Users/user/.rvm/gems/ruby-2.3.0
user_name@ ~/dev/scripts$ ruby break_probs.rb
a
JRuby behavior in 9.1.6.0, 9.1.5.0 and 1.7.19 is to throw a LocalJumpError:
user_name@ ~/dev/scripts$ rvm use jruby-9.1.6.0
Using /Users/user/.rvm/gems/jruby-9.1.6.0
user_name@ ~/dev/scripts$ ruby break_probs.rb
LocalJumpError: unexpected break
block in lambda_calls_block at break_probs.rb:2
lambda_calls_block at break_probs.rb:2
<main> at break_probs.rb:6
user_name@ ~/dev/scripts$ rvm use jruby-9.1.5.0
Using /Users/user/.rvm/gems/jruby-9.1.5.0
user_name@ ~/dev/scripts$ ruby break_probs.rb
LocalJumpError: unexpected break
block in lambda_calls_block at break_probs.rb:2
lambda_calls_block at break_probs.rb:2
<main> at break_probs.rb:6
user_name@ ~/dev/scripts$ rvm use jruby-1.7.19
Using /Users/user/.rvm/gems/jruby-1.7.19
user_name@ ~/dev/scripts$ ruby break_probs.rb
LocalJumpError: unexpected break
call at org/jruby/RubyProc.java:271
lambda_calls_block at break_probs.rb:2
(root) at break_probs.rb:6
Reactions are currently unavailable