mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
Add new test on receiver clash during default lambda inlining
This commit is contained in:
22
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt
vendored
Normal file
22
compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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 = { this }): String {
|
||||
return {
|
||||
"$value ${this} ${lambda()}"
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
//WITH_RUNTIME
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val result = with(A("VALUE")) { "OK".inlineFun() }
|
||||
return if (result == "VALUE OK OK") "OK" else "fail 1: $result"
|
||||
}
|
||||
Reference in New Issue
Block a user