move type inference into parsing, so we have typings for partially parsed programs. Fix exception message generation