Fir2Ir: create file level signatures where appropriate
This is godugly code, where a flag for file level signatures is passsed around. An alternative would be not to create file level signatures for toplevel private clases, since those still need unique names, at least on JVM. But that would break binary compatibility. Signatures are due for overhaul anyway. Hopefully this code can be reverted at that point.
This commit is contained in:
committed by
Alexander Udalov
parent
9d4ab09b41
commit
39bba7973c
@@ -0,0 +1,32 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
private class S public constructor() {
|
||||
class Z {
|
||||
fun a(): String {
|
||||
return "K"
|
||||
}
|
||||
|
||||
val empty = ""
|
||||
}
|
||||
|
||||
enum class E(val s: String) {
|
||||
EMPTY("")
|
||||
}
|
||||
}
|
||||
// This function exposes S.Z and S.E, nested into a private class S (package-private in the byte code)
|
||||
// They can be accessed outside the `test` package now that S.Z, S.E are public in the byte code, but that may be changed later
|
||||
internal inline fun call(s: () -> String): String {
|
||||
return s() + S.Z().empty + S.E.EMPTY.s + S.Z().a()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return call {
|
||||
"O"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user