Files
Denis.Zharkov e359db4111 K2: Set proper source for implicit it/receiver parameter
Previously, error types on those implicit parameters were being lost.

Changed test data is only partly here
(only parts that are considered to be correct).

Other ones (new green-to-red changes) should belong to the next commit
and will be fixed soon (as a part of PCLA).
2024-01-11 10:32:12 +00:00

18 lines
836 B
Kotlin
Vendored

// !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 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>createMemoizedFunction<!> <!CANNOT_INFER_PARAMETER_TYPE!>{ it.foo() }<!> // error type infered, no diagnostic, BAD, backend fails
val memoizedFunctionReference = createMemoizedFunction(TypeConstructor::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>foo<!>) // EXTENSION_IN_CLASS_REFERENCE_IS_NOT_ALLOWED, fine
val memoizedFunctionTypes = createMemoizedFunction<TypeConstructor, Boolean> { it.foo() } // works fine
private fun TypeConstructor.foo(): Boolean = true
}