Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-dispatcher erroneously can't figure out default value of typed container #2645

Leont opened this Issue Jan 25, 2019 · 1 comment


None yet
2 participants
Copy link

Leont commented Jan 25, 2019

The Problem

This works:

perl6 -e 'sub foo ($foo, Str :@bar) { say $foo }; foo(1)'

This dies with a "Cannot resolve caller foo(Int:D); none of these signatures match:" error:

perl6 -e 'multi foo ($foo, Str :@bar) { say $foo }; foo(1)'

These do work though:

perl6 -e 'multi foo ($foo, Str :@bar = Array[Str].new) { say $foo }; foo(1)'
perl6 -e 'multi foo ($foo, Str :@bar) { say $foo }; foo(1, bar => Array[Str].new)'

Expected Behavior

I expect all multis to behave the same as onlys.

Actual Behavior

A multi with a parameterized container argument fails to dispatch


This is Rakudo version 2018.12 built on MoarVM version 2018.12
implementing Perl 6.d.

@Leont Leont changed the title Multi-dispatcher Multi-dispatcher erroneously can't figure out default value of typed container Jan 25, 2019


This comment has been minimized.

Copy link

jnthn commented Jan 28, 2019

I don't think it's specific to multiple dispatch, but rather that named parameters cause it to use the signature binder to disambiguate, and:

$ ./perl6-m -e 'sub foo (Str :@bar []) {}; foo()'
Type check failed in binding to parameter '@bar'; expected Positional[Str] but got Array ($[])
  in sub foo at -e line 1
  in block <unit> at -e line 1

The [] there forces the slow-path binder to be used, and exposes the problem also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.