Files
kotlin-fork/compiler/testData/codegen/box/specialBuiltins/emptyStringMap.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

22 lines
719 B
Kotlin
Vendored

private object EmptyStringMap : Map<String, Nothing> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun containsKey(key: String): Boolean = false
override fun containsValue(value: Nothing): Boolean = false
override fun get(key: String): Nothing? = null
override val entries: Set<Map.Entry<String, Nothing>> get() = null!!
override val keys: Set<String> get() = null!!
override val values: Collection<Nothing> get() = null!!
}
fun box(): String {
val n = EmptyStringMap as Map<Any?, Any?>
if (n.get(null) != null) return "fail 1"
if (n.containsKey(null)) return "fail 2"
if (n.containsValue(null)) return "fail 3"
return "OK"
}