Fix for #1507: Don't forget to remember the current for loop in optimisations
Updated test for #1507: Backend error:"cannot find symbol" caused by spurious final local variable used for assignment outside of its scope