[
https://issues.apache.org/jira/browse/GROOVY-6212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15967519#comment-15967519
]
Daniil Ovchinnikov commented on GROOVY-6212:
--------------------------------------------
[~paulk] I'm getting the following behaviour in 2.5.0-alpha-1:
{code}
def a = ['foo']
def m = [foo: 42]
println m.get(*a) // 42
println m.getAt(*a) // 42
println m[*a] // null
{code}
Is it intended?
> SpreadExpression BUG! when slicing a List
> -----------------------------------------
>
> Key: GROOVY-6212
> URL: https://issues.apache.org/jira/browse/GROOVY-6212
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.1.5, 2.4.0-rc-1
> Reporter: Alexey Rusakovich
> Assignee: Paul King
> Fix For: 2.5.0-alpha-1
>
>
> Evaluating
> {code}
> (1..3)[*0..2]
> {code}
> throws: {{BUG! exception in phase 'class generation' in source unit
> 'ConsoleScript42' SpreadExpression should not be visited here}}
> It works fine if I manually call {{getAt}}:
> {code}
> (1..3).getAt([*0..2]) // [1, 2, 3]
> {code}
> It also works if I add something besides the spread:
> {code}
> (1..3)[*0..2, 2] // [1, 2, 3, 3]
> {code}
> as shown in the Ranges and List-Slicing section of [Getting Started Guide >
> Collections|http://groovy.codehaus.org/JN1015-Collections].
> There are other SpreadExpression BUG!s, but I'm not sure if this bug is the
> same:
> http://jira.codehaus.org/issues/?jql=text%20%7E%20%22SpreadExpression%22
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)