Files
kotlin-fork/compiler/testData/codegen/box/varargs/varargsOverride3.kt
T
Alexander Udalov 401f0ac583 Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.
2021-02-11 13:50:08 +01:00

42 lines
827 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// MODULE: lib
// FILE: A.java
public abstract class A<T> {
protected abstract String doIt(T... args);
class B<S extends T, U extends S> {
public String test(T... args) {
return doIt(args);
}
public String test2(S... args) {
return doIt(args);
}
public String test3(U... args) {
return doIt(args);
}
}
}
// MODULE: main(lib)
// FILE: 1.kt
open class Super
open class Sub: Super()
class Sub2: Sub()
val a: A<Super> =
object : A<Super>() {
override fun doIt(vararg parameters: Super): String = "OK"
}
fun box(): String {
val b = a.B<Sub, Sub2>()
if (b.test() != "OK") return "FAIL1"
if (b.test2() != "OK") return "FAIL2"
return b.test3()
}