Skip Menu |

To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Date: Fri, 01 Dec 2017 10:00:29 +0000
From: Dan Zwell <dan [...] zwell.net>
Subject: [BUG] type constraints to Array[Pair] don't work when precompiled
Download (untitled) / with headers
text/plain 556b
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

To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Date: Mon, 04 Dec 2017 03:16:48 +0000
From: Dan Zwell <dan [...] zwell.net>
Subject: Re: [BUG] type constraints to Array[Pair] don't work when precompiled
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 <dan@zwell.net> wrote:
Show quoted text
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

From: Dan Zwell <dan [...] zwell.net>
Date: Wed, 06 Dec 2017 09:59:22 +0000
To: perl6-bugs-followup [...] perl.org
Subject: Re: [perl #132525] AutoReply: [BUG] type constraints to Array[Pair] don't work when precompiled
Download (untitled) / with headers
text/plain 1.5k
A git bisect showed that this error began in commit 22b4ef05b1f72b50d63e4599d5e037bccf1f08ed, but there must be have been an underlying problem that was already present, since this commit did not change the type system.

On Fri, Dec 1, 2017 at 6:00 PM perl6 via RT <perl6-bugs-followup@perl.org> wrote:
Show quoted text
Greetings,

This message has been automatically generated in response to the
creation of a trouble ticket regarding:
        "[BUG] type constraints to Array[Pair] don't work when precompiled",
a summary of which appears below.

There is no need to reply to this message right now.  Your ticket has been
assigned an ID of [perl #132525].

Please include the string:

         [perl #132525]

in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.

                        Thank you,
                        perl6-bugs-followup@perl.org

-------------------------------------------------------------------------
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

RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.8k
On Wed, 06 Dec 2017 01:59:42 -0800, dan@zwell.net wrote: Show quoted text
> A git bisect showed that this error began in commit > 22b4ef05b1f72b50d63e4599d5e037bccf1f08ed, but there must be have been > an > underlying problem that was already present, since this commit did not > change the type system. > > On Fri, Dec 1, 2017 at 6:00 PM perl6 via RT <perl6-bugs- > followup@perl.org> > wrote: >
> > Greetings, > > > > This message has been automatically generated in response to the > > creation of a trouble ticket regarding: > > "[BUG] type constraints to Array[Pair] don't work when > > precompiled", > > a summary of which appears below. > > > > There is no need to reply to this message right now. Your ticket has > > been > > assigned an ID of [perl #132525]. > > > > Please include the string: > > > > [perl #132525] > > > > in the subject line of all future correspondence about this issue. To > > do > > so, > > you may reply to this message. > > > > Thank you, > > perl6-bugs-followup@perl.org > > > > ------------------------------------------------------------------------- > > 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 > > > >
These two tickets have the same symptoms: https://rt.perl.org/Ticket/Display.html?id=128287#ticket-history https://rt.perl.org/Ticket/Display.html?id=127001#ticket-history
From: Dan Zwell <dan [...] zwell.net>
Subject: Re: [perl #132525] [REGRESSION][PRECOMP] type constraints to Array[Pair] don't work when precompiled
Date: Thu, 14 Dec 2017 07:33:23 +0000
To: perl6-bugs-followup [...] perl.org
Download (untitled) / with headers
text/plain 2.2k
Thanks for finding that. Can we close this duplicate bug? Issue #128287 has stronger steps to reproduce, and using that test case, I found this bug goes back to at least 2015.12.

On Wed, Dec 13, 2017 at 11:56 PM Zoffix Znet via RT <perl6-bugs-followup@perl.org> wrote:
Show quoted text
On Wed, 06 Dec 2017 01:59:42 -0800, dan@zwell.net wrote:
> A git bisect showed that this error began in commit
> 22b4ef05b1f72b50d63e4599d5e037bccf1f08ed, but there must be have been
> an
> underlying problem that was already present, since this commit did not
> change the type system.
>
> On Fri, Dec 1, 2017 at 6:00 PM perl6 via RT <perl6-bugs-
> followup@perl.org>
> wrote:
>
> > Greetings,
> >
> > This message has been automatically generated in response to the
> > creation of a trouble ticket regarding:
> >         "[BUG] type constraints to Array[Pair] don't work when
> > precompiled",
> > a summary of which appears below.
> >
> > There is no need to reply to this message right now.  Your ticket has
> > been
> > assigned an ID of [perl #132525].
> >
> > Please include the string:
> >
> > [perl #132525]
> >
> > in the subject line of all future correspondence about this issue. To
> > do
> > so,
> > you may reply to this message.
> >
> > Thank you,
> > perl6-bugs-followup@perl.org
> >
> > -------------------------------------------------------------------------
> > 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
> >
> >


These two tickets have the same symptoms:

https://rt.perl.org/Ticket/Display.html?id=128287#ticket-history
https://rt.perl.org/Ticket/Display.html?id=127001#ticket-history
We can, but I'd much rather have this particular case tested (and to make sure that it is, we'll close it with tests once the issue is resolved).

For example, here's this interesting bit: https://github.com/rakudo/rakudo/blob/master/src/core/core_prologue.pm#L2 :

my class Pair { ... } # must be first for some reason

I don't know if it's related to this issue, but Pairs are weird for some reason. Adding a test won't hurt for sure.

On 2017-12-13 23:33:43, dan@zwell.net wrote:
Show quoted text
> Thanks for finding that. Can we close this duplicate bug? Issue #128287 has
> stronger steps to reproduce, and using that test case, I found this bug
> goes back to at least 2015.12.
>
> On Wed, Dec 13, 2017 at 11:56 PM Zoffix Znet via RT <
> perl6-bugs-followup@perl.org> wrote:
>
> > On Wed, 06 Dec 2017 01:59:42 -0800, dan@zwell.net wrote:
> > > A git bisect showed that this error began in commit
> > > 22b4ef05b1f72b50d63e4599d5e037bccf1f08ed, but there must be have been
> > > an
> > > underlying problem that was already present, since this commit did not
> > > change the type system.
> > >
> > > On Fri, Dec 1, 2017 at 6:00 PM perl6 via RT <perl6-bugs-
> > > followup@perl.org>
> > > wrote:
> > >
> > > > Greetings,
> > > >
> > > > This message has been automatically generated in response to the
> > > > creation of a trouble ticket regarding:
> > > > "[BUG] type constraints to Array[Pair] don't work when
> > > > precompiled",
> > > > a summary of which appears below.
> > > >
> > > > There is no need to reply to this message right now. Your ticket has
> > > > been
> > > > assigned an ID of [perl #132525].
> > > >
> > > > Please include the string:
> > > >
> > > > [perl #132525]
> > > >
> > > > in the subject line of all future correspondence about this issue. To
> > > > do
> > > > so,
> > > > you may reply to this message.
> > > >
> > > > Thank you,
> > > > perl6-bugs-followup@perl.org
> > > >
> > > >
> > -------------------------------------------------------------------------
> > > > 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
> > > >
> > > >
> >
> >
> > These two tickets have the same symptoms:
> >
> > https://rt.perl.org/Ticket/Display.html?id=128287#ticket-history
> > https://rt.perl.org/Ticket/Display.html?id=127001#ticket-history
> >


Oh, by the way. The issue goes much farther than 2015.12, so the underlying issue is not a regression.

On 2017-12-13 23:42:11, alex.jakimenko@gmail.com wrote:
Show quoted text
> We can, but I'd much rather have this particular case tested (and to
> make sure
> that it is, we'll close it with tests once the issue is resolved).
>
> For example, here's this interesting bit:
> https://github.com/rakudo/rakudo/blob/master/src/core/core_prologue.pm#L2
> :
>
> my class Pair { ... } # must be first for some reason
>
> I don't know if it's related to this issue, but Pairs are weird for
> some
> reason. Adding a test won't hurt for sure.
>
> On 2017-12-13 23:33:43, dan@zwell.net wrote:
> > Thanks for finding that. Can we close this duplicate bug? Issue
> > #128287 has
> > stronger steps to reproduce, and using that test case, I found this
> > bug
> > goes back to at least 2015.12.
> >
> > On Wed, Dec 13, 2017 at 11:56 PM Zoffix Znet via RT <
> > perl6-bugs-followup@perl.org> wrote:
> >
> > > On Wed, 06 Dec 2017 01:59:42 -0800, dan@zwell.net wrote:
> > > > A git bisect showed that this error began in commit
> > > > 22b4ef05b1f72b50d63e4599d5e037bccf1f08ed, but there must be have
> > > > been
> > > > an
> > > > underlying problem that was already present, since this commit
> > > > did not
> > > > change the type system.
> > > >
> > > > On Fri, Dec 1, 2017 at 6:00 PM perl6 via RT <perl6-bugs-
> > > > followup@perl.org>
> > > > wrote:
> > > >
> > > > > Greetings,
> > > > >
> > > > > This message has been automatically generated in response to
> > > > > the
> > > > > creation of a trouble ticket regarding:
> > > > > "[BUG] type constraints to Array[Pair] don't work when
> > > > > precompiled",
> > > > > a summary of which appears below.
> > > > >
> > > > > There is no need to reply to this message right now. Your
> > > > > ticket has
> > > > > been
> > > > > assigned an ID of [perl #132525].
> > > > >
> > > > > Please include the string:
> > > > >
> > > > > [perl #132525]
> > > > >
> > > > > in the subject line of all future correspondence about this
> > > > > issue. To
> > > > > do
> > > > > so,
> > > > > you may reply to this message.
> > > > >
> > > > > Thank you,
> > > > > perl6-bugs-followup@perl.org
> > > > >
> > > > >
> > > -------------------------------------------------------------------------
> > > > > 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
> > > > >
> > > > >
> > >
> > >
> > > These two tickets have the same symptoms:
> > >
> > > https://rt.perl.org/Ticket/Display.html?id=128287#ticket-history
> > > https://rt.perl.org/Ticket/Display.html?id=127001#ticket-history
> > >




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org