Pair type inference improved