rta: limit the depth of types to avoid infinite loops