mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
Without the `-Xmultifile-parts-inherit` mode for now. This is implemented as follows: FileClassLowering collects information about multifile parts and the corresponding facades, which a later GenerateMultifileFacades phase uses to generate new IrFile instances and add it to the module fragment that's being compiled. Note that GenerateMultifileFacades is in the end of lowering phases because delegates in the facade should be generated for all additional functions generated by certain lowerings (default arguments, JvmOverloads, etc.). If GenerateMultifileFacades was right after FileClassLowering, they would still be generated, but we'd then process them in lowerings mentioned above, which would result in duplicated logic in the bytecode. There's a new bytecode text test which checks that this doesn't happen for functions with default arguments.
20 lines
352 B
Kotlin
Vendored
20 lines
352 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
// FILE: part1.kt
|
|
|
|
@file:JvmName("Facade")
|
|
@file:JvmMultifileClass
|
|
|
|
fun foo(o: String = "O", k: String = "K"): String = o + k
|
|
|
|
// FILE: part2.kt
|
|
|
|
@file:JvmName("Facade")
|
|
@file:JvmMultifileClass
|
|
|
|
val bar = ""
|
|
|
|
// Default argument handling should not happen in the facade, only in parts.
|
|
// @Facade.class:
|
|
// 0 LDC
|