#1690: Overriding one signature of a multi-method in a subclass prevents access
to the other signatures
---------------------+------------------------------------------------------
Reporter: tcurtis | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: core | Version: 2.5.0
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
---------------------+------------------------------------------------------
If a class defines a multi-method with multiple signature, a sub-class
cannot override only some signatures of the multi-method and still inherit
the remaining signatures.
For an example:
{{{
class A {
our multi method foo (Integer $i) {
self.foo(~$i);
}
our multi method foo (String $s) {
say($s);
}
}
class B is A {
our multi method foo (Integer $i) {
self.foo(~($i + 1));
}
}
A.new.foo(1);
B.new.foo(1);
}}}
And the output of running it:
{{{
$ ./parrot-nqp test.nqp
1
No applicable candidates found to dispatch to for 'foo'
current instr.: 'parrot;B;foo' pc 329 (EVAL_1:33777434)
called from Sub '_block11' pc 97 (EVAL_1:33777341)
called from Sub 'parrot;HLL;Compiler;_block465' pc 23452 (ext/nqp-
rx/src/stage0/HLL-s0.pir:7654)
called from Sub 'parrot;HLL;Compiler;eval' pc 23332 (ext/nqp-
rx/src/stage0/HLL-s0.pir:7622)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1500
(compilers/pct/src/PCT/HLLCompiler.pir:761)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1702
(compilers/pct/src/PCT/HLLCompiler.pir:869)
called from Sub 'parrot;NQP;Compiler;main' pc 83871 (ext/nqp-
rx/src/stage0/NQP-s0.pir:23065)
}}}
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1690>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets