[Test] KT-61360: add tests for the IrFakeOverrideBuilder
Add tests for fake overrides with focus on java interoperability Co-authored-by: Aleksandra Arsenteva <aleksandra.arsenteva@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
30aae741a6
commit
82255d5ee8
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
open class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
inline fun foo(noinline lambda: Function1<Int, Int>) {
|
||||
}
|
||||
|
||||
inline fun foo2(crossinline lambda: Function1<Int, Int>) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B : Java1 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class C : Java1, Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class D : Java1, Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(lambda: Function<Int, Int>?) {
|
||||
}
|
||||
|
||||
override fun foo2(lambda: Function<Int, Int>?) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class E : A, Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*A*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class F : A, Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*A*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(lambda: Function<Int, Int>?) {
|
||||
}
|
||||
|
||||
override fun foo2(lambda: Function<Int, Int>?) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test(b: B, c: C, d: D, e: E, f: F) {
|
||||
b.foo(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
b.foo2(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
c.foo(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
c.foo2(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
d.foo(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
d.foo2(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
e.foo(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
e.foo2(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
f.foo(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
f.foo2(lambda = local fun <anonymous>(it: Int): Int {
|
||||
return 1
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user