[
https://issues.apache.org/jira/browse/GROOVY-8169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16000789#comment-16000789
]
Eric Milles commented on GROOVY-8169:
-------------------------------------
For one, code editors get the wrong picture of the source. In the Eclipse IDE,
this extra bit prevents code hover and select on the type in the for statement.
> 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
>
> {{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
(v6.3.15#6346)