On Tue, 06 Sep 2016 13:26:42 -0700, r...@ringlet.net wrote: > Hi, > > So here's the main program: > > #!/usr/bin/perl6 > > use v6.c; > > use lib '.'; > use trap; > > sub woof-local(Hash[Str:D] $data) > { > return $data<title>[0]; > } > > { > my %opts = title => 'Something something something dark side'; > say 'Invoking the local sub...'; > say woof-local(Hash[Str:D].new(%opts)); > > %opts<title> = "It's a trap!"; > say 'Invoking the remote sub...'; > say woof-remote(Hash[Str:D].new(%opts)); > } > > And here's the trap.pm6 module: > > #!/usr/bin/env perl6 > > unit module trap; > > sub woof-remote(Hash[Str:D] $data) is export > { > return $data<title>[0]; > } > > And here's the result of the execution: > > [roam@straylight ~/lang/perl/misc/rt/hash/03-param]$ perl6 hash- > param.p6 > Invoking the local sub... > Something something something dark side > Invoking the remote sub... > Type check failed in binding to $data; expected Hash[Str:D] but got > (my Str:D % = :title(... > in sub woof-remote at /home/roam/lang/perl/misc/rt/hash/03- > param/trap.pm6 (trap) line 5 > in block <unit> at hash-param.p6 line 20 > > G'luck, > Peter
This is not particular to signature binding typechecks. It looks like an instance of a Hash[Str:D] from the calling module !~~ Hash[Str:D] in the called module in general. Fudged tests added in S11-modules/export.t in roast commit 272ce3800 Perplexingly, I was unable to replicate this failure using Test::Compile, which compiles through the ComUnit:: interface... a real 'use' statement was needed to replicate the problem.