Consider the following Scala code:
abstract class A
abstract class B[T <: A]
class ConcreteA extends A
class ConcreteB extends B[ConcreteA]
class Example
I have composed a document of type inference workarounds on GitHub for my own learning.
A few simple rules that I find useful are:
Type parameters of type parameters cannot be inferred: Scala type inference only sees types specified in the parameter list (not to be confused with type parameter list).
Previous parameters are not used to infer future parameters: Type information only flows across parameter lists, not parameters.
However, in this particular example type members are the way forward (thanks @Kipton Barros!)