Futher fix for EQUALP on numeric tower

This fixes the following case

    (let ((h1 (make-hash-table :test 'equalp))
          (h2 (make-hash-table :test 'equalp))
          (h  (make-hash-table :test 'equalp)))
        (setf (gethash 1 h1) 2
              (gethash 2 h2) 1
              (gethash h1 h) h2
              (gethash h2 h) h1)
        h)

See <https://mailman.common-lisp.net/pipermail/armedbear-devel/2015-April/003452.html>.
See <http://abcl.org/trac/ticket/388>.

Thanks to Massimiliano Ghilardi.
parent d46ba3b9
......@@ -213,7 +213,7 @@ public final class Bignum extends LispInteger
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
......@@ -143,7 +143,7 @@ public final class Complex extends LispObject
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
......@@ -169,7 +169,7 @@ public final class DoubleFloat extends LispObject
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
......@@ -228,7 +228,7 @@ public final class Fixnum extends LispInteger
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
......@@ -137,7 +137,7 @@ public final class Ratio extends LispObject
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
......@@ -169,7 +169,7 @@ public final class SingleFloat extends LispObject
@Override
public boolean equalp(LispObject obj)
{
if (obj.numberp())
if (obj != null && obj.numberp())
return isEqualTo(obj);
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment