我想重写ScalaTest特征BeforeAndAfterEach来为所有测试实现一次这些东西。最后我把它编译出来,但我不明白为什么。 trait MySetup extends BeforeAndAfterEach {
this : org.scalatest.BeforeAndAfterEach with org.scalatest.Suite =>
var service
可能重复: What is the difference between scala self-types and trait subclasses? 我明白了一个自我注解作为承诺的编译器,其中编程器体现一个特征将与注释之一混入。例如: scala> trait X
defined trait X
scala> trait Y { this: X => }
defined trait Y
scala> class A
defined class A
scala> class B {this: A => }
defined class B
scala> new B
<console>:10: error: class B cannot be instantiated because it does not conform
to its self-type B with