Created
October 15, 2011 16:01
-
-
Save taku0/1289761 to your computer and use it in GitHub Desktop.
Scalaでtypeをダイアモンド継承する際に綺麗に書けない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 // ここも | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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