mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
1. Scheme of capturing local variables not touched 2. Lowered local functions are transposed to the nearest class (including local) or file 3. Local classes are also transpose to the nearest class (including local) or file
30 lines
711 B
Kotlin
Vendored
30 lines
711 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// TARGET_BACKEND: JVM
|
|
// WITH_REFLECT
|
|
import kotlin.test.*
|
|
|
|
inline class S(val string: String)
|
|
|
|
fun test(s: S) {
|
|
class Local
|
|
|
|
val localKClass = Local::class
|
|
val localJClass = localKClass.java
|
|
|
|
val kName = localKClass.simpleName
|
|
// See https://youtrack.jetbrains.com/issue/KT-29413
|
|
// assertEquals("Local", kName)
|
|
if (kName != "Local" && kName != "test\$Local") throw AssertionError("Fail KClass: $kName")
|
|
|
|
assertTrue { localJClass.isLocalClass }
|
|
|
|
val jName = localJClass.simpleName
|
|
if (jName != "Local" && jName != "test\$Local") throw AssertionError("Fail java.lang.Class: $jName")
|
|
}
|
|
|
|
fun box(): String {
|
|
test(S(""))
|
|
|
|
return "OK"
|
|
}
|