refactor TypeChecker::resolveTypes()