Files
kotlin-fork/compiler/testData/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt
T
Mikhail Glukhikh 672b5ba0d7 K2/Java: implement platform-dependent function filtering in JvmMappedScope
We drop Kotlin function 'remove' or 'getOrDefault' from JvmMappedScope,
if it has platform-dependent annotation, and the bound Java class scope
does not contain a function with the same signature.

#KT-57268 Fixed
2024-01-30 19:44:00 +00:00

59 lines
1.5 KiB
Kotlin
Vendored

var result = ""
public abstract class AbstractFoo<K, V> : Map<K, V> {
override operator fun get(key: K): V? {
result = "AbstractFoo"
return null
}
override val size: Int
get() = throw UnsupportedOperationException()
override fun isEmpty(): Boolean {
throw UnsupportedOperationException()
}
override fun containsKey(key: K): Boolean {
throw UnsupportedOperationException()
}
override fun containsValue(value: V): Boolean {
throw UnsupportedOperationException()
}
override val keys: Set<K>
get() = throw UnsupportedOperationException()
override val values: Collection<V>
get() = throw UnsupportedOperationException()
override val entries: Set<Map.Entry<K, V>>
get() = throw UnsupportedOperationException()
}
public open class StringFoo<E> : AbstractFoo<String, E>() {
override operator fun get(key: String): E? {
result = "StringFoo"
return null
}
}
public class IntFoo<E> : AbstractFoo<Int, E>() {
override operator fun get(key: Int): E? {
result = "IntFoo"
return null
}
}
public class AnyFoo<E> : AbstractFoo<Any?, E>() {}
fun box(): String {
StringFoo<String>().get("")
if (result != "StringFoo") return "fail 1: $result"
IntFoo<String>().get(1)
if (result != "IntFoo") return "fail 2: $result"
AnyFoo<String>().get(null)
if (result != "AbstractFoo") return "fail 3: $result"
return "OK"
}