Added test on function overriding return type with Unit

This commit is contained in:
Igor Chevdar
2017-05-16 14:51:03 +03:00
parent bdb185ee93
commit 8a789a9ac4
2 changed files with 18 additions and 0 deletions
+5
View File
@@ -688,6 +688,11 @@ task bridges_test17(type: RunKonanTest) {
source = "codegen/bridges/test17.kt"
}
task bridges_test18(type: RunKonanTest) {
goldValue = "kotlin.Unit\n"
source = "codegen/bridges/test18.kt"
}
task bridges_linkTest(type: LinkKonanTest) {
goldValue = "42\n42\n42\n"
source = "codegen/bridges/linkTest_main.kt"
@@ -0,0 +1,13 @@
// overriden function returns Unit
open class A {
open fun foo(): Any = 42
}
open class B: A() {
override fun foo(): Unit { }
}
fun main(args: Array<String>) {
val a: A = B()
println(a.foo())
}