You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/25 15:07:00 UTC

[jira] [Updated] (GROOVY-8133) Static type checking failure for streams and spread operator

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

Eric Milles updated GROOVY-8133:
--------------------------------
    Description: 
Input files:

Test.groovy
{code:groovy}
class Test {
    static void main(String[] args) {
        [1, 2, 3].stream()*.toString()
    }
}
{code}
compiler-config.groovy
{code:groovy}
import groovy.transform.CompileStatic
withConfig(configuration) {
    ast(CompileStatic)
}
{code}

    {{Error:(3, 9) Groovyc: [Static type checking] - Spread operator can only be used on collection types}}

Expected: static type checking allows spread operator for streams

  was:
Input files:

Test.groovy
class Test {
    static void main(String[] args) {
        [1, 2, 3].stream()*.toString()
    }
}

compiler-config.groovy
import groovy.transform.CompileStatic

withConfig(configuration) {
    ast(CompileStatic)
}

Error:(3, 9) Groovyc: [Static type checking] - Spread operator can only be used on collection types

Expected: static type checking allows spread operator for streams


> Static type checking failure for streams and spread operator
> ------------------------------------------------------------
>
>                 Key: GROOVY-8133
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8133
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static Type Checker
>    Affects Versions: 2.4.10
>         Environment: Windows 7, JDK 1.8.0_66
>            Reporter: Iurii
>            Priority: Major
>
> Input files:
> Test.groovy
> {code:groovy}
> class Test {
>     static void main(String[] args) {
>         [1, 2, 3].stream()*.toString()
>     }
> }
> {code}
> compiler-config.groovy
> {code:groovy}
> import groovy.transform.CompileStatic
> withConfig(configuration) {
>     ast(CompileStatic)
> }
> {code}
>     {{Error:(3, 9) Groovyc: [Static type checking] - Spread operator can only be used on collection types}}
> Expected: static type checking allows spread operator for streams



--
This message was sent by Atlassian Jira
(v8.3.4#803005)