This minimal example
interface Foo<T> {
fun foobinate(value: T)
}
interface Bar<T>
class AFoo<T> : Foo<T> {
override fun foobinate(value: T) {}
}
class ABar<T> : Bar<T>
fun <T> doSomething(foo: Foo<Bar<T>>, x: Bar<T>) {
foo.foobinate(x)
}
fun main() {
val foo = AFoo<ABar<Int>>()
doSomething(foo, ABar<Int>())
}
gives an error for the doSomething line:
Type mismatch: inferred type is AFoo<ABar<Int>> but Foo<Bar<Int>> was expected
Is there any way to make it work, or is there some conceptual thing standing in the way?