Fix var type inference2

Giving it another try.
I have another pull request for computing the sort of rewrite.
We're no longer looking for LUB. We want the maximum sort for overloaded operators. For rewrite this would be the context in which it is found.