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

type constraints to Array[Pair] don't work when precompiled #6645

Open
p6rt opened this issue Dec 1, 2017 · 9 comments
Open

type constraints to Array[Pair] don't work when precompiled #6645

p6rt opened this issue Dec 1, 2017 · 9 comments
Labels
precomp regression Issue did not exist previously

Comments

@p6rt
Copy link

p6rt commented Dec 1, 2017

Migrated from rt.perl.org#132525 (status was 'open')

Searchable as RT132525$

@p6rt
Copy link
Author

p6rt commented Dec 1, 2017

From @lefth

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

@p6rt
Copy link
Author

p6rt commented Dec 4, 2017

From @lefth

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

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

@p6rt
Copy link
Author

p6rt commented Dec 6, 2017

From @lefth

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 #&#8203;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@&#8203;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

@p6rt
Copy link
Author

p6rt commented Dec 13, 2017

From @zoffixznet

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-archive.perl.org/perl6/Ticket/Display.html?id=128287#ticket-history
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127001#ticket-history

@p6rt
Copy link
Author

p6rt commented Dec 13, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 14, 2017

From @lefth

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-archive.perl.org/perl6/Ticket/Display.html?id=128287#ticket-history
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127001#ticket-history

@p6rt
Copy link
Author

p6rt commented Dec 14, 2017

From @AlexDaniel

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-archive.perl.org/perl6/Ticket/Display.html?id=128287#ticket-history
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127001#ticket-history

@p6rt
Copy link
Author

p6rt commented Dec 14, 2017

From @AlexDaniel

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

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-archive.perl.org/perl6/Ticket/Display.html?id=128287#ticket-history
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127001#ticket-history

@p6rt
Copy link
Author

p6rt commented Dec 16, 2017

@p6rt p6rt added precomp regression Issue did not exist previously labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
precomp regression Issue did not exist previously
Projects
None yet
Development

No branches or pull requests

1 participant