A lot of people seem to not know this. In particular 90% of use of self types I’ve seen appear to exist solely because people do not know this.
Observe the following interpreter session:
scala> class Foo; defined class Foo scala> class Bar; defined class Bar scala> trait Stuff extends Foo; defined trait Stuff scala> new Foo with Stuff; res0: Foo with Stuff = $anon$1@148b272 scala> new Bar with Stuff; <console>:8: error: illegal inheritance; superclass Bar is not a subclass of the superclass Foo of the mixin trait Stuff new Bar with Stuff; ^
You can basically view this as putting a constraint on the trait, saying that all classes that implement this trait must extend this superclass. This can be particularly useful for adding various sorts of behaviour to classes. e.g. traits which add behaviours to GUI components.
Thus ends our public service announcement.