Unify the code in type_resolve and resolve_standard.