Skip to content

Commit ad31d07

Browse files
committed
Forbid classes inheriting from themselves.
1 parent 509350b commit ad31d07

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/how/NQPClassHOW.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ knowhow NQPClassHOW {
9393
if $!composed {
9494
pir::die("NQPClassHOW does not support adding parents after being composed.");
9595
}
96+
if $obj =:= $parent {
97+
pir::die("Class '$!name' cannot inherit from itself.");
98+
}
9699
for @!parents {
97100
if $_ =:= $parent {
98101
pir::die("Already have " ~ $parent ~ " as a parent class.");

0 commit comments

Comments
 (0)