[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
+42
@@ -0,0 +1,42 @@
|
||||
class A : Java1 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B : Java1 {
|
||||
constructor() /* primary */ {
|
||||
super/*Java1*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
override fun <T : Any> bar(): T? {
|
||||
return CHECK_NOT_NULL<Nothing>(arg0 = null)
|
||||
}
|
||||
|
||||
override fun <T : Any> foo(a: T?) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
val k: Int = a.bar<@FlexibleNullability Int?>() /*!! Int */
|
||||
val k2: Int? = a.bar<Int?>()
|
||||
val k3: Any = a.bar<@FlexibleNullability Any?>() /*!! Any */
|
||||
val k4: Nothing = a.bar<@FlexibleNullability Nothing?>() /*!! Nothing */
|
||||
a.foo<@FlexibleNullability Int?>(a = 1)
|
||||
a.foo<Nothing?>(a = null)
|
||||
a.foo<@FlexibleNullability Int?>(a = null)
|
||||
a.foo<@FlexibleNullability List<Nothing?>?>(a = listOf<Nothing?>(element = null))
|
||||
val k5: Int? = b.bar<Int>()
|
||||
val k7: Any? = b.bar<Any>()
|
||||
val k8: Nothing? = b.bar<Nothing>()
|
||||
b.foo<Int>(a = 1)
|
||||
b.foo<Nothing>(a = null)
|
||||
b.foo<Int>(a = null)
|
||||
b.foo<List<Nothing?>>(a = listOf<Nothing?>(element = null))
|
||||
}
|
||||
Reference in New Issue
Block a user