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

List literal type inference does not take its context into account

    XMLWordPrintableJSON

Details

    Description

      bug.groovy
      def methodAcceptingListOfObjects(List<Object> lo) {}
      
      @groovy.transform.CompileStatic
      def usage() {
          methodAcceptingListOfObjects([1, 2, 3]) 
      }
      

      Compilation fails with

      [Static type checking] - Cannot call #methodAcceptingListOfObjects(java.util.List <java.lang.Object>) with arguments [java.util.List <java.lang.Integer>]
      

      Attachments

        Activity

          People

            emilles Eric Milles
            daniilo Daniil Ovchinnikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: