1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
object Test { def main(args: Array[String]): Unit = { println((new Foo: Baz).value) println((new Foo: Qux).value) } } class Foo extends Bar[Boolean](true) with Baz with Qux class Bar[T](x: T) { def value: T = x } trait Baz { def value: Boolean } trait Qux { def value: Boolean }