Created
October 16, 2012 10:22
-
-
Save lumimies/3898515 to your computer and use it in GitHub Desktop.
Core dump from rakudo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
class X::Overload::Missing is Exception { | |
has $.type; | |
has $.method; | |
method message() { | |
"Method $.method of type $.type doesn't override anything" | |
} | |
} | |
multi trait_mod:<is>(Method:D $m, :$overload!) { | |
my $pkg := $m.signature.params[0].type; | |
my $m_name := $m.name; | |
for $pkg.HOW.parents($pkg) -> $p { | |
return if $p.HOW.methods($p).grep(*.name == $m_name); | |
} | |
X::Overload::Missing.new(:type($pkg), :method($m)).throw; | |
} | |
# testing... | |
class A { | |
method foo {} | |
} | |
class B is A { | |
method foo is overload {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment