# New Ticket Created by Dan Zwell # Please include the string: [perl #132531] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=132531 >
I just checked, and got the same result on Rakudo version 2017.11 built on MoarVM version 2017.11. The full stack trace with --ll-exception is: Type check failed for return value; expected Array[Pair] but got Array[Pair].new() at SETTING::src/core/Exception.pm:57 (rakudo/share/perl6/runtime/CORE.setting.moarvm:throw) from SETTING::src/core/Exception.pm:2646 (rakudo/share/perl6/runtime/CORE.setting.moarvm:) from src/vm/moar/Perl6/Ops.nqp:588 (rakudo/share/nqp/lib/Perl6/Ops.moarvm:return_error) from MyModule.pm6 (MyModule):2 (.precomp/6A0100E73A9E0630ECFBF4CBF870A4533AB71A3F.1511332631.3124/2D/ 2DC204F1E0858A7337033F5946B1DC262A92FFCD:get-array) from -e:1 (<ephemeral file>:<unit>) from -e:1 (<ephemeral file>:<unit-outer>) from gen/moar/stage2/NQPHLL.nqp:1542 (rakudo/share/nqp/lib/NQPHLL.moarvm:eval) from gen/moar/stage2/NQPHLL.nqp:1649 (rakudo/share/nqp/lib/NQPHLL.moarvm:) from gen/moar/stage2/NQPHLL.nqp:1704 (rakudo/share/nqp/lib/NQPHLL.moarvm:command_eval) from src/Perl6/Compiler.nqp:42 (rakudo/share/nqp/lib/Perl6/Compiler.moarvm:command_eval) from gen/moar/stage2/NQPHLL.nqp:1630 (rakudo/share/nqp/lib/NQPHLL.moarvm:command_line) from gen/moar/main.nqp:47 (rakudo/share/perl6/runtime/perl6.moarvm:MAIN) from gen/moar/main.nqp:38 (rakudo/share/perl6/runtime/perl6.moarvm:<mainline>) from <unknown>:1 (rakudo/share/perl6/runtime/perl6.moarvm:<main>) from <unknown>:1 (rakudo/share/perl6/runtime/perl6.moarvm:<entry>) On Fri, Dec 1, 2017 at 6:00 PM Dan Zwell <d...@zwell.net> wrote: > The following function runs fine when it's not defined in an external file: > > our sub get-array(--> Array[Pair]) { > return my Pair @pairs; > } > > But when if you put the above code in a module and run it with: > perl6 -I. -MMyModule -e 'MyModule::get-array' > > The output is: > Type check failed for return value; expected Array[Pair] but got > Array[Pair].new() > in sub get-array at MyModule.pm6 (MyModule) line 2 > > Tested with: > Rakudo version 2017.10 built on MoarVM version 2017.10 > Rakudo version 2017.10-196-gfff43fd70 built on MoarVM version > 2017.10-77-gb9a01f75 > >