Ticket #879 (new bug)
isa does not take (correctly) namespace, pmcarray,stringarray
Reported by: | jessevdam | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | core | Version: | 1.4.0 |
Severity: | medium | Keywords: | isa |
Cc: | Language: | ||
Patch status: | new | Platform: | all |
Description
When running this code isa returns true while it should return false
$P1 = #object of type 'FOO::BAR::TEST'
$P3 = get_hll_namespace [ 'FOO';'BAR2';'Object']
$I1 = isa $P1,$P3
returns true must be false
$P3 = string array with elements "FOO","BAR","TEST"
$I1 = isa $P1,$P3
returns fasle must be true
I solved this problem by replacing the
VTABLE INTVAL isa_pmc(PMC *lookup)
function with the following code
VTABLE INTVAL isa_pmc(PMC *lookup) {
Hash * const isa_hash = SELF->vtable->isa_hash;
+ PMC *classobj;
STRING *pmc_name;
if (PMC_IS_NULL(lookup))
return 0;
+ classobj = Parrot_oo_get_class(interp, lookup);
+ if (PMC_IS_NULL(classobj))
+ return 0;
-+ pmc_name = VTABLE_get_string(interp, classobj);
if (!isa_hash)
return Parrot_str_equal(interp, SELF->vtable->whoami, pmc_name);
/* RT #46665 - walk mro */
return parrot_hash_exists(INTERP, isa_hash, (void*)pmc_name);
}
I'am not sure it's completely correct, because i do not know how the mro isa_hash is build up.
Adding this code will make 2 test failing in the t/tests/objects.t test set, because there are more bugs present, I made seperate ticket for that one