Subtle name-resolution bug in resolving the parameters of for-loops, and a regression test to make sure we don't make this mistake in the future.  Basically, the values being bound as the initial values to the looped function should be resolved in the environment outside the loop, while the names of the parameters are accumulated to provide the environment inside the loop.