I did not try to figure out exactly what happened yet but based on the side effect, this typo caused a. considerable chunk of your code to become unreachable. Was this loop around most of the code in your program (including function calls, of course)?
It is not related to scoping at all. The error resulted in the compiler determining a lot of code was unreachable so it simply removed it.
In fact, what is happening here is actually pretty easy to explain. Without the ++, the loop is an infinite one. So the compiler knows that once it reaches it, no code that was not used before it will ever be executed so it simply elided all that code.