K1/K2: add reproducers for KT-66229, KT-66243 and KT-66272

As all these issues aren't reproducible in K2, we may count them as fixed.
Related to KT-53478
#KT-66229 Fixed
#KT-66243 Fixed
#KT-66272 Fixed
This commit is contained in:
Mikhail Glukhikh
2024-03-01 15:16:27 +01:00
committed by Space Team
parent b43f69364b
commit 5ea6f20192
32 changed files with 596 additions and 0 deletions
@@ -0,0 +1,24 @@
// WITH_STDLIB
// ISSUE: KT-66229
// IGNORE_BACKEND_K1: ANY
// Reason: Could not load module <Error module>
fun foo() {
buildMap {
for (v in this) {
put(1, 1)
}
}
}
fun bar() {
buildMap {
mapValues { (key: Int, value: String) -> "1" }
}
}
fun box(): String {
foo()
bar()
return "OK"
}
@@ -0,0 +1,25 @@
// ISSUE: KT-66243
// IGNORE_BACKEND_K1: ANY
// Reason: Could not load module <Error module>
class A<T>
class Test<T> {
fun add(a: T) {}
var lambdaInVariable: ((A<T>) -> Unit)? = null
}
fun <T> builder(x: Test<T>.() -> Unit): Test<T> {
return Test<T>().apply(x)
}
fun check() {
val x = builder {
add(1)
lambdaInVariable = {}
}
}
fun box(): String {
check()
return "OK"
}
@@ -0,0 +1,25 @@
// FIR_IDENTICAL
// ISSUE: KT-66272
// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6, WASM, NATIVE
// Reason: Could not load module <Error module>
data class DataClass(val data: String)
fun box(): String {
A.create {
it.group().apply(it, ::DataClass)
}
return "OK"
}
open class A<O, F> {
open fun group(): A<F, String> {
return null!!
}
fun <R> apply(instance: A<O, *>, function: (F) -> R): A<O, R> {
return null!!
}
companion object {
fun <T> create(a: (A<T, T>) -> A<T, T>) {}
}
}