Make convertToComprehensions work on typed trees.

- Type information is correctly propagated through convertToComprehensions

- Move assignTypes phase up before convertToComprehensions