Support covariant MutableMap.entries.remove in JS/IR
Workaround for KT-43321 Follow up to KT-41278
This commit is contained in:
committed by
TeamCityServer
parent
666ad1f9d5
commit
ed3542cdf5
@@ -50,6 +50,8 @@ public actual abstract class AbstractMutableMap<K, V> protected actual construct
|
||||
internal abstract class AbstractEntrySet<E : Map.Entry<K, V>, K, V> : AbstractMutableSet<E>() {
|
||||
final override fun contains(element: E): Boolean = containsEntry(element)
|
||||
abstract fun containsEntry(element: Map.Entry<K, V>): Boolean
|
||||
final override fun remove(element: E): Boolean = removeEntry(element)
|
||||
abstract fun removeEntry(element: Map.Entry<K, V>): Boolean
|
||||
}
|
||||
|
||||
actual override fun clear() {
|
||||
|
||||
@@ -32,7 +32,7 @@ public actual open class HashMap<K, V> : AbstractMutableMap<K, V>, MutableMap<K,
|
||||
|
||||
override operator fun iterator(): MutableIterator<MutableEntry<K, V>> = internalMap.iterator()
|
||||
|
||||
override fun remove(element: MutableEntry<K, V>): Boolean {
|
||||
override fun removeEntry(element: Map.Entry<K, V>): Boolean {
|
||||
if (contains(element)) {
|
||||
this@HashMap.remove(element.key)
|
||||
return true
|
||||
|
||||
@@ -90,7 +90,7 @@ public actual open class LinkedHashMap<K, V> : HashMap<K, V>, MutableMap<K, V> {
|
||||
|
||||
override operator fun iterator(): MutableIterator<MutableEntry<K, V>> = EntryIterator()
|
||||
|
||||
override fun remove(element: MutableEntry<K, V>): Boolean {
|
||||
override fun removeEntry(element: Map.Entry<K, V>): Boolean {
|
||||
checkIsMutable()
|
||||
if (contains(element)) {
|
||||
this@LinkedHashMap.remove(element.key)
|
||||
|
||||
Reference in New Issue
Block a user