The weird thing here is, is that somehow the List.iterator is used, instead of 
the Array.iterator (which *does* take null values into account, even makes them 
bindable)

Is this still a problem on HEAD ?


Liz
===============
> On 04 Jun 2016, at 20:45, Christian Bartolomaeus (via RT) 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  Christian Bartolomaeus 
> # Please include the string:  [perl #128320]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=128320 >
> 
> 
> The following code (tested in S32-array/delete.t) started to fail with 
> rakudo-j recently:
> 
> $ perl6-j -e 'my @a = 0..1; @a[0]:delete; map { 1 }, @a'
> java.lang.NullPointerException
>  in block <unit> at -e line 1
> 
> $ perl6-j --ll-exception -e 'my @a = 0..1; @a[0]:delete; map { 1 }, @a'
> java.lang.NullPointerException
>  in add_to_cache (gen/jvm/BOOTSTRAP.nqp:1512)
>  in  (gen/jvm/BOOTSTRAP.nqp:1516)
>  in push (gen/jvm/CORE.setting:1828)
>  in push-all (gen/jvm/CORE.setting:14627)
>  in push-until-lazy (gen/jvm/CORE.setting:2401)
>  in  (gen/jvm/CORE.setting:14308)
>  in  (gen/jvm/CORE.setting:14306)
>  in reify-until-lazy (gen/jvm/CORE.setting:14304)
>  in is-lazy (gen/jvm/CORE.setting:14892)
>  in map (gen/jvm/CORE.setting:5366)
>  in map (gen/jvm/CORE.setting:5365)
>  in <unit> (-e:1)
>  in <unit-outer> (-e:1)
>  in eval (gen/jvm/stage2/NQPHLL.nqp:1198)
>  in eval (src/Perl6/Compiler.nqp:171)
>  in  (gen/jvm/stage2/NQPHLL.nqp:1288)
>  in command_eval (gen/jvm/stage2/NQPHLL.nqp:1285)
>  in command_eval (src/Perl6/Compiler.nqp:29)
>  in command_line (gen/jvm/stage2/NQPHLL.nqp:1269)
>  in MAIN (gen/jvm/main.nqp:37)
>  in <mainline> (gen/jvm/main.nqp:33)
>  in  (gen/jvm/main.nqp)
> 
> I think, the error first appeared with Rakudo commit beb3c986.
> 
> The following patch makes the NPE go away (and has no spectest fallout). But 
> I'm not sure if it is the right thing to insert Nil when nqp::atpos returns 
> null.
> 
> ====
> 
> diff --git a/src/core/List.pm b/src/core/List.pm
> index 0c65a6f..ddc8607 100644
> --- a/src/core/List.pm
> +++ b/src/core/List.pm
> @@ -476,7 +476,7 @@ my class List does Iterable does Positional { # declared 
> in BOOTSTRAP
>                 method push-all($target) {
>                     my int $elems = nqp::elems($!reified);
>                     my $no-sink;
> -                    $no-sink := $target.push(nqp::atpos($!reified,$!i))
> +                    $no-sink := 
> $target.push(nqp::ifnull(nqp::atpos($!reified,$!i),Nil))
>                       while nqp::islt_i($!i = nqp::add_i($!i,1),$elems);
>                     IterationEnd
>                 }

Reply via email to