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

VMNull in add_method in indirect use #2897

Open
gfldex opened this issue May 14, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@gfldex
Copy link
Contributor

commented May 14, 2019

https://gist.github.com/gfldex/dc47e3c4981cd63543d3e20f3e6b7b5e

#  warn-in-add_method.pm6 
sub EXPORT {
    Nil.^add_method('list', method ($self: ){ my $i = 41++; Empty });
    Nil.^compose;
    %()
}
# EOF

# warn-in-add_method-indirect.pm6
use warn-in-add_method;
# EOF

#  warn-in-add_method.p6 
use v6.d;

use lib '.';
use warn-in-add_method-indirect;

Nil.list();
# EOF

Yields:

Cannot invoke this object (REPR: Null; VMNull)
  in method <anon> at /home/dex/projects/perl6/rakudobug/warn-in-add_method.pm6 (warn-in-add_method) line 2
  in block <unit> at warn-in-add_method.p6 line 6

It doesn't really matter what the first statement in the added method is as long as it's not optimised away. The indirection is needed to trigger this and the `sub EXPORT´ is required to avoid STable-confusion (what may also be a bug).

$ perl6 --version
This is Rakudo version 2019.03.1-292-g48a12551f built on MoarVM version 2019.03-110-g081823ffc
implementing Perl 6.d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.