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

Using a compiled (mbc) wrapping trait: Cannot invoke this object (REPR: Null, cs = 0) #4393

Open
p6rt opened this issue Jul 17, 2015 · 9 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 17, 2015

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

Searchable as RT125634$

@p6rt
Copy link
Author

p6rt commented Jul 17, 2015

From perl6@6dof.xyz

How to reproduce​:

  cdc​:~/golf$ cat lib/Golf.pm6

  unit module Golf;

  multi sub trait_mod​:<is>(Routine $routine, :$wrapped!) {
  $routine.wrap​: -> |args { callwith(|args) }
  }

  sub foo is export is wrapped { say 'OK' }

  cdc​:~/golf$ panda-build
  Compiling lib/Golf.pm6 to mbc

  cdc​:~/golf$ PERL6LIB=$PWD/blib/lib perl6 -e 'use Golf; foo'
  Cannot invoke this object (REPR​: Null, cs = 0)
  in block at lib/Golf.pm6​:4
  in any enter at src/gen/m-Metamodel.nqp​:3560
 
Expected result -- same as without precompilation​:

  cdc​:~/golf$ PERL6LIB=$PWD/lib perl6 -e 'use Golf; foo'
  OK

@p6rt
Copy link
Author

p6rt commented Jul 18, 2015

From perl6@6dof.xyz

For information, it segfaults -- if pre-compiled -- when modifying the
code snippet this way​:

  +sub call-with(|args) { callwith(|args) }
  +
  multi sub trait_mod​:<is>(Routine $routine, :$wrapped!) {
  - $routine.wrap​: -> |args { callwith(|args) }
  + $routine.wrap​: -> |args { call-with(|args) }
  }

@p6rt
Copy link
Author

p6rt commented Jul 20, 2015

From @jnthn

It golfs to this in the module​:

constant &xxx = -> |args { nqp​::say('in closure'); nqp​::say(nqp​::getlex('&say').^name); };
sub foo is export { xxx() }

@p6rt
Copy link
Author

p6rt commented Jul 20, 2015

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

@p6rt
Copy link
Author

p6rt commented Jul 29, 2015

From @hoelzro

See the attached files.

If you run test.pl without a precompiled Example.pm, everything works fine (FALLBACK is added to the Example class and the die() is called). However, if you precompile Example.pm, you get the following error message​:

Cannot invoke this object (REPR​: Null, cs = 0)
  in block at Example.pm​:6
  in any at src/gen/m-Metamodel.nqp​:2867
  in block <unit> at test2.pl​:6

@p6rt
Copy link
Author

p6rt commented Jul 29, 2015

From @hoelzro

Example.pm

@p6rt
Copy link
Author

p6rt commented Jul 29, 2015

From @hoelzro

test.pl

@p6rt
Copy link
Author

p6rt commented Jan 20, 2016

From @LLFourn

I've just run into this while trying to get old code working with precomp.

These are all really the same thing I think​:

https://rt.perl.org/Public/Bug/Display.html?id=126818
https://rt.perl.org/Public/Bug/Display.html?id=127034
https://rt.perl.org/Public/Bug/Display.html?id=127112

I actually made an attempt at helping. A few instances of the bug can be
fixed by putting jnthn++'s "begin_time_lexical_fixup" in a few more places,
but I coulnd't figure out how to get closures declared in 'is' traits to
work.

LL

@p6rt
Copy link
Author

p6rt commented Jan 26, 2016

From @hoelzro

I think that this might be related to another bug I found​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127089

On 2016-01-19 20​:10​:14, lloyd.fourn@​gmail.com wrote​:

I've just run into this while trying to get old code working with precomp.

These are all really the same thing I think​:

https://rt.perl.org/Public/Bug/Display.html?id=126818
https://rt.perl.org/Public/Bug/Display.html?id=127034
https://rt.perl.org/Public/Bug/Display.html?id=127112

I actually made an attempt at helping. A few instances of the bug can be
fixed by putting jnthn++'s "begin_time_lexical_fixup" in a few more places,
but I coulnd't figure out how to get closures declared in 'is' traits to
work.

LL

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant