fix for loop desugaring to allow type checking when declaring variables inside the loop