Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
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