Your declaration already works as supposed to, i.e. you're restricting the type of T as well as Key and Value. The way you've written it, however, scala will complain if you issue something like
scala> class Foo[T <: OtherT, Key[T], Value[T]] defined class Foo scala> new Foo[SpecialOtherT, Key[SpecialOtherT], Value[SpecialOtherT]] <console>:13: error: Key[SpecialOtherT] takes no type parameters, expected: one new Foo[SpecialOtherT, Key[SpecialOtherT], Value[SpecialOtherT]]
because the types of both Key and Value are already given by your former declaration. Hence this will work
scala> new Foo[SpecialOtherT, Key, Value] res20: Foo[SpecialOtherT,Key,Value] = Foo@3dc6a6fd
which is probably not want you want. You could do it like this
scala> class Foo[T <: OtherT, K <: Key[T], V <: Value[T]] defined class Foo scala> new Foo[SpecialOtherT, Key[SpecialOtherT], Value[SpecialOtherT]] res21: Foo[SpecialOtherT,Key[SpecialOtherT],Value[SpecialOtherT]] = Foo@7110506e
At the bottom line, since the types of Key and Value depend solely on T it is somewhat superfluous to have all that redundant information when working with Foo. So why not use an inner type declaration like so:
class Foo[T <: OtherT] { type K = Key[T] type V = Value[T] }
Then you'd have access to types K and V from within the class but wouldn't need to type it everytime you create a new answer:
scala> new Foo[SpecialOtherT] res23: Foo[SpecialOtherT] = Foo@17055e90 scala> new Foo[Int] <console>:11: error: ...