Skip to content

Instantly share code, notes, and snippets.

@jamie-allen
Created December 6, 2013 22:54
Show Gist options
  • Save jamie-allen/7833551 to your computer and use it in GitHub Desktop.
Save jamie-allen/7833551 to your computer and use it in GitHub Desktop.
How to bypass Scala trait linearization
scala> trait A { def p: Unit }
defined trait A
scala> trait B extends A { def p = println("b") }
defined trait B
scala> trait C extends A { def p = println("c") }
defined trait C
scala> class D extends B with C { override def p = { super[B].p } }
defined class D
scala> new D().p
b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment