Add tests for obsolete issues

#KT-38804 Obsolete
 #KT-38801 Obsolete
 #KT-38835 Obsolete
 #KT-38737 Obsolete
 #KT-38664 Obsolete
 #KT-38549 Obsolete
 #KT-38766 Obsolete
 #KT-38714 Obsolete
This commit is contained in:
Mikhail Zarechenskiy
2020-08-11 10:11:47 +03:00
parent 7f4df19dd1
commit 2e131b870a
30 changed files with 503 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS
interface C<A : Any, B : Any> {
fun foo(a: A): B
companion object {
inline fun <reified A : Any, reified B : Any> inlinefun(crossinline fooParam: (A) -> B): C<A, B> {
return object : C<A, B> {
override fun foo(a: A) = fooParam(a)
}
}
}
}
data class A(val s: String) {
companion object : C<A, String> by C.inlinefun(
fooParam = { it.s }
)
}
class OtherB {
var a: String? = null
}
data class B(val a: A?) {
companion object : C<B, OtherB> by C.inlinefun(
fooParam = {
OtherB().apply {
a = it.a?.let(A::foo)
}
}
)
}
fun box(): String {
val b = B(A("OK"))
return B.foo(b).a ?: "fail"
}
@@ -0,0 +1,12 @@
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
fun foo(l: List<String>, vararg values: Any): Boolean =
l.any(values::contains)
fun box(): String {
if (!foo(listOf("OK"), "OK")) return "fail 1"
if (foo(listOf("none", "OK"))) return "fail 2"
return "OK"
}