Skip to content

Commit

Permalink
RakuAST: fix initialization of shaped variables
Browse files Browse the repository at this point in the history
We need to create an object of the container type, i.e. Array, instead
of the default base type, i.e. Mu.
  • Loading branch information
niner committed Jan 29, 2023
1 parent ade6861 commit a49f5a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Raku/ast/variable-declaration.rakumod
Expand Up @@ -484,9 +484,12 @@ class RakuAST::VarDeclaration::Simple is RakuAST::Declaration is RakuAST::Implic
:value($container)
);
if $!shape || self.IMPL-HAS-CONTAINER-BASE-TYPE {
my @lookups := self.IMPL-UNWRAP-LIST(self.get-implicit-lookups());
my $of := $!type ?? @lookups[0].resolution.compile-time-value !! Mu;

$qast := QAST::Op.new( :op('bind'), $qast, QAST::Op.new(
:op('callmethod'), :name('new'),
QAST::WVal.new( :value(self.IMPL-CONTAINER-BASE-TYPE) )
QAST::WVal.new( :value(self.IMPL-CONTAINER-TYPE($of)) )
) );
if $!shape {
my $shape_ast := $!shape.IMPL-TO-QAST($context);
Expand Down

0 comments on commit a49f5a9

Please sign in to comment.