You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/06/26 04:53:04 UTC

[jira] [Commented] (GROOVY-7157) CompilationError for [[1]] as List>

    [ https://issues.apache.org/jira/browse/GROOVY-7157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14602316#comment-14602316 ] 

Paul King commented on GROOVY-7157:
-----------------------------------

The grammar also passes these:
{code}
def list = [[1]] as List<List<Integer> >  // note space
def list2 = [[1]] as List<List<Integer>/* */>  // note comment
def list3 = [[1]] as List<List<Integer>>;
def list4 = (List<List<Integer>>)[[1]]
{code}
The same behaviour is noted for binary assignments or declarations, e.g. this is also an error:
{code}
def list
list = [[1]] as List<List<Integer>>
{code}


> CompilationError for [[1]] as List<List<Integer>>
> -------------------------------------------------
>
>                 Key: GROOVY-7157
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7157
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.3.7, 2.4.0-beta-3
>            Reporter: Yu Kobayashi
>
> I can run this code,
> {code}
> def list = ([[1]] as List<List<Integer>>)
> println list
> {code}
> but cannot run this code.
> {code}
> def list = [[1]] as List<List<Integer>>
> println list
> {code}
> Error message:
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> C:\Users\Yu\Desktop\test.groovy: 2: expecting EOF, found 'println' @ line 2, column 1.
>    println list
>    ^
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)