K2: reproduce KT-65410 in diagnostic/BB tests

This commit is contained in:
Mikhail Glukhikh
2024-01-31 08:37:47 +01:00
committed by Space Team
parent b6c805bbb6
commit ba374a3978
18 changed files with 214 additions and 0 deletions
@@ -22859,6 +22859,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt");
}
@Test
@TestMetadata("removeAt.kt")
public void testRemoveAt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt");
}
@Test
@TestMetadata("specializedMap.kt")
public void testSpecializedMap() throws Exception {
@@ -8242,6 +8242,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -22859,6 +22859,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt");
}
@Test
@TestMetadata("removeAt.kt")
public void testRemoveAt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt");
}
@Test
@TestMetadata("specializedMap.kt")
public void testSpecializedMap() throws Exception {
@@ -8242,6 +8242,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -22853,6 +22853,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt");
}
@Test
@TestMetadata("removeAt.kt")
public void testRemoveAt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt");
}
@Test
@TestMetadata("specializedMap.kt")
public void testSpecializedMap() throws Exception {
@@ -22859,6 +22859,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt");
}
@Test
@TestMetadata("removeAt.kt")
public void testRemoveAt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt");
}
@Test
@TestMetadata("specializedMap.kt")
public void testSpecializedMap() throws Exception {
@@ -8243,6 +8243,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -8243,6 +8243,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -8243,6 +8243,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -0,0 +1,49 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// WITH_STDLIB
// ISSUE: KT-65410
// FILE: Java1.java
import kotlin.collections.AbstractMutableList;
public class Java1 extends AbstractMutableList<Integer> {
int size = 0;
@Override
public int getSize() {
return size;
}
@Override
public void add(int i, Integer integer) {
size++;
}
@Override
public Integer removeAt(int i) {
size--;
return null;
}
@Override
public Integer get(int index) {
return null;
}
@Override
public Integer set(int i, Integer integer) {
return null;
}
}
// FILE: 1.kt
class A : Java1()
fun box(): String {
val list = A()
list.add(1)
list.removeAt(0)
if (list.isNotEmpty()) return "Not empty"
if (list.size != 0) return "Size = ${list.size}"
return "OK"
}
@@ -0,0 +1,34 @@
// WITH_STDLIB
// SCOPE_DUMP: A:removeAt
// ISSUE: KT-65410
// FILE: Java1.java
import kotlin.collections.AbstractMutableList;
public class Java1 extends AbstractMutableList<Integer> {
@Override
public int getSize() {
return 0;
}
@Override
public void add(int i, Integer integer) {}
@Override
public Integer removeAt(int i) {
return null;
}
@Override
public Integer get(int index) {
return null;
}
@Override
public Integer set(int i, Integer integer) {
return null;
}
}
// FILE: 1.kt
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED("Class 'A'; removeAt")!>class A<!> : Java1()
@@ -0,0 +1,14 @@
A:
[Enhancement]: public open fun removeAt(i: R|kotlin/Int|): R|kotlin/Int!| from Use site scope of /A [id: 0]
[Enhancement]: public open fun removeAt(i: R|kotlin/Int|): R|kotlin/Int!| from Java enhancement scope for /Java1 [id: 0]
[SubstitutionOverride(DeclarationSite)]: /* hidden due to clash */ public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Use site scope of /A [id: 0]
[SubstitutionOverride(DeclarationSite)]: /* hidden due to clash */ public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Java enhancement scope for /Java1 [id: 0]
[SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Substitution scope for [Use site scope of kotlin/collections/AbstractMutableList] for type Java1 [id: 1]
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/AbstractMutableList [id: 2]
[SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type kotlin/collections/AbstractMutableList<E> [id: 3]
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4]
[SubstitutionOverride(DeclarationSite)]: public open operator fun removeAt(p0: R|kotlin/Int|): R|ft<E & Any, E?>| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type kotlin/collections/AbstractMutableList<E> [id: 5]
[Enhancement]: public open operator fun removeAt(p0: R|kotlin/Int|): R|ft<E & Any, E?>| from Java enhancement scope for java/util/AbstractList [id: 6]
[SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|ft<E & Any, E?>| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList<E> [id: 7]
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4]
@@ -0,0 +1,34 @@
// WITH_STDLIB
// SCOPE_DUMP: A:removeAt
// ISSUE: KT-65410
// FILE: Java1.java
import kotlin.collections.AbstractMutableList;
public class Java1 extends AbstractMutableList<Integer> {
@Override
public int getSize() {
return 0;
}
@Override
public void add(int i, Integer integer) {}
@Override
public Integer removeAt(int i) {
return null;
}
@Override
public Integer get(int index) {
return null;
}
@Override
public Integer set(int i, Integer integer) {
return null;
}
}
// FILE: 1.kt
class A : Java1()
@@ -22859,6 +22859,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt");
}
@Test
@TestMetadata("removeAt.kt")
public void testRemoveAt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt");
}
@Test
@TestMetadata("specializedMap.kt")
public void testSpecializedMap() throws Exception {
@@ -8243,6 +8243,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -8243,6 +8243,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -8243,6 +8243,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@Test
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
@@ -7205,6 +7205,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt");
}
@TestMetadata("removeAtInJava.kt")
public void testRemoveAtInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt");
}
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");