Skip to content

Commit 008d651

Browse files
committed
add Any as default superclass
1 parent 791b30a commit 008d651

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/Perl6/TypeGraph.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class Perl6::TypeGraph {
5252
my $m = Decl.parse($l, :actions(Actions.new));
5353
my $t = $m<type>.ast;
5454
$t.packagetype = ~$m<package>;
55+
if $t.packagetype ne 'role' && !$t.super && $t ne 'Mu' {
56+
$t.super.push: $get-type('Any');
57+
}
5558
}
5659
}
5760
}

t/typegraph.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ ok $t.types<List>.roles.any eq 'Positional',
1212
'List does positional';
1313
is $t.types<Str>.mro, 'Str Cool Any Mu', 'Str mro';
1414
is $t.types<Match>.mro, 'Match Capture Cool Any Mu', 'Match mro';
15+
is $t.types<Stash>.super.any, 'Any', 'Any as default parent works';
16+
is $t.types<Any>.super, 'Mu', 'default-Any did not add a parent to Any';
1517
done;

0 commit comments

Comments
 (0)