19 lines
737 B
Kotlin
Vendored
19 lines
737 B
Kotlin
Vendored
// !LANGUAGE: +NewInference
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
interface MemoizedFunctionToNotNull<K, V>
|
|
|
|
fun <K, V : Any> createMemoizedFunction(compute: (K) -> V): MemoizedFunctionToNotNull<K, V> = TODO()
|
|
|
|
interface A
|
|
|
|
interface TypeConstructor
|
|
|
|
class Refiner {
|
|
val memoizedFunctionLambda = createMemoizedFunction { it.foo() } // error type infered, no diagnostic, BAD, backend fails
|
|
val memoizedFunctionReference = createMemoizedFunction(<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>TypeConstructor::foo<!>) // EXTENSION_IN_CLASS_REFERENCE_IS_NOT_ALLOWED, fine
|
|
val memoizedFunctionTypes = createMemoizedFunction<TypeConstructor, Boolean> { it.foo() } // works fine
|
|
|
|
private fun TypeConstructor.foo(): Boolean = true
|
|
}
|