Fixnum#[] blows when small Bignum is given
------------------------------------------
Key: JRUBY-6050
URL: https://jira.codehaus.org/browse/JRUBY-6050
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Reporter: Yusuke Endoh
$ bin/jruby -e 'p 3[(1<<100).coerce(1).first]'
RubyNumeric.java:265:in `fix2long': java.lang.ClassCastException:
org.jruby.RubyBignum cannot be cast to org.jruby.RubyFixnum
from RubyFixnum.java:1023:in `op_aref'
*snip*
diff --git a/src/org/jruby/RubyFixnum.java b/src/org/jruby/RubyFixnum.java
index 89eb177..24e9073 100644
--- a/src/org/jruby/RubyFixnum.java
+++ b/src/org/jruby/RubyFixnum.java
@@ -1018,6 +1018,7 @@ public class RubyFixnum extends RubyInteger {
if (!(tryFix instanceof RubyFixnum)) {
return big.getValue().signum() == 0 || value >= 0 ?
RubyFixnum.zero(getRuntime()) : RubyFixnum.one(getRuntime());
}
+ other = tryFix;
}
long otherValue = fix2long(other);
--
Yusuke Endoh <[email protected]>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email