251827c9aa
This fixes some type argument mismatch errors caused by a captured type being approximated and then captured again. Some places need to be adapted to work with captured types that previously only worked with approximated types. #KT-62959 Fixed
43 lines
972 B
Kotlin
Vendored
43 lines
972 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_STDLIB
|
|
// SAM_CONVERSIONS: CLASS
|
|
// ^ test checks reflection for synthetic classes
|
|
// MODULE: lib
|
|
// JVM_ABI_K1_K2_DIFF: KT-64954
|
|
// FILE: Promise.java
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
interface Consumer<T> {
|
|
void consume(T t);
|
|
}
|
|
|
|
public abstract class Promise<T> {
|
|
@NotNull
|
|
public abstract Promise<T> done(@NotNull Consumer<? super T> done);
|
|
}
|
|
|
|
// MODULE: main(lib)
|
|
// FILE: 1.kt
|
|
class User {
|
|
fun use(promise: Promise<*>): Promise<*> {
|
|
promise.done { }
|
|
return promise
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
var result = ""
|
|
User().use(
|
|
object : Promise<CharSequence>() {
|
|
override fun done(x: Consumer<in CharSequence?>): Promise<CharSequence> {
|
|
result = x.javaClass.genericInterfaces[0].toString()
|
|
return this
|
|
}
|
|
}
|
|
)
|
|
|
|
if (result != "interface Consumer") return "fail: $result"
|
|
|
|
return "OK"
|
|
}
|