[FE] Fix tests
This commit is contained in:
committed by
teamcity
parent
12a39d0330
commit
0f1d212fc5
-12
@@ -1,12 +0,0 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
val range1 = 0..1
|
||||
range1 as List<Double>
|
||||
range1.joinToString { "" }
|
||||
} catch (e: java.lang.ClassCastException) {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
Vendored
-41
@@ -1,41 +0,0 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: JVM, NATIVE, JS, JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IGNORED_IN_JS
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun useSuspendFun(fn : suspend () -> String) = fn()
|
||||
suspend fun useSuspendFunInt(fn: suspend (Int) -> String) = fn(42)
|
||||
|
||||
suspend fun <T> testIntersection(x: T): String where T : () -> String, T : (Int) -> String {
|
||||
val a = useSuspendFun(x)
|
||||
val b = useSuspendFunInt(x)
|
||||
return a + b
|
||||
}
|
||||
|
||||
class Test : () -> String, (Int) -> String {
|
||||
override fun invoke(): String = "OKEmpty"
|
||||
override fun invoke(p: Int) = "OK$p"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var test = "Failed"
|
||||
builder {
|
||||
test = testIntersection(Test())
|
||||
}
|
||||
|
||||
if (test != "OKEmptyOK42") return "failed: $test"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user