Skip to content
Permalink
Browse files

Add warning for improperly shaped arrays

In response to R#2554
  • Loading branch information...
lizmat committed Dec 18, 2018
1 parent e7b61af commit 79824db5361c4bef8c09e363fe9483f10c584b5d
Showing with 6 additions and 19 deletions.
  1. +6 −19 src/core/Array.pm6
@@ -245,37 +245,24 @@ my class Array { # declared in BOOTSTRAP
nqp::if(
Metamodel::EnumHOW.ACCEPTS($shape.HOW),
set-shape(self,$shape.^elems),
nqp::create(self)
nqp::stmts(
warn("Ignoring [{ $shape.^name }] as shape specification"),
nqp::create(self)
)
)
)
}
multi method new() {
nqp::create(self)
}
multi method new(\values, :$shape!) {
nqp::if(
nqp::defined($shape),
set-shape(self,$shape),
nqp::if(
Metamodel::EnumHOW.ACCEPTS($shape.HOW),
set-shape(self,$shape.^elems),
nqp::create(self)
)
).STORE(values)
self.new(:$shape).STORE(values)
}
multi method new(\values) {
nqp::create(self).STORE(values)
}
multi method new(**@values is raw, :$shape!) {
nqp::if(
nqp::defined($shape),
set-shape(self,$shape),
nqp::if(
Metamodel::EnumHOW.ACCEPTS($shape.HOW),
set-shape(self,$shape.^elems),
nqp::create(self)
)
).STORE(@values)
self.new(:$shape).STORE(@values)
}
multi method new(**@values is raw) {
nqp::create(self).STORE(@values)

0 comments on commit 79824db

Please sign in to comment.
You can’t perform that action at this time.