Add a loop {} construct for infinite loops, and use it in test cases. See #1906 for details.
It would fail to start out with a fresh scope when going over a loop or block function for the second time, and thus not recognize last uses of locals defined inside the block. Closes #1818