Skip to content

Commit

Permalink
Test on abstract bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
homuroll committed May 10, 2017
1 parent 97fe5c6 commit 39d1b89
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend.native/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,11 @@ task bridges_test16(type: RunKonanTest) {
source = "codegen/bridges/test16.kt"
}

task bridges_test17(type: RunKonanTest) {
goldValue = "42\n42\n42\n42\n"
source = "codegen/bridges/test17.kt"
}

task bridges_linkTest(type: LinkKonanTest) {
goldValue = "42\n42\n42\n"
source = "codegen/bridges/linkTest_main.kt"
Expand Down
25 changes: 25 additions & 0 deletions backend.native/tests/codegen/bridges/test17.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// abstract bridge
interface A<T> {
fun foo(): T
}

abstract class B<T>: A<T>

abstract class C: B<Int>()

class D: C() {
override fun foo(): Int {
return 42
}
}

fun main(args: Array<String>) {
val d = D()
val c: C = d
val b: B<Int> = d
val a: A<Int> = d
println(d.foo())
println(c.foo())
println(b.foo())
println(a.foo())
}

0 comments on commit 39d1b89

Please sign in to comment.