Skip to content

Commit 1e4ad0c

Browse files
committed
More correctly fake up role MROs
(Take roles of roles into account)
1 parent 9e98885 commit 1e4ad0c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Perl6/TypeGraph.pm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ class Perl6::TypeGraph {
6969
}
7070
for %.types.values -> $t {
7171
# roles that have a superclass actually apply that superclass
72-
# to the class that does them, so mimic that here:
73-
for $t.roles -> $r {
72+
# to the class that does them, so mimic that here, including
73+
# parent roles
74+
my @roles = $t.roles;
75+
while @roles {
76+
my $r = @roles.shift;
7477
$t.super.append: $r.super if $r.super;
78+
@roles.append: $r.roles if $r.roles;
7579
}
7680
# non-roles default to superclass Any
7781
if $t.packagetype ne 'role' && !$t.super && $t ne 'Mu' {

0 commit comments

Comments
 (0)