diff --git a/moo/kernel/test-003.moo b/moo/kernel/test-003.moo index c5962fd..435dfc2 100644 --- a/moo/kernel/test-003.moo +++ b/moo/kernel/test-003.moo @@ -54,7 +54,7 @@ class MyObject(TestObject) method(#class) main { | tc limit | - +(10 isKindOf: 20) dump. tc := %( ## 0 - 4 [(Object isKindOf: Class) == true], @@ -63,9 +63,11 @@ class MyObject(TestObject) [(Class isKindOf: Apex) == true], [(Class isKindOf: Object) == false], + ## 5-9 [(Apex isKindOf: Class) == true], [(SmallInteger isKindOf: Integer) == false], [(10 isKindOf: Integer) == true], + [(10 isKindOf: 20) == false], [(Apex isMemberOf: Class) == true], [(Class isMemberOf: Class) == true] diff --git a/moo/lib/exec.c b/moo/lib/exec.c index fc54073..37c8a17 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -2105,9 +2105,8 @@ static moo_pfrc_t pf_is_kind_of (moo_t* moo, moo_ooi_t nargs) rcv = MOO_STACK_GETRCV(moo, nargs); _class = MOO_STACK_GETARG(moo, nargs, 0); - MOO_PF_CHECK_ARGS (moo, nargs, MOO_CLASSOF(moo, _class) == moo->_class); - - if (moo_iskindof(moo, rcv, (moo_oop_class_t)_class)) + if (MOO_CLASSOF(moo, _class) == moo->_class && + moo_iskindof(moo, rcv, (moo_oop_class_t)_class)) { MOO_STACK_SETRET (moo, nargs, moo->_true); } diff --git a/moo/lib/moo.c b/moo/lib/moo.c index 29adb76..aefcdc4 100644 --- a/moo/lib/moo.c +++ b/moo/lib/moo.c @@ -978,6 +978,8 @@ int moo_iskindof (moo_t* moo, moo_oop_t obj, moo_oop_class_t _class) { moo_oop_class_t c; + MOO_ASSERT (moo, MOO_CLASSOF(moo,_class) == moo->_class); + c = MOO_CLASSOF(moo,obj); /* c := self class */ if (c == moo->_class) {