[Test] Convert IGNORE: NATIVE directives in box tests from A to C

^KT-59057

Merge-request: KT-MR-10747
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2023-06-22 08:39:20 +00:00
committed by Space Team
parent 2da0e622c0
commit 3d60ed8874
49 changed files with 429 additions and 1430 deletions
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_REFLECT
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
fun foo(x: Cloneable) = x
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
@@ -0,0 +1,23 @@
// WITH_STDLIB
import kotlin.test.assertEquals
inline fun <R, T> foo(x : R, y : R, block : (R) -> T) : T {
val a = x is Number
val b = x is Any
val b1 = x as Any
if (a && b) {
return block(x)
} else {
return block(y)
}
}
fun box() : String {
assertEquals(1, foo(1, 2) { x -> x as Int })
assertEquals("def", foo("abc", "def") { x -> x as String })
return "OK"
}
+1 -1
View File
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
open class BaseStringList: ArrayList<String>() {
}
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
class A : HashSet<Long>()
fun box(): String {
@@ -1,8 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// KT-6042 java.lang.UnsupportedOperationException with ArrayList
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
class A : ArrayList<String>()
fun box(): String {
@@ -1,7 +1,7 @@
// WITH_STDLIB
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
open class A : ArrayList<String>()
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
class A : HashMap<String, Double>()
fun box(): String {
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
class A : HashSet<Long>()
fun box(): String {
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_REFLECT
@@ -1,8 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// WITH_REFLECT
@@ -25,7 +22,7 @@ inline fun <reified T, reified R> check(f: (T) -> R, g: (T) -> R, tType: String,
fun box(): String {
check("", 1, ::foo, "String", "Int")
check("", 1, ::fooReturnInt, "String", "Int")
check("", "", ::fooReturnInt, "String", "Any")
check("", "", ::fooReturnInt, "String", "Any") // KT-59348 Non-JVM backends have not "Any", but "Comparable" as common parent for Int and String
check(Int::toString, ::foo, "Int", "String")
@@ -0,0 +1,30 @@
// DONT_TARGET_EXACT_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: JVM_IR
// WITH_STDLIB
// WITH_REFLECT
import kotlin.test.assertEquals
fun <T, R> foo(x: T): R = TODO()
fun <T> fooReturnInt(x: T): Int = 1
inline fun <reified T, reified R> check(x: T, y: R, f: (T) -> R, tType: String, rType: String) {
assertEquals(tType, T::class.simpleName)
assertEquals(rType, R::class.simpleName)
}
inline fun <reified T, reified R> check(f: (T) -> R, g: (T) -> R, tType: String, rType: String) {
assertEquals(tType, T::class.simpleName)
assertEquals(rType, R::class.simpleName)
}
fun box(): String {
check("", 1, ::foo, "String", "Int")
check("", 1, ::fooReturnInt, "String", "Int")
check("", "", ::fooReturnInt, "String", "Comparable") // KT-59348 JVM backends have not "Comparable", but "Any" as common parent for Int and String
check(Int::toString, ::foo, "Int", "String")
return "OK"
}
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
class Test {
private var iv = 1
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
fun foo(x: Any) = x as Runnable
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
fun foo(x: Any) = x as? Runnable
@@ -1,10 +1,3 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
fun fn0() {}
@@ -15,10 +8,6 @@ val lambda1 = { x: Any -> } as (Any) -> Unit
fun Any.extFun() {}
var Any.extProp: String
get() = "extProp"
set(x: String) {}
class A {
fun foo() {}
}
@@ -28,8 +17,6 @@ fun box(): String {
val f1 = ::fn1 as Any
val ef = Any::extFun as Any
val epg = Any::extProp.getter
val eps = Any::extProp.setter
val afoo = A::foo
@@ -38,27 +25,19 @@ fun box(): String {
val localFun0 = ::local0 as Any
val localFun1 = ::local1 as Any
assert(f0 is Function0<*>) { "Failed: f0 is Function0<*>" }
assert(f1 is Function1<*, *>) { "Failed: f1 is Function1<*, *>" }
assert(f0 !is Function1<*, *>) { "Failed: f0 !is Function1<*, *>" }
assert(f1 !is Function0<*>) { "Failed: f1 !is Function0<*>" }
assert(lambda0 is Function0<*>) { "Failed: lambda0 is Function0<*>" }
assert(lambda1 is Function1<*, *>) { "Failed: lambda1 is Function1<*, *>" }
assert(lambda0 !is Function1<*, *>) { "Failed: lambda0 !is Function1<*, *>" }
assert(lambda1 !is Function0<*>) { "Failed: lambda1 !is Function0<*>" }
if (f0 !is Function0<*>) return "Failed: f0 is Function0<*>"
if (f1 !is Function1<*, *>) return "Failed: f1 is Function1<*, *>"
assert(localFun0 is Function0<*>) { "Failed: localFun0 is Function0<*>" }
assert(localFun1 is Function1<*, *>) { "Failed: localFun1 is Function1<*, *>" }
assert(localFun0 !is Function1<*, *>) { "Failed: localFun0 !is Function1<*, *>" }
assert(localFun1 !is Function0<*>) { "Failed: localFun1 !is Function0<*>" }
if (lambda0 !is Function0<*>) return "Failed: lambda0 is Function0<*>"
if (lambda1 !is Function1<*, *>) return "Failed: lambda1 is Function1<*, *>"
assert(ef is Function1<*, *>) { "Failed: ef is Function1<*, *>" }
assert(epg is Function1<*, *>) { "Failed: epg is Function1<*, *>"}
assert(eps is Function2<*, *, *>) { "Failed: eps is Function2<*, *, *>"}
if (localFun0 !is Function0<*>) return "Failed: localFun0 is Function0<*>"
if (localFun1 !is Function1<*, *>) return "Failed: localFun1 is Function1<*, *>"
assert(afoo is Function1<*, *>) { "afoo is Function1<*, *>" }
if (ef !is Function1<*, *>) return "Failed: ef is Function1<*, *>"
if (afoo !is Function1<*, *>) return "afoo is Function1<*, *>"
return "OK"
}
@@ -0,0 +1,46 @@
// TARGET_BACKEND: JS
// TARGET_BACKEND: JS_IR
// TARGET_BACKEND: JS_IR_ES6
// WITH_REFLECT
fun fn0() {}
fun fn1(x: Any) {}
val lambda0 = {} as () -> Unit
val lambda1 = { x: Any -> } as (Any) -> Unit
fun Any.extFun() {}
var Any.extProp: String
get() = "extProp"
set(x: String) {}
class A {
fun foo() {}
}
fun box(): String {
val f0 = ::fn0 as Any
val f1 = ::fn1 as Any
val ef = Any::extFun as Any
val afoo = A::foo
fun local0() {}
fun local1(x: Any) {}
val localFun0 = ::local0 as Any
val localFun1 = ::local1 as Any
if (f0 !is Function1<*, *>) return "Failed: f0 is Function1<*, *>"
if (f1 !is Function0<*>) return "Failed: f1 is Function0<*>"
if (lambda0 !is Function1<*, *>) return "Failed: lambda0 is Function1<*, *>"
if (lambda1 !is Function0<*>) return "Failed: lambda1 is Function0<*>"
if (localFun0 !is Function1<*, *>) return "Failed: localFun0 is Function1<*, *>"
if (localFun1 !is Function0<*>) return "Failed: localFun1 is Function0<*>"
return "OK"
}
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_REFLECT
var Any.extProp: String
get() = "extProp"
set(x: String) {}
fun box(): String {
val epg = Any::extProp.getter
val eps = Any::extProp.setter
if (epg !is Function1<*, *>) return "Failed: epg is Function1<*, *>"
if (eps !is Function2<*, *, *>) return "Failed: eps is Function2<*, *, *>"
return "OK"
}
@@ -0,0 +1,46 @@
// DONT_TARGET_EXACT_BACKEND: JS
// DONT_TARGET_EXACT_BACKEND: JS_IR
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
// WITH_REFLECT
fun fn0() {}
fun fn1(x: Any) {}
val lambda0 = {} as () -> Unit
val lambda1 = { x: Any -> } as (Any) -> Unit
fun Any.extFun() {}
var Any.extProp: String
get() = "extProp"
set(x: String) {}
class A {
fun foo() {}
}
fun box(): String {
val f0 = ::fn0 as Any
val f1 = ::fn1 as Any
val ef = Any::extFun as Any
val afoo = A::foo
fun local0() {}
fun local1(x: Any) {}
val localFun0 = ::local0 as Any
val localFun1 = ::local1 as Any
if (f0 is Function1<*, *>) return "Failed: f0 !is Function1<*, *>"
if (f1 is Function0<*>) return "Failed: f1 !is Function0<*>"
if (lambda0 is Function1<*, *>) return "Failed: lambda0 !is Function1<*, *>"
if (lambda1 is Function0<*>) "Failed: lambda1 !is Function0<*>"
if (localFun0 is Function1<*, *>) return "Failed: localFun0 !is Function1<*, *>"
if (localFun1 is Function0<*>) return "Failed: localFun1 !is Function0<*>"
return "OK"
}
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
fun foo(x: Any) = x is Runnable
+2 -6
View File
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
fun foo(x: Any) = x !is Runnable
@@ -1,8 +1,3 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE, WASM
fun box(): String {
var x = 42
@@ -11,8 +6,8 @@ fun box(): String {
if (x != 43) return "Fail 2: $x"
val k2 = { x *= 2; x }()::class
// Note that k2 is the class of the wrapper type java.lang.Integer
if (k2 != Integer::class) return "Fail 3: $k2"
// Note that k2 is the class of the wrapper type Int
if (k2 != Int::class) return "Fail 3: $k2"
if (x != 86) return "Fail 4: $x"
return "OK"
+2 -4
View File
@@ -1,7 +1,5 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE, WASM
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// WASM_MUTE_REASON: Wrong box result 'fail2: global = AD'; Expected "OK"
var global = "A"
class C {
+2 -5
View File
@@ -1,9 +1,6 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// Enable for JS when it supports Java class library.
// IGNORE_BACKEND: JS, NATIVE
class TestJava(r : Runnable) : Runnable by r {}
class TestRunnable() : Runnable {
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
interface A : Set<String>
+2 -6
View File
@@ -1,10 +1,6 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// Won't ever work with JS backend.
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// TODO: Consider rewriting this test without using threads, since the issue is not about threads at all.
// IGNORE_BACKEND: JS, NATIVE
object RefreshQueue {
val any = Any()
+1 -1
View File
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: WASM
// IGNORE_BACKEND: NATIVE
// DONT_TARGET_EXACT_BACKEND: NATIVE
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
// WITH_STDLIB
@@ -1,8 +1,6 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: FAILS_IN_JS_IR
// IGNORE_BACKEND: JS, JS_IR, NATIVE
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND_K2: JVM_IR, NATIVE
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: value: 0 should have type Long
// WITH_STDLIB
@@ -1,28 +0,0 @@
// IGNORE_BACKEND: JVM_IR, JS_IR
// FIR status: not supported in JVM
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JVM, JS, NATIVE
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// WITH_STDLIB
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
suspend fun callLocal(): String {
val local = suspend fun() = "OK"
return local()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res = "FAIL"
builder {
res = callLocal()
}
return res
}