Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent a class from inheriting from itself.
  • Loading branch information
jnthn committed May 13, 2011
1 parent adf72d8 commit 9ab0356
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Metamodel/MultipleInheritance.pm
Expand Up @@ -7,6 +7,9 @@ role Perl6::Metamodel::MultipleInheritance {
if self.is_composed($obj) {
pir::die("Parents cannot be added to a class after it has been composed");
}
if $parent =:= $obj {
pir::die("Class " ~ self.name($obj) ~ " cannot inherit from itself");
}
for @!parents {
if $_ =:= $parent {
pir::die("Package '" ~ self.name($obj) ~
Expand Down

0 comments on commit 9ab0356

Please sign in to comment.