K2/tests: add a similar to containsAndOverload test about charAt / get

Related to KT-64846
This commit is contained in:
Mikhail Glukhikh
2024-01-19 16:18:10 +01:00
committed by Space Team
parent 005cda1f6e
commit 30ad532ff9
8 changed files with 88 additions and 0 deletions
@@ -0,0 +1,26 @@
// SCOPE_DUMP: KA:get
// FILE: A.java
abstract public class A implements CharSequence {
public final int length() {
return 0;
}
public char charAt(int index) {
return ' ';
}
public char get(int index) {
return 'X';
}
}
// FILE: main.kt
abstract class KA : A() {
override fun get(index: Int) = 'O'
}
fun foo(a: A, ka: KA) {
a.get(0)
ka.<!UNRESOLVED_REFERENCE!>get<!>(0)
}
@@ -0,0 +1,6 @@
KA:
[Source]: public open override operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of /KA [id: 0]
[Enhancement]: public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /A [id: 1]
[Enhancement]: /* hidden due to clash */ public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /A [id: 2]
[Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 3]
@@ -0,0 +1,26 @@
// SCOPE_DUMP: KA:get
// FILE: A.java
abstract public class A implements CharSequence {
public final int length() {
return 0;
}
public char charAt(int index) {
return ' ';
}
public char get(int index) {
return 'X';
}
}
// FILE: main.kt
abstract class <!CONFLICTING_JVM_DECLARATIONS!>KA<!> : A() {
<!CONFLICTING_JVM_DECLARATIONS!>override fun get(index: Int)<!> = 'O'
}
fun foo(a: A, ka: KA) {
a.get(0)
ka.get(0)
}