Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for RT #127093
It turned out that somehow the default value of the ContainerDescriptor
for a typed, shaped array, wasn't set.  By setting it explicitely, the
described problem goes away.  Perhaps this has something to do with the
fact that you cannot set default values on shaped arrays yet.

Jonathan: I was wondering whether the .new of ContainerDescriptor should
not just set the default attribute with the :of value if no :default is
specified.  OTOH, I'm not sure how to detect :default not being passed
in nqp.
  • Loading branch information
lizmat committed Jan 2, 2016
1 parent 3568c1e commit 42326d1
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/core/Array.pm
Expand Up @@ -744,26 +744,21 @@ my class Array { # declared in BOOTSTRAP

method !new-internal(\values, \shape) {
my \arr = nqp::create(self);
nqp::bindattr(
arr,
Array,
'$!descriptor',
Perl6::Metamodel::ContainerDescriptor.new(
:of(TValue), :rw(1), :default(TValue))
);
if shape.DEFINITE {
my \list-shape = nqp::istype(shape, List) ?? shape !! shape.list;
allocate-shaped-storage(arr, list-shape);
arr does ShapedArray[Mu];
arr.^set_name('Array');
nqp::bindattr(arr, arr.WHAT, '$!shape', list-shape);
nqp::bindattr(
arr,
Array,
'$!descriptor',
Perl6::Metamodel::ContainerDescriptor.new(:of(TValue), :rw(1))
);
arr.STORE(values) if values;
} else {
nqp::bindattr(
arr,
Array,
'$!descriptor',
Perl6::Metamodel::ContainerDescriptor.new(:of(TValue), :rw(1))
);
arr.STORE(values);
}
arr
Expand Down

0 comments on commit 42326d1

Please sign in to comment.