c80cfb0fdb
This big refactoring is needed to cleanup building of overrides
mappings and prevent creating redundant intersection overrides in
cases when there is no need in them:
```kotlin
interface A {
fun foo()
}
interface B {
fun foo()
}
interface C : A, B {
override fun foo()
}
```
Before this refactoring there was next override tree:
C.foo
intersection override (A.foo, B.foo)
A.foo
B.foo
Also this commit fixes special mapping of overrides in jvm scopes
for declarations which have kotlin builtins in supertypes with
special java mapping rules (collections, for example)
43 lines
1.0 KiB
Kotlin
Vendored
43 lines
1.0 KiB
Kotlin
Vendored
// SCOPE_DUMP: SomeMap:containsKey;containsValue;get;remove, MyMap:containsKey;containsValue;get
|
|
|
|
// FILE: MyBaseMap.java
|
|
public interface MyBaseMap<K1, V1> {
|
|
boolean containsKey(Object key);
|
|
}
|
|
|
|
// FILE: MyMap.java
|
|
public interface MyMap<K2, V2> extends MyBaseMap<K2, V2> {
|
|
@Override
|
|
boolean containsKey(Object key);
|
|
boolean containsValue(Object key);
|
|
|
|
V2 get(K2 key);
|
|
}
|
|
|
|
// FILE: SomeMap.java
|
|
import java.util.Map;
|
|
|
|
public abstract class SomeMap<K3, V3> implements Map<K3, V3>, MyMap<K3, V3> {
|
|
@Override
|
|
public abstract boolean containsKey(Object key);
|
|
|
|
@Override
|
|
public abstract V3 remove(Object key);
|
|
}
|
|
|
|
// FILE: main.kt
|
|
|
|
fun test(map: SomeMap<Int, String>) {
|
|
map.containsKey(1) // ok
|
|
map.containsKey(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
|
|
map.containsValue("") // ok
|
|
map.containsValue(<!ARGUMENT_TYPE_MISMATCH!>1<!>) // error
|
|
|
|
map.get(1) // ok
|
|
map.get(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
|
|
map.remove(1) // ok
|
|
map.remove(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
}
|