See comments I made in ExpressionCompiler. I think it's easiest if you calculate the data type there and pass it through the constructor here.