On Mon Jan 13 18:00:36 2014, m...@kli.org wrote:
> Rakudo explicitly fails with a message when someone tries to use a
> typed
> slurpy positional argument, e.g. Int *@_, but not for a typed slurpy
> named
> argument, like Int *%_. But those aren't supported either: the
> argument creates
> a parameter with type Associative[Int], but no matter what types are
> passed in,
> the dispatcher slurps up the extra named parameters into a plain Hash,
> which
> does not match.
> 
> > sub foo(Int *@_) { }
> ===SORRY!=== Error while compiling <unknown file>
> Slurpy positionals with type constraints are not supported.
> at <unknown file>:1
> ------> sub foo(Int *@_⏏) { }
> expecting any of:
> formal parameter
> constraint
> 
> 
> 
> > sub foo(Int *%_) { }
> sub foo(Int *%_) { ... }
> > foo(:b(8))
> Nominal type check failed for parameter '%_'; expected
> Associative[Int] but got
> Hash instead

It's now detected at compile time:

$ perl6-m -e "sub foo(Int *%_) { }"
===SORRY!=== Error while compiling -e
Slurpy named parameters with type constraints are not supported
at -e:1
------> sub foo(Int *%_<HERE>) { }

Test coverage added for this in S06-signature/slurpy-params.t.

Reply via email to