You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2023/05/26 09:57:00 UTC

[jira] [Created] (GROOVY-11073) Cannot infer type of parameterized method when dealing with arrays

Thodoris Sotiropoulos created GROOVY-11073:
----------------------------------------------

             Summary: Cannot infer type of parameterized method when dealing with arrays
                 Key: GROOVY-11073
                 URL: https://issues.apache.org/jira/browse/GROOVY-11073
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following code

{code}
class Main {
  static final void test() {
    double[] x = Tuple.tuple(org.codehaus.groovy.runtime.ArrayGroovyMethods.max((double[][]) null, { -> 1 })).getV1();
  }
}
{code}

h3. Actual behavior

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 3: [Static type checking] - Cannot assign value of type (java.io.Serializable or java.lang.Cloneable) to variable of type double[]
 @ line 3, column 18.
       double[] x = Tuple.tuple(org.codehaus.groovy.runtime.ArrayGroovyMethods.max((double[][]) null, { -> 1 })).getV1();
                    ^

1 error
{code}

h3. Expected behavior

Compile successully

Tested against master (commit: 73c0f12ab35427bc3e7fd76929b482df61e1b80d)



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