Add tests for obsolete issues

#KT-12126
 #KT-12189
 #KT-23628
 #KT-24209
 #KT-34338
 #KT-47279
 #KT-48498
This commit is contained in:
Alexander Udalov
2021-08-31 16:32:07 +02:00
committed by Space
parent 5c3ce66e99
commit d5372521f1
28 changed files with 400 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// IGNORE_BACKEND: JVM
interface Interface
operator fun Interface.invoke(): String = "OK"
class Class : Interface
object Holder {
val value = Class()
}
fun box(): String =
Holder?.value()!!
@@ -0,0 +1,13 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_STDLIB
abstract class Base {
@JvmField val name: String = "O"
@JvmField val Name: String = "K"
}
class Derived : Base()
fun box(): String =
Derived().name + Derived().Name
@@ -0,0 +1,22 @@
// SKIP_JDK6
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_STDLIB
// FULL_JDK
// PARAMETERS_METADATA
// KT-23628
class A @JvmOverloads constructor(x: String, y: Int = 42) {
@JvmOverloads
fun f(a: Long, b: Char = 'b') {}
}
fun box(): String {
val ctor = A::class.java.getDeclaredConstructor(String::class.java).parameters.toList()
if (ctor.toString() != "[java.lang.String x]") return "Fail constructor: $ctor"
val method = A::class.java.getDeclaredMethod("f", Long::class.java).parameters.toList()
if (method.toString() != "[long a]") return "Fail method: $method"
return "OK"
}
+8
View File
@@ -0,0 +1,8 @@
fun test() {
null?.run { return }
}
fun box(): String {
test()
return "OK"
}
@@ -0,0 +1,18 @@
// FILE: 1.kt
package x
operator fun String.provideDelegate(thisRef: Any?, prop: Any?) = this
operator fun String.getValue(thisRef: Any?, prop: Any?) = this
inline fun foo(): String {
val x by "OK"
return x
}
// FILE: 2.kt
import x.*
fun box(): String = foo()
@@ -0,0 +1,25 @@
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_IR_AGAINST_OLD
// FILE: a.kt
package test
open class A {
val v = "OK"
open inner class AA {
protected inline fun inAA(crossinline modifier: (String) -> String): String = modifier(v)
}
}
// FILE: b.kt
import test.*
class B : A() {
inner class BB : AA() {
fun test(): String = inAA { i -> i }
}
}
fun box(): String = B().BB().test()
@@ -0,0 +1,12 @@
// IGNORE_BACKEND: JVM
// KT-34338
fun main() {
}
fun main(args: Array<String?>) {
}
// 0 INVOKESTATIC DontGenerateOnNullableArrayKt\.main ()V