9807c67ae4
If some java class has multiple supertypes then we need to collect overriddens from all those types directly, even if superTypeScope (which is FirTypeIntersectionScope in this case) returns only one symbol from one of this types (not intersection one) This is needed to proper enhancement in cases when some type occurs multiple times in supertypes graph with different nullability of arguments: class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V> If we try to find method `get(key: K): V` supertype scope returns `AbstractMap.get(key: K!): V!` (because it actually overrides `MutableMap(key: K): V?`), but we need to get both symbols to properly enhance types for `ConcurrentHashMap.remove`
31 lines
1002 B
Kotlin
Vendored
31 lines
1002 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE
|
|
// FULL_JDK
|
|
|
|
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
|
|
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
|
get() = throw UnsupportedOperationException()
|
|
|
|
override fun remove(x: K, y: V) = true
|
|
}
|
|
|
|
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
|
|
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
|
|
get() = throw UnsupportedOperationException()
|
|
|
|
override fun remove(x: String, y: Int) = true
|
|
}
|
|
|
|
fun foo(x: MutableMap<String, Int>, y: java.util.HashMap<String, Int>, z: java.util.AbstractMap<String, Int>) {
|
|
x.remove("", 1)
|
|
x.remove("", <!ARGUMENT_TYPE_MISMATCH!>""<!>)
|
|
x.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
|
|
|
y.remove("", 1)
|
|
y.remove("", <!ARGUMENT_TYPE_MISMATCH!>""<!>)
|
|
y.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
|
|
|
z.remove("", 1)
|
|
z.remove("", <!ARGUMENT_TYPE_MISMATCH!>""<!>)
|
|
z.remove("", null)
|
|
}
|