Remove tern leftovers

I've removed a great deal of dead code. The basic tern stuff remains in the `infer-type` branch, which we can merge back in once it actually works ;)