Sample code to re-create the problem...
NOTE: Only happens when trying to run in 'Rapid Debug' mode.
In Rapid Debug this code will fail to compile with the following error message
In both Legacy Debug and Release mode it will compile without error and run just fine on the device.
PS. I'm pretty careful to always fully declare my variables and only fell foul of this whilst modifying someone else's code. The sample above is meaningless and purely for the purpose of recreating the error.
B4X:
Sub Activity_Create(FirstTime As Boolean)
For X = 0 To 5
Log(X)
Next
For Y = 0 To 5
Dim X As Int = Y
Log(X)
Next
End Sub
NOTE: Only happens when trying to run in 'Rapid Debug' mode.
In Rapid Debug this code will fail to compile with the following error message
"An error occurred.
Error compiling program.
Current declaration does not match the previous one. Make sure to declare the variable before it is used in a For loop.
Occurred on Line: 27
Dim X As Int = Y"
In both Legacy Debug and Release mode it will compile without error and run just fine on the device.
PS. I'm pretty careful to always fully declare my variables and only fell foul of this whilst modifying someone else's code. The sample above is meaningless and purely for the purpose of recreating the error.