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

STC: closure param type inference for array and list

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment