Skip to content

Instantly share code, notes, and snippets.

@frozenspider
Last active November 21, 2015 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frozenspider/938991752d59d07927db to your computer and use it in GitHub Desktop.
Save frozenspider/938991752d59d07927db to your computer and use it in GitHub Desktop.
self-recursive-type-failure.scala
trait Foo { self =>
type SelfType <: Foo {
type SelfType = self.SelfType
}
}
// SelfType points to its child type
trait FooExtLvl1 extends Foo {
type SelfType = FooExtLvl2
}
// SelfType points to own type
trait FooExtLvl2 extends FooExtLvl1
// SelfType points to its parent type
trait FooExtLvl3 extends FooExtLvl2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment