-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
jRuby 9050 and 9100 behave differently for case / when with Array from MRI #3897
Comments
Ah-ha...you may have found the source of pesky "Undefined" errors we have not been able to reproduce. Apparently this form is not particularly common? This definitely needs to be fixed. |
Oops...nevermind...the "Undefined" errors I've seen are unrelated to your script. But yes, this is still a bug. |
Thank you for your confirmation! I'll fix my application's code to avoid that for now. |
The case-when construct uses IRRuntimeHelpers.isEQQ (via EQQInstr) and the if-then-else construct uses the Array.=== call. So, maybe the isEQQ implementation has a bug in some corner-case. |
@subbuss I think the problem is that the IR does not distinguish between these two whens: ary = [1,2,3]
case x
when 1,2,3
# 1, 2, 3 should each be used to === in turn
when ary
# Array#== should be called once
end Both cases fall into rescue may have a similar bug. |
I just tested the original case and we seem to be passing it now. I am guessing this got fixed via another issue at some point in the past. |
Environment:
jruby-9.0.5.0
jruby-9.1.0.0
ruby-2.2.4 ( MRI )
Problem:
The following code returns different results between jRuby and MRI.
Stacktrace:
Another code using if / else:
=> This code returns the same result ( 1234: good ).
I thought
case a when b then c else d end
is equivalent toif b === a then c else d end
.But it doesn't look like so.
Is this a known issue?
The text was updated successfully, but these errors were encountered: