Fix for KT-7490: Bad bytecode generated by delegates and lambdas

#KT-7490 Fixed
This commit is contained in:
Michael Bogdanov
2015-05-09 14:36:22 +03:00
parent aed6ed0f9b
commit d6964525b2
9 changed files with 148 additions and 22 deletions
@@ -0,0 +1,7 @@
//NO_CHECK_LAMBDA_INLINING
//KT-7490
import test.*
fun box(): String {
return Entity("OK").directed().calc().value
}
@@ -0,0 +1,18 @@
package test
open class Entity(val value: String)
public abstract class Task<T>() {
abstract fun calc(): T
}
fun <Self : Entity> nullableTask(factory: () -> Task<Self>): Task<Self> {
return factory()
}
inline fun<reified Self : Entity> Self.directed(): Task<Self> =
nullableTask {
object : Task<Self>() {
override fun calc(): Self = this@directed
}
}