Skip to content
Permalink
Browse files

Make List.reverse return a Seq again

Apparently having it return a list caused ecosystem test breakage.
Fixed R#2999.
  • Loading branch information...
lizmat committed Jun 19, 2019
1 parent f05b1b0 commit 8ddc2ad503f07fd4a50e1d423091f3374cba3008
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/List.pm6
@@ -1128,20 +1128,20 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
)
}

method reverse(List:D: --> List:D) is nodal {
method reverse(List:D: --> Seq:D) is nodal {
self.is-lazy # reifies
?? Failure.new(X::Cannot::Lazy.new(:action<reverse>))
!! $!reified
!! Seq.new: $!reified
?? nqp::stmts(
(my \src := nqp::clone(nqp::getattr(self,List,'$!reified'))),
(my \dst := nqp::create(src.WHAT)),
nqp::while(
nqp::elems(src),
nqp::push(dst,nqp::pop(src))
),
nqp::p6bindattrinvres(nqp::create(self),List,'$!reified',dst)
Rakudo::Iterator.ReifiedList(dst)
)
!! nqp::create(self)
!! Rakudo::Iterator.Empty
}

method rotate(List:D: Int(Cool) $rotate = 1) is nodal {

0 comments on commit 8ddc2ad

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