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

SC: closure with default argument(s)

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      Consider the following:

      @groovy.transform.CompileStatic
      void test() {
        def c = { p = 'foo' -> return p }
        assert c('bar') == 'bar'
        assert c() == 'foo'
      
        c = { p, q = 'baz' -> return '' + p + q }
        assert c('foo', 'bar') == 'foobar'
        assert c('foo') == 'foobaz'
      }
      test()
      

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              emilles Eric Milles

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment