K2: add a pair of KJ tests related to KT-64846 but w/out explicit override

This commit is contained in:
Mikhail Glukhikh
2024-01-26 10:33:59 +01:00
committed by Space Team
parent c0e0b4d32b
commit 49ec30735c
10 changed files with 139 additions and 0 deletions
@@ -22525,6 +22525,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charAtAndOverloadWithoutExplicitOverride.kt")
public void testCharAtAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22561,6 +22567,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverload.kt");
}
@Test
@TestMetadata("containsAndOverloadWithoutExplicitOverride.kt")
public void testContainsAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("getCharSequence.kt")
public void testGetCharSequence() throws Exception {
@@ -22525,6 +22525,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charAtAndOverloadWithoutExplicitOverride.kt")
public void testCharAtAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22561,6 +22567,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverload.kt");
}
@Test
@TestMetadata("containsAndOverloadWithoutExplicitOverride.kt")
public void testContainsAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("getCharSequence.kt")
public void testGetCharSequence() throws Exception {
@@ -22519,6 +22519,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charAtAndOverloadWithoutExplicitOverride.kt")
public void testCharAtAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22555,6 +22561,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverload.kt");
}
@Test
@TestMetadata("containsAndOverloadWithoutExplicitOverride.kt")
public void testContainsAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("getCharSequence.kt")
public void testGetCharSequence() throws Exception {
@@ -22525,6 +22525,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charAtAndOverloadWithoutExplicitOverride.kt")
public void testCharAtAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22561,6 +22567,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverload.kt");
}
@Test
@TestMetadata("containsAndOverloadWithoutExplicitOverride.kt")
public void testContainsAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("getCharSequence.kt")
public void testGetCharSequence() throws Exception {
@@ -0,0 +1,24 @@
// FIR_IDENTICAL
// 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()
fun foo(a: A, ka: KA) {
ka.get(0)
}
@@ -0,0 +1,6 @@
KA:
[Enhancement]: public open 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: 0]
[Enhancement]: /* hidden due to clash */ public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of /KA [id: 0]
[Enhancement]: /* hidden due to clash */ public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /A [id: 0]
[Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1]
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -PARAMETER_NAME_CHANGED_ON_OVERRIDE
// SCOPE_DUMP: KA:contains
// FILE: A.java
abstract public class A implements java.util.Collection<String> {
public boolean contains(Object x) {return false;}
public boolean contains(String x) {return false;}
}
// FILE: main.kt
abstract class KA : A()
fun foo(a: A, ka: KA) {
ka.contains("")
ka.contains(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
"" in ka
<!ARGUMENT_TYPE_MISMATCH!>1<!> in ka
}
@@ -0,0 +1,13 @@
KA:
[Enhancement]: public open operator fun contains(x: R|kotlin/String!|): R|kotlin/Boolean| from Use site scope of /KA [id: 0]
[Enhancement]: public open operator fun contains(x: R|kotlin/String!|): R|kotlin/Boolean| from Java enhancement scope for /A [id: 0]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|kotlin/String!|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type A [id: 1]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 2]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/Collection] for type kotlin/collections/MutableCollection<E> [id: 2]
[Library]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Collection [id: 3]
[Enhancement]: /* hidden due to clash */ public open operator fun contains(x: R|kotlin/String!|): R|kotlin/Boolean| from Use site scope of /KA [id: 0]
[Enhancement]: /* hidden due to clash */ public open operator fun contains(x: R|kotlin/String!|): R|kotlin/Boolean| from Java enhancement scope for /A [id: 0]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|kotlin/String!|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type A [id: 1]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 2]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/Collection] for type kotlin/collections/MutableCollection<E> [id: 2]
[Library]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Collection [id: 3]
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -PARAMETER_NAME_CHANGED_ON_OVERRIDE
// SCOPE_DUMP: KA:contains
// FILE: A.java
abstract public class A implements java.util.Collection<String> {
public boolean contains(Object x) {return false;}
public boolean contains(String x) {return false;}
}
// FILE: main.kt
abstract class KA : A()
fun foo(a: A, ka: KA) {
ka.contains("")
ka.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
"" in ka
<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> in ka
}
@@ -22525,6 +22525,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverload.kt");
}
@Test
@TestMetadata("charAtAndOverloadWithoutExplicitOverride.kt")
public void testCharAtAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/charAtAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("charBuffer.kt")
public void testCharBuffer() throws Exception {
@@ -22561,6 +22567,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverload.kt");
}
@Test
@TestMetadata("containsAndOverloadWithoutExplicitOverride.kt")
public void testContainsAndOverloadWithoutExplicitOverride() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/containsAndOverloadWithoutExplicitOverride.kt");
}
@Test
@TestMetadata("getCharSequence.kt")
public void testGetCharSequence() throws Exception {