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
@@ -22519,6 +22519,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/collectionOverrides"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("charAtAndOverload.kt")
public void testCharAtAndOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22519,6 +22519,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/collectionOverrides"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("charAtAndOverload.kt")
public void testCharAtAndOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22513,6 +22513,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/collectionOverrides"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("charAtAndOverload.kt")
public void testCharAtAndOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22519,6 +22519,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/collectionOverrides"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("charAtAndOverload.kt")
public void testCharAtAndOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -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)
}
@@ -22519,6 +22519,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/collectionOverrides"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("charAtAndOverload.kt")
public void testCharAtAndOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {