Fix PR7658, a problem where type refinement can trigger