Skip to content

Commit

Permalink
Fix roles without signatures
Browse files Browse the repository at this point in the history
While we did just fine on parametric roles, a simple
role Foo { }; class Bar does Foo { };
was broken as the role body's default signature did not contain the ::?CLASS
type capture.
  • Loading branch information
niner authored and Stefan Seifert committed Jun 22, 2022
1 parent 5ce6bf7 commit f27a2d0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Raku/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,11 +1119,8 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
?? $<block>.ast
!! self.r('Block').new(body => self.r('Blockoid').new($<statementlist>.ast));
if $*PKGDECL eq 'role' {
my $signature;
if $<signature> {
$signature := $<signature>.ast;
$signature.set-is-on-role-body(1);
}
my $signature := $<signature> ?? $<signature>.ast !! self.r('Signature').new;
$signature.set-is-on-role-body(1);
# upgrade body to a sub with a signature
$body := self.r('Sub').new(
:name($package.name),
Expand Down

0 comments on commit f27a2d0

Please sign in to comment.