Fix var type inference2

Giving it another try.
Why do you have to do this?  Haven't we agreed that for each term you should pick the largest sort that it can have in its context?