You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2024/06/05 21:32:00 UTC

[jira] [Updated] (GROOVY-11399) STC: inferred type of closure delegate, owner and thisObject

     [ https://issues.apache.org/jira/browse/GROOVY-11399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-11399:
---------------------------------
    Fix Version/s: 3.0.22
                   4.0.22

> 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
>            Priority: Major
>             Fix For: 3.0.22, 5.0.0-alpha-9, 4.0.22
>
>
> 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)