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