Compute types of expression with primitives