Developing Petr Pudlak’s explanation, here’s what I’m guessing : the compiler is trying to combine CC[A, B] with Thing[A, B <: Int] . According to the declaration of B in CC , B top binding of type Any , which is selected to instantiate B It is expected that B in Thing has Int a its top type binding, and the compiler will thus not be able to receive an error message.
This is necessary to maintain the stability of the type system, as shown in the following sketch. Suppose that Thing defines an operation based on the fact that its B <: Int , for example,
class Thing[A, B <: Int] { def f(b: B) = 2 * b }
If you declared Class as
class Class[CC[A,B]] { val c: CC }
and Test like
class Test extends Class[Thing] { val t: Thing }
without a compiler complaint, you can make the next call
new Test().tf(true)
which is obviously unsafe.
source share