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

Lambda converted to block treats 'return' like it's a proc #1985

Closed
adz opened this issue Sep 19, 2014 · 6 comments
Closed

Lambda converted to block treats 'return' like it's a proc #1985

adz opened this issue Sep 19, 2014 · 6 comments

Comments

@adz
Copy link

adz commented Sep 19, 2014

def test
  [1].map(&lambda{ |n| return -1 })
end

Calling #test will return [-1] in mri where-as jruby will return -1. This seems to occur when converting a lambda to a block (the return now leaves the method not the lambda).

@billdueber
Copy link

Confirmed in JRuby 1.7. As of jruby_head #89076918f8af17bf2a3c256d3cd7a791331c5e53 this returns [-1], as expected

@kares
Copy link
Member

kares commented Apr 9, 2016

jruby-1.7.24 :009 > def test
jruby-1.7.24 :010?>     [1].map(&lambda{ |n| return -1 })
jruby-1.7.24 :011?>   end
 => nil 
jruby-1.7.24 :012 > test
 => -1 

jruby-9.0.5.0 :001 > def test
jruby-9.0.5.0 :002?>     [1].map(&lambda{ |n| return -1 })
jruby-9.0.5.0 :003?>   end
 => :test 
jruby-9.0.5.0 :004 > test
 => [-1] 

@enebo
Copy link
Member

enebo commented Apr 9, 2016

Added info this bug is that 1.8 mode should return -1 and 1.9+ returns [-1].

@enebo enebo added this to the Won't Fix milestone May 16, 2017
@enebo
Copy link
Member

enebo commented May 16, 2017

Works on 9k. 1.7.x is EOL and this will not get fixed. Marking WONTFIX

@enebo enebo closed this as completed May 16, 2017
@Nakilon
Copy link

Nakilon commented May 17, 2017

Marking DIDNTCARETOFIXINTIME

@enebo
Copy link
Member

enebo commented May 17, 2017

@Nakilon well we did fix in one version of JRuby just not the older one. Keep it classy now. We can only support so much at a time...

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

5 participants