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

STC: closure param type inference for array and list

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.12
    • 3.0.18, 4.0.13
    • Static Type Checker
    • None

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      void test() {
        (new String[]{'a','b'}).with { a, b -> } // throws MissingMethodException
        ['a','b'].with { a, b -> } // param count error
      }
      test()
      

      1. STC thinks it can spread array elements across closure parameters, but this does not work.
      2. STC thinks it cannot spread list elements across closure parameters, which does work (if length check is lifted).

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: