Hi,
Is it possible to have function which has two generic types and explicitly define only one type in call sites:
`
suspend fun <T, U> DataSource.mustHave(block: suspend T.() -> U): U =
((this as? T) ?: throw RuntimeException("Operation is not supported")).block()
`
and use it:
dataSource.mustHave<DataSource.HasAddOperation> { add(command) }
Logically it should be able to infer U type automatically, but if I'm specifying first type T compiler requires me to specify also U type.
eg.
dataSource.mustHave<DataSource.HasAddOperation, AddResult> { add(command) }
Is it possible to somehow declare that extension function in a way that U type be inferred automatically?