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

STC: inferred type of closure delegate, owner and thisObject

    XMLWordPrintableJSON

Details

    Description

      The inferred type of "delegate", "owner", "thisObject", "getDelegate()", "getOwner()" and "getThisObject()" within a closure has a few problems.

      1) All should infer to Class<Type> when in a static context (and no nesting or delegation metadata is present).

      2) getOwner() and getThisObject() infer to the enclosing type regardless of the object expression when inside a closure. And the same for getDelegate() if no delegation metadata is found.

      3) getOwner() and getDelegate (if no delegation metadata is found) should infer to Closure within a nested closure block. StaticTypeCheckingVisitor#visitVariableExpression does this for "owner" and "delegate".
       
      GROOVY-5470, GROOVY-6091, GROOVY-9604

      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: