#713: Too little MMD? i_add doesn't know about subclasses.
-------------------+--------------------------------------------------------
Reporter: coke | Owner:
Type: bug | Status: new
Priority: major | Milestone:
Component: core | Version: trunk
Severity: high | Keywords: tcl blocker
Lang: | Patch:
Platform: |
-------------------+--------------------------------------------------------
partcl has a bug (http://code.google.com/p/partcl/issues/detail?id=81)
where TclInt+=a TclInt is now generating a TclFloat (instead of a TclInt.)
I suspect that this is a result of the change to src/pmc/integer.pmc which
change i_add from a MULTI to a vtable-with-a-switch.
Originally:
{{{
- MULTI void i_add(Integer value) {
- STATICSELF.i_add_int(VTABLE_get_integer(INTERP, value));
- }
}}}
This is now:
{{{
+ VTABLE void i_add(PMC *value) {
+ const INTVAL type = value->vtable->base_type;
+
+ switch (type) {
+ case enum_class_Integer:
+ STATICSELF.i_add_int(VTABLE_get_integer(INTERP, value));
+ break;
}}}
But since subclasses of Integer are not enum_class_Integer, subclasses
seem to now fall through to:
{{{
+ default:
+ VTABLE_set_number_native(INTERP, SELF,
+ SELF.get_integer() + VTABLE_get_number(INTERP,
value));
+ break;
}}}
This is, from partcl's standpoint, a substantial feature change. This
should probably be reverted, tests added, and if we want to go forward
with this change, we can do it post 1.4.
Alternatively, we can update the switch statement to be functionally
equivalent to the old multi. (and still add tests to verify that
subclasses continue to work as expected.)
''Apologies for not testing this sooner; partcl has been broken for other
reasons, just got back to a point where this could be tested.''
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/713>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets