[ 
https://issues.apache.org/jira/browse/GROOVY-5397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles closed GROOVY-5397.
-------------------------------
    Resolution: Not A Problem

> possible bug: list coercion during assignment to an array is a little odd
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-5397
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5397
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.8.6
>            Reporter: Paul King
>            Priority: Major
>
> User bug submitted by David Greenberg via twitter (@dgrnbrg):
> {code}
> double[] n1 = new double[10]; n1 = 3.0; assert n1 == [3.0]
> float[] n2 = new float[10]; n2 = 3.0; assert n2 == [3.0]
> int[] n3 = new int[10]; n3 = 3; assert n3 == [3]
> boolean[] b1 = new boolean[10]; b1 = false; assert b1 == [false]
> String[] s1 = new String[10]; s1 = 'foo'; assert s1 == ['f', 'o', 'o']
> {code}
> When assigning to an array, the right hand side's iterator "coercion" is 
> applied returning a singleton list of size 1. The list elements are then fed 
> into the array. The last line shows a slightly more understandable example.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to