Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-11073

Cannot infer type of parameterized method when dealing with arrays

    XMLWordPrintableJSON

Details

    Description

      I have the following code

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

      Actual behavior

      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
      

      Expected behavior

      Compile successully

      Tested against master (commit: 73c0f12ab35427bc3e7fd76929b482df61e1b80d)

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              theosot Thodoris Sotiropoulos
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: