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

Static type checker should not register errors for ellipsis closure parameter annotated with @DelegatesTo

    XMLWordPrintableJSON

Details

    Description

      def with(@DelegatesTo.Target Object target, @DelegatesTo(strategy = Closure.DELEGATE_FIRST) Closure... arg) {
          for (Closure a : arg) {
              a.delegate = target
              a.resolveStrategy = Closure.DELEGATE_FIRST
              a()
          }
      }
      
      @CompileStatic
      def test() {
          with(a:2) {
              print(get('a')) //false positive error
          } {
              print(get('a')) //false positive error
          }
      }
      
      test()
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              mxm-groovy Maxim Medvedev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: