Skip to content

Commit

Permalink
Fix handling of generics in TypedArray.raku
Browse files Browse the repository at this point in the history
When calling .raku on a generic typed array, it's possible for the
method to wind up calling .raku on an uninstantiated generic. Instead of
using the typed array's parameter directly, use the type of the array's
container descriptor (which should get instantiated eventually).

Fixes #3784
  • Loading branch information
Kaiepi committed Jul 10, 2020
1 parent 631ab68 commit 90f86d4
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 := nqp::getattr(self,Array,'$!descriptor').of.^name;
my $raku := self.map({
nqp::isconcrete($_) ?? .raku(:arglist) !! $type
}).join(', ');
'Array[' ~ $type ~ '].new(' ~ $raku ~ ')';
'Array[' ~ $type ~ '].new(' ~ $raku ~ ')'
}
}
method ^parameterize(Mu:U \arr, Mu \t, |c) {
Expand Down

0 comments on commit 90f86d4

Please sign in to comment.