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 2023/10/02 22:34:00 UTC
[jira] [Commented] (GROOVY-11185) each after transpose with 2 arguments does not compile
[ https://issues.apache.org/jira/browse/GROOVY-11185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17771291#comment-17771291 ]
Paul King commented on GROOVY-11185:
------------------------------------
I agree it does look unexpected but the transpose method doesn't have any type information that the static compiler could use, so maybe we do extra checks now. In any case, it looks related to GROOVY-11090.
Workaround is to not use @CompileStatic.
> each after transpose with 2 arguments does not compile
> ------------------------------------------------------
>
> Key: GROOVY-11185
> URL: https://issues.apache.org/jira/browse/GROOVY-11185
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.19
> Reporter: Mauro Ciancio
> Priority: Minor
> Labels: CompileStatic
>
> Hi there, this code compiled up until groovy 3.0.18, in 3.0.19 stopped compiling:
> {code:java}
> @groovy.transform.CompileStatic
> class Prueba {
> public static void main(String[] args) {
> [
> [1],
> ['a'],
> ].transpose().each { int a, String b ->
> println(a)
> println(b)
> }
> }
> }
> {code}
>
> {code:java}
> $ groovy Prueba.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> /home/becho/Prueba.groovy: 9: Incorrect number of parameters. Expected 1 but found 2
> @ line 9, column 22.
> ].transpose().each { int a, String b ->
> ^1 error
> {code}
>
> Is this an expected behavior? Or something got broken along the way?
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)