Consider the following Scala code:
abstract class A
abstract class B[T <: A]
class ConcreteA extends A
class ConcreteB extends B[ConcreteA]
class Example[U <: B[T], T <: A]( resolver: U )
object Test {
new Example( new ConcreteB )
}
The last line new Example( new ConcreteB ) fails to compile with the following error:
error: inferred type arguments [ConcreteB,Nothing] do not conform to class Example’s type parameter bounds [U <: B[T],T <: A]
But ConcreteB has all the necessary data to resolve both U and T. What am I missing here?
Kipton got close with his higher-kinded solution. Unfortunately he tripped over what appears to be a bug in Scala < 2.9.1.RC1. The following works as expected with 2.9.1.RC1 and trunk,