[FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes

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)
This commit is contained in:
Dmitriy Novozhilov
2022-01-13 18:22:42 +03:00
parent 17916d4a63
commit c80cfb0fdb
82 changed files with 2564 additions and 636 deletions
@@ -0,0 +1,42 @@
// SCOPE_DUMP: C:foo;x;y;getX, D:x;y;getX, E:x;getX
// FILE: lib.kt
interface A {
fun foo(): Any
val x: Int
val y: Int
}
interface B {
fun foo(): Any
val x: String
val y: Int
}
// FILE: C.java
public abstract class C {
public int x;
private int y;
}
// FILE: D.java
public abstract class D extends C implements A, B {
public abstract Object foo();
public abstract Object getX();
public abstract int getY();
}
// FILE: E.java
public abstract class E implements A, B {
public abstract Object foo();
public abstract Object getX();
}
// FILE: main.kt
fun test(d: D) {
val a = d.x
val b = d.y
}