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

Applying additional role with 'does' breaks role-qualified method call #2282

Closed
vrurg opened this issue Sep 16, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@vrurg
Copy link
Member

commented Sep 16, 2018

The Problem

When a role is dynamically applied to instantiated object using does it breaks role-qualified calls to any previously applied roles.

Expected Behavior

self.Role1::method;
self does Role2;
self.Role1::method;

must pass without errors

Actual Behavior

In the above example second call to method would fail with No concretization found for Role1 error.

Steps to Reproduce

The following code demonstrates the bug:

 role Foo1 { method foo { say "Foo1::foo"; } }
 role Foo2 { method foo { say "Foo2::foo"; } }
 role Foo3 { method foo { say "Foo3::foo"; } }

 class Foo { method foo { say "Foo::foo"; } }

 class Bar is Foo does Foo1 {
     method foo {
         say "Bar::foo";
         self.Foo::foo;
         self.Foo1::foo;

         say "-- Do Foo2";
         self does Foo2;
         self.Foo::foo;
         try {
             self.Foo1::foo;
             CATCH { default { say $_.message } }
         }
         self.Foo2::foo;

         say "-- Do Foo3";
         self does Foo3;
         try {
             self.Foo2::foo;
             CATCH { default { say $_.message } }
         }
         self.Foo3::foo;
     }
 }

 Bar.new.foo;

Being run it produces the output:

Bar::foo
Foo::foo
Foo1::foo
-- Do Foo2
Foo::foo
No concretization found for Foo1
Foo2::foo
-- Do Foo3
No concretization found for Foo2
Foo3::foo

Note that problem occurs with role-qualified calls only while class-qualified remain unaffected.

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 and 2017.10 are affected too.
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.