testData for binary compatibility tests on klib library evolution

This commit is contained in:
Alexander Gorshenev
2020-12-23 07:24:10 +03:00
parent 3704b2a5af
commit 504bdfc283
39 changed files with 1910 additions and 0 deletions
@@ -0,0 +1,63 @@
// MODULE: base
// FILE: base.kt
open class X {
open val bar: String
get() = "base class open"
val zon: String
get() = "base class"
}
interface Y {
val qux: String
get() = "base interface Y"
}
interface Z {
val sep: String
get() = "base interface Z"
}
// MODULE: lib(base)
// FILE: A.kt
// VERSION: 1
class W : Y, Z, X() {
override val bar: String
get() = "from base class"
override val qux: String
get() = "from interface Y"
override val sep: String
get() = "from interface Z"
}
// FILE: B.kt
// VERSION: 2
class W : X(), Z, Y {
override val bar: String
get() = "from base class"
override val qux: String
get() = "from interface Y"
override val sep: String
get() = "from interface Z"
}
// MODULE: mainLib(lib)
// FILE: mainLib.kt
fun lib(): String {
val w = W()
return when {
w.bar != "from base class" -> "fail 1"
w.zon != "base class" -> "fail 2"
w.qux != "from interface Y" -> "fail 3"
w.sep != "from interface Z" -> "fail 4"
else -> "OK"
}
}
// MODULE: main(mainLib)
// FILE: main.kt
fun box(): String = lib()