Tests: do not report backend diagnostics in diagnostic tests

There's a separate test data directory `testsWithJvmBackend` with a
runner that properly invokes the JVM backend and reports diagnostics
from it. All tests where JVM diagnostic presence/absence is important
were copied/moved there in this and previous commits.

The problem with the code removed in this commit is that it invoked some
parts of the _old JVM backend_ and old light classes, which is very far
from what users see in the production compiler at this point. This led
to real issues where we implemented incorrect behavior in K2 based on
the misleading diagnostic report from the K1 test.

The diagnostic in `triangleWithFlexibleTypeAndSubstitution4.kt` was
removed, but there's a copy of this test in `codegen/box/javaInterop`
which fails for K2 (KT-66529).

The diagnostic in `intersectionWithMappedSignature.kt` was removed and
that is OK because at this point CONFLICTING_JVM_DECLARATIONS there
seems like a bug in the old JVM backend.
This commit is contained in:
Alexander Udalov
2024-03-12 11:40:06 +01:00
committed by Space Team
parent 7d6cd8d126
commit 324d2e042a
9 changed files with 5 additions and 92 deletions
@@ -1,38 +0,0 @@
// FULL_JDK
// SCOPE_DUMP: B1:remove, B2:remove
// FILE: Java1.java
public interface Java1 {
Boolean remove(Integer element);
}
// FILE: testRemove.kt
import java.util.*
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class B1 : ArrayList<Int>(), Java1 {
override fun remove(element: Int?): Boolean {
return false
}
}
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class B2 : ArrayList<Int>(), Java1 {
}
// FILE: Java2.java
public interface Java2 {
Character get(Integer i);
}
// FILE: MyString.java
public abstract class MyString implements CharSequence {
@Override
public char charAt(int i) {
return 'c';
}
}
// FILE: testRenamed.kt
abstract class B3 : MyString(), Java2 {
override fun get(i: Int?): Char? = null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FULL_JDK
// SCOPE_DUMP: B1:remove, B2:remove
// FILE: Java1.java
@@ -8,14 +9,12 @@ public interface Java1 {
// FILE: testRemove.kt
import java.util.*
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class <!CONFLICTING_JVM_DECLARATIONS!>B1<!> : ArrayList<Int>(), Java1 {
<!CONFLICTING_JVM_DECLARATIONS!>override fun remove(element: Int?): Boolean<!> {
class B1 : ArrayList<Int>(), Java1 {
override fun remove(element: Int?): Boolean {
return false
}
}
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class B2 : ArrayList<Int>(), Java1 {
}
@@ -35,4 +34,4 @@ public abstract class MyString implements CharSequence {
// FILE: testRenamed.kt
abstract class B3 : MyString(), Java2 {
override fun get(i: Int?): Char? = null
}
}
@@ -22,4 +22,3 @@ B2:
[SubstitutionOverride(DeclarationSite)]: public abstract override fun remove(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type kotlin/collections/MutableList<E> [id: 11]
[Library]: public abstract fun remove(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 8]
[Enhancement]: public abstract fun remove(element: R|kotlin/Int!|): R|kotlin/Boolean!| from Java enhancement scope for /Java1 [id: 13]
@@ -21,7 +21,7 @@ open class C : A<Int>()
interface D : B<Int>
class <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>E<!> : C(), D
class E : C(), D
fun main() {
E().foo(42)