[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
+138
@@ -0,0 +1,138 @@
|
||||
class A : Java2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class B : KotlinClass<Int>, Java3 {
|
||||
constructor() /* primary */ {
|
||||
super/*KotlinClass*/<Int>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class C : KotlinClass<Int>, Java3 {
|
||||
constructor() /* primary */ {
|
||||
super/*KotlinClass*/<Int>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(t: Any?) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class D : Java4<Any>, Java3 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java4*/<Any>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class E : Java4<Any>, Java3 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java4*/<Any>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(t: Any?) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class F : Java1<Int>, Java5 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/<Int>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class G : Java1<Int>, Java5 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/<Int>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(t: Any) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class H : Java2, KotlinInterface<Any> {
|
||||
constructor() /* primary */ {
|
||||
super/*Java2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class I : Java2, KotlinInterface<Any> {
|
||||
constructor() /* primary */ {
|
||||
super/*Java2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun foo(t: Any) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class KotlinClass<T> : Java1<T> where T : Number, T : Comparable<T> {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/<T>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface KotlinInterface<T : Any> {
|
||||
abstract fun bar(): T?
|
||||
|
||||
abstract fun foo(t: T)
|
||||
|
||||
}
|
||||
|
||||
fun test(a: A, b: B, c: C, d: D, e: E, f: F, h: H, i: I) {
|
||||
a.foo(t = 1)
|
||||
a.foo(t = 1.1)
|
||||
a.foo(t = null)
|
||||
a.foo(t = "")
|
||||
a.bar() /*~> Unit */
|
||||
b.foo(t = 1.2)
|
||||
b.foo(t = null)
|
||||
b.bar() /*~> Unit */
|
||||
c.foo(t = null)
|
||||
c.foo(t = "")
|
||||
c.foo(t = 1)
|
||||
c.bar() /*~> Unit */
|
||||
d.foo(t = null)
|
||||
d.foo(t = 1)
|
||||
d.bar() /*~> Unit */
|
||||
e.foo(t = 1.1)
|
||||
e.foo(t = null)
|
||||
e.bar() /*~> Unit */
|
||||
f.foo(t = 2)
|
||||
f.foo(t = "")
|
||||
f.bar() /*~> Unit */
|
||||
h.foo(t = 2)
|
||||
h.foo(t = "")
|
||||
h.bar() /*~> Unit */
|
||||
i.foo(t = 2)
|
||||
i.foo(t = "")
|
||||
i.bar() /*~> Unit */
|
||||
}
|
||||
Reference in New Issue
Block a user