mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +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.
25 lines
537 B
Kotlin
Vendored
25 lines
537 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS
|
|
// FILE: bar.kt
|
|
|
|
@file:JvmName("Util")
|
|
@file:JvmMultifileClass
|
|
public fun bar(): String = barx()
|
|
|
|
public fun foox(): String = "O"
|
|
|
|
// FILE: foo.kt
|
|
|
|
@file:JvmName("Util")
|
|
@file:JvmMultifileClass
|
|
public fun foo(): String = foox()
|
|
|
|
public fun barx(): String = "K"
|
|
|
|
// @Util.class:
|
|
// 1 public final class Util extends Util__FooKt
|
|
// 0 public final static foo\(\)
|
|
// 0 public final static foox\(\)
|
|
// 0 public final static bar\(\)
|
|
// 0 public final static barx\(\)
|