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
This commit is contained in:
Denis.Zharkov
2023-04-21 14:41:40 +02:00
parent 8b81c3715d
commit 555d8eeb25
12 changed files with 122 additions and 7 deletions
@@ -30,7 +30,7 @@ internal class TowerDataElementsForName2() {
internal class TowerDataElementsForName3() {
val reversedFilteredLocalScopes by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>lazy<!>(LazyThreadSafetyMode.NONE) {
@OptIn(ExperimentalStdlibApi::class)
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> l1@ {
buildList l1@ {
for (i in lastIndex downTo 0) {
val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
@OptIn(ExperimentalStdlibApi::class)
@@ -30,7 +30,7 @@ internal class TowerDataElementsForName2() {
internal class TowerDataElementsForName3() {
val reversedFilteredLocalScopes by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>lazy<!>(LazyThreadSafetyMode.NONE) {
@OptIn(ExperimentalStdlibApi::class)
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> l1@ {
buildList l1@ {
for (i in lastIndex downTo 0) {
val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) {
@OptIn(ExperimentalStdlibApi::class)