From 5a29a0ce41f20aaff659fb804b4f6ced810fe130 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 16 Nov 2017 09:01:26 +0100 Subject: [PATCH] Make .head and .tail only take WhateverCode Instead of Callable. Being able to take a Callable is not documented at the moment, and restricting it to WhateverCode does not break any tests. Should allow for more uses of Callable with .head/.tail. --- src/core/Any-iterable-methods.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Any-iterable-methods.pm b/src/core/Any-iterable-methods.pm index 21b6c013569..6de8bdbd18a 100644 --- a/src/core/Any-iterable-methods.pm +++ b/src/core/Any-iterable-methods.pm @@ -1818,7 +1818,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?" $pulled ) } - multi method head(Any:D: Callable:D $w) { + multi method head(Any:D: WhateverCode:D $w) { Seq.new( Rakudo::Iterator.AllButLastNValues(self.iterator,-($w(0).Int)) ) @@ -1841,7 +1841,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?" multi method tail(Any:D: $n) { Seq.new( nqp::if( - nqp::istype($n,Callable) + nqp::istype($n,WhateverCode) && nqp::isgt_i((my $skip := -($n(0).Int)),0), nqp::stmts( (my $iterator := self.iterator).skip-at-least($skip),