type inference on branches