Files
kotlin-fork/compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt
T
Dmitriy Novozhilov c80cfb0fdb [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)
2022-01-19 15:24:43 +03:00

31 lines
568 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: J.java
public class J {
abstract static public class AImpl {
public char charAt(int index) {
return 'A';
}
public final int length() { return 56; }
}
public static class A extends AImpl implements CharSequence {
public CharSequence subSequence(int start, int end) {
return null;
}
}
}
// FILE: test.kt
class X : J.A()
fun box(): String {
val x = X()
if (x.length != 56) return "fail 1"
if (x[0] != 'A') return "fail 2"
return "OK"
}