是否可以在下面的代码中做我想做的事情:
class Foo extends SomeClass
class Bar extends SomeClass
def f[A<:SomeClass,B<:SomeClass](a:A,b:B):B = b
val a = new Foo
val b = new Bar
scala> Map[String,(_<:SomeClass)=>(_<:SomeClass)]("key"->f(a,b))
<console>:15: error: type mismatch;
found : Bar
required: Function2[_ <: SomeClass, _ <: SomeClass, _ <: SomeClass]
Map[String,(_<:SomeClass,_<:SomeClass)=>(_<:SomeClass)]("key"->fun(a, b))
^