Ticket #1690 (new bug)

Opened 4 years ago

Overriding one signature of a multi-method in a subclass prevents access to the other signatures

Reported by: tcurtis Owned by:
Priority: normal Milestone:
Component: core Version: 2.5.0
Severity: medium Keywords:
Cc: Language:
Patch status: 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) {

    our multi method foo (String $s) {

class B is A {
    our multi method foo (Integer $i) {
        self.foo(~($i + 1));



And the output of running it:

$ ./parrot-nqp test.nqp 
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)
Note: See TracTickets for help on using tickets.