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

.:: fails if dispating to a role exported from a module unless fully-qualified name is used #2273

Closed
vrurg opened this issue Sep 11, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@vrurg
Copy link
Member

commented Sep 11, 2018

The Problem

Dispatching a method to a role with .:: operator fails if role is defined in a separate file.

Expected Behavior

The following code being executed as a one-liner or in a single file outputs Foo:d as expected:

 role Foo {
     method d { note "Foo::d" }
 }

 class Baz does Foo {
     method d { self.Foo::d }
 }

 Baz.new.d;

Actual Behavior

Executing this code:

 module My {
     role Foo is export {
         method d { note "Foo::d" }
     }
 }

 import My;
 class Baz does Foo {
     method d { self.Foo::d }
 }

 Baz.new.d;

will produce error message:

Cannot dispatch to method d on My::Foo because it is not inherited or done by Baz
  in method d at ./r-d.p6 line 11
  in block <unit> at ./r-d.p6 line 14

Workaround

Use of fully-qualified My::Foo works as expected. Replacing class definition with

 class Baz does MyFoo {
     method d { self.My::Foo::d }
 }

produces the correct Foo::d output.

Environment

  • Operating system: macOS 10.13, Linux Mint 19
  • Compiler version (perl6 -v): This is Rakudo version 2018.08 built on MoarVM version 2018.08, 2018.06
@vrurg

This comment has been minimized.

Copy link
Member Author

commented Feb 9, 2019

Fixed with #2675

@vrurg vrurg closed this Feb 9, 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.