Handle class constraints on types of arbitrary depth correctly.