[FIR] Properly collect overriddens for method enhancement
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`
This commit is contained in:
Vendored
+1
@@ -17,6 +17,7 @@ fun hashMapTest() {
|
||||
x[bar()] = 1
|
||||
x[""] = <!TYPE_MISMATCH!>nullableInt<!>
|
||||
x[""] = 1
|
||||
x[""] = <!NULL_FOR_NONNULL_TYPE!>null<!>
|
||||
|
||||
val b1: MutableMap<String?, Int?> = <!TYPE_MISMATCH!>x<!>
|
||||
val b2: MutableMap<String?, Int> = x
|
||||
|
||||
Reference in New Issue
Block a user