【发布时间】:2013-03-23 22:16:45
【问题描述】:
我有以下案例类:
case class Alert[T <: Transport](destination: Destination[T], message: Message[T])
在 Scala 2.9.2 中,以下方法签名编译得很好:
def send(notification: Alert[_]) {
notification match {
...
}
}
现在在 Scala 2.10.1 中编译失败并出现以下错误:
type arguments [_$1] do not conform to class Alert's type parameter bounds [T <: code.notifications.Transport]
这是为什么?如何修复错误?简单地给send 赋予相同的类型边界会导致更多的编译错误......
更新:看看SIP-18,我不认为原因是我没有启用存在类型,因为 SIP-18 说它只需要非通配符类型,这正是我在这里所拥有的。
【问题讨论】:
标签: scala scala-2.10 scala-2.9