Skip to content

At-pos/at-key/zen slices hypered over empty List/Array crash #2133

Open
@zoffixznet

Description

@zoffixznet

These work:

m: dd (<a b>,)»[]
rakudo-moar a71e370bb: OUTPUT: «(("a", "b"),)␤»
m: dd ({:42foo},)»{}
rakudo-moar a71e370bb: OUTPUT: «({:foo(42)},)␤»
m: my @a = 42; dd @a»[]
 rakudo-moar a71e370bb: OUTPUT: «(42,)␤»
m: my @a = {:42foo},; dd @a»{} 
rakudo-moar a71e370bb: OUTPUT: «({:foo(42)},)␤»

But if the List/Array is empty, they crash:

rakudo-moar a71e370bb: OUTPUT: «This type (Scalar) does not support elems␤  in block <unit> at <tmp> line 1␤␤»
m: my @a; @a»[]                                                                
rakudo-moar a71e370bb: OUTPUT: «This type (Mu) does not support elems␤  in block <unit> at <tmp> line 1␤␤»
m: dd ()»{}                                                                                                                                          │
rakudo-moar a71e370bb: OUTPUT: «This type (Scalar) does not support elems␤  in block <unit> at <tmp> line 1␤␤»
m: my @a; @a»{}
rakudo-moar a71e370bb: OUTPUT: «This type (Mu) does not support elems␤  in block <unit> at <tmp> line

Happens with regular at-key/at-pos instead of zen slices as well:

m: my @a; @a».[1]
rakudo-moar a71e370bb: OUTPUT: «This type (Mu) does not support elems␤  in block <unit> at <tmp> line 1␤␤»

Activity

dogbert17

dogbert17 commented on Oct 22, 2020

@dogbert17

Fixed with commit 9b50329 lizmat++

added
tests neededIssue is generally resolved but tests were not written yet
on Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    data typesArrays, lists, hashes, pair objects, etc.tests neededIssue is generally resolved but tests were not written yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      At-pos/at-key/zen slices hypered over empty List/Array crash · Issue #2133 · rakudo/rakudo