7
的不允许混鉴于:特殊性状
trait Foo
trait Bar { this: Foo => }
trait NoBar { this: Foo => }
有没有一种方式可以欺骗类型系统分为禁止:
new Foo with Bar with NoBar {}
的不允许混鉴于:特殊性状
trait Foo
trait Bar { this: Foo => }
trait NoBar { this: Foo => }
有没有一种方式可以欺骗类型系统分为禁止:
new Foo with Bar with NoBar {}
和类型擦除节省了再次的日子:
trait Foo
trait Dummy[A]
trait Bar extends Dummy[Bar]{ this: Foo => }
trait NoBar extends Dummy[NoBar]{ this: Foo => }
new Foo with Bar with NoBar {}
这会导致以下错误:
illegal inheritance; anonymous class $anon inherits different
type instances of trait Dummy: Dummy[Bar] and Dummy[NoBar]