Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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:
@CompileStatic def m() { List<String> strings = ... for (String s in strings) { } }
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.
Attachments
Issue Links
- links to