JVM IR: write inherited multifile parts flag to kotlin.Metadata
This flag is unused at the moment, but might be used one day to support proper incremental compilation for multifile classes.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FIR reports unresolved reference on `extraInt`.
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// MODULE: optimized
|
||||
// !INHERIT_MULTIFILE_PARTS
|
||||
// FILE: optimized.kt
|
||||
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("Optimized")
|
||||
package optimized
|
||||
|
||||
fun test() {}
|
||||
|
||||
class RandomClass
|
||||
|
||||
// MODULE: main(optimized)
|
||||
// FILE: default.kt
|
||||
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("Default")
|
||||
package default
|
||||
|
||||
fun test() {}
|
||||
|
||||
// FILE: box.kt
|
||||
|
||||
fun isFlagSet(className: String): Boolean {
|
||||
val extraInt = Class.forName(className).getAnnotation(Metadata::class.java).extraInt
|
||||
return (extraInt and (1 shl 0)) != 0
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (isFlagSet("default.Default"))
|
||||
return "Fail: inherited multifile parts flag should NOT be set by default for the facade"
|
||||
if (isFlagSet("default.Default__DefaultKt"))
|
||||
return "Fail: inherited multifile parts flag should NOT be set by default for the part"
|
||||
|
||||
if (!isFlagSet("optimized.Optimized"))
|
||||
return "Fail: inherited multifile parts flag SHOULD be set by default for the facade"
|
||||
if (!isFlagSet("optimized.Optimized__OptimizedKt"))
|
||||
return "Fail: inherited multifile parts flag SHOULD be set by default for the part"
|
||||
|
||||
if (isFlagSet("optimized.RandomClass"))
|
||||
return "Fail: inherited multifile parts flag should NOT be set by default for some random class if -Xmultifile-part-inherit is enabled"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user