Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329554

Summary: Issue with i implicit and explicit i counters in for loops
Product: [Modeling] Acceleo Reporter: Yvan Lussaud <yvan.lussaud>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stephane.begaudeau, vlad.gheorghe
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Yvan Lussaud CLA 2010-11-05 11:04:43 EDT
Writing the following code in a module create an error about i variable not defined :

[for (Sequence{0..4})]
[i/]
[/for]
[for (i : Integer | Sequence{0..4})]
[i/]
[/for]

-----------------------

To fix this do not call a for variable i :

[for (Sequence{0..4})]
[i/]
[/for]
[for (Sequence{0..4})]
[i/]
[/for]

or

[for (Sequence{0..4})]
[i/]
[/for]
[for (j : Integer | Sequence{0..4})]
[j/]
[/for]

regards,
Yvan.
Comment 1 Vlad Gheorghe CLA 2011-04-02 18:38:13 EDT
First, do we agree that this is a real bug ?

May I suggest to change the "i" to something less common, which also states that is an acceleo extension, like 
"acceleoCurrentIteration"
Comment 2 Stephane Begaudeau CLA 2011-04-04 04:21:03 EDT
It is indeed a real bug but we will not change "i" for something else because it would potentially break the compatibility with acceleo module already created.

A patch has been contributed. The "i" variable should not create problems with an iteration variable named "i" anymore. The fix has been contributed on HEAD, it will be available for Acceleo 3.1 M7.

4 unit tests have been contributed to ensure that compilation errors do not re-appear.