Files
kotlin-fork/compiler/testData/ir/irText/fakeOverrides/collections/map/intersectionWithGenericMapOverrideKJJ.kt.txt
anzhela.sukhanova 82255d5ee8 [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>
2024-03-04 16:21:02 +00:00

39 lines
1.0 KiB
Kotlin
Vendored

abstract class A<T : Any?> : HashMap<T, T>, SortedMap<T, T> {
constructor() /* primary */ {
super/*HashMap*/<@FlexibleNullability T?, @FlexibleNullability T?>()
/* <init>() */
}
}
abstract class B<T : Any?> : HashMap<T, T>, SortedMap<T, T> {
constructor() /* primary */ {
super/*HashMap*/<@FlexibleNullability T?, @FlexibleNullability T?>()
/* <init>() */
}
override fun put(key: T, value: T): T? {
return CHECK_NOT_NULL<Nothing>(arg0 = null)
}
override fun remove(key: T): T {
return CHECK_NOT_NULL<Nothing>(arg0 = null)
}
}
fun test(a: A<Boolean>, b: B<Boolean?>) {
a.<get-size>() /*~> Unit */
a.set<Boolean, Boolean>(key = true, value = true)
a.put(key = null, value = null) /*~> Unit */
a.get(key = true) /*~> Unit */
a.get(key = null) /*~> Unit */
a.remove(key = null) /*~> Unit */
a.remove(key = true) /*~> Unit */
b.put(key = false, value = false) /*~> Unit */
b.set<Boolean?, Boolean?>(key = true, value = true)
b.remove(key = null) /*~> Unit */
}