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

trait excepting an Attribute and a &callable works on a classes but doesn't work on roles #2619

Open
FCO opened this issue Jan 18, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@FCO
Copy link
Member

commented Jan 18, 2019

This works

multi trait_mod:<is>(Attribute $attr, :&bla!) {say 42}; class :: { has $.a is bla{;} }

but this doesn't work

multi trait_mod:<is>(Attribute $attr, :&bla!) {say 42}; role :: { has $.a is bla{;} }

dies with:

===SORRY!===
Cannot invoke this object (REPR: Null; VMNull)

https://colabti.org/irclogger/irclogger_log/perl6?date=2019-01-18#l150

@FCO

This comment has been minimized.

Copy link
Member Author

commented Jan 18, 2019

this works:

multi trait_mod:<is>(Attribute $attr, :&bla!) {say 42}; my &a = {;}; role :: { has $.a is bla(&a) }
@jonathanstowe

This comment has been minimized.

Copy link
Contributor

commented Jan 18, 2019

There's a whole category of related "closure disappearing in compilation". problems that seem to have been around forever: https://rt.perl.org/Public/Search/Simple.html?q=Cannot+invoke+this+object also #1536 has a round up of other related issues.

@FCO

This comment has been minimized.

Copy link
Member Author

commented Jan 18, 2019

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.