【发布时间】:2012-01-27 10:39:16
【问题描述】:
观察以下代码
trait Example {
type O
def apply(o: O)
def f(o: O) = this.apply(o)
}
在 Scala 中编译得很好。我希望我可以像往常一样省略apply,写def f(o: O) = this(o)。但是,这会导致令人兴奋的错误消息
type mismatch; found : o.type (with underlying type Example.this.O)
required: _31.O where val _31: Example
possible cause: missing arguments for method or constructor
谁能给我解释一下这是怎么回事?
【问题讨论】: