A set of tests on fake override motion in class hierarchy
(cherry picked from commit 4612e03d24fb3ff55c1622ea11fe892d5f1f1965)
This commit is contained in:
committed by
Vasily Levchenko
parent
704224f7a3
commit
238b2245e9
@@ -4001,6 +4001,20 @@ task library_ir_provider_mismatch(type: KonanDriverTest) {
|
||||
}
|
||||
}
|
||||
|
||||
standaloneTest("fake_override_0") {
|
||||
def sources = "$projectDir/link/fake_overrides"
|
||||
def dir = buildDir.absolutePath
|
||||
doBeforeBuild {
|
||||
konanc("$sources/base.kt -p library -o $dir/base")
|
||||
konanc("$sources/move.kt -p library -o $dir/move -r $dir -l base")
|
||||
konanc("$sources/use.kt -p library -o $dir/use -r $dir -l move")
|
||||
konanc("$sources/move2.kt -p library -o $dir/move -r $dir -l base")
|
||||
}
|
||||
source = "$sources/main.kt"
|
||||
flags = ["-l", "use", "-r", "$dir"]
|
||||
goldValue = "Moved\nMoved\nChild\nSuper\n"
|
||||
}
|
||||
|
||||
if (isAppleTarget(project)) {
|
||||
task testObjCExport(type: FrameworkTest) {
|
||||
final String frameworkName = 'Kt'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package serialization.fake_overrides
|
||||
|
||||
open class A {
|
||||
open fun qux() = "Super"
|
||||
open fun tic() = "Super"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import serialization.fake_overrides.*
|
||||
fun test1() = println(Z().bar())
|
||||
|
||||
fun main() {
|
||||
test0()
|
||||
test1()
|
||||
test2()
|
||||
test3()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package serialization.fake_overrides
|
||||
|
||||
open class X {
|
||||
}
|
||||
|
||||
class Y: X() {
|
||||
fun bar() = "Stale"
|
||||
}
|
||||
|
||||
class B: A() {
|
||||
}
|
||||
|
||||
class C: A() {
|
||||
override fun tic() = "Child"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package serialization.fake_overrides
|
||||
|
||||
open class X {
|
||||
fun bar() = "Moved"
|
||||
}
|
||||
|
||||
class Y: X() {
|
||||
}
|
||||
|
||||
class B: A() {
|
||||
override fun qux() = "Child"
|
||||
}
|
||||
|
||||
class C: A() {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package serialization.fake_overrides
|
||||
|
||||
class Z: X() {
|
||||
}
|
||||
|
||||
fun test0() = println(Y().bar())
|
||||
fun test2() = println(B().qux())
|
||||
fun test3() = println(C().qux())
|
||||
Reference in New Issue
Block a user