Skip to content

Instantly share code, notes, and snippets.

@taku0
Created October 15, 2011 16:01
Show Gist options
  • Save taku0/1289761 to your computer and use it in GitHub Desktop.
Save taku0/1289761 to your computer and use it in GitHub Desktop.
Scalaでtypeをダイアモンド継承する際に綺麗に書けない
trait A {
type X <: AA
trait AA
}
trait B extends A {
type X <: AA with BB
trait BB
}
trait C extends A {
type X <: AA with CC
trait CC
}
trait D extends B with C {
type X <: AA with BB with CC // ここなんとかしたい
}
class E extends D {
type X = EE
val x = new X
class EE extends AA with BB with CC // ここも
}
trait A {
type X <: A.XX
}
object A {
trait XX extends AA
trait AA
}
trait B extends A {
type X <: B.XX
}
object B {
trait XX extends A.XX with BB
trait BB
}
trait C extends A {
type X <: B.XX
}
object C {
trait XX extends A.XX with CC
trait CC
}
trait D extends B with C {
type X <: D.XX
}
object D {
trait XX extends B.XX with C.XX
}
class E extends D {
type X = EE
val x = new X
class EE extends D.XX
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment