K2: Run completion-writer related PCLA tasks for irregular call kinds

- For synthetic calls
- For delegated constructor calls

Also, I checked that for each toResolvedReference() (beside annotations)
that converts candidate to the resolved reference,
we run `runPCLARelatedTasksForCandidate()` in the same context.

^KT-65103 Fixed
This commit is contained in:
Denis.Zharkov
2024-01-22 18:48:53 +01:00
committed by Space Team
parent 438c55756f
commit ca80ddb8ca
25 changed files with 569 additions and 6 deletions
@@ -0,0 +1,16 @@
// ISSUE: KT-65103
interface Consumer<in T>
public fun <T> buildConsumer(
block: (Consumer<T>) -> Unit
): Any? = "OK"
fun expectConsumerString(x: Consumer<String>) {}
abstract class A(val x: Any?)
class B : A(buildConsumer {
expectConsumerString(it)
})
fun box(): String = B().x as String
@@ -0,0 +1,18 @@
// ISSUE: KT-65103
interface Consumer<in T>
public fun <T> buildConsumer(
b: Boolean,
block: (Consumer<T>) -> Unit
): T? = if (b) ("O" as T) else null
public fun <T> materialize(): T = "K" as T
fun expectConsumerString(x: Consumer<String>) {}
fun elvis(b: Boolean) =
buildConsumer(b) {
expectConsumerString(it)
} ?: materialize()
fun box(): String = elvis(true) + elvis(false)
@@ -0,0 +1,29 @@
// ISSUE: KT-65103
interface Consumer<in T>
public fun <T> buildConsumer(
block: (Consumer<T>) -> Unit
): T = "O" as T
public fun <T> materialize(): T = "K" as T
fun expectConsumerString(x: Consumer<String>) {}
fun foo1(x: Boolean) = when {
x -> buildConsumer {
expectConsumerString(it)
}
else -> materialize()
}
fun foo2(x: Boolean) =
if (x)
buildConsumer {
expectConsumerString(it)
}
else
materialize()
fun box(): String {
return foo1(true) + foo2(false)
}
@@ -0,0 +1,16 @@
// ISSUE: KT-65103
interface Consumer<in T>
public fun <T> buildConsumer(
block: (Consumer<T>) -> Unit
): T = "OK" as T
fun expectConsumerString(x: Consumer<String>) {}
fun box() =
try { // This try is essential
buildConsumer {
expectConsumerString(it)
}
} finally {
}