[Test] Add regression tests for issues which are fixed in K2

Related issues:
KT-10879, KT-18055, KT-20617, KT-23873
KT-25668, KT-31191, KT-33108, KT-41013
KT-51827, KT-53886, KT-56624, KT-58447
KT-58458, KT-58751, KT-58814, KT-60597
KT-62806, KT-63258, KT-63444, KT-65101
KT-65408, KT-65844, KT-66186

^KT-65926 Fixed
This commit is contained in:
Dmitriy Novozhilov
2024-02-28 12:13:45 +02:00
committed by Space Team
parent b875ae774e
commit 4b5eac7816
79 changed files with 1719 additions and 0 deletions
@@ -0,0 +1,27 @@
// LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// ISSUE: KT-52887
interface SnarkRoute {
context(PageContext)
fun route(route: String, block: context(PageContext, SnarkRoute) () -> Unit)
}
context(PageContext)
fun SnarkRoute.pagesFrom() {
route("") {
get {
}
}
}
data class PageContext(val context: String)
fun SnarkRoute.get(foo: ()-> Unit) {}
fun box(): String {
return "OK"
}
@@ -0,0 +1,10 @@
// WITH_STDLIB
// IGNORE_BACKEND_K1: JS_IR, JS_IR_ES6, WASM, NATIVE
// ISSUE: KT-62806
fun <T: Number> foo(x: Number) = x as? T ?: TODO()
val x: Int? = foo<Int>(1)
fun box(): String {
return if (x == 1) "OK" else "Fail: $x"
}
@@ -0,0 +1,25 @@
// IGNORE_BACKEND_K1: ANY
// WITH_STDLIB
// ISSUE: KT-63258
class MethodReferenceNPE() {
private val singleRef: () -> Unit =
1.let {
if (it == 0) {
{ }
} else {
this@MethodReferenceNPE::myMethod
}
}
private fun myMethod() {}
fun run() {
singleRef()
}
}
fun box(): String {
MethodReferenceNPE().run()
return "OK"
}