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

Role with stubs in a file without a package declation #2247

Open
vrurg opened this issue Sep 5, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@vrurg
Copy link
Contributor

commented Sep 5, 2018

The Problem

A role with a stub declared in a file without module or package declarations generates a weird error message if used in a script:

Method 'b-meth' must be implemented by FooRole because it is required by roles: FooRole.

Steps to Reproduce

Let's create the following file and name it FooRole.pm6:

     role FooRole is export {
         method b-meth { ... }
     }

and a script:

     use lib '.';
     use FooRole;

Running the script would generate the error line mentioned in the beginning.

Replacing use FooRole with need FooRole or wrapping the role FooRole declaration into a package fixes the problem.

If this behavior is intended then better error text and a note in documentation would be very helpful.

Environment

  • Operating system: macOS 10.13
  • Compiler version (perl6 -v): This is Rakudo version 2018.08 built on MoarVM version 2018.08

Reproducable on 2018.06 too.

@vrurg vrurg changed the title Role with stubs Role with stubs in a file without a package declation Sep 5, 2018

@lucasbuchala lucasbuchala added the roles label Mar 15, 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.