Add new test on receiver clash during default lambda inlining
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
class A(val value: String) {
|
||||
|
||||
inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambda: () -> String = { this }): String {
|
||||
return {
|
||||
"$value ${this} ${lambda()} ${dlambda()}"
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
//WIH_RUNTIME
|
||||
import test.*
|
||||
|
||||
fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) }
|
||||
|
||||
fun box(): String {
|
||||
val result = "TEST".test()
|
||||
return if (result == "VALUE INLINE TEST INLINE") "OK" else "fail 1: $result"
|
||||
}
|
||||
Reference in New Issue
Block a user