lizmat / Method-Also

Method::Also - add "is also" trait to Methods
Artistic License 2.0
2 stars 2 forks source link

Corrects Weird .value issue #3

Closed Xliff closed 4 years ago

Xliff commented 4 years ago

Take the following role definition:

role Pango::Roles::References {
  has Pointer $!ref;

  # We use these for inc/dec ops
  method upref
    is also<ref>
  {
    g_object_ref($!ref);
    self;
  }
  method downref
    is also<unref>
  { g_object_unref($!ref); }
}

If I compile this using the existing Method::Also, I get the following error:

===SORRY!=== Error while compiling /home/cbwood/Projects/p6-Pango/lib/Pango/Context.pm6 (Pango::Context)
    No such method 'value' for invocant of type 'Any'. Did you mean 'values'?
    at /home/cbwood/Projects/p6-Pango/lib/Pango/Context.pm6 (Pango::Context):15

This PR seems to mute...and hopefully correct... this error.