Fix for KT-7490: Bad bytecode generated by delegates and lambdas
#KT-7490 Fixed
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user