Move expression type inference into a separate module