You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/08/12 12:56:00 UTC

[jira] [Closed] (GROOVY-8169) StaticCompilationVisitor.visitForLoop sets Parameter origin type, which prevents access to original source type and location

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

Paul King closed GROOVY-8169.
-----------------------------

> StaticCompilationVisitor.visitForLoop sets Parameter origin type, which prevents access to original source type and location
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8169
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8169
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>            Reporter: Eric Milles
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.5.8, 3.0.0-beta-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {{StaticCompilationVisitor.visitForLoop}} has call to {{forLoop.getVariable().setOriginType(componentType)}}.  I think this call is unnecessary as the inferred type is set on the previous line.  By replacing the origin type, it is no longer possible to determine the uninferred type of the parameter or the source location of the ClassNode.  Additionally, I think the semantics of origin type is not being preserved by overwriting the value.
> Example:
> {code}
> @CompileStatic
> def m() {
>   List<String> strings = ...
>   for (String s in strings) {
>   }
> }
> {code}
> In this example, the second occurrence of String is replaced in the AST by the first and so the source position of the ClassNode after "for" and before "s" is lost.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)