Eric Milles created GROOVY-11399: ------------------------------------ Summary: STC: inferred type of closure delegate, owner and thisObject Key: GROOVY-11399 URL: https://issues.apache.org/jira/browse/GROOVY-11399 Project: Groovy Issue Type: Bug Components: Static Type Checker Reporter: Eric Milles Assignee: Eric Milles
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 -- This message was sent by Atlassian Jira (v8.20.10#820010)