0
scala> trait Foo
defined trait Foo
scala> trait Bar[+V <: Foo]
defined trait Bar
scala> trait Baz[+V <: Foo] {
| def print[W >: V](bar: Bar[W]) = println("hello bar")
| }
<console>:10: error: type arguments [W] do not conform to trait Bar's type parameter bounds [+V <: Foo]
def print[W >: V](bar: Bar[W]) = println("hello bar")
scala> trait Baz[+V <: Foo] {
| def print[W >: V <: Foo](bar: Bar[W]) = println("hello bar")
| }
defined trait Baz
任何人都可以解释为什么[W >: V]
不工作?以及如何使其工作?为什么最后一个案例正在起作用类型参数不符合特性Bar的类型参数边界
这与您的[早期问题](http://stackoverflow.com/questions/28383284/type-arguments-w-do-not-conform-to-trait-type-parameter-bounds)有什么不同? – 2015-02-07 20:32:27
阿尼希,是否为你解决了一些问题? – AmigoNico 2015-04-27 12:54:47