[FE] Erase type parameters of super types during intersection type emptiness check as well

This commit is contained in:
Victor Petukhov
2022-04-25 12:25:06 +03:00
committed by teamcity
parent 0f1d212fc5
commit fb76d819f0
19 changed files with 106 additions and 167 deletions
@@ -0,0 +1,41 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS, JS_IR
// IGNORE_BACKEND: JS_IR_ES6
fun interface KRunnable {
fun invoke()
}
fun interface KBoolean {
fun invoke(b: Boolean)
}
fun useFunInterface(fn: KRunnable) {
fn.invoke()
}
fun useFunInterfacePredicate(fn: KBoolean) {
fn.invoke(true)
}
fun <T> testIntersection(x: T) where T : () -> Unit, T : (Boolean) -> Unit {
useFunInterface(x)
useFunInterfacePredicate(x)
}
var result = ""
object Test : () -> Unit, (Boolean) -> Unit {
override fun invoke() {
result += "O"
}
override fun invoke(p1: Boolean) {
if (p1) result += "K"
}
}
fun box(): String {
testIntersection(Test)
return result
}