Add test for Obsolete issues

#KT-15956 Obsolete
 #KT-15751 Obsolete
 #KT-16417 Obsolete
 #KT-21787 Obsolete
This commit is contained in:
Mikhael Bogdanov
2019-01-08 10:00:08 +01:00
parent 6a19e45e27
commit 9a059809bf
17 changed files with 262 additions and 0 deletions
@@ -0,0 +1,34 @@
// FILE: 1.kt
// IGNORE_BACKEND: JS
// WITH_RUNTIME
public inline fun <T> T.myalso(block: (T) -> Unit): T {
block(this)
return this
}
public inline fun <T, R : Any> Iterable<T>.mymapNotNull(transform: (T) -> R?): List<R> {
return mapNotNullTo(ArrayList<R>(), transform)
}
// FILE: 2.kt
// NO_CHECK_LAMBDA_INLINING
var result = -1;
fun box(): String {
fff()
return if (result == 1) "OK" else "fail $result"
}
fun fff(): Int {
val y = 0
return 0.myalso {
fun increase(x: Int): Int = x + y
val values = listOf(1).mymapNotNull { something(::increase, it) }
result = values[0]!!
}
}
fun something(increase: (Int) -> Int, x: Int): Int? {
return increase(x)
}