mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
Preserve static initialization semantics for parts by introducing a special "clinit trigger" class.
Insert "static initialization trigger" call to every method of a part class, remove this call on inline.
Always mangle names for private functions in multifile class parts to avoid resolution clashes on inheritance.
NB in codegen tests initializers for all non-const vals are wrapped in 'run { ... }',
so that the initializer is not a constant expression, and some static initialization code should be generated.
27 lines
397 B
Kotlin
Vendored
27 lines
397 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS
|
|
// FILE: box.kt
|
|
|
|
import a.*
|
|
|
|
fun box(): String = J.ok()
|
|
|
|
// FILE: part1.kt
|
|
@file:[JvmName("MC") JvmMultifileClass]
|
|
package a
|
|
|
|
val O = run { "O" }
|
|
const val K = "K"
|
|
|
|
inline fun ok(): String {
|
|
return O + K
|
|
}
|
|
|
|
// FILE: J.java
|
|
import a.MC;
|
|
|
|
public class J {
|
|
public static String ok() {
|
|
return MC.ok();
|
|
}
|
|
} |