Skip to content

Commit

Permalink
Fix handling of generics in TypedArray.raku
Browse files Browse the repository at this point in the history
Using TValue directly can lead to an attempt to call .raku on an
uninstantiated generic. Just use the type name of self instead of
building it with "Array" and TValue.

Fixes #3784
  • Loading branch information
Kaiepi committed Jul 10, 2020
1 parent f3b1c8d commit ed5bbf7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core.c/TypedArray.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@
)
}

multi method raku(::?CLASS:D \SELF:) {
my $type := TValue.raku;
multi method raku(::?CLASS:D:) {
my $type := self.^name;
my $raku := self.map({
nqp::isconcrete($_) ?? .raku(:arglist) !! $type
}).join(', ');
'Array[' ~ $type ~ '].new(' ~ $raku ~ ')';
$type ~ '.new(' ~ $raku ~ ')'
}
}
method ^parameterize(Mu:U \arr, Mu \t, |c) {
Expand Down

0 comments on commit ed5bbf7

Please sign in to comment.