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

SC: array length not available within closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.5.9, 3.0.0-rc-2
    • None
    • None

    Description

      Consider the following:

      class C {
        @groovy.transform.CompileStatic
        void meth(String[] strings) {
          strings.with {
            println length
          }
        }
      }
      

      Compiler currently emits error "The variable [length] is undeclared." because the object expression type is C and not String[] (see StaticTypeCheckingVisitor#existsProperty).

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: