Tests: copy diagnostic test to codegen/box

This is basically a copy of the test
`diagnostics/tests/j+k/primitiveOverrides/triangleWithFlexibleTypeAndSubstitution4.kt`.
The diagnostic version of the test is not removed because it has
frontend-specific diagnostics `FIR_DUMP` and `SCOPE_DUMP`.

This test is copied to make it clear that it actually passes in K1, and
new errors in K2 here are technically a breaking change, see KT-66529.
The error CONFLICTING_INHERITED_JVM_DECLARATIONS was present there only
because diagnostic tests used parts of the old JVM backend to report JVM
backend diagnostics.

 #KT-66529
This commit is contained in:
Alexander Udalov
2024-03-12 15:24:54 +01:00
committed by Space Team
parent c997e9f142
commit d08c904b0c
11 changed files with 87 additions and 0 deletions
@@ -0,0 +1,28 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// K2 status: KT-66529 K2: MANY_IMPL_MEMBER_NOT_IMPLEMENTED on inheriting Java member with generic type and Kotlin member with primitive type
// FILE: A.java
public class A<T> {
public String foo(T x) {
return "Fail";
}
}
// FILE: main.kt
interface B<T> {
fun foo(x: T) = "OK"
}
open class C : A<Int>()
interface D : B<Int>
class E : C(), D
fun box(): String {
return E().foo(42)
}