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

The check for implemented stub method do not find methods generated by a attribute handles #2386

Closed
FCO opened this issue Oct 17, 2018 · 1 comment

Comments

@FCO
Copy link
Member

FCO commented Oct 17, 2018

The Problem

$ perl6 -e 'role R { method r {...} }; class C does R { has R $.a handles <r> }'
===SORRY!=== Error while compiling -e
Method 'r' must be implemented by C because it is required by roles: R.
at -e:1

I was searching for the reason, and looks that the compose_attributes (that creates the handled methods) is called after the check of the roles' stubed methods.

Expected Behavior

That should work

Actual Behavior

breaks at compile time sayng that the method wasnt implemented

Steps to Reproduce

just run the one-liner

Environment

  • Operating system: ubuntu and mac os x
  • Compiler version (perl6 -v):
This is Rakudo version 2018.08 built on MoarVM version 2018.08
implementing Perl 6.c.
@jnthn
Copy link
Member

jnthn commented Oct 17, 2018

It's a (I think solvable) ordering and factoring problem.

Attribute composition must happen after role composition for multiple reasons, so it's not a simple case of "re-order the steps". That means we have to break out the check for missing requirements - which I think happens inside the role composition code at the moment - so that it can happen after attribute composition. And then somehow communicate this between the phases. So, a bit less neat, but probably worth it, since folks stub their toe on this every now and then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants