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

SC: array length not available within closure

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.9, 3.0.0-rc-2
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: