Zac Sweers
12/23/2020, 9:18 PMdmitriy.novozhilov
12/24/2020, 8:06 AMVictor Petukhov
12/24/2020, 8:45 AMinterface Foo
fun <T : Foo> foo(x: () -> T) {}
fun <T> materialize(): T = TODO()
fun <T : Foo> bar(): T {}
fun testing() {
val x = foo(materialize()) // "Not enough information to infer parameter T" should be reported too
val y = bar() // "Not enough information to infer parameter T" is already reported
}
Please use some explicit source of type to infer a type parameter. For materialization-like functions you can specify an expected type or type argument:
fun testing() {
val y: Foo = bar() // OK
// or
val z = bar<Foo>() // OK
}
Zac Sweers
12/24/2020, 8:49 AM