Why the distinct logic for classes? What happens if there is a self-type? Please, add a test for this :-)