Fix var type inference2

Giving it another try.
this feels skeevy to me. Eventually we will want to compute all sort information immutably instead of setting it manually everywhere. Can you explain why Rewrite.computeSort isn't good enough for you, and why, if it does not behave correctly, it can't simply be changed?