Files
kotlin-fork/compiler/testData/diagnostics/tests/delegatedProperty/inference/nestedPartiallyResolvedCallsSimple.kt
T
Denis.Zharkov 555d8eeb25 K2: Fix false-positive DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
For explanation, see nestedPartiallyResolvedCallsSimple.k

The problem was caused by "select" variable is being leaked to the
inference session of delegate while it should not happen because
it doesn't belong to the common system of `KotlinVal { ..` call,
as we complete it with fixing `E` variable during completion
for `A(select(null, fun(): Int { return 1 }))`.

The root of the problem is that we were adding all the partial
nested calls to the session, while in fact we only need there
the top-level one.

^KT-57543 Fixed
2023-04-28 16:20:06 +02:00

17 lines
325 B
Kotlin
Vendored

// FIR_IDENTICAL
// ISSUE: KT-57543
class KotlinVal<T>(initializer: () -> T) {
operator fun getValue(instance: Any?, metadata: Any?): T = TODO()
}
class A(
myType: (() -> Int)?
) {
val arguments: A by KotlinVal {
A(select(null, fun(): Int { return 1 }))
}
}
fun <E> select(e: E, f: E): E = TODO()