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
This is a small test that shows different behaviour when coercing + and coercing &. In JRuby 1.7 trying to coerce & raised and exception. I don´t know what is the correct behaviour.
class Test
def +(val)
p "doing +"
end
def &(val)
p "doing &"
2 & val
end
def coerce(val)
p "doing coerce"
return [Test.new, val]
end
end
t = Test.new
p 2 & t
p 2 + t
The text was updated successfully, but these errors were encountered:
verified 1.7.24 behaves exactly as 1.9.3 with that piece of script (let us know if we missed something) :
jruby-1.7.24 :020 > p 2 & t
TypeError: can't convert Test into Integer
from org/jruby/RubyFixnum.java:1062:in `&'
from (irb):20:in `evaluate'
from org/jruby/RubyKernel.java:1079:in `eval'
from org/jruby/RubyKernel.java:1479:in `loop'
from org/jruby/RubyKernel.java:1242:in `catch'
from org/jruby/RubyKernel.java:1242:in `catch'
from /opt/local/rvm/rubies/jruby-1.7.24/bin/irb:13:in `(root)'
jruby-1.7.24 :021 > p 2 + t
"doing coerce"
"doing +"
"doing +"
=> "doing +"
This is a small test that shows different behaviour when coercing + and coercing &. In JRuby 1.7 trying to coerce & raised and exception. I don´t know what is the correct behaviour.
The text was updated successfully, but these errors were encountered: