diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedEnumEntry.kt b/backend.native/tests/external/codegen/box/annotations/annotatedEnumEntry.kt deleted file mode 100644 index 37f0de4e7c2..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedEnumEntry.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// KT-5665 - -@Retention(AnnotationRetention.RUNTIME) -annotation class First - -@Retention(AnnotationRetention.RUNTIME) -annotation class Second(val value: String) - -enum class E { - @First - E1 { - fun foo() = "something" - }, - - @Second("OK") - E2 -} - -fun box(): String { - val e = E::class.java - - val e1 = e.getDeclaredField(E.E1.toString()).getAnnotations() - if (e1.size != 1) return "Fail E1 size: ${e1.toList()}" - if (e1[0].annotationClass.java != First::class.java) return "Fail E1: ${e1.toList()}" - - val e2 = e.getDeclaredField(E.E2.toString()).getAnnotations() - if (e2.size != 1) return "Fail E2 size: ${e2.toList()}" - if (e2[0].annotationClass.java != Second::class.java) return "Fail E2: ${e2.toList()}" - - return (e2[0] as Second).value -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/funExpression.kt b/backend.native/tests/external/codegen/box/annotations/annotatedLambda/funExpression.kt deleted file mode 100644 index d8f6b4fce94..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/funExpression.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.lang.reflect.Method -import kotlin.test.assertEquals - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val x: String) - -fun foo0(block: () -> Unit) = block.javaClass -fun foo1(block: (String) -> Unit) = block.javaClass - -fun testMethod(method: Method, name: String) { - assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") - - for ((index, annotations) in method.getParameterAnnotations().withIndex()) { - val ann = annotations.filterIsInstance().single() - assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") - } -} - -fun testClass(clazz: Class<*>, name: String) { - val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } - testMethod(invokes, name) -} - -fun box(): String { - testClass(foo0( @Ann("OK") fun() {} ), "1") - testClass(foo1( @Ann("OK") fun(@Ann("OK0") x: String) {} ), "2") - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/lambda.kt b/backend.native/tests/external/codegen/box/annotations/annotatedLambda/lambda.kt deleted file mode 100644 index 67bea1e84ea..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/lambda.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.lang.reflect.Method -import kotlin.test.assertEquals - -@Target(AnnotationTarget.FUNCTION) -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val x: String) - -fun foo0(block: () -> Unit) = block.javaClass - -fun testMethod(method: Method, name: String) { - assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") - - for ((index, annotations) in method.getParameterAnnotations().withIndex()) { - val ann = annotations.filterIsInstance().single() - assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") - } -} - -fun testClass(clazz: Class<*>, name: String) { - val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } - testMethod(invokes, name) -} - -fun box(): String { - testClass(foo0(@Ann("OK") { }), "1") - testClass(foo0( @Ann("OK") { }), "2") - - testClass(foo0() @Ann("OK") { }, "3") - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samFunExpression.kt b/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samFunExpression.kt deleted file mode 100644 index 0e03694d6a9..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samFunExpression.kt +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - public static Class apply(Runnable x) { - return x.getClass(); - } - - public static interface ABC { - void apply(String x1, String x2); - } - - public static Class applyABC(ABC x) { - return x.getClass(); - } -} - -// FILE: test.kt - -import java.lang.reflect.Method -import kotlin.test.assertEquals - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val x: String) - -fun testMethod(method: Method, name: String) { - assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") - - for ((index, annotations) in method.getParameterAnnotations().withIndex()) { - val ann = annotations.filterIsInstance().single() - assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") - } -} - -fun testClass(clazz: Class<*>, name: String) { - val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } - testMethod(invokes, name) -} - -fun box(): String { - testClass(Test.apply(@Ann("OK") fun(){}), "1") - - testClass(Test.applyABC(@Ann("OK") fun(@Ann("OK0") x: String, @Ann("OK1") y: String){}), "2") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samLambda.kt b/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samLambda.kt deleted file mode 100644 index 382c6902ce9..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedLambda/samLambda.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - public static Class apply(Runnable x) { - return x.getClass(); - } -} - -// FILE: test.kt - -import java.lang.reflect.Method -import kotlin.test.assertEquals - -@Target(AnnotationTarget.FUNCTION) -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val x: String) - -fun testMethod(method: Method, name: String) { - assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") - - for ((index, annotations) in method.getParameterAnnotations().withIndex()) { - val ann = annotations.filterIsInstance().single() - assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") - } -} - -fun testClass(clazz: Class<*>, name: String) { - val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } - testMethod(invokes, name) -} - -fun box(): String { - testClass(Test.apply(@Ann("OK") {}), "1") - testClass(Test.apply @Ann("OK") {}, "2") - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotatedObjectLiteral.kt b/backend.native/tests/external/codegen/box/annotations/annotatedObjectLiteral.kt deleted file mode 100644 index 0fba694eb67..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotatedObjectLiteral.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -annotation class Ann(val v: String = "???") -@Ann open class My -fun box(): String { - val v = @Ann("OK") object: My() {} - val klass = v.javaClass - - val annotations = klass.annotations.toList() - // Ann, kotlin.Metadata - if (annotations.size != 2) return "Fail annotations size is ${annotations.size}: $annotations" - val annotation = annotations.filterIsInstance().firstOrNull() - ?: return "Fail no @Ann: $annotations" - - return annotation.v -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinProperty.kt b/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinProperty.kt deleted file mode 100644 index 5f01b7eb25d..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinProperty.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaClass.java - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -public class JavaClass { - - @Retention(RetentionPolicy.RUNTIME) - @interface Foo { - int value(); - } - - @Foo(KotlinClass.FOO_INT) - public String test() throws NoSuchMethodException { - return KotlinClass.FOO_STRING + - JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); - } -} - -// FILE: kotlinClass.kt - -class KotlinClass { - companion object { - const val FOO_INT: Int = 10 - @JvmField val FOO_STRING: String = "OK" - } -} - -fun box(): String { - val test = JavaClass().test() - return if (test == "OK10") "OK" else "fail : $test" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt b/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt deleted file mode 100644 index 74c8a7cbfff..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -public class JavaClass { - - @Retention(RetentionPolicy.RUNTIME) - @interface Foo { - int value(); - } - - @Foo(KotlinInterface.FOO_INT) - public String test() throws NoSuchMethodException { - return KotlinInterface.FOO_STRING + - JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); - } -} - -// FILE: KotlinInterface.kt - -interface KotlinInterface { - companion object { - const val FOO_INT: Int = 10 - const val FOO_STRING: String = "OK" - } -} - -fun box(): String { - val test = JavaClass().test() - return if (test == "OK10") "OK" else "fail : $test" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotationsOnDefault.kt b/backend.native/tests/external/codegen/box/annotations/annotationsOnDefault.kt deleted file mode 100644 index d9f682c8a55..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotationsOnDefault.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val x: Int) -class A { - @Ann(1) fun foo(x: Int, y: Int = 2, z: Int) {} - - @Ann(1) constructor(x: Int, y: Int = 2, z: Int) -} - -class B @Ann(1) constructor(x: Int, y: Int = 2, z: Int) {} - -fun test(name: String, annotations: Array) { - assertEquals(1, annotations.filterIsInstance().single().x, "$name[0]") -} - -fun box(): String { - val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" } - test("foo", foo.getDeclaredAnnotations()) - - val fooDefault = A::class.java.getDeclaredMethods().first { it.getName() == "foo\$default" } - test("foo", foo.getDeclaredAnnotations()) - - val (secondary, secondaryDefault) = A::class.java.getDeclaredConstructors().partition { it.getParameterTypes().size == 3 } - - test("secondary", secondary[0].getDeclaredAnnotations()) - test("secondary\$default", secondaryDefault[0].getDeclaredAnnotations()) - - val (primary, primaryDefault) = B::class.java.getConstructors().partition { it.getParameterTypes().size == 3 } - - test("primary", primary[0].getDeclaredAnnotations()) - test("primary\$default", primaryDefault[0].getDeclaredAnnotations()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/annotationsOnTypeAliases.kt b/backend.native/tests/external/codegen/box/annotations/annotationsOnTypeAliases.kt deleted file mode 100644 index 497fa723e09..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/annotationsOnTypeAliases.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import kotlin.annotation.AnnotationTarget.* -import kotlin.annotation.AnnotationRetention.* -import java.lang.Class - -@Target(TYPEALIAS) -@Retention(RUNTIME) -annotation class Ann(val x: Int) - -@Ann(2) -typealias TA = Any - -fun Class<*>.assertHasDeclaredMethodWithAnn() { - if (!declaredMethods.any { it.isSynthetic && it.getAnnotation(Ann::class.java) != null }) { - throw java.lang.AssertionError("Class ${this.simpleName} has no declared method with annotation @Ann") - } -} - -fun box(): String { - Class.forName("AnnotationsOnTypeAliasesKt").assertHasDeclaredMethodWithAnn() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/annotations/defaultParameterValues.kt b/backend.native/tests/external/codegen/box/annotations/defaultParameterValues.kt deleted file mode 100644 index 6987d370f5d..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/defaultParameterValues.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val i: Int = 1, - val s: String = "a", - val a: Ann2 = Ann2(), - val e: MyEnum = MyEnum.A, - val c: KClass<*> = A::class, - val ia: IntArray = intArrayOf(1, 2), - val sa: Array = arrayOf("a", "b") -) - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" - if (ann.s != "a") return "fail: annotation parameter s should be \"a\", but was ${ann.s}" - val annSimpleName = ann.a.annotationClass.java.getSimpleName() - if (annSimpleName != "Ann2") return "fail: annotation parameter a should be of class Ann2, but was $annSimpleName" - if (ann.e != MyEnum.A) return "fail: annotation parameter e should be MyEnum.A, but was ${ann.e}" - if (ann.c.java != A::class.java) return "fail: annotation parameter c should be of class A, but was ${ann.c}" - if (ann.ia[0] != 1 || ann.ia[1] != 2) return "fail: annotation parameter ia should be [1, 2], but was ${ann.ia}" - if (ann.sa[0] != "a" || ann.sa[1] != "b") return "fail: annotation parameter ia should be [\"a\", \"b\"], but was ${ann.sa}" - return "OK" -} - -annotation class Ann2 - -enum class MyEnum { - A -} - -class A - -@Ann class MyClass diff --git a/backend.native/tests/external/codegen/box/annotations/delegatedPropertySetter.kt b/backend.native/tests/external/codegen/box/annotations/delegatedPropertySetter.kt deleted file mode 100644 index 1abfbda2f9f..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/delegatedPropertySetter.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KProperty - -@Retention(AnnotationRetention.RUNTIME) -annotation class First - -class MyClass() { - public var x: String by Delegate() - @First set -} - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String { - return "OK" - } - - operator fun setValue(t: Any?, p: KProperty<*>, i: String) {} -} - -fun box(): String { - val e = MyClass::class.java - - val e1 = e.getDeclaredMethod("setX", String::class.java).getAnnotations() - if (e1.size != 1) return "Fail E1 size: ${e1.toList()}" - if (e1[0].annotationClass.java != First::class.java) return "Fail: ${e1.toList()}" - - return MyClass().x -} diff --git a/backend.native/tests/external/codegen/box/annotations/fileClassWithFileAnnotation.kt b/backend.native/tests/external/codegen/box/annotations/fileClassWithFileAnnotation.kt deleted file mode 100644 index c33bb1b4c8d..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/fileClassWithFileAnnotation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:StringHolder("OK") -@file:JvmName("FileClass") - -@Target(AnnotationTarget.FILE) -@Retention(AnnotationRetention.RUNTIME) -public annotation class StringHolder(val value: String) - -fun box(): String = - Class.forName("FileClass").getAnnotation(StringHolder::class.java)?.value ?: "null" diff --git a/backend.native/tests/external/codegen/box/annotations/jvmAnnotationFlags.kt b/backend.native/tests/external/codegen/box/annotations/jvmAnnotationFlags.kt deleted file mode 100644 index fb5282b64df..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/jvmAnnotationFlags.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import java.lang.reflect.Modifier -import kotlin.reflect.KProperty - -class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name -} - -class C { - @Volatile var vol = 1 - @Transient val tra = 1 - @delegate:Transient val del: String by CustomDelegate() - - @Strictfp fun str() {} - @Synchronized fun sync() {} -} - -fun box(): String { - val c = C::class.java - - if (c.getDeclaredField("vol").getModifiers() and Modifier.VOLATILE == 0) return "Fail: volatile" - if (c.getDeclaredField("tra").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: transient" - if (c.getDeclaredField("del\$delegate").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: delegate transient" - - if (c.getDeclaredMethod("str").getModifiers() and Modifier.STRICT == 0) return "Fail: strict" - if (c.getDeclaredMethod("sync").getModifiers() and Modifier.SYNCHRONIZED == 0) return "Fail: synchronized" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/kotlinPropertyFromClassObjectAsParameter.kt b/backend.native/tests/external/codegen/box/annotations/kotlinPropertyFromClassObjectAsParameter.kt deleted file mode 100644 index 1d2eb2eec5c..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/kotlinPropertyFromClassObjectAsParameter.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str) class MyClass - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}" - if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}" - if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}" - return "OK" -} - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val i: Int, - val s: Short, - val f: Float, - val d: Double, - val l: Long, - val b: Byte, - val bool: Boolean, - val c: Char, - val str: String -) - -class Foo { - companion object { - const val i: Int = 2 - const val s: Short = 2 - const val f: Float = 2.0.toFloat() - const val d: Double = 2.0 - const val l: Long = 2 - const val b: Byte = 2 - const val bool: Boolean = true - const val c: Char = 'c' - const val str: String = "str" - } -} diff --git a/backend.native/tests/external/codegen/box/annotations/kotlinTopLevelPropertyAsParameter.kt b/backend.native/tests/external/codegen/box/annotations/kotlinTopLevelPropertyAsParameter.kt deleted file mode 100644 index 4a2fda75c19..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/kotlinTopLevelPropertyAsParameter.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Ann(i, s, f, d, l, b, bool, c, str) class MyClass - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}" - if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}" - if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}" - if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}" - return "OK" -} - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val i: Int, - val s: Short, - val f: Float, - val d: Double, - val l: Long, - val b: Byte, - val bool: Boolean, - val c: Char, - val str: String -) - -const val i: Int = 2 -const val s: Short = 2 -const val f: Float = 2.0.toFloat() -const val d: Double = 2.0 -const val l: Long = 2 -const val b: Byte = 2 -const val bool: Boolean = true -const val c: Char = 'c' -const val str: String = "str" diff --git a/backend.native/tests/external/codegen/box/annotations/kt10136.kt b/backend.native/tests/external/codegen/box/annotations/kt10136.kt deleted file mode 100644 index c0481095c75..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/kt10136.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -annotation class A - -@Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.RUNTIME) -annotation class B(val items: Array = arrayOf(A())) - -@B -class C - -fun box(): String { - val bClass = B::class.java - val cClass = C::class.java - - val items = cClass.getAnnotation(bClass).items - assert(items.size == 1) { "Expected: [A()], got ${items.asList()}" } - assert(items[0] is A) { "Expected: [A()], got ${items.asList()}" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/nestedClassPropertyAsParameter.kt b/backend.native/tests/external/codegen/box/annotations/nestedClassPropertyAsParameter.kt deleted file mode 100644 index 20ce394faf4..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/nestedClassPropertyAsParameter.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Ann(A.B.i) class MyClass - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" - return "OK" -} - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val i: Int) - -class A { - class B { - companion object { - const val i = 1 - } - } -} diff --git a/backend.native/tests/external/codegen/box/annotations/parameterWithPrimitiveType.kt b/backend.native/tests/external/codegen/box/annotations/parameterWithPrimitiveType.kt deleted file mode 100644 index ac5be1259a4..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/parameterWithPrimitiveType.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val b: Byte, - val s: Short, - val i: Int, - val f: Float, - val d: Double, - val l: Long, - val c: Char, - val bool: Boolean -) - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.b != 1.toByte()) return "fail: annotation parameter b should be 1, but was ${ann.b}" - if (ann.s != 1.toShort()) return "fail: annotation parameter s should be 1, but was ${ann.s}" - if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" - if (ann.f != 1.toFloat()) return "fail: annotation parameter f should be 1, but was ${ann.f}" - if (ann.d != 1.0) return "fail: annotation parameter d should be 1, but was ${ann.d}" - if (ann.l != 1.toLong()) return "fail: annotation parameter l should be 1, but was ${ann.l}" - if (ann.c != 'c') return "fail: annotation parameter c should be 1, but was ${ann.c}" - if (!ann.bool) return "fail: annotation parameter bool should be 1, but was ${ann.bool}" - return "OK" -} - -@Ann(1, 1, 1, 1.0.toFloat(), 1.0, 1, 'c', true) class MyClass diff --git a/backend.native/tests/external/codegen/box/annotations/propertyWithPropertyInInitializerAsParameter.kt b/backend.native/tests/external/codegen/box/annotations/propertyWithPropertyInInitializerAsParameter.kt deleted file mode 100644 index 167f2774238..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/propertyWithPropertyInInitializerAsParameter.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Ann(i) class MyClass - -fun box(): String { - val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" - if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" - return "OK" -} - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val i: Int) - -const val i2: Int = 1 -const val i: Int = i2 diff --git a/backend.native/tests/external/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt b/backend.native/tests/external/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt deleted file mode 100644 index 9b51c9fdb51..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@kotlin.internal.LowPriorityInOverloadResolution -fun foo(i: Int) = 1 - -fun foo(a: Any) = 2 - -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@kotlin.internal.LowPriorityInOverloadResolution -fun bar(a: String?) = 3 - -fun bar(a: Any) = 4 - -fun box(): String { - if (foo(1) != 2) return "fail1" - if (bar(null) != 3) return "fail2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/annotations/varargInAnnotationParameter.kt b/backend.native/tests/external/codegen/box/annotations/varargInAnnotationParameter.kt deleted file mode 100644 index 2c21161ee08..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/varargInAnnotationParameter.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(vararg val p: Int) - -@Ann() class MyClass1 -@Ann(1) class MyClass2 -@Ann(1, 2) class MyClass3 - -@Ann(*intArrayOf()) class MyClass4 -@Ann(*intArrayOf(1)) class MyClass5 -@Ann(*intArrayOf(1, 2)) class MyClass6 - -@Ann(p = 1) class MyClass7 - -@Ann(p = *intArrayOf()) class MyClass8 -@Ann(p = *intArrayOf(1)) class MyClass9 -@Ann(p = *intArrayOf(1, 2)) class MyClass10 - -fun box(): String { - test(MyClass1::class.java, "") - test(MyClass2::class.java, "1") - test(MyClass3::class.java, "12") - - test(MyClass4::class.java, "") - test(MyClass5::class.java, "1") - test(MyClass6::class.java, "12") - - test(MyClass7::class.java, "1") - - test(MyClass8::class.java, "") - test(MyClass9::class.java, "1") - test(MyClass10::class.java, "12") - - return "OK" -} - -fun test(klass: Class<*>, expected: String) { - val ann = klass.getAnnotation(Ann::class.java) - if (ann == null) throw AssertionError("fail: cannot find Ann on ${klass}") - - var result = "" - for (i in ann.p) { - result += i - } - - if (result != expected) { - throw AssertionError("fail: expected = ${expected}, actual = ${result}") - } -} diff --git a/backend.native/tests/external/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt b/backend.native/tests/external/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt deleted file mode 100644 index e76d099ca05..00000000000 --- a/backend.native/tests/external/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND: JVM, JS, NATIVE - -// Here we check that there is compilation error, so ignore_backend directive is actual - -@Target(AnnotationTarget.FIELD, AnnotationTarget.CLASS) -annotation class Anno - -class UnresolvedArgument(@Anno(BLA) val s: Int) - -class WithoutArguments(@Deprecated val s: Int) - -fun box(): String { - UnresolvedArgument(3) - WithoutArguments(0) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInObjectSuperCall.kt b/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInObjectSuperCall.kt deleted file mode 100644 index b194d4365b3..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInObjectSuperCall.kt +++ /dev/null @@ -1,10 +0,0 @@ -var result = "fail" - -open class Base(val o: String, val k: String) - -fun box(): String { - val obj1 = object : Base(k = { result = "O"; "K"}() , o = {result += "K"; "O"}()) {} - - if (result != "OK") return "fail $result" - return obj1.o + obj1.k -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInSuperCall.kt b/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInSuperCall.kt deleted file mode 100644 index 042a5dcbae6..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/argumentOrderInSuperCall.kt +++ /dev/null @@ -1,11 +0,0 @@ -var result = "fail" - -open class Base(val o: String, val k: String) -class Derived : Base(k = { result = "O"; "K"}() , o = {result += "K"; "O"}()) {} - -fun box(): String { - val derived = Derived() - - if (result != "OK") return "fail $result" - return derived.o + derived.k -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/arguments.kt b/backend.native/tests/external/codegen/box/argumentOrder/arguments.kt deleted file mode 100644 index f3d4d9b9b33..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/arguments.kt +++ /dev/null @@ -1,13 +0,0 @@ - -fun test(a: String, b: String): String { - return a + b; -} - -fun box(): String { - var res = ""; - val call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) - - if (res != "KO" || call != "OK") return "fail: $res != KO or $call != OK" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/captured.kt b/backend.native/tests/external/codegen/box/argumentOrder/captured.kt deleted file mode 100644 index f4f35913a07..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/captured.kt +++ /dev/null @@ -1,31 +0,0 @@ -fun box(): String { - var invokeOrder = ""; - val expectedResult = "0_1_9" - val expectedInvokeOrder = "1_0_9" - var l = 1L - var i = 0 - val captured = 9L - - var result = test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "$captured"; "$captured"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = test(c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" - - return "OK" -} - -fun test(a: Int, b: Long, c: () -> String): String { - return { "${a}_${b}_${c()}"} () -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/capturedInExtension.kt b/backend.native/tests/external/codegen/box/argumentOrder/capturedInExtension.kt deleted file mode 100644 index cfd5329d520..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/capturedInExtension.kt +++ /dev/null @@ -1,30 +0,0 @@ -fun box(): String { - var invokeOrder = ""; - val expectedResult = "1_0_1_9" - val expectedInvokeOrder = "1_0_9" - var l = 1L - var i = 0 - val captured = 9L - - var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "${captured}"; "${captured}"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" - - return "OK" -} - -fun Double.test(a: Int, b: Long, c: () -> String): String { - return { "${this.toInt()}_${a}_${b}_${c()}"} () -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/defaults.kt b/backend.native/tests/external/codegen/box/argumentOrder/defaults.kt deleted file mode 100644 index ebf9b4d7d19..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/defaults.kt +++ /dev/null @@ -1,13 +0,0 @@ -var invokeOrder: String = "" - -fun test(x: Double = { invokeOrder += "x"; 1.0 }(), a: String, y: Long = { invokeOrder += "y"; 1 }(), b: String): String { - return "" + x.toInt() + a + b + y; -} - -fun box(): String { - val funResult = test(b = { invokeOrder += "K"; "K" }(), a = { invokeOrder += "O"; "O" }()) - - if (invokeOrder != "KOxy" || funResult != "1OK1") return "fail: $invokeOrder != KOxy or $funResult != 1OK1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/extension.kt b/backend.native/tests/external/codegen/box/argumentOrder/extension.kt deleted file mode 100644 index 86fff0d8e1f..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/extension.kt +++ /dev/null @@ -1,30 +0,0 @@ -fun box(): String { - var invokeOrder = ""; - val expectedResult = "1_0_1_L" - val expectedInvokeOrder = "1_0_L" - var l = 1L - var i = 0 - - var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "L"; "L"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" - - return "OK" -} - -fun Double.test(a: Int, b: Long, c: () -> String): String { - return "${this.toInt()}_${a}_${b}_${c()}" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/extensionInClass.kt b/backend.native/tests/external/codegen/box/argumentOrder/extensionInClass.kt deleted file mode 100644 index ed025997c74..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/extensionInClass.kt +++ /dev/null @@ -1,37 +0,0 @@ -fun box(): String { - return Z().test() -} - -class Z { - fun Double.test(a: Int, b: Long, c: () -> String): String { - return "${this.toInt()}_${a}_${b}_${c()}" - } - - - fun test(): String { - var invokeOrder = ""; - val expectedResult = "1_0_1_L" - val expectedInvokeOrder = "1_0_L" - var l = 1L - var i = 0 - - var result = 1.0.test(b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = { invokeOrder += "1_"; l }(), c = { invokeOrder += "L"; "L" }, a = { invokeOrder += "0_"; i }()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }()) - if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" - - return "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/kt9277.kt b/backend.native/tests/external/codegen/box/argumentOrder/kt9277.kt deleted file mode 100644 index eb08fb7b719..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/kt9277.kt +++ /dev/null @@ -1,13 +0,0 @@ -// KT-9277 Unexpected NullPointerException in an invocaton with named arguments - -fun box(): String { - foo(null) - - return "OK" -} - -fun foo(x : Int?){ - bar(z = x ?: return, y = x) -} - -fun bar(y : Int, z : Int) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigration.kt b/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigration.kt deleted file mode 100644 index 6ef53bff6ee..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigration.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - var res = ""; - var call = test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "KOL") return "fail 1: $res != KOL or $call != KOL" - - res = ""; - call = test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOL") return "fail 2: $res != KOL or $call != KOL" - - - res = ""; - call = test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOL") return "fail 3: $res != KOL or $call != KOL" - - return "OK" - -} - -fun test(a: String, b: String, c: () -> String): String { - return a + b + c(); -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigrationInClass.kt b/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigrationInClass.kt deleted file mode 100644 index 7100b035e29..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/lambdaMigrationInClass.kt +++ /dev/null @@ -1,25 +0,0 @@ -fun box(): String { - var res = ""; - var call = Z("Z").test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "KOLZ") return "fail 1: $res != KOL or $call != KOLZ" - - res = ""; - call = Z("Z").test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOLZ") return "fail 2: $res != KOL or $call != KOLZ" - - - res = ""; - call = Z("Z").test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOLZ") return "fail 3: $res != KOL or $call != KOLZ" - - return "OK" - -} - -class Z(val p: String) { - - fun test(a: String, b: String, c: () -> String): String { - return a + b + c() + p; - } - -} diff --git a/backend.native/tests/external/codegen/box/argumentOrder/simple.kt b/backend.native/tests/external/codegen/box/argumentOrder/simple.kt deleted file mode 100644 index 112891c4d9a..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/simple.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - var res = ""; - var call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "OKL") return "fail 1: $res != KOL or $call != OKL" - - res = ""; - call = test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKL") return "fail 2: $res != KOL or $call != OKL" - - - res = ""; - call = test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKL") return "fail 3: $res != KOL or $call != OKL" - - return "OK" - -} - -fun test(a: String, b: String, c: () -> String): String { - return a + b + c(); -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/simpleInClass.kt b/backend.native/tests/external/codegen/box/argumentOrder/simpleInClass.kt deleted file mode 100644 index 71bc1f7452c..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/simpleInClass.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun box(): String { - var res = ""; - var call = Z("Z").test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "OKLZ") return "fail 1: $res != KOL or $call != OKLZ" - - res = ""; - call = Z("Z").test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKLZ") return "fail 2: $res != KOL or $call != OKLZ" - - - res = ""; - call = Z("Z").test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKLZ") return "fail 3: $res != KOL or $call != OKLZ" - - return "OK" - -} - -class Z(val p: String) { - fun test(a: String, b: String, c: () -> String): String { - return a + b + c() + p; - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/argumentOrder/varargAndDefaultParameters_ForNative.kt b/backend.native/tests/external/codegen/box/argumentOrder/varargAndDefaultParameters_ForNative.kt deleted file mode 100644 index 969dc8e84f8..00000000000 --- a/backend.native/tests/external/codegen/box/argumentOrder/varargAndDefaultParameters_ForNative.kt +++ /dev/null @@ -1,54 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -// WITH_RUNTIME -// TARGET_BACKEND: NATIVE -package test - -open class A(val value: String) - -var invokeOrder = "" - -inline fun inlineFun( - vararg constraints: A, - receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(), - init: String -): String { - return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init -} - -// FILE: 2.kt -import test.* - - -var result = "" -fun box(): String { - - result = "" - invokeOrder = "" - result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }(), - init = { invokeOrder += " init"; "I" }()) - if (result != "C, R, I") return "fail 1: $result" - - if (invokeOrder != "constraints receiver init") return "fail 2: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }() - ) - if (result != "C, R, I") return "fail 3: $result" - //Change test after KT-17691 FIX - if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += " constraints";A("C") }()) - if (result != "C, DEFAULT, I") return "fail 5: $result" - if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/arrays/arrayConstructorsSimple.kt b/backend.native/tests/external/codegen/box/arrays/arrayConstructorsSimple.kt deleted file mode 100644 index 1c28cf17aa0..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arrayConstructorsSimple.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun simpleIntArray(): Array = Array(3) { it } -fun simpleDoubleArray(): Array = Array(3) { it.toDouble() + 0.1 } -fun simpleStringArray(): Array = Array(3) { it.toString() } - -fun box(): String { - val ia = simpleIntArray() - assertEquals(0, ia[0]) - assertEquals(1, ia[1]) - assertEquals(2, ia[2]) - - val da = simpleDoubleArray() - assertEquals(0.1, da[0]) - assertEquals(1.1, da[1]) - assertEquals(2.1, da[2]) - - val sa = simpleStringArray() - assertEquals("0", sa[0]) - assertEquals("1", sa[1]) - assertEquals("2", sa[2]) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/arrayGetAssignMultiIndex.kt b/backend.native/tests/external/codegen/box/arrays/arrayGetAssignMultiIndex.kt deleted file mode 100644 index 5e8e8bbd546..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arrayGetAssignMultiIndex.kt +++ /dev/null @@ -1,11 +0,0 @@ -operator fun Array.get(index1: Int, index2: Int) = this[index1 + index2] -operator fun Array.set(index1: Int, index2: Int, elem: String) { - this[index1 + index2] = elem -} - -fun box(): String { - val s = Array(1, { "" }) - s[1, -1] = "O" - s[2, -2] += "K" - return s[-3, 3] -} diff --git a/backend.native/tests/external/codegen/box/arrays/arrayGetMultiIndex.kt b/backend.native/tests/external/codegen/box/arrays/arrayGetMultiIndex.kt deleted file mode 100644 index 6898a9b08e6..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arrayGetMultiIndex.kt +++ /dev/null @@ -1,11 +0,0 @@ -operator fun Array.get(index1: Int, index2: Int) = this[index1 + index2] -operator fun Array.set(index1: Int, index2: Int, elem: String) { - this[index1 + index2] = elem -} - -fun box(): String { - val s = Array(1, { "" }) - s[1, -1] = "OK" - return s[-2, 2] -} - diff --git a/backend.native/tests/external/codegen/box/arrays/arrayInstanceOf.kt b/backend.native/tests/external/codegen/box/arrays/arrayInstanceOf.kt deleted file mode 100644 index 406b97e57a4..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arrayInstanceOf.kt +++ /dev/null @@ -1,29 +0,0 @@ -//test [], get and iterator calls -fun test(createIntNotLong: Boolean): String { - val a = if (createIntNotLong) IntArray(5) else LongArray(5) - if (a is IntArray) { - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "O" - } else if (a is LongArray) { - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a.get(i) != x.next()) return "Fail $i" - i++ - } - return "K" - } - return "fail" -} - -fun box(): String { - // Only run this test if primitive array `is` checks work (KT-17137) - if ((intArrayOf() as Any) is Array<*>) return "OK" - - return test(true) + test(false) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/arrayPlusAssign.kt b/backend.native/tests/external/codegen/box/arrays/arrayPlusAssign.kt deleted file mode 100644 index 9a243990fd5..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arrayPlusAssign.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val s = IntArray(1) - s[0] = 5 - s[0] += 7 - return if (s[0] == 12) "OK" else "Fail ${s[0]}" -} diff --git a/backend.native/tests/external/codegen/box/arrays/arraysAreCloneable.kt b/backend.native/tests/external/codegen/box/arrays/arraysAreCloneable.kt deleted file mode 100644 index f0860dadc0a..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/arraysAreCloneable.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun foo(x: Cloneable) = x - -fun box(): String { - foo(arrayOf("")) - foo(intArrayOf()) - foo(longArrayOf()) - foo(shortArrayOf()) - foo(byteArrayOf()) - foo(charArrayOf()) - foo(doubleArrayOf()) - foo(floatArrayOf()) - foo(booleanArrayOf()) - - arrayOf("").clone() - intArrayOf().clone() - longArrayOf().clone() - shortArrayOf().clone() - byteArrayOf().clone() - charArrayOf().clone() - doubleArrayOf().clone() - floatArrayOf().clone() - booleanArrayOf().clone() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/cloneArray.kt b/backend.native/tests/external/codegen/box/arrays/cloneArray.kt deleted file mode 100644 index fe7ae5ff309..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/cloneArray.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val s = arrayOf("live", "long") - val t: Array = s.clone() - if (!(s contentEquals t)) return "Fail string" - if (s === t) return "Fail string identity" - - val ss = arrayOf(s, s) - val tt: Array> = ss.clone() - if (!(ss contentEquals tt)) return "Fail string[]" - if (ss === tt) return "Fail string[] identity" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/clonePrimitiveArrays.kt b/backend.native/tests/external/codegen/box/arrays/clonePrimitiveArrays.kt deleted file mode 100644 index 578c79c0d3c..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/clonePrimitiveArrays.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val i = intArrayOf(1, 2) - if (!(i contentEquals i.clone())) return "Fail int" - if (i.clone() === i) return "Fail int identity" - - val j = longArrayOf(1L, 2L) - if (!(j contentEquals j.clone())) return "Fail long" - if (j.clone() === j) return "Fail long identity" - - val s = shortArrayOf(1.toShort(), 2.toShort()) - if (!(s contentEquals s.clone())) return "Fail short" - if (s.clone() === s) return "Fail short identity" - - val b = byteArrayOf(1.toByte(), 2.toByte()) - if (!(b contentEquals b.clone())) return "Fail byte" - if (b.clone() === b) return "Fail byte identity" - - val c = charArrayOf('a', 'b') - if (!(c contentEquals c.clone())) return "Fail char" - if (c.clone() === c) return "Fail char identity" - - val d = doubleArrayOf(1.0, -1.0) - if (!(d contentEquals d.clone())) return "Fail double" - if (d.clone() === d) return "Fail double identity" - - val f = floatArrayOf(1f, -1f) - if (!(f contentEquals f.clone())) return "Fail float" - if (f.clone() === f) return "Fail float identity" - - val z = booleanArrayOf(true, false) - if (!(z contentEquals z.clone())) return "Fail boolean" - if (z.clone() === z) return "Fail boolean identity" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/collectionAssignGetMultiIndex.kt b/backend.native/tests/external/codegen/box/arrays/collectionAssignGetMultiIndex.kt deleted file mode 100644 index 974b55f66a5..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/collectionAssignGetMultiIndex.kt +++ /dev/null @@ -1,12 +0,0 @@ -operator fun ArrayList.get(index1: Int, index2: Int) = this[index1 + index2] -operator fun ArrayList.set(index1: Int, index2: Int, elem: String) { - this[index1 + index2] = elem -} - -fun box(): String { - val s = ArrayList(1) - s.add("") - s[1, -1] = "O" - s[2, -2] += "K" - return s[2, -2] -} diff --git a/backend.native/tests/external/codegen/box/arrays/collectionGetMultiIndex.kt b/backend.native/tests/external/codegen/box/arrays/collectionGetMultiIndex.kt deleted file mode 100644 index 295f860f84a..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/collectionGetMultiIndex.kt +++ /dev/null @@ -1,11 +0,0 @@ -operator fun ArrayList.get(index1: Int, index2: Int) = this[index1 + index2] -operator fun ArrayList.set(index1: Int, index2: Int, elem: String) { - this[index1 + index2] = elem -} - -fun box(): String { - val s = ArrayList(1) - s.add("") - s[1, -1] = "OK" - return s[2, -2] -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachBooleanArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachBooleanArray.kt deleted file mode 100644 index f0238410cc5..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachBooleanArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in BooleanArray(5)) { - if (x != false) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachByteArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachByteArray.kt deleted file mode 100644 index 1ae8205531a..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachByteArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in ByteArray(5)) { - if (x != 0.toByte()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachCharArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachCharArray.kt deleted file mode 100644 index 4b797671175..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachCharArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in CharArray(5)) { - if (x != 0.toChar()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachDoubleArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachDoubleArray.kt deleted file mode 100644 index c1a79f222a3..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachDoubleArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in DoubleArray(5)) { - if (x != 0.toDouble()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachFloatArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachFloatArray.kt deleted file mode 100644 index 8245beab4ee..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachFloatArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in FloatArray(5)) { - if (x != 0.toFloat()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachIntArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachIntArray.kt deleted file mode 100644 index 53ce12dd393..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachIntArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in IntArray(5)) { - if (x != 0) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachLongArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachLongArray.kt deleted file mode 100644 index 6ed0259f765..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachLongArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in LongArray(5)) { - if (x != 0.toLong()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/forEachShortArray.kt b/backend.native/tests/external/codegen/box/arrays/forEachShortArray.kt deleted file mode 100644 index a9145d42422..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/forEachShortArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - for (x in ShortArray(5)) { - if (x != 0.toShort()) return "Fail $x" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt b/backend.native/tests/external/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt deleted file mode 100644 index 0493164e585..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME -abstract class Table( - val content: Array> -) - -fun box(): String { - val x = object : Table( - Array(1, { - x-> Array(1, {y -> "OK"}) - }) - ) {} - - return x.content[0][0] -} diff --git a/backend.native/tests/external/codegen/box/arrays/hashMap.kt b/backend.native/tests/external/codegen/box/arrays/hashMap.kt deleted file mode 100644 index 9c04d4911d6..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/hashMap.kt +++ /dev/null @@ -1,9 +0,0 @@ -operator fun HashMap.set(index: String, elem: Int?) { - this.put(index, elem) -} - -fun box(): String { - val s = HashMap() - s["239"] = 239 - return if (s["239"] == 239) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/arrays/inProjectionAsParameter.kt b/backend.native/tests/external/codegen/box/arrays/inProjectionAsParameter.kt deleted file mode 100644 index d89fdf1f02b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/inProjectionAsParameter.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun test(y: Array>) { - y[0] = kotlin.arrayOf("OK") -} - -fun box() : String { - val x : Array> = kotlin.arrayOf(kotlin.arrayOf(1)) - test(x) - return x[0][0] as String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/inProjectionOfArray.kt b/backend.native/tests/external/codegen/box/arrays/inProjectionOfArray.kt deleted file mode 100644 index 87785a47aaf..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/inProjectionOfArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val x : Array> = arrayOf(arrayOf(1)) - val y : Array> = x - - if (y.size != 1) return "fail 1" - - y[0] = arrayOf("OK") - - return x[0][0] as String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/inProjectionOfList.kt b/backend.native/tests/external/codegen/box/arrays/inProjectionOfList.kt deleted file mode 100644 index 3a22c9124c9..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/inProjectionOfList.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val x: Array> = arrayOf(listOf(1)) - val y : Array> = x - - if (y.size != 1) return "fail 1" - - y[0] = listOf("OK") - - return x[0][0] as String -} diff --git a/backend.native/tests/external/codegen/box/arrays/indices.kt b/backend.native/tests/external/codegen/box/arrays/indices.kt deleted file mode 100644 index 65976591a77..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/indices.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val a = Array(5, {it}) - val x = a.indices.iterator() - while (x.hasNext()) { - val i = x.next() - if (a[i] != i) return "Fail $i ${a[i]}" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/indicesChar.kt b/backend.native/tests/external/codegen/box/arrays/indicesChar.kt deleted file mode 100644 index 5d3470e389d..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/indicesChar.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val a = CharArray(5) - val x = a.indices.iterator() - while (x.hasNext()) { - val i = x.next() - if (a[i] != 0.toChar()) return "Fail $i ${a[i]}" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iterator.kt b/backend.native/tests/external/codegen/box/arrays/iterator.kt deleted file mode 100644 index eb8f84cbb04..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iterator.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val x = Array(5, { it } ).iterator() - var i = 0 - while (x.hasNext()) { - if (x.next() != i) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorBooleanArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorBooleanArray.kt deleted file mode 100644 index 753381f34f4..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorBooleanArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = BooleanArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorByteArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorByteArray.kt deleted file mode 100644 index 259eb5f3200..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorByteArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = ByteArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorByteArrayNextByte.kt b/backend.native/tests/external/codegen/box/arrays/iteratorByteArrayNextByte.kt deleted file mode 100644 index 61c458433a7..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorByteArrayNextByte.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = ByteArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.nextByte()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorCharArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorCharArray.kt deleted file mode 100644 index 525910d31e3..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorCharArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = CharArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorDoubleArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorDoubleArray.kt deleted file mode 100644 index 192625f22c6..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorDoubleArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = DoubleArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorFloatArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorFloatArray.kt deleted file mode 100644 index 4a5b86e694f..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorFloatArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = FloatArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorIntArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorIntArray.kt deleted file mode 100644 index 2dd09e3a59c..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorIntArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = IntArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorLongArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorLongArray.kt deleted file mode 100644 index b1033002764..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorLongArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = LongArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorLongArrayNextLong.kt b/backend.native/tests/external/codegen/box/arrays/iteratorLongArrayNextLong.kt deleted file mode 100644 index cc9cec5d570..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorLongArrayNextLong.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = LongArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.nextLong()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/iteratorShortArray.kt b/backend.native/tests/external/codegen/box/arrays/iteratorShortArray.kt deleted file mode 100644 index 49807e23720..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/iteratorShortArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val a = ShortArray(5) - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt1291.kt b/backend.native/tests/external/codegen/box/arrays/kt1291.kt deleted file mode 100644 index 02b5fd89707..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt1291.kt +++ /dev/null @@ -1,27 +0,0 @@ -var result = 0 - -fun Iterator.foreach(action: (T) -> Unit) { - while (this.hasNext()) { - (action)(this.next()) - } -} - -fun Iterator.select(f: (In) -> Out) : Iterator { - return Selector(this, f); -} - -class Selector(val source: Iterator, val f: (In) -> Out) : Iterator { - override fun hasNext(): Boolean = source.hasNext() - - override fun next(): Out { - return (f)(source.next()) - } -} - -fun box(): String { - Array(4, { it + 1 }).iterator() - .select({i -> i * 10}) - .foreach({k -> result += k}) - if (result != 10+20+30+40) return "Fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt17134.kt b/backend.native/tests/external/codegen/box/arrays/kt17134.kt deleted file mode 100644 index 515d0aceeb9..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt17134.kt +++ /dev/null @@ -1,17 +0,0 @@ -//WITH_RUNTIME -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -object A { - @JvmStatic fun main(args: Array) { - val b = arrayOf(arrayOf("")) - object { - val c = b[0] - } - } -} - -fun box(): String { - A.main(emptyArray()) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/kt238.kt b/backend.native/tests/external/codegen/box/arrays/kt238.kt deleted file mode 100644 index 71c935d5c9d..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt238.kt +++ /dev/null @@ -1,58 +0,0 @@ -fun t1 () { - val a1 = arrayOfNulls(1) - a1[0] = "0" //ok - val s = a1[0] //ok -} - -fun t2 () { - val a2 = arrayOfNulls(1) as Array - a2[0] = 0 //ok - var i = a2[0] //ok -} - -fun t3 () { - val a3 = arrayOfNulls(1) - a3[0] = 0 //verify error - var j = a3[0] //ok - var k : Int = a3[0] ?: 5 //ok -} - -fun t4 () { - val b1 = StrangeIntArray(10) - b1[4] = 5 //ok - var i = b1[1] //ok -} - -fun t5 () { - val b2 = StrangeArray(10, 0) - b2.set(4, 5) //ok - b2[4] = 5 //verify error - var i = b2.get(2) //ok - i = b2[1] //verify error -} - -fun t6() { - val b3 = StrangeArray(10, 0) - b3.set(5, 6) //ok - b3[4] = 5 //verify error - val v = b3[1] //ok -} - -fun box() : String { - return "OK" -} - -class StrangeArray(size: Int, private var defaultValue: T) { - operator fun get(index: Int): T = defaultValue - operator fun set(index: Int, v: T) { - defaultValue = v - } -} - -class StrangeIntArray(size: Int) { - private var defaultValue = 0 - operator fun get(index: Int): Int = defaultValue - operator fun set(index: Int, v: Int) { - defaultValue = v - } -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt2997.kt b/backend.native/tests/external/codegen/box/arrays/kt2997.kt deleted file mode 100644 index ac70c009a2d..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt2997.kt +++ /dev/null @@ -1,80 +0,0 @@ -//KT-2997 Automatically cast error (Array) - -fun foo(a: Any): Int { - if (a is IntArray) { - a.get(0) - a.set(0, 1) - a.iterator() - return a.size - } - if (a is ShortArray) { - a.get(0) - a.set(0, 1) - a.iterator() - return a.size - } - if (a is ByteArray) { - a.get(0) - a.set(0, 1) - a.iterator() - return a.size - } - if (a is FloatArray) { - a.get(0) - a.set(0, 1.toFloat()) - a.iterator() - return a.size - } - if (a is DoubleArray) { - a.get(0) - a.set(0, 1.0) - a.iterator() - return a.size - } - if (a is BooleanArray) { - a.get(0) - a.set(0, false) - a.iterator() - return a.size - } - if (a is CharArray) { - a.get(0) - a.set(0, 'a') - a.iterator() - return a.size - } - if (a is Array<*>) { - if (a.size > 0) a.get(0) - a.iterator() - return a.size - } - - return 0 -} - -fun box(): String { - // Only run this test if primitive array `is` checks work (KT-17137) - if ((intArrayOf() as Any) is Array<*>) return "OK" - - val iA = IntArray(1) - if (foo(iA) != 1) return "fail int[]" - val sA = ShortArray(1) - if (foo(sA) != 1) return "fail short[]" - val bA = ByteArray(1) - if (foo(bA) != 1) return "fail byte[]" - val fA = FloatArray(1) - if (foo(fA) != 1) return "fail float[]" - val dA = DoubleArray(1) - if (foo(dA) != 1) return "fail double[]" - val boolA = BooleanArray(1) - if (foo(boolA) != 1) return "fail boolean[]" - val cA = CharArray(1) - if (foo(cA) != 1) return "fail char[]" - val oA = arrayOfNulls(1) - if (foo(oA) != 1) return "fail Any[]" - - val sArray = arrayOfNulls(0) - if (foo(sArray) != 0) return "fail String[]" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt33.kt b/backend.native/tests/external/codegen/box/arrays/kt33.kt deleted file mode 100644 index 25941e0f5cd..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt33.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box () : String { - val s = ArrayList() - s.add("foo") - s[0] += "bar" - return if(s[0] == "foobar") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt3771.kt b/backend.native/tests/external/codegen/box/arrays/kt3771.kt deleted file mode 100644 index 60db734b833..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt3771.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun fill(dest : Array, v : String) { - dest[0] = v -} - -fun box() : String { -//fun main(args : Array) { - val s : String = "bar" - val any : Array = arrayOf(1, "foo", 1.234) - fill(any, s) - /* shouldn't throw -ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String; - */ - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt4118.kt b/backend.native/tests/external/codegen/box/arrays/kt4118.kt deleted file mode 100644 index 979effeed54..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt4118.kt +++ /dev/null @@ -1,94 +0,0 @@ -fun Array.test1(): Array { - val func = { i:Int -> this} - return func(1) -} - -fun Array.test1Nested(): Array { - val func = { i: Int -> { this }()} - return func(1) -} - - -fun Array.test2() : Array { - class Z2() { - fun run(): Array { - return this@test2 - } - } - return Z2().run() -} - -fun Array.test2Nested() : Array { - class Z2() { - fun run(): Array { - class Z3 { - fun run(): Array { - return this@test2Nested; - } - } - return Z3().run() - } - } - return Z2().run() -} - -fun Array.test3(): Array { - fun local(): Array { - return this@test3 - } - return local() -} - -fun Array.test3Nested(): Array { - fun local(): Array { - fun local2(): Array { - return this@test3Nested - } - return local2() - } - return local() -} - - -fun Array.test4() : Array { - return object { - fun run() : Array { - return this@test4 - } - }.run() -} - -fun Array.test4Nested() : Array { - return object { - fun run() : Array { - return object { - fun run() : Array { - return this@test4Nested - } - }.run() - } - }.run() -} - -fun Array.test1(): Array { - val func = { i: Int -> this} - return func(1) -} - - -fun box() : String { - val array = Array(2, { i -> "${i}" }) - if (array != array.test1()) return "fail 1" - if (array != array.test2()) return "fail 2" - if (array != array.test3()) return "fail 3" - if (array != array.test4()) return "fail 4" - - if (array != array.test1Nested()) return "fail 1Nested" - if (array != array.test2Nested()) return "fail 2Nested" - if (array != array.test3Nested()) return "fail 3Nested" - if (array != array.test4Nested()) return "fail 4Nested" - - val array2 = Array(2, { i -> DoubleArray(i) }) - if (array2 != array2.test1()) return "fail on array of double []" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/kt4348.kt b/backend.native/tests/external/codegen/box/arrays/kt4348.kt deleted file mode 100644 index aba4a1922d9..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt4348.kt +++ /dev/null @@ -1,14 +0,0 @@ -operator fun String.get(vararg value: Any) : String { - return if (value[0] == 44 && value[1] == "example") "OK" else "fail" -} - -operator fun Int.get(vararg value: Any) : Int { - return if (value[0] == 44 && value[1] == "example") 1 else 0 -} - -fun box(): String { - if ("foo" [44, "example"] != "OK") return "fail1" - if (11 [44, "example"] != 1) return "fail2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/kt4357.kt b/backend.native/tests/external/codegen/box/arrays/kt4357.kt deleted file mode 100644 index 95b92765fa4..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt4357.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val array = intArrayOf(11, 12, 13) - val p = array.get(0) - if (p != 11) return "fail 1: $p" - - val stringArray = arrayOf("OK", "FAIL") - return stringArray.get(0) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/kt503.kt b/backend.native/tests/external/codegen/box/arrays/kt503.kt deleted file mode 100644 index bdad1a98add..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt503.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun iarr(vararg a : Int) = a -fun array(vararg a : T) = a - -fun box() : String { - val tests = array( - iarr(6, 5, 4, 3, 2, 1), - iarr(1, 2), - iarr(1, 2, 3), - iarr(1, 2, 3, 4), - iarr(1) - ) - - var n = 0 - - try { - var i = 0 - while (true) { - if (thirdElementIsThree(tests[i++])) - n++ - } - } - catch (e : ArrayIndexOutOfBoundsException) { - // No more tests to process - } - return if(n == 2) "OK" else "fail" -} - -fun thirdElementIsThree(a : IntArray) = - a.size >= 3 && a[2] == 3 diff --git a/backend.native/tests/external/codegen/box/arrays/kt594.kt b/backend.native/tests/external/codegen/box/arrays/kt594.kt deleted file mode 100644 index c67bd1b66e7..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt594.kt +++ /dev/null @@ -1,16 +0,0 @@ -package array_test - -fun box() : String { - var array : IntArray? = IntArray(10) - array?.set(0, 3) - if(array?.get(0) != 3) return "fail" - - var a = arrayOfNulls>(5) - var b = arrayOfNulls(1) - b.set(0, "239") - a?.set(0, b) - - if(a?.get(0)?.get(0) != "239") return "fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt602.kt b/backend.native/tests/external/codegen/box/arrays/kt602.kt deleted file mode 100644 index 471a56cc117..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt602.kt +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box() = if(arrayOfNulls(10).isArrayOf()) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/arrays/kt7009.kt b/backend.native/tests/external/codegen/box/arrays/kt7009.kt deleted file mode 100644 index 91cf7e4fa5b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt7009.kt +++ /dev/null @@ -1,6 +0,0 @@ -// WITH_RUNTIME - -fun box() : String { - val value = (1 to doubleArrayOf(1.0)).second[0] - return if (value == 1.0) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt7288.kt b/backend.native/tests/external/codegen/box/arrays/kt7288.kt deleted file mode 100644 index 2c387e56cf9..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt7288.kt +++ /dev/null @@ -1,32 +0,0 @@ -fun test(b: Boolean): String { - val a = if (b) IntArray(5) else LongArray(5) - if (a is IntArray) { - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" - } else if (a is LongArray) { - val x = a.iterator() - var i = 0 - while (x.hasNext()) { - if (a[i] != x.next()) return "Fail $i" - i++ - } - return "OK" - } - return "fail" -} - -fun box(): String { - // Only run this test if primitive array `is` checks work (KT-17137) - if ((intArrayOf() as Any) is Array<*>) return "OK" - - if (test(true) != "OK") return "fail 1: ${test(true)}" - - if (test(false) != "OK") return "fail 1: ${test(false)}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/kt7338.kt b/backend.native/tests/external/codegen/box/arrays/kt7338.kt deleted file mode 100644 index 848764b3f57..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt7338.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun foo(x : Any): String { - return if(x is Array<*> && x.isArrayOf()) (x as Array)[0] else "fail" -} - -fun box(): String { - return foo(arrayOf("OK")) -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt779.kt b/backend.native/tests/external/codegen/box/arrays/kt779.kt deleted file mode 100644 index a56d1e0874b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt779.kt +++ /dev/null @@ -1,3 +0,0 @@ -val Array.length : Int get() = this.size - -fun box() = if(arrayOfNulls(10).length == 10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/arrays/kt945.kt b/backend.native/tests/external/codegen/box/arrays/kt945.kt deleted file mode 100644 index eaf6c5e61b6..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt945.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box() : String { - val data = Array>(3) { Array(4, {false}) } - for(d in data) { - if(d.size != 4) return "fail" - for(b in d) if (b) return "fail" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/kt950.kt b/backend.native/tests/external/codegen/box/arrays/kt950.kt deleted file mode 100644 index f9d26d44d43..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/kt950.kt +++ /dev/null @@ -1,7 +0,0 @@ -operator fun MutableMap.set(k : K, v : V) = put(k, v) - -fun box() : String { - val map = HashMap() - map["239"] = "932" - return if(map["239"] == "932") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/arrays/longAsIndex.kt b/backend.native/tests/external/codegen/box/arrays/longAsIndex.kt deleted file mode 100644 index c12d4dca9a4..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/longAsIndex.kt +++ /dev/null @@ -1,9 +0,0 @@ -operator fun IntArray.set(index: Long, elem: Int) { this[index.toInt()] = elem } -operator fun IntArray.get(index: Long) = this[index.toInt()] - -fun box(): String { - var l = IntArray(1) - l[0.toLong()] = 4 - l[0.toLong()] += 6 - return if (l[0.toLong()] == 10) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/arrays/multiArrayConstructors.kt b/backend.native/tests/external/codegen/box/arrays/multiArrayConstructors.kt deleted file mode 100644 index 77663265456..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiArrayConstructors.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun stringMultiArray(): Array> = Array(3) { - i -> Array(3) { j -> "$i-$j" } -} - -fun stringNullableMultiArray(): Array> = Array(3) { - i -> if (i == 1) Array(3) { j -> "$i-$j" } as Array else arrayOfNulls(3) -} - -fun box(): String { - val matrix = stringMultiArray() - - for (i in 0..2) { - for (j in 0..2) { - assertEquals("$i-$j", matrix[i][j], "matrix") - } - } - - val matrixNullable = stringNullableMultiArray() - - for (j in 0..2) { - assertEquals(null, matrixNullable[0][j], "nullable") - assertEquals("1-$j", matrixNullable[1][j], "nullable") - assertEquals(null, matrixNullable[2][j], "nullable") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclFor.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclFor.kt deleted file mode 100644 index 8657604547a..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclFor.kt +++ /dev/null @@ -1,18 +0,0 @@ -class C(val i: Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 -} - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> C(x)}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 056a9f5f793..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,19 +0,0 @@ -class C(val i: Int) { -} - -operator fun C.component1() = i + 1 -operator fun C.component2() = i + 2 - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> C(x)}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 6a9f6be2409..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,21 +0,0 @@ -class C(val i: Int) { -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 - - fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val l = Array(3, {x -> C(x)}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 376aabb2466..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,21 +0,0 @@ -class C(val i: Int) { -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 -} - -fun M.doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> C(x)}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForValCaptured.kt deleted file mode 100644 index f25b504d607..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/MultiDeclForValCaptured.kt +++ /dev/null @@ -1,18 +0,0 @@ -class C(val i: Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 -} - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val l = Array(3, {x -> C(x)}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt deleted file mode 100644 index f0687781516..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,16 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index 3dda25067f3..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,16 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 2cf40134bf3..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,18 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 - - fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val l = Array(3, {x -> x}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 9ad2af28556..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,18 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 -} - -fun M.doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15560.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15560.kt deleted file mode 100644 index 552a6653a97..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15560.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val array = arrayOf(doubleArrayOf(-1.0)) - for (node in array) { - node[0] += 1.0 - } - if (array[0][0] != 0.0) return "fail ${array[0][0]}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15568.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15568.kt deleted file mode 100644 index c030c22b217..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15568.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - val a = Array(2) { DoubleArray(3) } - - for (i in 1..1) { - for (j in 0..2) { - a[i][j] += a[i - 1][j] - } - } - - if (a[0][0] != 0.0) return "fail ${a[0][0]}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15575.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15575.kt deleted file mode 100644 index 16a7300358b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/kt15575.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val transform = transform(Array(1) { BooleanArray(1) }) - if (!transform[0][0]) return "OK" - return "fail" -} - -fun transform(screen: Array) = Array(1) { x -> - screen[x] -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 0ca7fc49d13..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,16 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x.toLong()}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index 3e610b49997..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,16 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x.toLong()}) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index dad12c6d80f..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,18 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 - - fun doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val l = Array(3, {x -> x.toLong()}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index fde531f8d21..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,18 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 -} - -fun M.doTest(l : Array): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = Array(3, {x -> x.toLong()}) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt b/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt deleted file mode 100644 index f87032e9a3b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt +++ /dev/null @@ -1,66 +0,0 @@ -fun testArray() { - Array(5) { i -> - if (i == 3) return - i.toString() - } - throw AssertionError() -} - -fun testIntArray() { - IntArray(5) { i -> - if (i == 3) return - i - } - throw AssertionError() -} - -fun testLongArray() { - LongArray(5) { i -> - if (i == 3) return - i.toLong() - } - throw AssertionError() -} - -fun testBooleanArray() { - BooleanArray(5) { i -> - if (i == 3) return - i % 2 == 0 - } - throw AssertionError() -} - -fun testCharArray() { - CharArray(5) { i -> - if (i == 3) return - i.toChar() - } - throw AssertionError() -} - -fun testFloatArray() { - FloatArray(5) { i -> - if (i == 3) return - i.toFloat() - } - throw AssertionError() -} - -fun testDoubleArray() { - DoubleArray(5) { i -> - if (i == 3) return - i.toDouble() - } - throw AssertionError() -} - -fun box(): String { - testArray() - testIntArray() - testLongArray() - testBooleanArray() - testCharArray() - testFloatArray() - testDoubleArray() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/nonNullArray.kt b/backend.native/tests/external/codegen/box/arrays/nonNullArray.kt deleted file mode 100644 index 2e480979e6b..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/nonNullArray.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A() { - class B(val i: Int) { - } - - fun test() = Array (10, { B(it) }) -} - -fun box() = if(A().test()[5].i == 5) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/arrays/primitiveArrays.kt b/backend.native/tests/external/codegen/box/arrays/primitiveArrays.kt deleted file mode 100644 index 86e2b17cb5a..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/primitiveArrays.kt +++ /dev/null @@ -1,193 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -fun box(): String { - assertTrue(eqBoolean(booleanArrayOf(false), BooleanArray(1))) - assertTrue(eqBoolean(booleanArrayOf(false, true, false), BooleanArray(3) { it % 2 != 0 })) - assertTrue(eqBoolean(booleanArrayOf(true), booleanArrayOf(true).copyOf())) - assertTrue(eqBoolean(booleanArrayOf(true, false), booleanArrayOf(true).copyOf(2))) - assertTrue(eqBoolean(booleanArrayOf(true), booleanArrayOf(true, true).copyOf(1))) - assertTrue(eqBoolean(booleanArrayOf(false, true), booleanArrayOf(false) + true)) - assertTrue(eqBoolean(booleanArrayOf(false, true, false), booleanArrayOf(false) + listOf(true, false))) - assertTrue(eqBoolean(booleanArrayOf(true, false), booleanArrayOf(false, true, false, true).copyOfRange(1, 3))) - assertTrue(eqBoolean(booleanArrayOf(false, true, false, true), customBooleanArrayOf(false, *booleanArrayOf(true, false), true))) - assertTrue(booleanArrayOf(true).iterator() is BooleanIterator) - assertEquals(true, booleanArrayOf(true).iterator().nextBoolean()) - assertEquals(true, booleanArrayOf(true).iterator().next()) - assertFalse(booleanArrayOf().iterator().hasNext()) - assertTrue(assertFails { booleanArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqByte(byteArrayOf(0), ByteArray(1))) - assertTrue(eqByte(byteArrayOf(1, 2, 3), ByteArray(3) { (it + 1).toByte() })) - assertTrue(eqByte(byteArrayOf(1), byteArrayOf(1).copyOf())) - assertTrue(eqByte(byteArrayOf(1, 0), byteArrayOf(1).copyOf(2))) - assertTrue(eqByte(byteArrayOf(1), byteArrayOf(1, 2).copyOf(1))) - assertTrue(eqByte(byteArrayOf(1, 2), byteArrayOf(1) + 2)) - assertTrue(eqByte(byteArrayOf(1, 2, 3), byteArrayOf(1) + listOf(2.toByte(), 3.toByte()))) - assertTrue(eqByte(byteArrayOf(2, 3), byteArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) - assertTrue(eqByte(byteArrayOf(1, 2, 3, 4), customByteArrayOf(1.toByte(), *byteArrayOf(2, 3), 4.toByte()))) - assertTrue(byteArrayOf(1).iterator() is ByteIterator) - assertEquals(1, byteArrayOf(1).iterator().nextByte()) - assertEquals(1, byteArrayOf(1).iterator().next()) - assertFalse(byteArrayOf().iterator().hasNext()) - assertTrue(assertFails { byteArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqShort(shortArrayOf(0), ShortArray(1))) - assertTrue(eqShort(shortArrayOf(1, 2, 3), ShortArray(3) { (it + 1).toShort() })) - assertTrue(eqShort(shortArrayOf(1), shortArrayOf(1).copyOf())) - assertTrue(eqShort(shortArrayOf(1, 0), shortArrayOf(1).copyOf(2))) - assertTrue(eqShort(shortArrayOf(1), shortArrayOf(1, 2).copyOf(1))) - assertTrue(eqShort(shortArrayOf(1, 2), shortArrayOf(1) + 2)) - assertTrue(eqShort(shortArrayOf(1, 2, 3), shortArrayOf(1) + listOf(2.toShort(), 3.toShort()))) - assertTrue(eqShort(shortArrayOf(2, 3), shortArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) - assertTrue(eqShort(shortArrayOf(1, 2, 3, 4), customShortArrayOf(1.toShort(), *shortArrayOf(2, 3), 4.toShort()))) - assertTrue(shortArrayOf(1).iterator() is ShortIterator) - assertEquals(1, shortArrayOf(1).iterator().nextShort()) - assertEquals(1, shortArrayOf(1).iterator().next()) - assertFalse(shortArrayOf().iterator().hasNext()) - assertTrue(assertFails { shortArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqChar(charArrayOf(0.toChar()), CharArray(1))) - assertTrue(eqChar(charArrayOf('a', 'b', 'c'), CharArray(3) { 'a' + it })) - assertTrue(eqChar(charArrayOf('a'), charArrayOf('a').copyOf())) - assertTrue(eqChar(charArrayOf('a', 0.toChar()), charArrayOf('a').copyOf(2))) - assertTrue(eqChar(charArrayOf('a'), charArrayOf('a', 'b').copyOf(1))) - assertTrue(eqChar(charArrayOf('a', 'b'), charArrayOf('a') + 'b')) - assertTrue(eqChar(charArrayOf('a', 'b', 'c'), charArrayOf('a') + listOf('b', 'c'))) - assertTrue(eqChar(charArrayOf('b', 'c'), charArrayOf('a', 'b', 'c', 'd').copyOfRange(1, 3))) - assertTrue(eqChar(charArrayOf('a', 'b', 'c', 'd'), customCharArrayOf('a', *charArrayOf('b', 'c'), 'd'))) - assertTrue(charArrayOf('a').iterator() is CharIterator) - assertEquals('a', charArrayOf('a').iterator().nextChar()) - assertEquals('a', charArrayOf('a').iterator().next()) - assertFalse(charArrayOf().iterator().hasNext()) - assertTrue(assertFails { charArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqInt(intArrayOf(0), IntArray(1))) - assertTrue(eqInt(intArrayOf(1, 2, 3), IntArray(3) { it + 1 })) - assertTrue(eqInt(intArrayOf(1), intArrayOf(1).copyOf())) - assertTrue(eqInt(intArrayOf(1, 0), intArrayOf(1).copyOf(2))) - assertTrue(eqInt(intArrayOf(1), intArrayOf(1, 2).copyOf(1))) - assertTrue(eqInt(intArrayOf(1, 2), intArrayOf(1) + 2)) - assertTrue(eqInt(intArrayOf(1, 2, 3), intArrayOf(1) + listOf(2, 3))) - assertTrue(eqInt(intArrayOf(2, 3), intArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) - assertTrue(eqInt(intArrayOf(1, 2, 3, 4), customIntArrayOf(1, *intArrayOf(2, 3), 4))) - assertTrue(intArrayOf(1).iterator() is IntIterator) - assertEquals(1, intArrayOf(1).iterator().nextInt()) - assertEquals(1, intArrayOf(1).iterator().next()) - assertFalse(intArrayOf().iterator().hasNext()) - assertTrue(assertFails { intArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqFloat(floatArrayOf(0f), FloatArray(1))) - assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f), FloatArray(3) { (it + 1).toFloat() })) - assertTrue(eqFloat(floatArrayOf(1f), floatArrayOf(1f).copyOf())) - assertTrue(eqFloat(floatArrayOf(1f, 0f), floatArrayOf(1f).copyOf(2))) - assertTrue(eqFloat(floatArrayOf(1f), floatArrayOf(1f, 2f).copyOf(1))) - assertTrue(eqFloat(floatArrayOf(1f, 2f), floatArrayOf(1f) + 2f)) - assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f), floatArrayOf(1f) + listOf(2f, 3f))) - assertTrue(eqFloat(floatArrayOf(2f, 3f), floatArrayOf(1f, 2f, 3f, 4f).copyOfRange(1, 3))) - assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f, 4f), customFloatArrayOf(1f, *floatArrayOf(2f, 3f), 4f))) - assertTrue(floatArrayOf(1f).iterator() is FloatIterator) - assertEquals(1f, floatArrayOf(1f).iterator().nextFloat()) - assertEquals(1f, floatArrayOf(1f).iterator().next()) - assertFalse(floatArrayOf().iterator().hasNext()) - assertTrue(assertFails { floatArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqDouble(doubleArrayOf(0.0), DoubleArray(1))) - assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0), DoubleArray(3) { (it + 1).toDouble() })) - assertTrue(eqDouble(doubleArrayOf(1.0), doubleArrayOf(1.0).copyOf())) - assertTrue(eqDouble(doubleArrayOf(1.0, 0.0), doubleArrayOf(1.0).copyOf(2))) - assertTrue(eqDouble(doubleArrayOf(1.0), doubleArrayOf(1.0, 2.0).copyOf(1))) - assertTrue(eqDouble(doubleArrayOf(1.0, 2.0), doubleArrayOf(1.0) + 2.0)) - assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0), doubleArrayOf(1.0) + listOf(2.0, 3.0))) - assertTrue(eqDouble(doubleArrayOf(2.0, 3.0), doubleArrayOf(1.0, 2.0, 3.0, 4.0).copyOfRange(1, 3))) - assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0, 4.0), customDoubleArrayOf(1.0, *doubleArrayOf(2.0, 3.0), 4.0))) - assertTrue(doubleArrayOf(1.0).iterator() is DoubleIterator) - assertEquals(1.0, doubleArrayOf(1.0).iterator().nextDouble()) - assertEquals(1.0, doubleArrayOf(1.0).iterator().next()) - assertFalse(doubleArrayOf().iterator().hasNext()) - assertTrue(assertFails { doubleArrayOf().iterator().next() } is NoSuchElementException) - - assertTrue(eqLong(longArrayOf(0), LongArray(1))) - assertTrue(eqLong(longArrayOf(1, 2, 3), LongArray(3) { it + 1L })) - assertTrue(eqLong(longArrayOf(1), longArrayOf(1).copyOf())) - assertTrue(eqLong(longArrayOf(1, 0), longArrayOf(1).copyOf(2))) - assertTrue(eqLong(longArrayOf(1), longArrayOf(1, 2).copyOf(1))) - assertTrue(eqLong(longArrayOf(1, 2), longArrayOf(1) + 2)) - assertTrue(eqLong(longArrayOf(1, 2, 3), longArrayOf(1) + listOf(2L, 3L))) - assertTrue(eqLong(longArrayOf(2, 3), longArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) - assertTrue(eqLong(longArrayOf(1, 2, 3, 4), customLongArrayOf(1L, *longArrayOf(2, 3), 4L))) - assertTrue(longArrayOf(1).iterator() is LongIterator) - assertEquals(1L, longArrayOf(1).iterator().nextLong()) - assertEquals(1L, longArrayOf(1).iterator().next()) - assertFalse(longArrayOf().iterator().hasNext()) - assertTrue(assertFails { longArrayOf().iterator().next() } is NoSuchElementException) - - // If `is` checks work... - if (intArrayOf() is IntArray) { - assertTrue(booleanArrayOf(false) is BooleanArray) - assertTrue(byteArrayOf(0) is ByteArray) - assertTrue(shortArrayOf(0) is ShortArray) - assertTrue(charArrayOf('a') is CharArray) - assertTrue(intArrayOf(0) is IntArray) - assertTrue(floatArrayOf(0f) is FloatArray) - assertTrue(doubleArrayOf(0.0) is DoubleArray) - assertTrue(longArrayOf(0) is LongArray) - } - - // Rhino `instanceof` fails to distinguish TypedArray's - if (intArrayOf() is IntArray && (byteArrayOf() as Any) !is IntArray) { - assertTrue(checkExactArrayType(booleanArrayOf(false), booleanArray = true)) - assertTrue(checkExactArrayType(byteArrayOf(0), byteArray = true)) - assertTrue(checkExactArrayType(shortArrayOf(0), shortArray = true)) - assertTrue(checkExactArrayType(charArrayOf('a'), charArray = true)) - assertTrue(checkExactArrayType(intArrayOf(0), intArray = true)) - assertTrue(checkExactArrayType(floatArrayOf(0f), floatArray = true)) - assertTrue(checkExactArrayType(doubleArrayOf(0.0), doubleArray = true)) - assertTrue(checkExactArrayType(longArrayOf(0), longArray = true)) - assertTrue(checkExactArrayType(arrayOf(), array = true)) - } - - return "OK" -} - -fun eqBoolean(expected: BooleanArray, actual: BooleanArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqByte(expected: ByteArray, actual: ByteArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqShort(expected: ShortArray, actual: ShortArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqChar(expected: CharArray, actual: CharArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqInt(expected: IntArray, actual: IntArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqLong(expected: LongArray, actual: LongArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqFloat(expected: FloatArray, actual: FloatArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } -fun eqDouble(expected: DoubleArray, actual: DoubleArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } - -fun customBooleanArrayOf(vararg arr: Boolean): BooleanArray = arr -fun customByteArrayOf(vararg arr: Byte): ByteArray = arr -fun customShortArrayOf(vararg arr: Short): ShortArray = arr -fun customCharArrayOf(vararg arr: Char): CharArray = arr -fun customIntArrayOf(vararg arr: Int): IntArray = arr -fun customFloatArrayOf(vararg arr: Float): FloatArray = arr -fun customDoubleArrayOf(vararg arr: Double): DoubleArray = arr -fun customLongArrayOf(vararg arr: Long): LongArray = arr - -fun checkExactArrayType( - a: Any?, - booleanArray: Boolean = false, - byteArray: Boolean = false, - shortArray: Boolean = false, - charArray: Boolean = false, - intArray: Boolean = false, - longArray: Boolean = false, - floatArray: Boolean = false, - doubleArray: Boolean = false, - array: Boolean = false -): Boolean { - return a is BooleanArray == booleanArray && - a is ByteArray == byteArray && - a is ShortArray == shortArray && - a is CharArray == charArray && - a is IntArray == intArray && - a is LongArray == longArray && - a is FloatArray == floatArray && - a is DoubleArray == doubleArray && - a is Array<*> == array -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/arrays/stdlib.kt b/backend.native/tests/external/codegen/box/arrays/stdlib.kt deleted file mode 100644 index 41f1090eba1..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/stdlib.kt +++ /dev/null @@ -1,56 +0,0 @@ -interface ISized { - val size : Int -} - -interface javaUtilIterator : Iterator { - fun remove() : Unit { - throw UnsupportedOperationException() - } -} - -class MyIterator(val array : ReadOnlyArray) : javaUtilIterator { - private var index = 0 - - override fun hasNext() : Boolean = index < array.size - - override fun next() : T = array.get(index++) -} - -interface ReadOnlyArray : ISized, Iterable { - operator fun get(index : Int) : T - - override fun iterator() : Iterator = MyIterator(this) -} - -interface WriteOnlyArray : ISized { - operator fun set(index : Int, value : T) : Unit - - operator fun set(from: Int, count: Int, value: T) { - for(i in from..from+count-1) { - set(i, value) - } - } -} - -class MutableArray(length: Int, init : (Int) -> T) : ReadOnlyArray, WriteOnlyArray { - private val array = Array(length, init) - - override fun get(index : Int) : T = array[index] as T - override fun set(index : Int, value : T) : Unit { array[index] = value } - - override val size : Int - get() = array.size -} - -fun box() : String { - var a = MutableArray (4, {0}) - a [0] = 10 - a.set(1, 2, 13) - a [3] = 40 - a.iterator() - a.iterator().hasNext() - for(el in a) { - val fl = el - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/arrays/varargsWithJava.kt b/backend.native/tests/external/codegen/box/arrays/varargsWithJava.kt deleted file mode 100644 index ce5377fdf63..00000000000 --- a/backend.native/tests/external/codegen/box/arrays/varargsWithJava.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: AT.java - -public class AT { - public String result = "fail"; - public void foo(G ...y) { - result = "OK"; - } -} - -// FILE: main.kt - -fun AT<*>.bar() { - foo() -} - -fun box(): String { - val a = AT() - a.bar() - return a.result -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOp.kt b/backend.native/tests/external/codegen/box/binaryOp/bitwiseOp.kt deleted file mode 100644 index 75a771d5d7e..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOp.kt +++ /dev/null @@ -1,70 +0,0 @@ -// WITH_RUNTIME -import kotlin.experimental.* - -fun box(): String { - // D = 1101 C = 1100 - // 6 = 0110 5 = 0101 - var iarg1: Int = 0xDC56DC56.toInt() - var iarg2: Int = 0x65DC65DC - var i1 = iarg1 and iarg2 - var i2 = iarg1 or iarg2 - var i3 = iarg1 xor iarg2 - var i4 = iarg1.inv() - var i5 = iarg1 shl 16 - var i6 = iarg1 shr 16 - var i7 = iarg1 ushr 16 - - if (i1 != 0x44544454.toInt()) return "fail: Int.and" - if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" - if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" - if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" - if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" - if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" - if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" - - - // TODO: Use long hex constants after KT-4749 is fixed - var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! - var larg2: Long = 0x65DC65DC65DC65DC - var l1 = larg1 and larg2 - var l2 = larg1 or larg2 - var l3 = larg1 xor larg2 - var l4 = larg1.inv() - var l5 = larg1 shl 32 - var l6 = larg1 shr 32 - var l7 = larg1 ushr 32 - - if (l1 != 0x4454445444544454) return "fail: Long.and" - if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" - if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" - if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" - if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" - if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" - if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" - - var sarg1: Short = 0xDC56.toShort() - var sarg2: Short = 0x65DC.toShort() - var s1 = sarg1 and sarg2 - var s2 = sarg1 or sarg2 - var s3 = sarg1 xor sarg2 - var s4 = sarg1.inv() - - if (s1 != 0x4454.toShort()) return "fail: Short.and" - if (s2 != 0xFDDE.toShort()) return "fail: Short.or" - if (s3 != 0xB98A.toShort()) return "fail: Short.xor" - if (s4 != 0x23A9.toShort()) return "fail: Short.inv" - - var barg1: Byte = 0xDC.toByte() - var barg2: Byte = 0x65.toByte() - var b1 = barg1 and barg2 - var b2 = barg1 or barg2 - var b3 = barg1 xor barg2 - var b4 = barg1.inv() - - if (b1 != 0x44.toByte()) return "fail: Byte.and" - if (b2 != 0xFD.toByte()) return "fail: Byte.or" - if (b3 != 0xB9.toByte()) return "fail: Byte.xor" - if (b4 != 0x23.toByte()) return "fail: Byte.inv" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpAny.kt b/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpAny.kt deleted file mode 100644 index d9913d379a1..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpAny.kt +++ /dev/null @@ -1,70 +0,0 @@ -// WITH_RUNTIME -import kotlin.experimental.* - -fun box(): String { - // D = 1101 C = 1100 - // 6 = 0110 5 = 0101 - var iarg1: Int = 0xDC56DC56.toInt() - var iarg2: Int = 0x65DC65DC - var i1: Any = iarg1 and iarg2 - var i2: Any = iarg1 or iarg2 - var i3: Any = iarg1 xor iarg2 - var i4: Any = iarg1.inv() - var i5: Any = iarg1 shl 16 - var i6: Any = iarg1 shr 16 - var i7: Any = iarg1 ushr 16 - - if (i1 != 0x44544454.toInt()) return "fail: Int.and" - if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" - if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" - if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" - if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" - if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" - if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" - - - // TODO: Use long hex constants after KT-4749 is fixed - var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! - var larg2: Long = 0x65DC65DC65DC65DC - var l1: Any = larg1 and larg2 - var l2: Any = larg1 or larg2 - var l3: Any = larg1 xor larg2 - var l4: Any = larg1.inv() - var l5: Any = larg1 shl 32 - var l6: Any = larg1 shr 32 - var l7: Any = larg1 ushr 32 - - if (l1 != 0x4454445444544454) return "fail: Long.and" - if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" - if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" - if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" - if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" - if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" - if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" - - var sarg1: Short = 0xDC56.toShort() - var sarg2: Short = 0x65DC.toShort() - var s1: Any = sarg1 and sarg2 - var s2: Any = sarg1 or sarg2 - var s3: Any = sarg1 xor sarg2 - var s4: Any = sarg1.inv() - - if (s1 != 0x4454.toShort()) return "fail: Short.and" - if (s2 != 0xFDDE.toShort()) return "fail: Short.or" - if (s3 != 0xB98A.toShort()) return "fail: Short.xor" - if (s4 != 0x23A9.toShort()) return "fail: Short.inv" - - var barg1: Byte = 0xDC.toByte() - var barg2: Byte = 0x65.toByte() - var b1: Any = barg1 and barg2 - var b2: Any = barg1 or barg2 - var b3: Any = barg1 xor barg2 - var b4: Any = barg1.inv() - - if (b1 != 0x44.toByte()) return "fail: Byte.and" - if (b2 != 0xFD.toByte()) return "fail: Byte.or" - if (b3 != 0xB9.toByte()) return "fail: Byte.xor" - if (b4 != 0x23.toByte()) return "fail: Byte.inv" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpNullable.kt b/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpNullable.kt deleted file mode 100644 index 16e8a0fe855..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/bitwiseOpNullable.kt +++ /dev/null @@ -1,70 +0,0 @@ -// WITH_RUNTIME -import kotlin.experimental.* - -fun box(): String { - // D = 1101 C = 1100 - // 6 = 0110 5 = 0101 - var iarg1: Int = 0xDC56DC56.toInt() - var iarg2: Int = 0x65DC65DC - var i1: Int? = iarg1 and iarg2 - var i2: Int? = iarg1 or iarg2 - var i3: Int? = iarg1 xor iarg2 - var i4: Int? = iarg1.inv() - var i5: Int? = iarg1 shl 16 - var i6: Int? = iarg1 shr 16 - var i7: Int? = iarg1 ushr 16 - - if (i1 != 0x44544454.toInt()) return "fail: Int.and" - if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" - if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" - if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" - if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" - if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" - if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" - - - // TODO: Use long hex constants after KT-4749 is fixed - var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! - var larg2: Long = 0x65DC65DC65DC65DC - var l1: Long? = larg1 and larg2 - var l2: Long? = larg1 or larg2 - var l3: Long? = larg1 xor larg2 - var l4: Long? = larg1.inv() - var l5: Long? = larg1 shl 32 - var l6: Long? = larg1 shr 32 - var l7: Long? = larg1 ushr 32 - - if (l1 != 0x4454445444544454) return "fail: Long.and" - if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" - if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" - if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" - if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" - if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" - if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" - - var sarg1: Short = 0xDC56.toShort() - var sarg2: Short = 0x65DC.toShort() - var s1: Short? = sarg1 and sarg2 - var s2: Short? = sarg1 or sarg2 - var s3: Short? = sarg1 xor sarg2 - var s4: Short? = sarg1.inv() - - if (s1 != 0x4454.toShort()) return "fail: Short.and" - if (s2 != 0xFDDE.toShort()) return "fail: Short.or" - if (s3 != 0xB98A.toShort()) return "fail: Short.xor" - if (s4 != 0x23A9.toShort()) return "fail: Short.inv" - - var barg1: Byte = 0xDC.toByte() - var barg2: Byte = 0x65.toByte() - var b1: Byte? = barg1 and barg2 - var b2: Byte? = barg1 or barg2 - var b3: Byte? = barg1 xor barg2 - var b4: Byte? = barg1.inv() - - if (b1 != 0x44.toByte()) return "fail: Byte.and" - if (b2 != 0xFD.toByte()) return "fail: Byte.or" - if (b3 != 0xB9.toByte()) return "fail: Byte.xor" - if (b4 != 0x23.toByte()) return "fail: Byte.inv" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/call.kt b/backend.native/tests/external/codegen/box/binaryOp/call.kt deleted file mode 100644 index 0f3d0139001..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/call.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Byte = 1.plus(1) - val a2: Short = 1.plus(1) - val a3: Int = 1.plus(1) - val a4: Long = 1.plus(1) - val a5: Double = 1.0.plus(1) - val a6: Float = 1f.plus(1) - val a7: Char = 'A'.plus(1) - val a8: Int = 'B'.minus('A') - - if (a1 != 2.toByte()) return "fail 1" - if (a2 != 2.toShort()) return "fail 2" - if (a3 != 2) return "fail 3" - if (a4 != 2L) return "fail 4" - if (a5 != 2.0) return "fail 5" - if (a6 != 2f) return "fail 6" - if (a7 != 'B') return "fail 7" - if (a8 != 1) return "fail 8" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/callAny.kt b/backend.native/tests/external/codegen/box/binaryOp/callAny.kt deleted file mode 100644 index 7969cb5ec79..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/callAny.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Any = 1.toByte().plus(1) - val a2: Any = 1.toShort().plus(1) - val a3: Any = 1.plus(1) - val a4: Any = 1L.plus(1) - val a5: Any = 1.0.plus(1) - val a6: Any = 1f.plus(1) - val a7: Any = 'A'.plus(1) - val a8: Any = 'B'.minus('A') - - if (a1 !is Int || a1 != 2) return "fail 1" - if (a2 !is Int || a2 != 2) return "fail 2" - if (a3 !is Int || a3 != 2) return "fail 3" - if (a4 !is Long || a4 != 2L) return "fail 4" - if (a5 !is Double || a5 != 2.0) return "fail 5" - if (a6 !is Float || a6 != 2f) return "fail 6" - if (a7 !is Char || a7 != 'B') return "fail 7" - if (a8 !is Int || a8 != 1) return "fail 8" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/callNullable.kt b/backend.native/tests/external/codegen/box/binaryOp/callNullable.kt deleted file mode 100644 index 0167a38ed04..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/callNullable.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Byte? = 1.plus(1) - val a2: Short? = 1.plus(1) - val a3: Int? = 1.plus(1) - val a4: Long? = 1.plus(1) - val a5: Double? = 1.0.plus(1) - val a6: Float? = 1f.plus(1) - val a7: Char? = 'A'.plus(1) - val a8: Int? = 'B'.minus('A') - - if (a1!! != 2.toByte()) return "fail 1" - if (a2!! != 2.toShort()) return "fail 2" - if (a3!! != 2) return "fail 3" - if (a4!! != 2L) return "fail 4" - if (a5!! != 2.0) return "fail 5" - if (a6!! != 2f) return "fail 6" - if (a7!! != 'B') return "fail 7" - if (a8!! != 1) return "fail 8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/compareBoxedChars.kt b/backend.native/tests/external/codegen/box/binaryOp/compareBoxedChars.kt deleted file mode 100644 index f472ebfc47d..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/compareBoxedChars.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun id(x: T) = x - -fun box(): String { - if (id('a') > id('b')) return "fail 1" - if (id('a') >= id('b')) return "fail 2" - if (id('b') < id('a')) return "fail 3" - if (id('b') <= id('a')) return "fail 4" - - val x = id('a').compareTo('b') - if (x != -1) return "fail 5" - - val y = id('b').compareTo('a') - if (y != 1) return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedDouble.kt b/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedDouble.kt deleted file mode 100644 index de72811d997..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedDouble.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// reason - multifile tests are not supported in JS tests -//FILE: Holder.java - -class Holder { - public Double value; - public Holder(Double value) { this.value = value; } -} - -//FILE: test.kt - -import Holder - -fun box(): String { - val j = Holder(0.99) - return if (j.value > 0) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedLong.kt b/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedLong.kt deleted file mode 100644 index 26d6818bed2..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/compareWithBoxedLong.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// reason - multifile tests are not supported in JS tests -//FILE: JavaClass.java - -class JavaClass { - public static Long get() { return 2364137526064485012L; } -} - -//FILE: test.kt - -import JavaClass - -fun box(): String { - return if (JavaClass.get() > 0) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/divisionByZero.kt b/backend.native/tests/external/codegen/box/binaryOp/divisionByZero.kt deleted file mode 100644 index 1daa188f030..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/divisionByZero.kt +++ /dev/null @@ -1,14 +0,0 @@ -// IGNORE_BACKEND: JS -// reason - no ArithmeticException in JS -fun box(): String { - val a1 = 0 - val a2 = try { 1 / 0 } catch(e: ArithmeticException) { 0 } - val a3 = try { 1 / a1 } catch(e: ArithmeticException) { 0 } - val a4 = try { 1 / a2 } catch(e: ArithmeticException) { 0 } - val a5 = try { 2 * (1 / 0) } catch(e: ArithmeticException) { 0 } - val a6 = try { 2 * 1 / 0 } catch(e: ArithmeticException) { 0 } - - try { val s1 = "${2 * (1 / 0) }" } catch(e: ArithmeticException) { } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/intrinsic.kt b/backend.native/tests/external/codegen/box/binaryOp/intrinsic.kt deleted file mode 100644 index 7434a7848e5..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/intrinsic.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Byte = 1 + 1 - val a2: Short = 1 + 1 - val a3: Int = 1 + 1 - val a4: Long = 1 + 1 - val a5: Double = 1.0 + 1 - val a6: Float = 1f + 1 - val a7: Char = 'A' + 1 - val a8: Int = 'B' - 'A' - - if (a1 != 2.toByte()) return "fail 1" - if (a2 != 2.toShort()) return "fail 2" - if (a3 != 2) return "fail 3" - if (a4 != 2L) return "fail 4" - if (a5 != 2.0) return "fail 5" - if (a6 != 2f) return "fail 6" - if (a7 != 'B') return "fail 7" - if (a8 != 1) return "fail 8" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/intrinsicAny.kt b/backend.native/tests/external/codegen/box/binaryOp/intrinsicAny.kt deleted file mode 100644 index fd240b08a58..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/intrinsicAny.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Any = 1.toByte() + 1 - val a2: Any = 1.toShort() + 1 - val a3: Any = 1 + 1 - val a4: Any = 1L + 1 - val a5: Any = 1.0 + 1 - val a6: Any = 1f + 1 - val a7: Any = 'A' + 1 - val a8: Any = 'B' - 'A' - - if (a1 !is Int || a1 != 2) return "fail 1" - if (a2 !is Int || a2 != 2) return "fail 2" - if (a3 !is Int || a3 != 2) return "fail 3" - if (a4 !is Long || a4 != 2L) return "fail 4" - if (a5 !is Double || a5 != 2.0) return "fail 5" - if (a6 !is Float || a6 != 2f) return "fail 6" - if (a7 !is Char || a7 != 'B') return "fail 7" - if (a8 !is Int || a8 != 1) return "fail 8" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/intrinsicNullable.kt b/backend.native/tests/external/codegen/box/binaryOp/intrinsicNullable.kt deleted file mode 100644 index fdfc98f3bb4..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/intrinsicNullable.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - val a1: Byte? = 1 + 1 - val a2: Short? = 1 + 1 - val a3: Int? = 1 + 1 - val a4: Long? = 1 + 1 - val a5: Double? = 1.0 + 1 - val a6: Float? = 1f + 1 - val a7: Char? = 'A' + 1 - val a8: Int? = 'B' - 'A' - - if (a1!! != 2.toByte()) return "fail 1" - if (a2!! != 2.toShort()) return "fail 2" - if (a3!! != 2) return "fail 3" - if (a4!! != 2L) return "fail 4" - if (a5!! != 2.0) return "fail 5" - if (a6!! != 2f) return "fail 6" - if (a7!! != 'B') return "fail 7" - if (a8!! != 1) return "fail 8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/binaryOp/kt11163.kt b/backend.native/tests/external/codegen/box/binaryOp/kt11163.kt deleted file mode 100644 index 6a20534e140..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/kt11163.kt +++ /dev/null @@ -1,12 +0,0 @@ -operator fun Int.compareTo(c: Char) = 0 - -fun foo(x: Int, y: Char): String { - if (x < y) { - throw Error() - } - return "${y}K" -} - -fun box(): String { - return foo(42, 'O') -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/kt6747_identityEquals.kt b/backend.native/tests/external/codegen/box/binaryOp/kt6747_identityEquals.kt deleted file mode 100644 index cf261d60b7a..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/kt6747_identityEquals.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Test { - fun check(a: Any?): String { - if (this === a) return "Fail 1" - if (!(this !== a)) return "Fail 2" - return "OK" - } -} - -fun box(): String = Test().check("String") diff --git a/backend.native/tests/external/codegen/box/binaryOp/overflowChar.kt b/backend.native/tests/external/codegen/box/binaryOp/overflowChar.kt deleted file mode 100644 index 0f06f4969fd..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/overflowChar.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val c1: Char = 0.toChar() - val c2 = c1 - 1 - if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive." - - val c3 = c2 + 1 - if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero." - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/overflowInt.kt b/backend.native/tests/external/codegen/box/binaryOp/overflowInt.kt deleted file mode 100644 index 4d5b899987f..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/overflowInt.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val i1: Int = Int.MAX_VALUE - val i2 = i1 + 1 - if (i2 > i1) return "fail: Int.MAX_VALUE + 1 should overflow to negative." - - val i3: Int = Int.MIN_VALUE - val i4 = i3 - 1 - if (i4 < i3) return "fail: Int.MIN_VALUE - 1 should overflow to positive." - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/binaryOp/overflowLong.kt b/backend.native/tests/external/codegen/box/binaryOp/overflowLong.kt deleted file mode 100644 index 28d37ab1c12..00000000000 --- a/backend.native/tests/external/codegen/box/binaryOp/overflowLong.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box(): String { - val a: Long = 2147483647 + 1 - if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected" - - val l1 = Long.MAX_VALUE - val l2 = l1 + 1 - if (l2 > l1) return "fail: Long.MAX_VALUE + 1 should overflow to negative." - - val l3 = Long.MIN_VALUE - val l4 = l3 - 1 - if (l4 < l3) return "fail: Long.MIN_VALUE - 1 should overflow to positive." - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/boxedIntegersCmp.kt b/backend.native/tests/external/codegen/box/boxingOptimization/boxedIntegersCmp.kt deleted file mode 100644 index 1a181d9b391..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/boxedIntegersCmp.kt +++ /dev/null @@ -1,46 +0,0 @@ -inline fun ltx(a: Comparable, b: Any) = a < b -inline fun lex(a: Comparable, b: Any) = a <= b -inline fun gex(a: Comparable, b: Any) = a >= b -inline fun gtx(a: Comparable, b: Any) = a > b - -inline fun lt(a: Any, b: Any) = ltx(a as Comparable, b) -inline fun le(a: Any, b: Any) = lex(a as Comparable, b) -inline fun ge(a: Any, b: Any) = gex(a as Comparable, b) -inline fun gt(a: Any, b: Any) = gtx(a as Comparable, b) - -val ONE = 1 -val ONEL = 1L - -fun box(): String { - return when { - !lt(ONE, 42) -> "Fail 1 LT" - lt(42, ONE) -> "Fail 2 LT" - - !le(ONE, 42) -> "Fail 1 LE" - le(42, ONE) -> "Fail 2 LE" - !le(1, ONE) -> "Fail 3 LE" - - !ge(42, ONE) -> "Fail 1 GE" - ge(ONE, 42) -> "Fail 2 GE" - !ge(1, ONE) -> "Fail 3 GE" - - gt(ONE, 42) -> "Fail 1 GT" - !gt(42, ONE) -> "Fail 2 GT" - - !lt(ONEL, 42L) -> "Fail 1 LT L" - lt(42L, ONEL) -> "Fail 2 LT L" - - !le(ONEL, 42L) -> "Fail 1 LE L" - le(42L, ONEL) -> "Fail 2 LE L" - !le(ONEL, 1L) -> "Fail 3 LE L" - - !ge(42L, ONEL) -> "Fail 1 GE L" - ge(ONEL, 42L) -> "Fail 2 GE L" - !ge(ONEL, 1L) -> "Fail 3 GE L" - - gt(ONEL, 42L) -> "Fail 1 GT L" - !gt(42L, ONEL) -> "Fail 2 GT L" - - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/boxedPrimitivesAreEqual.kt b/backend.native/tests/external/codegen/box/boxingOptimization/boxedPrimitivesAreEqual.kt deleted file mode 100644 index 2bd8eda1ddd..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/boxedPrimitivesAreEqual.kt +++ /dev/null @@ -1,21 +0,0 @@ -inline fun eq(a: Any, b: Any) = a == b -inline fun ne(a: Any, b: Any) = a != b - -val ONE = 1 -val ONEL = 1L - -fun box(): String { - return when { - eq(ONE, 2) -> "Fail 1" - !eq(ONE, 1) -> "Fail 2" - !ne(ONE, 2) -> "Fail 3" - ne(ONE, 1) -> "Fail 4" - - eq(ONEL, 42L) -> "Fail 1L" - !eq(ONEL, 1L) -> "Fail 2L" - !ne(ONEL, 42L) -> "Fail 3L" - ne(ONEL, 1L) -> "Fail 4L" - - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/boxedRealsCmp.kt b/backend.native/tests/external/codegen/box/boxingOptimization/boxedRealsCmp.kt deleted file mode 100644 index 73046a97b47..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/boxedRealsCmp.kt +++ /dev/null @@ -1,83 +0,0 @@ -// -// IGNORE_BACKEND: JS - -inline fun ltx(a: Comparable, b: Any) = a < b -inline fun lex(a: Comparable, b: Any) = a <= b -inline fun gex(a: Comparable, b: Any) = a >= b -inline fun gtx(a: Comparable, b: Any) = a > b - -inline fun lt(a: Any, b: Any) = ltx(a as Comparable, b) -inline fun le(a: Any, b: Any) = lex(a as Comparable, b) -inline fun ge(a: Any, b: Any) = gex(a as Comparable, b) -inline fun gt(a: Any, b: Any) = gtx(a as Comparable, b) - -val PLUS0F = 0.0F -val MINUS0F = -0.0F -val PLUS0D = 0.0 -val MINUS0D = -0.0 - -fun box(): String { - return when { - !lt(1.0F, 42.0F) -> "Fail 1 LT F" - lt(42.0F, 1.0F) -> "Fail 2 LT F" - - !le(1.0F, 42.0F) -> "Fail 1 LE F" - le(42.0F, 1.0F) -> "Fail 2 LE F" - !le(1.0F, 1.0F) -> "Fail 3 LE F" - - !ge(42.0F, 1.0F) -> "Fail 1 GE F" - ge(1.0F, 42.0F) -> "Fail 2 GE F" - !ge(1.0F, 1.0F) -> "Fail 3 GE F" - - gt(1.0F, 42.0F) -> "Fail 1 GT F" - !gt(42.0F, 1.0F) -> "Fail 2 GT F" - - !lt(1.0, 42.0) -> "Fail 1 LT D" - lt(42.0, 1.0) -> "Fail 2 LT D" - - !le(1.0, 42.0) -> "Fail 1 LE D" - le(42.0, 1.0) -> "Fail 2 LE D" - !le(1.0, 1.0) -> "Fail 3 LE D" - - !ge(42.0, 1.0) -> "Fail 1 GE D" - ge(1.0, 42.0) -> "Fail 2 GE D" - !ge(1.0, 1.0) -> "Fail 3 GE D" - - gt(1.0, 42.0) -> "Fail 1 GT D" - !gt(42.0, 1.0) -> "Fail 2 GT D" - - !lt(MINUS0F, PLUS0F) -> "Fail 1 LT +-0 F" - lt(PLUS0F, MINUS0F) -> "Fail 2 LT +-0 F" - - !le(MINUS0F, PLUS0F) -> "Fail 1 LE +-0 F" - le(PLUS0F, MINUS0F) -> "Fail 2 LE +-0 F" - !le(MINUS0F, MINUS0F) -> "Fail 3 LE +-0 F" - !le(PLUS0F, PLUS0F) -> "Fail 3 LE +-0 F" - - ge(MINUS0F, PLUS0F) -> "Fail 1 GE +-0 F" - !ge(PLUS0F, MINUS0F) -> "Fail 2 GE +-0 F" - !ge(MINUS0F, MINUS0F) -> "Fail 3 GE +-0 F" - !ge(PLUS0F, PLUS0F) -> "Fail 3 GE +-0 F" - - gt(MINUS0F, PLUS0F) -> "Fail 1 GT +-0 F" - !gt(PLUS0F, MINUS0F) -> "Fail 2 GT +-0 F" - - !lt(MINUS0D, PLUS0D) -> "Fail 1 LT +-0 D" - lt(PLUS0D, MINUS0D) -> "Fail 2 LT +-0 D" - - !le(MINUS0D, PLUS0D) -> "Fail 1 LE +-0 D" - le(PLUS0D, MINUS0D) -> "Fail 2 LE +-0 D" - !le(MINUS0D, MINUS0D) -> "Fail 3 LE +-0 D" - !le(PLUS0D, PLUS0D) -> "Fail 3 LE +-0 D" - - ge(MINUS0D, PLUS0D) -> "Fail 1 GE +-0 D" - !ge(PLUS0D, MINUS0D) -> "Fail 2 GE +-0 D" - !ge(MINUS0D, MINUS0D) -> "Fail 3 GE +-0 D" - !ge(PLUS0D, PLUS0D) -> "Fail 3 GE +-0 D" - - gt(MINUS0D, PLUS0D) -> "Fail 1 GT +-0 D" - !gt(PLUS0D, MINUS0D) -> "Fail 2 GT +-0 D" - - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/casts.kt b/backend.native/tests/external/codegen/box/boxingOptimization/casts.kt deleted file mode 100644 index 47ce676892b..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/casts.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x : R?, block : (R?) -> T) : T { - return block(x) -} - -fun box() : String { - assertEquals(1L, foo(1) { x -> x!!.toLong() }) - assertEquals(1.toShort(), foo(1) { x -> x!!.toShort() }) - assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() }) - assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() }) - assertEquals('a'.toDouble(), foo('a') { x -> x!!.toDouble() }) - assertEquals(1.0.toByte(), foo(1.0) { x -> x!!.toByte() }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/checkcastAndInstanceOf.kt b/backend.native/tests/external/codegen/box/boxingOptimization/checkcastAndInstanceOf.kt deleted file mode 100644 index 86e8dc6bec7..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/checkcastAndInstanceOf.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x : R, y : R, block : (R) -> T) : T { - val a = x is Number - val b = x is Object - - val b1 = x as Object - - 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" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/explicitEqualsOnDouble.kt b/backend.native/tests/external/codegen/box/boxingOptimization/explicitEqualsOnDouble.kt deleted file mode 100644 index ea864337add..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/explicitEqualsOnDouble.kt +++ /dev/null @@ -1,8 +0,0 @@ -// IGNORE_BACKEND: JS - -fun equals1(a: Double, b: Double) = a.equals(b) - -fun box(): String { - if ((-0.0).equals(0.0)) return "fail 0" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/fold.kt b/backend.native/tests/external/codegen/box/boxingOptimization/fold.kt deleted file mode 100644 index 7bb1608458b..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/fold.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box() : String { - val x = LongArray(5) - for (i in 0..4) { - x[i] = (i + 1).toLong() - } - - assertEquals(15L, x.fold(0L) { x, y -> x + y }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/foldRange.kt b/backend.native/tests/external/codegen/box/boxingOptimization/foldRange.kt deleted file mode 100644 index 1127090af9e..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/foldRange.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - val result = (1..5).fold(0) { x, y -> x + y } - - assertEquals(15, result) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/intCompareTo.kt b/backend.native/tests/external/codegen/box/boxingOptimization/intCompareTo.kt deleted file mode 100644 index e3016ff7bbe..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/intCompareTo.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val a: Any = 1 - val b: Any = 42 - val test = (a as Comparable).compareTo(b) - if (test != -1) return "Fail: $test" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kClassEquals.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kClassEquals.kt deleted file mode 100644 index 635e9949a6f..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kClassEquals.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TARGET_BACKEND: JVM - -fun test(a: Any) = when (a::class) { - String::class -> "String" - Int::class -> "Int" - Boolean::class -> "Boolean" - else -> "Else" -} - -fun box(): String { - val s = "" - val i = 0 - val b = false - - if (test(s) != "String") return "Fail 1" - if (test(i) != "Int") return "Fail 2" - if (test(b) != "Boolean") return "Fail 3" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt15871.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt15871.kt deleted file mode 100644 index f41df27c983..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt15871.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box() = - if (getAndCheck({ 42 }, { 42 })) "OK" else "fail" - -inline fun getAndCheck(getFirst: () -> T, getSecond: () -> T) = - getFirst() == getSecond() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt17748.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt17748.kt deleted file mode 100644 index 1639def43c6..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt17748.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM - -fun box(): String { - 42.doSwitchInt() - "".doSwitchString() - return "OK" -} - -inline fun E.doSwitchInt(): String = when (E::class) { - Int::class -> "success!" - else -> throw AssertionError() -} - -inline fun E.doSwitchString(): String = when(E::class) { - String::class -> "success!" - else -> throw AssertionError() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt19767.kt deleted file mode 100644 index bb00ac53fa6..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun foo(p: Int?): Boolean { - return M(p)?.nulled() == 1 -} - -fun foo2(p: Int?): Boolean { - return 1 == M(p)?.nulled() -} - -class M(val z: T?) { - fun nulled(): T? = z -} - - -fun box(): String { - if (foo(null)) return "fail 1" - if (!foo(1)) return "fail 2" - - if (foo2(null)) return "fail 1" - if (!foo2(1)) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_2.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_2.kt deleted file mode 100644 index 8f0913523f9..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_2.kt +++ /dev/null @@ -1,6 +0,0 @@ -//WITH_RUNTIME - -fun box(): String { - val map: Map? = mapOf() - return if (map?.get("") == true) "fail" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_3.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_3.kt deleted file mode 100644 index cf8f6d9063e..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_3.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// FILE: M.java - -public class M { - private final Integer value; - - public M(Integer value) { - this.value = value; - } - - public Integer nulled() { - return value; - } -} - - -// FILE: Kotlin.kt -fun foo(p: Int?): Boolean { - return M(p)?.nulled() == 1 -} - -fun foo2(p: Int?): Boolean { - return 1 == M(p)?.nulled() -} - -fun box(): String { - if (foo(null)) return "fail 1" - if (!foo(1)) return "fail 2" - - if (foo2(null)) return "fail 1" - if (!foo2(1)) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_chain.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_chain.kt deleted file mode 100644 index 441714d90b2..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt19767_chain.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun foo(p: Int?): Boolean { - return M(p)?.chain()?.nulled() == 1 -} - -fun foo2(p: Int?): Boolean { - return 1 == M(p)?.chain()?.nulled() -} - -class M(val z: T?) { - fun nulled(): T? = z - - fun chain(): M? = this -} - - -fun box(): String { - if (foo(null)) return "fail 1" - if (!foo(1)) return "fail 2" - - if (foo2(null)) return "fail 1" - if (!foo2(1)) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt5493.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt5493.kt deleted file mode 100644 index efd7e94a5f7..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt5493.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box() : String { - try { - return "OK" - } - finally { - null?.toString() - } -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt5588.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt5588.kt deleted file mode 100644 index ece5914c504..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt5588.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box() : String { - val s = "notA" - val id = when (s) { - "a" -> 1 - else -> null - } - - if (id == null) return "OK" - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt5844.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt5844.kt deleted file mode 100644 index acc4da5c729..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt5844.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun test1() { - val u = when (true) { - true -> 42 - else -> 1.0 - } - - assertEquals(42, u) -} - -fun test2() { - val u = 1L.let { - when (it) { - is Long -> if (it.toLong() == 2L) it.toLong() else it * 2L // CompilationException - else -> it.toDouble() - } - } - - assertEquals(2L, u) -} - -fun box(): String { - test1() - test2() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt6047.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt6047.kt deleted file mode 100644 index a397903567e..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt6047.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun checkLongAB5E(x: Long) = assertEquals(0xAB5EL, x) -fun checkDouble1(y: Double) = assertEquals(1.0, y) -fun checkByte10(z: Byte) = assertEquals(10.toByte(), z) - -fun box(): String { - val x = java.lang.Long.valueOf("AB5E", 16) - checkLongAB5E(x) - - val y = java.lang.Double.valueOf("1.0") - checkDouble1(y) - - val z = java.lang.Byte.valueOf("A", 16) - checkByte10(z) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/kt6842.kt b/backend.native/tests/external/codegen/box/boxingOptimization/kt6842.kt deleted file mode 100644 index e3162a626a3..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/kt6842.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - val x = (10L..50).map { it * 40L } - assertEquals(400L, x.first()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/maxMinBy.kt b/backend.native/tests/external/codegen/box/boxingOptimization/maxMinBy.kt deleted file mode 100644 index 00adbc52f4c..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/maxMinBy.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val intList = listOf(1, 2, 3) - val longList = listOf(1L, 2L, 3L) - - val intListMin = intList.minBy { it } - if (intListMin != 1) return "Fail intListMin=$intListMin" - - val intListMax = intList.maxBy { it } - if (intListMax != 3) return "Fail intListMax=$intListMax" - - val longListMin = longList.minBy { it } - if (longListMin != 1L) return "Fail longListMin=$longListMin" - - val longListMax = longList.maxBy { it } - if (longListMax != 3L) return "Fail longListMax=$longListMax" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/nullCheck.kt b/backend.native/tests/external/codegen/box/boxingOptimization/nullCheck.kt deleted file mode 100644 index 4ba74af4165..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/nullCheck.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x : R?, y : R?, block : (R?) -> T) : T { - if (x == null) { - return block(x) - } else { - return block(y) - } -} - -fun box() : String { - assertEquals(3, foo(1, 2) { x -> if (x != null) 3 else 4 }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/progressions.kt b/backend.native/tests/external/codegen/box/boxingOptimization/progressions.kt deleted file mode 100644 index 6892c12e89d..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/progressions.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box() : String { - - val result1 = (1..100).count { x -> x % 2 == 0 } - val result2 = (1..100).filter { x -> x % 2 == 0 }.size - assertEquals(result1, 50) - assertEquals(result2, 50) - - val result3 = (1..100).map { x -> 2 * x }.count { x -> x % 2 == 0 } - val result4 = (1..100).map { x -> 2 * x }.filter { x -> x % 2 == 0 }.size - assertEquals(result3, 100) - assertEquals(result4, 100) - - val result5 = (1L..100L).count { x -> x % 2 == 0L } - val result6 = (1L..100L).filter { x -> x % 2 == 0L }.size - assertEquals(result5, 50) - assertEquals(result6, 50) - - val result7 = (1L..100L).map { x -> 2 * x }.count { x -> x % 2 == 0L } - val result8 = (1L..100L).map { x -> 2 * x }.filter { x -> x % 2 == 0L }.size - assertEquals(result7, 100) - assertEquals(result8, 100) - - val result9 = (0..10).reduce { total, next -> total + next } - val result10 = (0L..10L).reduce { total, next -> total + next } - assertEquals(result9, 55) - assertEquals(result10, 55L) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/safeCallWithElvis.kt b/backend.native/tests/external/codegen/box/boxingOptimization/safeCallWithElvis.kt deleted file mode 100644 index 1ffec309237..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/safeCallWithElvis.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -class A(val x : Int, val y : A?) - -fun check(a : A?) : Int { - return a?.y?.x ?: (a?.x ?: 3) -} - -fun checkLeftAssoc(a : A?) : Int { - return (a?.y?.x ?: a?.x) ?: 3 -} - -fun box() : String { - val a1 = A(2, A(1, null)) - val a2 = A(2, null) - val a3 = null - - assertEquals(1, check(a1)) - assertEquals(2, check(a2)) - assertEquals(3, check(a3)) - - assertEquals(1, checkLeftAssoc(a1)) - assertEquals(2, checkLeftAssoc(a2)) - assertEquals(3, checkLeftAssoc(a3)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/simple.kt b/backend.native/tests/external/codegen/box/boxingOptimization/simple.kt deleted file mode 100644 index fbe93a5233a..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/simple.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x : R, block : (R) -> R) : R { - return block(x) -} - -fun box() : String { - val result = foo(1) { x -> x + 1 } - assertEquals(2, result) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/simpleUninitializedMerge.kt b/backend.native/tests/external/codegen/box/boxingOptimization/simpleUninitializedMerge.kt deleted file mode 100644 index 9612abbe1bb..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/simpleUninitializedMerge.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var result = 0 - if (1 == 1) { - val x: Int? = 1 - result += x!! - } - - assertEquals(1, result) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/taintedValues.kt b/backend.native/tests/external/codegen/box/boxingOptimization/taintedValues.kt deleted file mode 100644 index 83ce3905b87..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/taintedValues.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -// Just make sure there's no VerifyError - -fun getOrElse() = - mapOf().getOrElse("foo") { 3 } - -fun isNotEmpty(l: ArrayList) = - l.iterator()?.hasNext() ?: false - -fun box() = "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/taintedValuesBox.kt b/backend.native/tests/external/codegen/box/boxingOptimization/taintedValuesBox.kt deleted file mode 100644 index 5ea75e4adf6..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/taintedValuesBox.kt +++ /dev/null @@ -1,49 +0,0 @@ -// WITH_RUNTIME - -inline fun put( - x: T, - maxExclusive: Int, - isEmpty: (Int) -> Boolean, - equals: (T, T) -> Boolean, - fetch: (Int) -> T, - store: (Int, T) -> Unit -): Boolean { - var i = 0 - do { - if (isEmpty(i)) { - store(i, x) - return true - } - - val y = fetch(i) - if (equals(x, y)) { - return false - } - - i++ - if (i >= maxExclusive) return false - } while (true) -} - -const val SIZE = 16 -val arr = IntArray(SIZE) { -1 } - -fun putNonNegInt(x: Int) = - put(x, SIZE, - isEmpty = { arr[it] < 0 }, - equals = { x, y -> x == y }, - fetch = { arr[it] }, - store = { i, x -> arr[i] = x } - ) - -fun box(): String { - putNonNegInt(1) - putNonNegInt(2) - putNonNegInt(3) - - if (arr[0] != 1) return "Fail, ${arr.toList().toString()}" - if (arr[1] != 2) return "Fail, ${arr.toList().toString()}" - if (arr[2] != 3) return "Fail, ${arr.toList().toString()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/unsafeRemoving.kt b/backend.native/tests/external/codegen/box/boxingOptimization/unsafeRemoving.kt deleted file mode 100644 index e11a594361d..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/unsafeRemoving.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun returningBoxed() : Int? = 1 -fun acceptingBoxed(x : Int?) : Int ? = x - -class A(var x : Int? = null) - -fun box() : String { - assertEquals(1, returningBoxed()) - assertEquals(1, acceptingBoxed(1)) - - val a = A() - a.x = 1 - assertEquals(1, a.x) - - val b = Array(1, { null }) - b[0] = 1 - assertEquals(1, b[0]) - - val x: Int? = 1 - assertEquals(1, x!!.hashCode()) - - val y: Int? = 1000 - val z: Int? = 1000 - val res = y === z - - val c1: Any = if (1 == 1) 0 else "abc" - val c2: Any = if (1 != 1) 0 else "abc" - assertEquals(0, c1) - assertEquals("abc", c2) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/boxingOptimization/variables.kt b/backend.native/tests/external/codegen/box/boxingOptimization/variables.kt deleted file mode 100644 index 18f6bf3d71e..00000000000 --- a/backend.native/tests/external/codegen/box/boxingOptimization/variables.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x : R, block : (R) -> T) : T { - var y = x - var z = y - z = x - return block(z) -} - -fun box() : String { - assertEquals(1, foo(1) { x -> x }) - assertEquals(1f, foo(1f) { x -> x }) - assertEquals(1L, foo(1L) { x -> x }) - assertEquals(1.toDouble(), foo(1.toDouble()) { x -> x }) - assertEquals(1.toShort(), foo(1.toShort()) { x -> x }) - assertEquals(1.toByte(), foo(1.toByte()) { x -> x }) - assertEquals('a', foo('a') { x -> x }) - assertEquals(true, foo(true) { x -> x }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/complexMultiInheritance.kt b/backend.native/tests/external/codegen/box/bridges/complexMultiInheritance.kt deleted file mode 100644 index 227bd67042c..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/complexMultiInheritance.kt +++ /dev/null @@ -1,25 +0,0 @@ -open class A { - open fun foo(): Any = "A" -} - -open class C : A() { - override fun foo(): Int = 222 -} - -interface D { - fun foo(): Number -} - -class E : C(), D - -fun box(): String { - val e = E() - if (e.foo() != 222) return "Fail 1" - val d: D = e - val c: C = e - val a: A = e - if (d.foo() != 222) return "Fail 2" - if (c.foo() != 222) return "Fail 3" - if (a.foo() != 222) return "Fail 4" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/complexTraitImpl.kt b/backend.native/tests/external/codegen/box/bridges/complexTraitImpl.kt deleted file mode 100644 index ff5edc8750b..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/complexTraitImpl.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME - -abstract class A { - abstract fun foo(): List -} - -interface B { - fun foo(): ArrayList = ArrayList(listOf("B")) -} - -open class C : A(), B { - override fun foo(): ArrayList = super.foo() -} - -interface D { - fun foo(): Collection -} - -class E : D, C() - -fun box(): String { - val e = E() - var r = e.foo()[0] - val d: D = e - val c: C = e - val b: B = e - val a: A = e - r += d.foo().iterator().next() - r += c.foo()[0] - r += b.foo()[0] - r += a.foo()[0] - return if (r == "BBBBB") "OK" else "Fail: $r" -} diff --git a/backend.native/tests/external/codegen/box/bridges/delegation.kt b/backend.native/tests/external/codegen/box/bridges/delegation.kt deleted file mode 100644 index 29dfbecf8a6..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/delegation.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface A { - fun foo(): T -} - -class B : A { - override fun foo() = "OK" -} - -class C(a: A) : A by a - -fun box(): String { - val a: A = C(B()) - return a.foo() -} diff --git a/backend.native/tests/external/codegen/box/bridges/delegationComplex.kt b/backend.native/tests/external/codegen/box/bridges/delegationComplex.kt deleted file mode 100644 index 77af8d7e9b5..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/delegationComplex.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Content() { - override fun toString() = "OK" -} - -interface Box { - fun get(): E -} - -interface ContentBox : Box - -object Impl : ContentBox { - override fun get(): Content = Content() -} - -class ContentBoxDelegate() : ContentBox by (Impl as ContentBox) - -fun box() = ContentBoxDelegate().get().toString() diff --git a/backend.native/tests/external/codegen/box/bridges/delegationComplexWithList.kt b/backend.native/tests/external/codegen/box/bridges/delegationComplexWithList.kt deleted file mode 100644 index caf8be2c5dd..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/delegationComplexWithList.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -open class Content() { - override fun toString() = "OK" -} - -interface ContentBox : List - -object Impl : ContentBox , AbstractList() { - override fun get(index: Int) = Content() - - override val size: Int - get() = throw UnsupportedOperationException() -} - -class ContentBoxDelegate() : ContentBox by (Impl as ContentBox) - -fun box() = ContentBoxDelegate()[0].toString() diff --git a/backend.native/tests/external/codegen/box/bridges/delegationProperty.kt b/backend.native/tests/external/codegen/box/bridges/delegationProperty.kt deleted file mode 100644 index 8192c4f4532..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/delegationProperty.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface A { - var result: T -} - -class B(a: A): A by a - -fun box(): String { - val o = object : A { - override var result = "Fail" - } - val b: A = B(o) - b.result = "OK" - if (b.result != "OK") return "Fail" - return b.result -} diff --git a/backend.native/tests/external/codegen/box/bridges/diamond.kt b/backend.native/tests/external/codegen/box/bridges/diamond.kt deleted file mode 100644 index ef1990bf937..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/diamond.kt +++ /dev/null @@ -1,26 +0,0 @@ -interface A { - fun foo(t: T, u: U) = "A" -} - -interface B : A - -interface C : A - -class Z : B, C { - override fun foo(t: String, u: Int) = "Z" -} - - -fun box(): String { - val z = Z() - val c: C = z - val b: B = z - val a: A = z - return when { - z.foo("", 0) != "Z" -> "Fail #1" - c.foo("", 0) != "Z" -> "Fail #2" - b.foo("", 0) != "Z" -> "Fail #3" - a.foo("", 0) != "Z" -> "Fail #4" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/fakeCovariantOverride.kt b/backend.native/tests/external/codegen/box/bridges/fakeCovariantOverride.kt deleted file mode 100644 index e62de29d55a..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeCovariantOverride.kt +++ /dev/null @@ -1,19 +0,0 @@ -// KT-4145 - -interface A { - fun foo(): Any -} - -open class B { - fun foo(): String = "A" -} - -open class C: B(), A - -fun box(): String { - val a: A = C() - if (a.foo() != "A") return "Fail 1" - if ((a as B).foo() != "A") return "Fail 2" - if ((a as C).foo() != "A") return "Fail 3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverride.kt b/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverride.kt deleted file mode 100644 index ffff9f297e4..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverride.kt +++ /dev/null @@ -1,22 +0,0 @@ -// KT-3985 - -interface Trait { - fun f(): T -} - -open class Class { - fun f(): String = throw UnsupportedOperationException() -} - -class Foo: Class(), Trait { -} - -fun box(): String { - val t: Trait = Foo() - try { - t.f() - } catch (e: UnsupportedOperationException) { - return "OK" - } - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt b/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt deleted file mode 100644 index 450ad185175..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeGenericCovariantOverrideWithDelegation.kt +++ /dev/null @@ -1,32 +0,0 @@ -interface A { - fun foo(t: T): String -} - -interface B { - fun foo(t: Int) = "B" -} - -class Z : B - -class Z1 : A, B by Z() - -class Z2 : B by Z(), A - -fun box(): String { - val z1 = Z1() - val z2 = Z2() - val z1a: A = z1 - val z1b: B = z1 - val z2a: A = z2 - val z2b: B = z2 - - return when { - z1.foo( 0) != "B" -> "Fail #1" - z1a.foo( 0) != "B" -> "Fail #2" - z1b.foo( 0) != "B" -> "Fail #3" - z2.foo( 0) != "B" -> "Fail #4" - z2a.foo( 0) != "B" -> "Fail #5" - z2b.foo( 0) != "B" -> "Fail #6" - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/bridges/fakeOverrideOfTraitImpl.kt b/backend.native/tests/external/codegen/box/bridges/fakeOverrideOfTraitImpl.kt deleted file mode 100644 index 7827f53a892..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeOverrideOfTraitImpl.kt +++ /dev/null @@ -1,31 +0,0 @@ -var result = "" - -interface D1 { - fun foo(): D1 { - result += "D1" - return this - } -} - -interface F2 : D1 - -interface D3 : F2 { - override fun foo(): D3 { - result += "D3" - return this - } -} - -class D4 : D3 - -fun box(): String { - val x = D4() - x.foo() - val d3: D3 = x - val f2: F2 = x - val d1: D1 = x - d3.foo() - f2.foo() - d1.foo() - return if (result == "D3D3D3D3") "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt b/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt deleted file mode 100644 index c9844928db7..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt +++ /dev/null @@ -1,30 +0,0 @@ -interface D1 { - fun foo(): Any -} - -interface D2 { - fun foo(): Number -} - -interface F3 : D1, D2 - -open class D4 { - fun foo(): Int = 42 -} - -class F5 : F3, D4() - -fun box(): String { - val z = F5() - var result = z.foo() - val d4: D4 = z - val f3: F3 = z - val d2: D2 = z - val d1: D1 = z - - result += d4.foo() - result += f3.foo() as Int - result += d2.foo() as Int - result += d1.foo() as Int - return if (result == 5 * 42) "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt b/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt deleted file mode 100644 index 075bbca0443..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/fakeOverrideWithSynthesizedImplementation.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A(val value: String) { - fun component1() = value -} - -interface B { - fun component1(): Any -} - -class C(value: String) : A(value), B - -fun box(): String { - val c = C("OK") - val b: B = c - val a: A = c - if (b.component1() != "OK") return "Fail 1" - if (a.component1() != "OK") return "Fail 2" - return c.component1() -} diff --git a/backend.native/tests/external/codegen/box/bridges/genericProperty.kt b/backend.native/tests/external/codegen/box/bridges/genericProperty.kt deleted file mode 100644 index be4000a62e3..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/genericProperty.kt +++ /dev/null @@ -1,19 +0,0 @@ -open class A { - var size: T = 56 as T -} - -interface C { - var size: Int -} - -class B : C, A() - -fun box(): String { - val b = B() - if (b.size != 56) return "fail 1: ${b.size}" - - b.size = 55 - if (b.size != 55) return "fail 2: ${b.size}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/jsName.kt b/backend.native/tests/external/codegen/box/bridges/jsName.kt deleted file mode 100644 index c024e4eed2e..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/jsName.kt +++ /dev/null @@ -1,59 +0,0 @@ -// TARGET_BACKEND: JS -package foo - -interface A { - @JsName("foo") fun foo(value: Int): String -} - -interface B { - @JsName("bar") fun foo(value: Int): String -} - -open class C : A, B { - override fun foo(value: Int) = "C.foo($value)" -} - -class CDerived : C() { - override fun foo(value: Int) = "CDerived.foo($value)" -} - -open class D { - open fun foo(value: Int) = "D.foo($value)" -} - -class E : D(), A, B - -fun box(): String { - val a: A = C() - assertEquals("C.foo(55)", a.foo(55)) - - val b: B = C() - assertEquals("C.foo(23)", b.foo(23)) - - val a2: A = CDerived() - assertEquals("CDerived.foo(55)", a2.foo(55)) - - val b2: B = CDerived() - assertEquals("CDerived.foo(23)", b2.foo(23)) - - val d: dynamic = C() - assertEquals("C.foo(42)", d.foo(42)) - assertEquals("C.foo(99)", d.bar(99)) - - val d2: dynamic = CDerived() - assertEquals("CDerived.foo(42)", d2.foo(42)) - assertEquals("CDerived.foo(99)", d2.bar(99)) - - val da: A = E() - assertEquals("D.foo(55)", da.foo(55)) - - val db: B = E() - assertEquals("D.foo(23)", db.foo(23)) - - val dd: dynamic = E() - assertEquals("D.foo(42)", dd.foo(42)) - assertEquals("D.foo(99)", dd.bar(99)) - assertEquals("D.foo(88)", dd.`foo_za3lpa$`(88)) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/bridges/jsNative.kt b/backend.native/tests/external/codegen/box/bridges/jsNative.kt deleted file mode 100644 index b13d97886dd..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/jsNative.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TARGET_BACKEND: JS -package foo - -external interface A { - fun foo(value: Int): String -} - -interface B { - fun foo(value: Int): String -} - -class C : A, B { - override fun foo(value: Int) = "C.foo($value)" -} - -open class D { - open fun foo(value: Int) = "D.foo($value)" -} - -class E : D(), A, B - -fun box(): String { - val a: A = C() - assertEquals("C.foo(55)", a.foo(55)) - - val b: B = C() - assertEquals("C.foo(23)", b.foo(23)) - - val d: dynamic = C() - assertEquals("C.foo(42)", d.foo(42)) - assertEquals("C.foo(99)", d.`foo_za3lpa$`(99)) - - val da: A = E() - assertEquals("D.foo(55)", da.foo(55)) - - val db: B = E() - assertEquals("D.foo(23)", db.foo(23)) - - val dd: dynamic = E() - assertEquals("D.foo(42)", dd.foo(42)) - assertEquals("D.foo(99)", dd.`foo_za3lpa$`(99)) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/bridges/kt12416.kt b/backend.native/tests/external/codegen/box/bridges/kt12416.kt deleted file mode 100644 index c50c81671f5..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt12416.kt +++ /dev/null @@ -1,41 +0,0 @@ -interface A { - fun foo(t: T, u: Int) = "A" -} - -interface B { - fun foo(t: T, u: U) = "B" -} - -interface Z1 : A, B { - override fun foo(t: String, u: Int) = "Z1" -} - -interface Z2 : B, A { - override fun foo(t: String, u: Int) = "Z2" -} - -class Z1C : Z1 { - -} - -class Z2C : Z2 { - -} - -fun box(): String { - val z1 = Z1C() - val z2 = Z2C() - val z1a: A = z1 - val z1b: B = z1 - val z2a: A = z2 - val z2b: B = z2 - return when { - z1.foo("", 0) != "Z1" -> "Fail #1" - z1a.foo("", 0) != "Z1" -> "Fail #2" - z1b.foo("", 0) != "Z1" -> "Fail #3" //FAIL - z2.foo("", 0) != "Z2" -> "Fail #4" - z2a.foo("", 0) != "Z2" -> "Fail #5" - z2b.foo("", 0) != "Z2" -> "Fail #6" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/kt1939.kt b/backend.native/tests/external/codegen/box/bridges/kt1939.kt deleted file mode 100644 index ad300dc796e..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt1939.kt +++ /dev/null @@ -1,12 +0,0 @@ -abstract class Foo { - fun hello(id: T) = "Hi $id" -} - -interface Tr { - fun hello(s : String): String -} - -class Bar: Foo(), Tr { -} - -fun box(): String = if (Bar().hello("Reg") == "Hi Reg") "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/bridges/kt1959.kt b/backend.native/tests/external/codegen/box/bridges/kt1959.kt deleted file mode 100644 index e820d707615..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt1959.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class A { - open fun f(args : Array) {} -} - -class B(): A() { - override fun f(args : Array) {} -} - -fun box(): String { - B() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/bridges/kt2498.kt b/backend.native/tests/external/codegen/box/bridges/kt2498.kt deleted file mode 100644 index 63811a52bf8..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt2498.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -open class BaseStringList: ArrayList() { -} - -class StringList: BaseStringList() { - public override fun get(index: Int): String { - return "StringList.get()" - } -} - -fun box(): String { - val myStringList = StringList() - myStringList.add("first element") - if (myStringList.get(0) != "StringList.get()") return "Fail #1" - val b: BaseStringList = myStringList - val a: ArrayList = myStringList - if (b.get(0) != "StringList.get()") return "Fail #2" - if (a.get(0) != "StringList.get()") return "Fail #3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/kt2702.kt b/backend.native/tests/external/codegen/box/bridges/kt2702.kt deleted file mode 100644 index cbf5eebee68..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt2702.kt +++ /dev/null @@ -1,14 +0,0 @@ -open class A { - open fun foo(r: R): R {return r} -} - -open class B : A() { -} - -open class C : B() { - override fun foo(r: String): String { - return super.foo(r) + "K" - } -} - -fun box() = C().foo("O") diff --git a/backend.native/tests/external/codegen/box/bridges/kt2833.kt b/backend.native/tests/external/codegen/box/bridges/kt2833.kt deleted file mode 100644 index 50a2989d904..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt2833.kt +++ /dev/null @@ -1,17 +0,0 @@ -package test - -public interface FunDependencyEdge { - val from: FunctionNode -} - -public interface FunctionNode - -public class FunctionNodeImpl : FunctionNode - -class FunDependencyEdgeImpl(override val from: FunctionNodeImpl): FunDependencyEdge { -} - -fun box(): String { - (FunDependencyEdgeImpl(FunctionNodeImpl()) as FunDependencyEdge).from - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/kt2920.kt b/backend.native/tests/external/codegen/box/bridges/kt2920.kt deleted file mode 100644 index 0f71953ba12..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt2920.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface Tr { - val v: T -} - -class C : Tr { - override val v = "OK" -} - -fun box() = C().v diff --git a/backend.native/tests/external/codegen/box/bridges/kt318.kt b/backend.native/tests/external/codegen/box/bridges/kt318.kt deleted file mode 100644 index 72e5991297c..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/kt318.kt +++ /dev/null @@ -1,24 +0,0 @@ -var result = "" - -interface Base -open class Child : Base - -interface A { - fun foo(a : E) { - result += "A" - } -} - -class B : A { - override fun foo(a : E) { - result += "B" - } -} - -fun box(): String { - val b = B() - b.foo(Child()) - val a: A = b - a.foo(Child()) - return if (result == "BB") "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/bridges/longChainOneBridge.kt b/backend.native/tests/external/codegen/box/bridges/longChainOneBridge.kt deleted file mode 100644 index 6d1d79c28e7..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/longChainOneBridge.kt +++ /dev/null @@ -1,32 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -open class B : A() - -open class C : B() { - override fun foo(t: String) = "C" -} - -open class D : C() - -class Z : D() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val z = Z() - val d: D = z - val c: C = z - val b: B = z - val a: A = z - return when { - z.foo("") != "Z" -> "Fail #1" - d.foo("") != "Z" -> "Fail #2" - c.foo("") != "Z" -> "Fail #3" - b.foo("") != "Z" -> "Fail #4" - a.foo("") != "Z" -> "Fail #5" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt b/backend.native/tests/external/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt deleted file mode 100644 index 82306ddf3f4..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/manyTypeArgumentsSubstitutedSuccessively.kt +++ /dev/null @@ -1,26 +0,0 @@ -open class A { - open fun foo(t: T, u: U, v: V) = "A" -} - -open class B : A() - -open class C : B() - -class Z : C() { - override fun foo(t: String, u: Int, v: Double) = "Z" -} - - -fun box(): String { - val z = Z() - val c: C = z - val b: B = z - val a: A = z - return when { - z.foo("", 0, 0.0) != "Z" -> "Fail #1" - c.foo("", 0, 0.0) != "Z" -> "Fail #2" - b.foo("", 0, 0.0) != "Z" -> "Fail #3" - a.foo("", 0, 0.0) != "Z" -> "Fail #4" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/methodFromTrait.kt b/backend.native/tests/external/codegen/box/bridges/methodFromTrait.kt deleted file mode 100644 index 058109901d1..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/methodFromTrait.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface A { - fun foo(t: T, u: U) = "A" -} - -class Z : A { - override fun foo(t: T, u: Int) = "Z" -} - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo(0, 0) != "Z" -> "Fail #1" - a.foo(0, 0) != "Z" -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt b/backend.native/tests/external/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt deleted file mode 100644 index 59e364fe37f..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME - -interface A { - fun foo(): Collection -} - -interface B : A { - override fun foo(): MutableCollection -} - -class C : B { - override fun foo(): MutableList = ArrayList(listOf("C")) -} - -fun box(): String { - val c = C() - var r = c.foo().iterator().next() - val b: B = c - val a: A = c - r += b.foo().iterator().next() - r += a.foo().iterator().next() - return if (r == "CCC") "OK" else "Fail: $r" -} diff --git a/backend.native/tests/external/codegen/box/bridges/objectClone.kt b/backend.native/tests/external/codegen/box/bridges/objectClone.kt deleted file mode 100644 index 773f66e04c4..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/objectClone.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM -import java.util.HashSet - -interface A : Set - -class B : A, HashSet() { - override fun clone(): B = throw AssertionError() -} - -fun box(): String { - return try { - B().clone() - "Fail 1" - } catch (e: AssertionError) { - try { - val hs: HashSet = B() - hs.clone() - "Fail 2" - } catch (e: AssertionError) { - "OK" - } - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/overrideAbstractProperty.kt b/backend.native/tests/external/codegen/box/bridges/overrideAbstractProperty.kt deleted file mode 100644 index ec01cfced5c..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/overrideAbstractProperty.kt +++ /dev/null @@ -1,10 +0,0 @@ -public abstract class AbstractClass { - public abstract val some: T -} - -public class Class: AbstractClass() { - public override val some: String - get() = "OK" -} - -fun box(): String = Class().some diff --git a/backend.native/tests/external/codegen/box/bridges/overrideReturnType.kt b/backend.native/tests/external/codegen/box/bridges/overrideReturnType.kt deleted file mode 100644 index e8d2619eb02..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/overrideReturnType.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class C { - open fun f(): Any = "C f" -} - -class D() : C() { - override fun f(): String = "D f" -} - -fun box(): String{ - val d : C = D() - if(d.f() != "D f") return "fail f" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/propertyAccessorsWithoutBody.kt b/backend.native/tests/external/codegen/box/bridges/propertyAccessorsWithoutBody.kt deleted file mode 100644 index 82a9b0b930c..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/propertyAccessorsWithoutBody.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class A { - open var x: T = "Fail" as T - get -} - -class B : A() { - override var x: String = "Fail" - set -} - -fun box(): String { - val a: A = B() - a.x = "OK" - return a.x -} diff --git a/backend.native/tests/external/codegen/box/bridges/propertyDiamond.kt b/backend.native/tests/external/codegen/box/bridges/propertyDiamond.kt deleted file mode 100644 index 802f6f77932..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/propertyDiamond.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - val o: O - val k: K -} - -interface B : A - -interface C : A - -class D : B, C { - override val o = "O" - override val k = "K" -} - -fun box(): String { - val a: A = D() - return a.o + a.k -} diff --git a/backend.native/tests/external/codegen/box/bridges/propertyInConstructor.kt b/backend.native/tests/external/codegen/box/bridges/propertyInConstructor.kt deleted file mode 100644 index 9ca1e8bf8f5..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/propertyInConstructor.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface A { - var x: T -} - -class B(override var x: String) : A - -fun box(): String { - val a: A = B("Fail") - a.x = "OK" - return a.x -} diff --git a/backend.native/tests/external/codegen/box/bridges/propertySetter.kt b/backend.native/tests/external/codegen/box/bridges/propertySetter.kt deleted file mode 100644 index a258dc85346..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/propertySetter.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface A { - var v: T -} - -class B : A { - override var v: String = "Fail" -} - -fun box(): String { - val a: A = B() - a.v = "OK" - return a.v -} diff --git a/backend.native/tests/external/codegen/box/bridges/simple.kt b/backend.native/tests/external/codegen/box/bridges/simple.kt deleted file mode 100644 index 284d7cbb44c..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simple.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -class Z : A() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo("") != "Z" -> "Fail #1" - a.foo("") != "Z" -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleEnum.kt b/backend.native/tests/external/codegen/box/bridges/simpleEnum.kt deleted file mode 100644 index 0446aba8c33..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleEnum.kt +++ /dev/null @@ -1,20 +0,0 @@ -interface A { - open fun foo(t: T) = "A" -} - -enum class Z(val aname: String) : A { - Z1("Z1"), - Z2("Z2"); - override fun foo(t: String) = aname -} - - -fun box(): String { - return when { - Z.Z1.foo("") != "Z1" -> "Fail #1" - Z.Z2.foo("") != "Z2" -> "Fail #2" - (Z.Z1 as A).foo("") != "Z1" -> "Fail #3" - (Z.Z2 as A).foo("") != "Z2" -> "Fail #4" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleGenericMethod.kt b/backend.native/tests/external/codegen/box/bridges/simpleGenericMethod.kt deleted file mode 100644 index 81e6c8607c1..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleGenericMethod.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A { - open fun foo(t: T, u: U) = "A" -} - -class Z : A() { - override fun foo(t: String, u: U) = "Z" -} - - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo("", 0) != "Z" -> "Fail #1" - a.foo("", 0) != "Z" -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleObject.kt b/backend.native/tests/external/codegen/box/bridges/simpleObject.kt deleted file mode 100644 index 5ff3c8177e6..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleObject.kt +++ /dev/null @@ -1,23 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -object Z : A() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val z = object : A() { - override fun foo(t: String) = "z" - } - val az: A = Z - val a: A = z - return when { - Z.foo("") != "Z" -> "Fail #1" - z.foo("") != "z" -> "Fail #2" - az.foo("") != "Z" -> "Fail #3" - a.foo("") != "z" -> "Fail #4" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleReturnType.kt b/backend.native/tests/external/codegen/box/bridges/simpleReturnType.kt deleted file mode 100644 index ffd0bf84892..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleReturnType.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class A(val t: T) { - open fun foo(): T = t -} - -class Z : A(17) { - override fun foo() = 239 -} - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo() != 239 -> "Fail #1" - a.foo() != 239 -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleTraitImpl.kt b/backend.native/tests/external/codegen/box/bridges/simpleTraitImpl.kt deleted file mode 100644 index 1e1ccbab17e..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleTraitImpl.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface A { - fun foo(t: T) = "A" -} - -class Z : A - - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo("") != "A" -> "Fail #1" - a.foo("") != "A" -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/simpleUpperBound.kt b/backend.native/tests/external/codegen/box/bridges/simpleUpperBound.kt deleted file mode 100644 index dea1f7eb647..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/simpleUpperBound.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -class Z : A() { - override fun foo(t: Int) = "Z" -} - - -fun box(): String { - val z = Z() - val a: A = z - return when { - z.foo(0) != "Z" -> "Fail #1" - a.foo(0) != "Z" -> "Fail #2" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/strListContains.kt b/backend.native/tests/external/codegen/box/bridges/strListContains.kt deleted file mode 100644 index 33062160eb9..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/strListContains.kt +++ /dev/null @@ -1,53 +0,0 @@ - -class StrList : List { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(o: String?) = o == null || o == "abc" - - override fun iterator(): Iterator { - throw UnsupportedOperationException() - } - - override fun containsAll(c: Collection) = false - override fun get(index: Int): String { - throw UnsupportedOperationException() - } - - override fun indexOf(o: String?): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(o: String?): Int { - throw UnsupportedOperationException() - } - - override fun listIterator(): ListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): ListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): List { - throw UnsupportedOperationException() - } -} - -fun Collection.forceContains(x: Any?): Boolean = contains(x as E) - -fun box(): String { - val strList = StrList() - - if (strList.forceContains(1)) return "fail 1" - if (!strList.forceContains(null)) return "fail 2" - if (strList.forceContains("cde")) return "fail 3" - if (!strList.forceContains("abc")) return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt deleted file mode 100644 index 39e1b1935f0..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/abstractFun.kt +++ /dev/null @@ -1,22 +0,0 @@ -abstract class A { - abstract fun foo(t: T): String -} - -abstract class B : A() - -class Z : B() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val z = Z() - val b: B = z - val a: A = z - return when { - z.foo("") != "Z" -> "Fail #1" - b.foo("") != "Z" -> "Fail #2" - a.foo("") != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt deleted file mode 100644 index 3db4852ed2b..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/boundedTypeArguments.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class A { - open fun foo(t: T, u: U) = "A" -} - -open class B : A() - -class Z : B() { - override fun foo(t: Int, u: Number) = "Z" -} - -fun box(): String { - val z = Z() - val b: B = z - val a: A = z - return when { - z.foo(0, 0) != "Z" -> "Fail #1" - b.foo(0, 0) != "Z" -> "Fail #2" - a.foo(0, 0) != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/delegation.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/delegation.kt deleted file mode 100644 index 3d80f6523ea..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/delegation.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - fun id(t: T): T -} - -open class B : A { - override fun id(t: String) = t -} - -class C : B() - -class D : A by C() - -fun box(): String { - val d = D() - if (d.id("") != "") return "Fail" - val a: A = d - return a.id("OK") -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt deleted file mode 100644 index d3bb7ce59e7..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -public open class A { - fun foo(x: T) = "O" - fun foo(x: A) = "K" -} - -// Shoudt not be reported CONFLICTING_INHERITED_JVM_DECLARATIONS -class B : A>() - -fun box(): String { - val x: A = A() - val y: A> = A() - val b = B() - - return b.foo(x) + b.foo(y) -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt deleted file mode 100644 index 473cee266e1..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt +++ /dev/null @@ -1,35 +0,0 @@ -public open class A { - fun foo(x: T) = "O" - fun foo(x: A) = "K" -} - -interface C { - fun foo(x: E): String - fun foo(x: A): String -} - -interface D { - fun foo(x: A>): String -} - -// Shoudt not be reported CONFLICTING_INHERITED_JVM_DECLARATIONS -class B : A>(), C>, D - -fun box(): String { - val x: A = A() - val y: A> = A() - - val b = B() - val bResult = b.foo(x) + b.foo(y) - if (bResult != "OK") return "fail 1: $bResult" - - val c: C> = B() - val cResult = c.foo(x) + c.foo(y) - if (cResult != "OK") return "fail 2: $cResult" - - val d: D = B() - - if (d.foo(y) != "K") return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/enum.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/enum.kt deleted file mode 100644 index 243498038e6..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/enum.kt +++ /dev/null @@ -1,28 +0,0 @@ -interface A { - open fun foo(t: T) = "A" -} - -interface B : A - -enum class Z(val aname: String) : B { - Z1("Z1"), - Z2("Z2"); - override fun foo(t: String) = aname -} - - -fun box(): String { - val z1b: B = Z.Z1 - val z2b: B = Z.Z2 - val z1a: A = Z.Z1 - val z2a: A = Z.Z2 - return when { - Z.Z1.foo("") != "Z1" -> "Fail #1" - Z.Z2.foo("") != "Z2" -> "Fail #2" - z1b.foo("") != "Z1" -> "Fail #3" - z2b.foo("") != "Z2" -> "Fail #4" - z1a.foo("") != "Z1" -> "Fail #5" - z2a.foo("") != "Z2" -> "Fail #6" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt deleted file mode 100644 index 0119eba58a8..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/genericMethod.kt +++ /dev/null @@ -1,22 +0,0 @@ -open class A { - open fun foo(t: T, u: U) = "A" -} - -open class B : A() - -class Z : B() { - override fun foo(t: String, u: U) = "Z" -} - - -fun box(): String { - val z = Z() - val b: B = z - val a: A = z - return when { - z.foo("", 0) != "Z" -> "Fail #1" - b.foo("", 0) != "Z" -> "Fail #2" - a.foo("", 0) != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/object.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/object.kt deleted file mode 100644 index c7c95464c59..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/object.kt +++ /dev/null @@ -1,30 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -open class B : A() - -object Z : B() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val o = object : B() { - override fun foo(t: String) = "o" - } - val zb: B = Z - val ob: B = o - val za: A = Z - val oa: A = o - - return when { - Z.foo("") != "Z" -> "Fail #1" - o.foo("") != "o" -> "Fail #2" - zb.foo("") != "Z" -> "Fail #3" - ob.foo("") != "o" -> "Fail #4" - za.foo("") != "Z" -> "Fail #5" - oa.foo("") != "o" -> "Fail #6" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/property.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/property.kt deleted file mode 100644 index 21208405891..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/property.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class A(val t: T) { - open val foo: T = t -} - -open class B : A("Fail") - -class Z : B() { - override val foo = "OK" -} - - -fun box(): String { - val a: A = Z() - return a.foo -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/simple.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/simple.kt deleted file mode 100644 index c6c2637ef22..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/simple.kt +++ /dev/null @@ -1,22 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -open class B : A() - -class Z : B() { - override fun foo(t: String) = "Z" -} - - -fun box(): String { - val z = Z() - val b: B = z - val a: A = z - return when { - z.foo("") != "Z" -> "Fail #1" - b.foo("") != "Z" -> "Fail #2" - a.foo("") != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/upperBound.kt b/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/upperBound.kt deleted file mode 100644 index f6d4dccfc40..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/substitutionInSuperClass/upperBound.kt +++ /dev/null @@ -1,22 +0,0 @@ -open class A { - open fun foo(t: T) = "A" -} - -open class B : A() - -class Z : B() { - override fun foo(t: Int) = "Z" -} - - -fun box(): String { - val z = Z() - val b: B = z - val a: A = z - return when { - z.foo(0) != "Z" -> "Fail #1" - b.foo(0) != "Z" -> "Fail #2" - a.foo(0) != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/traitImplInheritsTraitImpl.kt b/backend.native/tests/external/codegen/box/bridges/traitImplInheritsTraitImpl.kt deleted file mode 100644 index ec0cf44081a..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/traitImplInheritsTraitImpl.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface A { - fun foo(): Any = "A" -} - -interface B : A { - override fun foo(): String = "B" -} - -class C : B - -fun box(): String { - val c = C() - val b: B = c - val a: A = c - var r = c.foo() + b.foo() + a.foo() - return if (r == "BBB") "OK" else "Fail: $r" -} diff --git a/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt b/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt deleted file mode 100644 index 38d7cb2431f..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt +++ /dev/null @@ -1,33 +0,0 @@ -interface A { - fun foo(t: T, u: Int) = "A" -} - -interface B { - fun foo(t: T, u: U) = "B" -} - -class Z1 : A, B { - override fun foo(t: String, u: Int) = "Z1" -} - -class Z2 : B, A { - override fun foo(t: String, u: Int) = "Z2" -} - -fun box(): String { - val z1 = Z1() - val z2 = Z2() - val z1a: A = z1 - val z1b: B = z1 - val z2a: A = z2 - val z2b: B = z2 - return when { - z1.foo("", 0) != "Z1" -> "Fail #1" - z1a.foo("", 0) != "Z1" -> "Fail #2" - z1b.foo("", 0) != "Z1" -> "Fail #3" - z2.foo("", 0) != "Z2" -> "Fail #4" - z2a.foo("", 0) != "Z2" -> "Fail #5" - z2b.foo("", 0) != "Z2" -> "Fail #6" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt b/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt deleted file mode 100644 index 07af5afaa4e..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt +++ /dev/null @@ -1,40 +0,0 @@ -interface A { - fun foo(t: T, u: Int) = "A" -} - -interface B { - fun foo(t: T, u: U) = "B" -} - -interface Z1 : A, B { - override fun foo(t: String, u: Int) = "Z1" -} - -interface Z2 : B, A { - override fun foo(t: String, u: Int) = "Z2" -} - - -class Z1Class : Z1 { -} - -class Z2Class : Z2 { -} - -fun box(): String { - val z1 = Z1Class() - val z2 = Z2Class() - val z1a: A = z1 - val z1b: B = z1 - val z2a: A = z2 - val z2b: B = z2 - return when { - z1.foo("", 0) != "Z1" -> "Fail #1" - z1a.foo("", 0) != "Z1" -> "Fail #2" - z1b.foo("", 0) != "Z1" -> "Fail #3" //FAIL - z2.foo("", 0) != "Z2" -> "Fail #4" - z2a.foo("", 0) != "Z2" -> "Fail #5" - z2b.foo("", 0) != "Z2" -> "Fail #6" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt b/backend.native/tests/external/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt deleted file mode 100644 index de57467d8b1..00000000000 --- a/backend.native/tests/external/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt +++ /dev/null @@ -1,24 +0,0 @@ -interface A { - fun foo(t: T) = "A" -} - -interface B { - fun foo(t: T) = "B" -} - -class Z : A, B { - override fun foo(t: Int) = "Z" -} - - -fun box(): String { - val z = Z() - val a: A = z - val b: B = z - return when { - z.foo(0) != "Z" -> "Fail #1" - a.foo(0) != "Z" -> "Fail #2" - b.foo(0) != "Z" -> "Fail #3" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/Collection.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/Collection.kt deleted file mode 100644 index 7cf2ea396f8..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/Collection.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyCollection: Collection { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: T): Boolean = false - override fun iterator(): Iterator = throw UnsupportedOperationException() - override fun containsAll(c: Collection): Boolean = false - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false -} - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val myCollection = MyCollection() - val collection = myCollection as java.util.Collection - - expectUoe { collection.add("") } - expectUoe { collection.remove("") } - expectUoe { collection.addAll(myCollection) } - expectUoe { collection.removeAll(myCollection) } - expectUoe { collection.retainAll(myCollection) } - expectUoe { collection.clear() } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/Iterator.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/Iterator.kt deleted file mode 100644 index a02c5eb2741..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/Iterator.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyIterator(val v: T): Iterator { - override fun next(): T = v - override fun hasNext(): Boolean = true -} - -fun box(): String { - try { - (MyIterator("") as java.util.Iterator).remove() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/IteratorWithRemove.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/IteratorWithRemove.kt deleted file mode 100644 index 5958c38ca05..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/IteratorWithRemove.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyIterator(val v: T): Iterator { - override fun next(): T = v - override fun hasNext(): Boolean = true - - public fun remove() {} -} - -fun box(): String { - (MyIterator("") as java.util.Iterator).remove() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/List.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/List.kt deleted file mode 100644 index b080905285a..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/List.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyList: List { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: T): Boolean = false - override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false - override fun get(index: Int): T = throw IndexOutOfBoundsException() - override fun indexOf(o: T): Int = -1 - override fun lastIndexOf(o: T): Int = -1 - override fun listIterator(): ListIterator = throw Error() - override fun listIterator(index: Int): ListIterator = throw Error() - override fun subList(fromIndex: Int, toIndex: Int): List = this - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false -} - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val list = MyList() as java.util.List - - expectUoe { list.add("") } - expectUoe { list.remove("") } - expectUoe { list.addAll(list) } - expectUoe { list.removeAll(list) } - expectUoe { list.retainAll(list) } - expectUoe { list.clear() } - expectUoe { list.set(0, "") } - expectUoe { list.add(0, "") } - expectUoe { list.remove(0) } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/ListIterator.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/ListIterator.kt deleted file mode 100644 index d5a829d7566..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/ListIterator.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyListIterator : ListIterator { - override fun next(): T = null!! - override fun hasNext(): Boolean = null!! - override fun hasPrevious(): Boolean = null!! - override fun previous(): T = null!! - override fun nextIndex(): Int = null!! - override fun previousIndex(): Int = null!! -} - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val list = MyListIterator() as java.util.ListIterator - - expectUoe { list.set("") } - expectUoe { list.add("") } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllImplementations.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllImplementations.kt deleted file mode 100644 index c0fe1108a7d..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllImplementations.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyList(val v: T): List { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: T): Boolean = false - override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false - override fun get(index: Int): T = v - override fun indexOf(o: T): Int = -1 - override fun lastIndexOf(o: T): Int = -1 - override fun listIterator(): ListIterator = throw Error() - override fun listIterator(index: Int): ListIterator = throw Error() - override fun subList(fromIndex: Int, toIndex: Int): List = throw Error() - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false - - public fun add(e: T): Boolean = true - public fun remove(o: T): Boolean = true - public fun addAll(c: Collection): Boolean = true - public fun addAll(index: Int, c: Collection): Boolean = true - public fun removeAll(c: Collection): Boolean = true - public fun retainAll(c: Collection): Boolean = true - public fun clear() {} - public fun set(index: Int, element: T): T = element - public fun add(index: Int, element: T) {} - public fun removeAt(index: Int): T = v -} - -fun box(): String { - val list = MyList("") as java.util.List - - list.add("") - list.remove("") - list.addAll(list) - list.removeAll(list) - list.retainAll(list) - list.clear() - list.set(0, "") - list.add(0, "") - list.remove(0) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt deleted file mode 100644 index 1f7e0ba5468..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -open class Super(val v: T) { - public fun add(e: T): Boolean = true - public fun remove(o: T): Boolean = true - public fun addAll(c: Collection): Boolean = true - public fun addAll(index: Int, c: Collection): Boolean = true - public fun removeAll(c: Collection): Boolean = true - public fun retainAll(c: Collection): Boolean = true - public fun clear() {} - public fun set(index: Int, element: T): T = element - public fun add(index: Int, element: T) {} - public fun removeAt(index: Int): T = v -} - -class MyList(v: T): Super(v), List { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: T): Boolean = false - override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false - override fun get(index: Int): T = v - override fun indexOf(o: T): Int = -1 - override fun lastIndexOf(o: T): Int = -1 - override fun listIterator(): ListIterator = throw Error() - override fun listIterator(index: Int): ListIterator = throw Error() - override fun subList(fromIndex: Int, toIndex: Int): List = throw Error() - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false -} - -fun box(): String { - val list = MyList("") as java.util.List - - list.add("") - list.remove("") - list.addAll(list) - list.removeAll(list) - list.retainAll(list) - list.clear() - list.set(0, "") - list.add(0, "") - list.remove(0) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/Map.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/Map.kt deleted file mode 100644 index c8438bb3d13..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/Map.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyMap: Map { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun containsKey(key: K): Boolean = false - override fun containsValue(value: V): Boolean = false - override fun get(key: K): V? = null - override val keys: Set get() = throw UnsupportedOperationException() - override val values: Collection get() = throw UnsupportedOperationException() - override val entries: Set> get() = throw UnsupportedOperationException() -} - -fun expectUoe(block: () -> Unit) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val myMap = MyMap() - val map = myMap as java.util.Map - - expectUoe { map.put("", 1) } - expectUoe { map.remove("") } - expectUoe { map.putAll(myMap) } - expectUoe { map.clear() } - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntry.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntry.kt deleted file mode 100644 index 33a83a55ec8..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntry.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyMapEntry: Map.Entry { - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false - override val key: K get() = throw UnsupportedOperationException() - override val value: V get() = throw UnsupportedOperationException() -} - -fun box(): String { - try { - (MyMapEntry() as java.util.Map.Entry).setValue(1) - throw AssertionError() - } catch (e: UnsupportedOperationException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntryWithSetValue.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntryWithSetValue.kt deleted file mode 100644 index ce8eaaf6886..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/MapEntryWithSetValue.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyMapEntry: Map.Entry { - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false - override val key: K get() = throw UnsupportedOperationException() - override val value: V get() = throw UnsupportedOperationException() - - public fun setValue(value: V): V = value -} - -fun box(): String { - (MyMapEntry() as java.util.Map.Entry).setValue(1) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/MapWithAllImplementations.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/MapWithAllImplementations.kt deleted file mode 100644 index d84d89369d3..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/MapWithAllImplementations.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyMap: Map { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun containsKey(key: K): Boolean = false - override fun containsValue(value: V): Boolean = false - override fun get(key: K): V? = null - override val keys: Set get() = throw UnsupportedOperationException() - override val values: Collection get() = throw UnsupportedOperationException() - override val entries: Set> get() = throw UnsupportedOperationException() - - public fun put(key: K, value: V): V? = null - public fun remove(key: K): V? = null - public fun putAll(m: Map) {} - public fun clear() {} -} - -fun box(): String { - val myMap = MyMap() - val map = myMap as java.util.Map - - map.put("", 1) - map.remove("") - map.putAll(myMap) - map.clear() - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/SubstitutedList.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/SubstitutedList.kt deleted file mode 100644 index 79208da27c1..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/SubstitutedList.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyList: List { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: String): Boolean = false - override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false - override fun get(index: Int): String = throw IndexOutOfBoundsException() - override fun indexOf(o: String): Int = -1 - override fun lastIndexOf(o: String): Int = -1 - override fun listIterator(): ListIterator = throw Error() - override fun listIterator(index: Int): ListIterator = throw Error() - override fun subList(fromIndex: Int, toIndex: Int): List = this - override fun hashCode(): Int = 0 - override fun equals(other: Any?): Boolean = false -} - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val list = MyList() as java.util.List - - expectUoe { list.add("") } - expectUoe { list.remove("") } - expectUoe { list.addAll(list) } - expectUoe { list.removeAll(list) } - expectUoe { list.retainAll(list) } - expectUoe { list.clear() } - expectUoe { list.set(0, "") } - expectUoe { list.add(0, "") } - expectUoe { list.remove(0) } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/abstractMember.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/abstractMember.kt deleted file mode 100644 index 100748198dc..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/abstractMember.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -abstract class A : Iterator { - abstract fun remove(): Unit -} - -class B(var result: String) : A() { - override fun next() = "" - override fun hasNext() = false - override fun remove() { - result = "OK" - } -} - -fun box(): String { - val a = B("Fail") as java.util.Iterator - a.next() - a.hasNext() - a.remove() - - return (a as B).result -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/customReadOnlyIterator.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/customReadOnlyIterator.kt deleted file mode 100644 index 2038e67cbb5..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/customReadOnlyIterator.kt +++ /dev/null @@ -1,34 +0,0 @@ -class A : Collection { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun contains(element: Char): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun iterator() = MyIterator -} - -object MyIterator : Iterator { - override fun hasNext() = true - - override fun next() = 'a' -} - - -fun box(): String { - val it: MyIterator = A().iterator() - - if (!it.hasNext()) return "fail 1" - if (it.next() != 'a') return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/delegationToArrayList.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/delegationToArrayList.kt deleted file mode 100644 index b9436fab469..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/delegationToArrayList.kt +++ /dev/null @@ -1,49 +0,0 @@ -// TARGET_BACKEND: JVM - -import java.util.ArrayList - -class A : List by ArrayList() - -class B : List by A() - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val a = A() as java.util.List - expectUoe { a.add("") } - expectUoe { a.remove("") } - expectUoe { a.addAll(a) } - expectUoe { a.addAll(0, a) } - expectUoe { a.removeAll(a) } - expectUoe { a.retainAll(a) } - expectUoe { a.clear() } - expectUoe { a.add(0, "") } - expectUoe { a.set(0, "") } - expectUoe { a.remove(0) } - a.listIterator() - a.listIterator(0) - a.subList(0, 0) - - val b = B() as java.util.List - expectUoe { b.add("") } - expectUoe { b.remove("") } - expectUoe { b.addAll(b) } - expectUoe { b.addAll(0, b) } - expectUoe { b.removeAll(b) } - expectUoe { b.retainAll(b) } - expectUoe { b.clear() } - expectUoe { b.add(0, "") } - expectUoe { b.set(0, "") } - expectUoe { b.remove(0) } - b.listIterator() - b.listIterator(0) - b.subList(0, 0) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt deleted file mode 100644 index ba7fdde2891..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM - -import java.util.AbstractList - -class A : AbstractList() { - override fun get(index: Int): String = "" - override val size: Int get() = 0 -} - -fun box(): String { - val a = A() - val b = A() - - a.addAll(b) - a.addAll(0, b) - a.removeAll(b) - a.retainAll(b) - a.clear() - a.remove("") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt deleted file mode 100644 index c8bb76a50ba..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM - -import java.util.AbstractMap -import java.util.Collections - -class A : AbstractMap() { - override val entries: MutableSet> get() = Collections.emptySet() -} - -fun box(): String { - val a = A() - val b = A() - - a.remove(0) - - a.putAll(b) - a.clear() - - a.keys - a.values - a.entries - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt deleted file mode 100644 index 01e1c3c3b33..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: NATIVE -class A : HashSet() - -fun box(): String { - val a = A() - val b = A() - - a.iterator() - - a.add(0L) - a.remove(0L) - - a.addAll(b) - a.removeAll(b) - a.retainAll(b) - a.clear() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt deleted file mode 100644 index 6d07d0b285a..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt +++ /dev/null @@ -1,22 +0,0 @@ -// KT-6042 java.lang.UnsupportedOperationException with ArrayList -// IGNORE_BACKEND: NATIVE -class A : ArrayList() - -fun box(): String { - val a = A() - val b = A() - - a.addAll(b) - a.addAll(0, b) - a.removeAll(b) - a.retainAll(b) - a.clear() - - a.add("") - a.set(0, "") - a.add(0, "") - a.removeAt(0) - a.remove("") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt deleted file mode 100644 index 72242f04bbc..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: NATIVE -class A : HashMap() - -fun box(): String { - val a = A() - val b = A() - - a.put("", 0.0) - a.remove("") - - a.putAll(b) - a.clear() - - a.keys - a.values - a.entries - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt deleted file mode 100644 index 01e1c3c3b33..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: NATIVE -class A : HashSet() - -fun box(): String { - val a = A() - val b = A() - - a.iterator() - - a.add(0L) - a.remove(0L) - - a.addAll(b) - a.removeAll(b) - a.retainAll(b) - a.clear() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt deleted file mode 100644 index 85ebbd34f5b..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: Test.java - -import java.lang.*; -import java.util.*; - -public class Test { - public static class MapEntryImpl implements Map.Entry { - public String getKey() { return null; } - public String getValue() { return null; } - public String setValue(String s) { return null; } - } -} - -// FILE: main.kt - -//class MyIterable : Test.IterableImpl() -//class MyIterator : Test.IteratorImpl() -class MyMapEntry : Test.MapEntryImpl() - -fun box(): String { - - val b = MyMapEntry() - b.key - b.value - b.setValue(null) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/implementationInTrait.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/implementationInTrait.kt deleted file mode 100644 index b82febc0667..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/implementationInTrait.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -interface Addable { - fun add(s: String): Boolean = true -} - -class C : Addable, List { - override val size: Int get() = null!! - override fun isEmpty(): Boolean = null!! - override fun contains(o: String): Boolean = null!! - override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection): Boolean = null!! - override fun get(index: Int): String = null!! - override fun indexOf(o: String): Int = null!! - override fun lastIndexOf(o: String): Int = null!! - override fun listIterator(): ListIterator = null!! - override fun listIterator(index: Int): ListIterator = null!! - override fun subList(fromIndex: Int, toIndex: Int): List = null!! -} - -fun box(): String { - try { - val a = C() - if (!a.add("")) return "Fail 1" - if (!(a as Addable).add("")) return "Fail 2" - if (!(a as java.util.List).add("")) return "Fail 3" - return "OK" - } catch (e: UnsupportedOperationException) { - return "Fail: no stub method should be generated" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/inheritedImplementations.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/inheritedImplementations.kt deleted file mode 100644 index 606144d696d..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/inheritedImplementations.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -open class SetStringImpl { - fun add(s: String): Boolean = false - fun remove(o: String): Boolean = false - fun clear(): Unit {} -} - -class S : Set, SetStringImpl() { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: String): Boolean = false - override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection) = false -} - -fun box(): String { - val s = S() as java.util.Set - s.add("") - s.remove("") - s.clear() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt deleted file mode 100644 index f906f817cce..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME - -class A : Set { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun contains(o: W): Boolean = false - override fun iterator(): Iterator = emptySet().iterator() - override fun containsAll(c: Collection): Boolean = c.isEmpty() -} - -fun expectUoe(block: () -> Any) { - try { - block() - throw AssertionError() - } catch (e: UnsupportedOperationException) { - } -} - -fun box(): String { - val a = A() as java.util.Set - - a.iterator() - - expectUoe { a.add(42) } - expectUoe { a.remove(42) } - expectUoe { a.addAll(a) } - expectUoe { a.removeAll(a) } - expectUoe { a.retainAll(a) } - expectUoe { a.clear() } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt deleted file mode 100644 index d7671b38bd2..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyCollection : Collection>> { - override fun iterator() = null!! - override val size: Int get() = null!! - override fun isEmpty(): Boolean = null!! - override fun contains(o: List>): Boolean = null!! - override fun containsAll(c: Collection>>): Boolean = null!! -} - -fun box(): String { - val c = MyCollection() as java.util.Collection>> - try { - c.add(ArrayList()) - return "Fail" - } catch (e: UnsupportedOperationException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialUpperBound.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialUpperBound.kt deleted file mode 100644 index 71c6e0e60b7..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/nonTrivialUpperBound.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class MyIterator : Iterator { - override fun next() = null!! - override fun hasNext() = null!! -} - -fun box(): String { - try { - (MyIterator() as java.util.Iterator).remove() - return "Fail" - } catch (e: UnsupportedOperationException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedIterable.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedIterable.kt deleted file mode 100644 index 460328ffe0f..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedIterable.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -public class Test { - public static void checkCallFromJava() { - try { - String x = TestKt.foo().iterator().next(); - throw new AssertionError("E should have been thrown"); - } catch (E e) { } - } -} - -// FILE: test.kt - -interface MyIterable : Iterable - -class E : RuntimeException() -fun foo(): MyIterable = throw E() - -fun box(): String { - try { - foo().iterator().next() - return "Fail: E should have been thrown" - } catch (e: E) {} - - Test.checkCallFromJava() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt b/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt deleted file mode 100644 index e34741934e7..00000000000 --- a/backend.native/tests/external/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -class Test { - interface A { - boolean add(String s); - } - - static class D extends C {} - - void test() { - A a = new D(); - a.add("lol"); - } -} - -// FILE: test.kt - -abstract class C : Test.A, List { - override val size: Int get() = null!! - override fun isEmpty(): Boolean = null!! - override fun contains(o: String): Boolean = null!! - override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection): Boolean = null!! - override fun get(index: Int): String = null!! - override fun indexOf(o: String): Int = null!! - override fun lastIndexOf(o: String): Int = null!! - override fun listIterator(): ListIterator = null!! - override fun listIterator(index: Int): ListIterator = null!! - override fun subList(fromIndex: Int, toIndex: Int): List = null!! -} - -fun box(): String { - try { - Test().test() - return "Fail" - } catch (e: UnsupportedOperationException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/array.kt b/backend.native/tests/external/codegen/box/callableReference/bound/array.kt deleted file mode 100644 index 2a78bb9cc88..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/array.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A { - var f: String = "OK" -} - -class B : A() { -} - -fun box() : String { - val b = B() - return (b::f).get() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/companionObjectReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/bound/companionObjectReceiver.kt deleted file mode 100644 index ddf856c54da..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/companionObjectReceiver.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - companion object { - fun ok() = "OK" - } -} - -fun box() = (A.Companion::ok)() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/emptyLHS.kt b/backend.native/tests/external/codegen/box/callableReference/bound/emptyLHS.kt deleted file mode 100644 index be2bcc0b918..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/emptyLHS.kt +++ /dev/null @@ -1,57 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -var result = "" - -class A { - fun memberFunction() { result += "A.mf," } - fun aMemberFunction() { result += "A.amf," } - val memberProperty: Int get() = 42.also { result += "A.mp," } - val aMemberProperty: Int get() = 42.also { result += "A.amp," } - - fun test(): String { - (::memberFunction)() - (::aExtensionFunction)() - - (::memberProperty)() - (::aExtensionProperty)() - - return result - } - - inner class B { - fun memberFunction() { result += "B.mf," } - val memberProperty: Int get() = 42.also { result += "B.mp," } - - fun test(): String { - (::aMemberFunction)() - (::aExtensionFunction)() - - (::aMemberProperty)() - (::aExtensionProperty)() - - (::memberFunction)() - (::memberProperty)() - - (::bExtensionFunction)() - (::bExtensionProperty)() - - return result - } - } -} - -fun A.aExtensionFunction() { result += "A.ef," } -val A.aExtensionProperty: Int get() = 42.also { result += "A.ep," } -fun A.B.bExtensionFunction() { result += "B.ef," } -val A.B.bExtensionProperty: Int get() = 42.also { result += "B.ep," } - -fun box(): String { - val a = A().test() - if (a != "A.mf,A.ef,A.mp,A.ep,") return "Fail $a" - - result = "" - val b = A().B().test() - if (b != "A.amf,A.ef,A.amp,A.ep,B.mf,B.mp,B.ef,B.ep,") return "Fail $b" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/enumEntryMember.kt b/backend.native/tests/external/codegen/box/callableReference/bound/enumEntryMember.kt deleted file mode 100644 index ce40fb403cf..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/enumEntryMember.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND: JS -enum class E { - A, B; - - fun foo() = this.name -} - -fun box(): String { - val f = E.A::foo - val ef = E::foo - - if (f() != "A") return "Fail 1: ${f()}" - if (f == E.B::foo) return "Fail 2" - if (ef != E::foo) return "Fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt b/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt deleted file mode 100644 index 15824f1f47e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// See https://youtrack.jetbrains.com/issue/KT-14938 -// WITH_REFLECT - -class A - -val a = A() -val aa = A() - -fun A?.foo() {} - -var A?.bar: Int - get() = 42 - set(value) {} - -val aFoo = a::foo -val A_foo = A::foo -val nullFoo = null::foo - -val aBar = a::bar -val A_bar = A::bar -val nullBar = null::bar - -fun box(): String = - when { - nullFoo != null::foo -> "Bound extension refs with same receiver SHOULD be equal" - nullFoo == aFoo -> "Bound extension refs with different receivers SHOULD NOT be equal" - nullFoo == A_foo -> "Bound extension ref with receiver 'null' SHOULD NOT be equal to free ref" - - nullBar != null::bar -> "Bound extension property refs with same receiver SHOULD be equal" - nullBar == aBar -> "Bound extension property refs with different receivers SHOULD NOT be equal" - nullBar == A_bar -> "Bound extension property ref with receiver 'null' SHOULD NOT be equal to free property ref" - - else -> "OK" - } diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/equals/propertyAccessors.kt b/backend.native/tests/external/codegen/box/callableReference/bound/equals/propertyAccessors.kt deleted file mode 100644 index 17016fd88b0..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/equals/propertyAccessors.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.full.* - -class C { - var prop = 42 -} - -val C_propReflect = C::class.memberProperties.find { it.name == "prop" } as? KMutableProperty1 ?: throw AssertionError() -val C_prop = C::prop -val cProp = C()::prop - -fun box() = - when { - C_prop.getter != C_prop.getter -> "C_prop.getter != C_prop.getter" - C_propReflect.getter != C_propReflect.getter -> "C_propReflect.getter != C_propReflect.getter" - cProp.getter != cProp.getter -> "cProp.getter != cProp.getter" - - cProp.getter == C_prop.getter -> "cProp.getter == C_prop.getter" - C_prop.getter == cProp.getter -> "C_prop.getter == cProp.getter" - cProp.getter == C_propReflect.getter -> "cProp.getter == C_propReflect.getter" - C_propReflect.getter == cProp.getter -> "C_propReflect.getter == cProp.getter" - - // TODO https://youtrack.jetbrains.com/issue/KT-13490 - // cProp.getter != C()::prop.getter -> "cProp.getter != C()::prop.getter" - // cProp.setter != C()::prop.setter -> "cProp.setter != C()::prop.setter" - - else -> "OK" - } diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/equals/receiverInEquals.kt b/backend.native/tests/external/codegen/box/callableReference/bound/equals/receiverInEquals.kt deleted file mode 100644 index fd21eac125b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/equals/receiverInEquals.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -package test - -class A { - fun foo() {} - fun bar() {} -} - -val a = A() -val aa = A() - -val aFoo = a::foo -val aBar = a::bar -val aaFoo = aa::foo -val A_foo = A::foo - -fun box(): String = - when { - aFoo != a::foo -> "Bound refs with same receiver SHOULD be equal" - aFoo == aBar -> "Bound refs to different members SHOULD NOT be equal" - aFoo == aaFoo -> "Bound refs with different receiver SHOULD NOT be equal" - aFoo == A_foo -> "Bound ref SHOULD NOT be equal to free ref" - - else -> "OK" - } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/equals/reflectionReference.kt b/backend.native/tests/external/codegen/box/callableReference/bound/equals/reflectionReference.kt deleted file mode 100644 index b0e6ca50b37..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/equals/reflectionReference.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* - -class C { - fun foo() {} - val bar = 42 -} - -val C_fooReflect = C::class.functions.find { it.name == "foo" }!! -val C_foo = C::foo -val cFoo = C()::foo - -val C_barReflect = C::class.memberProperties.find { it.name == "bar" }!! -val C_bar = C::bar -val cBar= C()::bar - -val Any.className: String - get() = this::class.qualifiedName!! - -fun box(): String = - when { - C_fooReflect != C_foo -> "C_fooReflect != C_foo, ${C_fooReflect.className}" - C_foo != C_fooReflect -> "C_foo != C_fooReflect, ${C_foo.className}" - C_fooReflect == cFoo -> "C_fooReflect == cFoo, ${C_fooReflect.className}" - cFoo == C_fooReflect -> "cFoo == C_fooReflect, ${cFoo.className}" - C_barReflect != C_bar -> "C_barReflect != C_bar, ${C_barReflect.className}" - C_bar != C_barReflect -> "C_bar != C_barReflect, ${C_bar.className}" - C_barReflect == cBar -> "C_barReflect == cBar, ${C_barReflect.className}" - cBar == C_barReflect -> "cBar == C_barReflect, ${cBar.className}" - else -> "OK" - } diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/genericValOnLHS.kt b/backend.native/tests/external/codegen/box/callableReference/bound/genericValOnLHS.kt deleted file mode 100644 index c579cf7d957..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/genericValOnLHS.kt +++ /dev/null @@ -1,13 +0,0 @@ - -class Generic

dispatchResume(data: P, continuation: Continuation

): Boolean { - dispatchResume { - continuation.resume(data) - } - return true - } - - override fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean { - dispatchResume { - continuation.resumeWithException(exception) - } - return true - } - })) - return controller.log -} - -fun box(): String { - var result = test { - val o = suspendWithValue("O") - val k = suspendWithValue("K") - log += "$o$k;" - } - if (result != "before 0;suspend(O);before 1;suspend(K);before 2;OK;after 2;after 1;after 0;") return "fail1: $result" - - result = test { - try { - suspendWithException("OK") - log += "ignore;" - } - catch (e: RuntimeException) { - log += "${e.message};" - } - } - if (result != "before 0;error(OK);before 1;OK;after 1;after 0;") return "fail2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt b/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt deleted file mode 100644 index 24e96520a4f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var result = 0 - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - result++ - x.resume("OK") - COROUTINE_SUSPENDED - } -} - - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - - for (i in 1..3) { - builder { - if (suspendHere() != "OK") throw RuntimeException("fail 1") - } - } - - if (result != 3) return "fail 2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt b/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt deleted file mode 100644 index da69fb244b4..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(v: T): T = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -var result: Any = "" - -fun foo(v: T) { - builder { - val r = suspendHere(v) - suspendHere("") - result = r - } -} - -fun box(): String { - foo("OK") - return result as String -} diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt deleted file mode 100644 index 9fc5f638784..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/breakWithNonEmptyStack.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class A { - var result = mutableListOf("O", "K", null) - suspend fun foo(): String? = suspendCoroutineOrReturn { x -> - x.resume(result.removeAt(0)) - COROUTINE_SUSPENDED - } -} - -var result = "" - -suspend fun append(ignore: String, x: String) { - result += x -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -suspend fun bar() { - val a = A() - while (true) { - append("ignore", a.foo() ?: break) - } -} - -fun box(): String { - builder { - bar() - } - - return result -} - diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt deleted file mode 100644 index 719d2e11738..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -data class A(val o: String) { - operator fun component2(): String = "K" -} -fun builder(c: suspend (A) -> Unit) { - (c as (suspend A.() -> Unit)).startCoroutine(A("O"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - (x, y) -> - result = x + y - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt deleted file mode 100644 index 02c97d81531..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt +++ /dev/null @@ -1,49 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -class A(val w: String) { - suspend fun String.ext(): String = suspendCoroutineOrReturn { - x -> - x.resume(this + w) - COROUTINE_SUSPENDED - } -} - -suspend fun A.coroutinebug(v: String?): String { - val r = v?.ext() - if (r == null) return "null" - return r -} - -suspend fun A.coroutinebug2(v: String?): String { - val r = v?.ext() ?: "null" - return r -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "fail 2" - - builder { - val a = A("K") - val x1 = a.coroutinebug(null) - if (x1 != "null") throw RuntimeException("fail 1: $x1") - - val x2 = a.coroutinebug(null) - if (x2 != "null") throw RuntimeException("fail 2: $x2") - - val x3 = a.coroutinebug2(null) - if (x3 != "null") throw RuntimeException("fail 3: $x3") - - result = a.coroutinebug2("O") - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt deleted file mode 100644 index 2e50e1f256a..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt +++ /dev/null @@ -1,52 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -class A(val w: String) { - suspend fun Long.ext(): String = suspendCoroutineOrReturn { - x -> - x.resume(this.toString() + w) - COROUTINE_SUSPENDED - } -} - -suspend fun A.coroutinebug(v: Long?): String { - val r = v?.ext() - if (r == null) return "null" - return r -} - -suspend fun A.coroutinebug2(v: Long?): String { - val r = v?.ext() ?: "null" - return r -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "fail 2" - - builder { - val a = A("#test") - val x1 = a.coroutinebug(null) - if (x1 != "null") throw RuntimeException("fail 1: $x1") - - val x2 = a.coroutinebug(123456789012345) - if (x2 != "123456789012345#test") throw RuntimeException("fail 2: $x2") - - val x3 = a.coroutinebug2(null) - if (x3 != "null") throw RuntimeException("fail 3: $x3") - - val x4 = a.coroutinebug2(123456789012345) - if (x4 != "123456789012345#test") throw RuntimeException("fail 4: $x4") - - result = "OK" - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt deleted file mode 100644 index 9cea4eda0fe..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -data class A(val o: String) { - operator suspend fun component2(): String = suspendCoroutineOrReturn { x -> - x.resume("K") - COROUTINE_SUSPENDED - } -} -fun builder(c: suspend (A) -> Unit) { - (c as (suspend A.() -> Unit)).startCoroutine(A("O"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - (x, y) -> - result = x + y - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt deleted file mode 100644 index fcc0cf8bf29..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -suspend fun ArrayList.yield(v: Int): Unit = suspendCoroutineOrReturn { x -> - this.add(v) - x.resume(Unit) - COROUTINE_SUSPENDED -} - -tailrec suspend fun ArrayList.fromTo(from: Int, to: Int) { - if (from > to) return - yield(from) - return fromTo(from + 1, to) -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - val result = arrayListOf() - - builder { - result.fromTo(1, 5) - } - - assertEquals(listOf(1, 2, 3, 4, 5), result) - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/coroutines/generate.kt b/backend.native/tests/external/codegen/box/coroutines/generate.kt deleted file mode 100644 index 9d769af94b0..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/generate.kt +++ /dev/null @@ -1,63 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// FULL_JDK -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun box(): String { - val x = gen().joinToString() - if (x != "1, 2") return "fail1: $x" - - val y = gen().joinToString() - if (y != "-1") return "fail2: $y" - return "OK" -} - -var was = false - -fun gen() = generate { - if (was) { - yield(-1) - return@generate - } - for (i in 1..2) { - yield(i) - } - was = true -} - -// LIBRARY CODE -interface Generator { - suspend fun yield(value: T) -} - -fun generate(block: suspend Generator.() -> Unit): Sequence = GeneratedSequence(block) - -class GeneratedSequence(private val block: suspend Generator.() -> Unit) : Sequence { - override fun iterator(): Iterator = GeneratedIterator(block) -} - -class GeneratedIterator(block: suspend Generator.() -> Unit) : AbstractIterator(), Generator { - private var nextStep: Continuation = block.createCoroutine(this, object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(data: Unit) { - done() - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) - - override fun computeNext() { - nextStep.resume(Unit) - } - suspend override fun yield(value: T) = suspendCoroutineOrReturn { c -> - setNext(value) - nextStep = c - - COROUTINE_SUSPENDED - } -} diff --git a/backend.native/tests/external/codegen/box/coroutines/handleException.kt b/backend.native/tests/external/codegen/box/coroutines/handleException.kt deleted file mode 100644 index 8e26112b72e..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/handleException.kt +++ /dev/null @@ -1,82 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var exception: Throwable? = null - val postponedActions = ArrayList<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> Unit) { - c.startCoroutine(this, handleExceptionContinuation { - exception = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller = Controller() - controller.run(c) - - if (controller.exception?.message != "OK") { - throw RuntimeException("Unexpected result: ${controller.exception?.message}") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -fun box(): String { - builder { - throw RuntimeException("OK") - } - - builder { - commonThrow(RuntimeException("OK")) - } - - builder { - suspendWithException(RuntimeException("OK")) - } - - builder { - try { - suspendWithException(RuntimeException("fail 1")) - } catch (e: RuntimeException) { - suspendWithException(RuntimeException("OK")) - } - } - - builder { - try { - suspendWithException(Exception("OK")) - } catch (e: RuntimeException) { - suspendWithException(RuntimeException("fail 3")) - throw RuntimeException("fail 4") - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt deleted file mode 100644 index d76960c8fb3..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -fun builder(c: suspend () -> Unit): String { - var ok = false - c.startCoroutine(handleResultContinuation { - ok = true - }) - if (!ok) throw RuntimeException("Was not called") - return "OK" -} - -fun unitFun() {} - -fun box(): String { - return builder {} -} diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt deleted file mode 100644 index 29d1a5916f5..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - var isCompleted = false - c.startCoroutine(handleResultContinuation { - isCompleted = true - }) - if (!isCompleted) throw RuntimeException("fail") -} - -fun box(): String { - builder { - "OK" - } - - builder { - suspendHere() - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt deleted file mode 100644 index 194707f6e99..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var log = "" - - suspend fun suspendAndLog(value: T): T = suspendCoroutineOrReturn { x -> - log += "suspend($value);" - x.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> String): String { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.log += "return($it);" - }) - return controller.log -} - -fun box(): String { - val result = builder { suspendAndLog("OK") } - - if (result != "suspend(OK);return(OK);") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/illegalState.kt b/backend.native/tests/external/codegen/box/coroutines/illegalState.kt deleted file mode 100644 index e05d0d5aeb3..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/illegalState.kt +++ /dev/null @@ -1,70 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// TARGET_BACKEND: JVM -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED -} - -fun builder1(c: suspend () -> Unit) { - (c as Continuation).resume(Unit) -} - -fun builder2(c: suspend () -> Unit) { - val continuation = c.createCoroutine(EmptyContinuation) - - val delegateField = continuation.javaClass.getDeclaredField("delegate") - delegateField.setAccessible(true) - val originalContinuation = delegateField.get(continuation) - - val declaredField = originalContinuation.javaClass.superclass.getDeclaredField("label") - declaredField.setAccessible(true) - declaredField.set(originalContinuation, -3) - continuation.resume(Unit) -} - -fun box(): String { - - try { - builder1 { - suspendHere() - } - return "fail 1" - } catch (e: kotlin.KotlinNullPointerException) { - } - - try { - builder2 { - suspendHere() - } - return "fail 3" - } catch (e: java.lang.IllegalStateException) { - if (e.message != "call to 'resume' before 'invoke' with coroutine") return "fail 4: ${e.message!!}" - } - - var result = "OK" - - try { - builder1 { - result = "fail 5" - } - return "fail 6" - } catch (e: kotlin.KotlinNullPointerException) { - } - - try { - builder2 { - result = "fail 8" - } - return "fail 9" - } catch (e: java.lang.IllegalStateException) { - if (e.message != "call to 'resume' before 'invoke' with coroutine") return "fail 10: ${e.message!!}" - return result - } - - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/inlineFunInGenericClass.kt b/backend.native/tests/external/codegen/box/coroutines/inlineFunInGenericClass.kt deleted file mode 100644 index 4eee3b4e2ac..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/inlineFunInGenericClass.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: Any?): String = suspendCoroutineOrReturn { x -> - x.resume(v?.toString() ?: "") - COROUTINE_SUSPENDED -} - - -class A(val arg: T) { - var result = "" - inline suspend fun foo() { - result = suspendThere(arg) - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - val a = A("OK") - builder { - a.foo() - } - - return a.result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt b/backend.native/tests/external/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt deleted file mode 100644 index e8ebf741eef..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/inlineGenericFunCalledFromSubclass.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// WITH_REFLECT -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun foo(x: suspend () -> String): String = x() - -abstract class A { - inline suspend fun baz(): String { - return foo { - suspendThere(T::class.simpleName!!) - } - } - -} -class B : A() { - suspend fun bar(): String { - return baz() - } -} -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} -class OK -fun box(): String { - var result = "fail" - builder { - result = B().bar() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt deleted file mode 100644 index 0ad4d2d31ea..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt +++ /dev/null @@ -1,46 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// WITH_REFLECT -// CHECK_NOT_CALLED: suspendInline_61zpoe$ -// CHECK_NOT_CALLED: suspendInline_6r51u9$ -// CHECK_NOT_CALLED: suspendInline -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - fun withValue(v: String, x: Continuation) { - x.resume(v) - } - - suspend inline fun suspendInline(v: String): String = suspendCoroutineOrReturn { x -> - withValue(v, x) - COROUTINE_SUSPENDED - } - - suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b()) - - suspend inline fun suspendInline(): String = suspendInline({ T::class.simpleName!! }) -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -class OK - -fun box(): String { - var result = "" - - builder { - result = suspendInline("56") - if (result != "56") throw RuntimeException("fail 1") - - result = suspendInline { "57" } - if (result != "57") throw RuntimeException("fail 2") - - result = suspendInline() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt b/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt deleted file mode 100644 index 1417a30a017..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt +++ /dev/null @@ -1,162 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -var wasCalled = false -class Controller { - val postponedActions = mutableListOf<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> String) { - c.startCoroutine(this, handleResultContinuation { - globalResult = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { - val controller = Controller() - - globalResult = "#" - wasCalled = false - if (!expectException) { - controller.run(c) - } - else { - try { - controller.run(c) - globalResult = "fail: exception was not thrown" - } catch (e: Exception) { - globalResult = e.message!! - } - } - - if (!wasCalled) { - throw RuntimeException("fail wasCalled") - } - - if (globalResult != "OK") { - throw RuntimeException("fail $globalResult") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -inline fun tryCatch(t: () -> String, onException: (Exception) -> String) = - try { - t() - } catch (e: RuntimeException) { - onException(e) - } - -inline fun tryCatchFinally(t: () -> String, onException: (Exception) -> String, f: () -> Unit) = - try { - t() - } catch (e: RuntimeException) { - onException(e) - } finally { - f() - } - -fun box(): String { - builder { - tryCatch( - { - suspendWithValue("") - wasCalled = true - suspendWithValue("OK") - }, - { e -> - suspendWithValue("fail 1") - } - ) - } - - builder { - tryCatch( - { - suspendWithException(RuntimeException("M")) - }, - { e -> - if (e.message != "M") throw RuntimeException("fail 2") - wasCalled = true - suspendWithValue("OK") - } - ) - } - - builder { - tryCatchFinally( - { - suspendWithValue("") - wasCalled = true - suspendWithValue("OK") - }, - { - suspendWithValue("fail 1") - }, - { - suspendWithValue("ignored 1") - wasCalled = true - } - ) - } - - builder { - tryCatchFinally( - { - suspendWithException(RuntimeException("M")) - }, - { e -> - if (e.message != "M") throw RuntimeException("fail 2") - suspendWithValue("OK") - }, - { - suspendWithValue("ignored 2") - wasCalled = true - } - ) - } - - builder { - tryCatchFinally( - { - if (suspendWithValue("56") == "56") return@tryCatchFinally "OK" - suspendWithValue("fail 4") - }, - { - suspendWithValue("fail 5") - }, - { - suspendWithValue("ignored 3") - wasCalled = true - } - ) - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt b/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt deleted file mode 100644 index 9a15bcf4111..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt +++ /dev/null @@ -1,42 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var i = 0 - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume((i++).toString()) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result += "-" - result += suspendHere() - - if (result == "-0") { - builder { - result += "+" - result += suspendHere() - result += suspendHere() - result += "#" - } - - result += suspendHere() - result += "&" - } - } - - if (result != "-0+01#1&") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt b/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt deleted file mode 100644 index b90fe0385c8..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// WITH_REFLECT -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun runInstanceOf(): Boolean = suspendCoroutineOrReturn { x -> - val y: Any = x - x.resume(x is Continuation<*>) - COROUTINE_SUSPENDED - } - - suspend fun runCast(): Boolean = suspendCoroutineOrReturn { x -> - val y: Any = x - x.resume(Continuation::class.isInstance(y as Continuation<*>)) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = runInstanceOf().toString() + "," + runCast().toString() - } - - if (result != "true,true") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt deleted file mode 100644 index daf63a1d47b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun foo() = true - -private var booleanResult = false -fun setBooleanRes(x: Boolean) { - booleanResult = x -} - -fun box(): String { - builder { - val x = true - val y = false - suspendHere() - setBooleanRes(if (foo()) x else y) - } - - if (!booleanResult) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt deleted file mode 100644 index d991a7cc85b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var byteResult: Byte = 0 -fun setByteRes(x: Byte) { - byteResult = x -} - -fun foo(): Int = 1 - -fun box(): String { - builder { - val x: Byte = foo().toByte() - suspendHere() - setByteRes(x) - } - - if (byteResult != 1.toByte()) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt deleted file mode 100644 index 4aceec9ce80..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var booleanResult = false -fun setBooleanRes(x: Boolean) { - booleanResult = x -} - -fun box(): String { - builder { - val a = booleanArrayOf(true) - val x = a[0] - suspendHere() - setBooleanRes(x) - } - - if (!booleanResult) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt deleted file mode 100644 index 242c5c0ec2a..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var byteResult: Byte = 0 -fun setByteRes(x: Byte) { - byteResult = x -} - -fun box(): String { - builder { - val a = byteArrayOf(1) - val x = a[0] - suspendHere() - setByteRes(x) - } - - if (byteResult != 1.toByte()) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt deleted file mode 100644 index 3f614fd8f35..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var booleanResult = false -fun setBooleanRes(x: Boolean, ignored: Unit) { - booleanResult = x -} - -fun box(): String { - builder { - // 'true' value is spilled into variable and saved to field before suspension point - // It's important that there is no type info about this variable in local var table, - // so we should infer that ICONST_1 is a boolean value from it's usage - setBooleanRes(true, suspendHere()) - } - - if (!booleanResult) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt deleted file mode 100644 index 8d879ef9b93..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var result: String = "" -fun setRes(x: Byte, y: Int) { - result = "$x#$y" -} - -fun foo(): Int = 1 - -fun box(): String { - builder { - val x: Byte = 1 - // No actual cast happens here - val y: Int = x.toInt() - suspendHere() - setRes(x, y) - } - - if (result != "1#1") return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt deleted file mode 100644 index e93b94f13e7..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt +++ /dev/null @@ -1,81 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// TARGET_BACKEND: JVM -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -@JvmField -var booleanResult = booleanArrayOf() -@JvmField -var charResult = charArrayOf() -@JvmField -var byteResult = byteArrayOf() -@JvmField -var shortResult = shortArrayOf() -@JvmField -var intResult = intArrayOf() - -fun box(): String { - builder { - val x = true - suspendHere() - val a = BooleanArray(1) - a[0] = x - booleanResult = a - } - - if (!booleanResult[0]) return "fail 1" - - builder { - val x = '1' - suspendHere() - val a = CharArray(1) - a[0] = x - charResult = a - } - - if (charResult[0] != '1') return "fail 2" - - builder { - val x: Byte = 1 - suspendHere() - val a = ByteArray(1) - a[0] = x - byteResult = a - } - - if (byteResult[0] != 1.toByte()) return "fail 3" - - builder { - val x: Short = 1 - suspendHere() - val a = ShortArray(1) - a[0] = x - shortResult = a - } - - if (shortResult[0] != 1.toShort()) return "fail 4" - - builder { - val x: Int = 1 - suspendHere() - val a = IntArray(1) - a[0] = x - intResult = a - } - - if (intResult[0] != 1) return "fail 5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt deleted file mode 100644 index fbea445b8fa..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt +++ /dev/null @@ -1,84 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -private var booleanResult = false -fun setBooleanRes(x: Boolean) { - booleanResult = x -} - -private var charResult: Char = '0' -fun setCharRes(x: Char) { - charResult = x -} - -private var byteResult: Byte = 0 -fun setByteRes(x: Byte) { - byteResult = x -} - -private var shortResult: Short = 0 -fun setShortRes(x: Short) { - shortResult = x -} - -private var intResult: Int = 0 -fun setIntRes(x: Int) { - intResult = x -} - -fun box(): String { - builder { - val x = true - suspendHere() - setBooleanRes(x) - } - - if (!booleanResult) return "fail 1" - - builder { - val x = '1' - suspendHere() - setCharRes(x) - } - - if (charResult != '1') return "fail 2" - - builder { - val x: Byte = 1 - suspendHere() - setByteRes(x) - } - - if (byteResult != 1.toByte()) return "fail 3" - - builder { - val x: Short = 1 - suspendHere() - setShortRes(x) - } - - if (shortResult != 1.toShort()) return "fail 4" - - builder { - val x: Int = 1 - suspendHere() - setIntRes(x) - } - - if (intResult != 1) return "fail 5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt deleted file mode 100644 index 404f95df912..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt +++ /dev/null @@ -1,71 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// TARGET_BACKEND: JVM -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -@JvmField -var booleanResult = false -@JvmField -var charResult: Char = '0' -@JvmField -var byteResult: Byte = 0 -@JvmField -var shortResult: Short = 0 -@JvmField -var intResult: Int = 0 - -fun box(): String { - builder { - val x = true - suspendHere() - booleanResult = x - } - - if (!booleanResult) return "fail 1" - - builder { - val x = '1' - suspendHere() - charResult = x - } - - if (charResult != '1') return "fail 2" - - builder { - val x: Byte = 1 - suspendHere() - byteResult = x - } - - if (byteResult != 1.toByte()) return "fail 3" - - builder { - val x: Short = 1 - suspendHere() - shortResult = x - } - - if (shortResult != 1.toShort()) return "fail 4" - - builder { - val x: Int = 1 - suspendHere() - intResult = x - } - - if (intResult != 1) return "fail 5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt deleted file mode 100644 index 4afdab1b92f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt +++ /dev/null @@ -1,60 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - builder { - val x = true - suspendHere() - val y: Boolean = x - if (!y) throw IllegalStateException("fail 1") - } - - builder { - val x = '1' - suspendHere() - - val y: Char = x - if (y != '1') throw IllegalStateException("fail 2") - } - - builder { - val x: Byte = 1 - suspendHere() - - val y: Byte = x - if (y != 1.toByte()) throw IllegalStateException("fail 3") - } - - builder { - val x: Short = 1 - - suspendHere() - - val y: Short = x - if (y != 1.toShort()) throw IllegalStateException("fail 4") - } - - builder { - val x: Int = 1 - suspendHere() - - val y: Int = x - if (y != 1) throw IllegalStateException("fail 5") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt deleted file mode 100644 index ea431a3697c..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt +++ /dev/null @@ -1,45 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -suspend fun suspendWithException(): String = suspendCoroutineOrReturn { x -> - x.resumeWithException(RuntimeException("OK")) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> String): String { - var fromSuspension: String? = null - - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resumeWithException(exception: Throwable) { - fromSuspension = "Exception: " + exception.message!! - } - - override fun resume(value: String) { - fromSuspension = value - } - }) - - return fromSuspension as String -} - -fun box(): String { - if (builder { "OK" } != "OK") return "fail 4" - if (builder { suspendHere() } != "OK") return "fail 5" - - if (builder { throw RuntimeException("OK") } != "Exception: OK") return "fail 6" - if (builder { suspendWithException() } != "Exception: OK") return "fail 7" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt deleted file mode 100644 index 5f91a55d81f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt +++ /dev/null @@ -1,56 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -suspend fun suspendWithException(): String = suspendCoroutineOrReturn { x -> - x.resumeWithException(RuntimeException("OK")) - COROUTINE_SUSPENDED -} - -fun builder(shouldSuspend: Boolean, c: suspend () -> String): String { - var fromSuspension: String? = null - - val result = try { - c.startCoroutineUninterceptedOrReturn(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resumeWithException(exception: Throwable) { - fromSuspension = "Exception: " + exception.message!! - } - - override fun resume(value: String) { - fromSuspension = value - } - }) - } catch (e: Exception) { - "Exception: ${e.message}" - } - - if (shouldSuspend) { - if (result !== COROUTINE_SUSPENDED) throw RuntimeException("fail 1") - if (fromSuspension == null) throw RuntimeException("fail 2") - return fromSuspension!! - } - - if (result === COROUTINE_SUSPENDED) throw RuntimeException("fail 3") - return result as String -} - -fun box(): String { - if (builder(false) { "OK" } != "OK") return "fail 4" - if (builder(true) { suspendHere() } != "OK") return "fail 5" - - if (builder(false) { throw RuntimeException("OK") } != "Exception: OK") return "fail 6" - if (builder(true) { suspendWithException() } != "Exception: OK") return "fail 7" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt deleted file mode 100644 index 680af4e20cf..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt +++ /dev/null @@ -1,80 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.test.assertEquals - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -suspend fun suspendWithException(): String = suspendCoroutineOrReturn { x -> - x.resumeWithException(RuntimeException("OK")) - COROUTINE_SUSPENDED -} - -fun builder(shouldSuspend: Boolean, expectedCount: Int, c: suspend () -> String): String { - var fromSuspension: String? = null - var counter = 0 - - val result = try { - c.startCoroutineUninterceptedOrReturn(object: Continuation { - override val context: CoroutineContext - get() = ContinuationDispatcher { counter++ } - - override fun resumeWithException(exception: Throwable) { - fromSuspension = "Exception: " + exception.message!! - } - - override fun resume(value: String) { - fromSuspension = value - } - }) - } catch (e: Exception) { - "Exception: ${e.message}" - } - - if (counter != expectedCount) throw RuntimeException("fail 0") - - if (shouldSuspend) { - if (result !== COROUTINE_SUSPENDED) throw RuntimeException("fail 1") - if (fromSuspension == null) throw RuntimeException("fail 2") - return fromSuspension!! - } - - if (result === COROUTINE_SUSPENDED) throw RuntimeException("fail 3") - return result as String -} - -class ContinuationDispatcher(val dispatcher: () -> Unit) : AbstractCoroutineContextElement(ContinuationInterceptor), ContinuationInterceptor { - override fun interceptContinuation(continuation: Continuation): Continuation = DispatchedContinuation(dispatcher, continuation) -} - -private class DispatchedContinuation( - val dispatcher: () -> Unit, - val continuation: Continuation -): Continuation { - override val context: CoroutineContext = continuation.context - - override fun resume(value: T) { - dispatcher() - continuation.resume(value) - } - - override fun resumeWithException(exception: Throwable) { - dispatcher() - continuation.resumeWithException(exception) - } -} - -fun box(): String { - if (builder(false, 0) { "OK" } != "OK") return "fail 4" - if (builder(true, 1) { suspendHere() } != "OK") return "fail 5" - - if (builder(false, 0) { throw RuntimeException("OK") } != "Exception: OK") return "fail 6" - if (builder(true, 1) { suspendWithException() } != "Exception: OK") return "fail 7" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt b/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt deleted file mode 100644 index 837df4220be..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - val a = arrayOfNulls(2) as Array - a[0] = "O" - a[1] = "K" - var result = "" - - builder { - for (s in a) { - // 's' variable must be spilled before suspension point - // And it's important that it should be treated as a String instance because of 'result += s' after - // But BasicInterpreter just ignores type of argument array for AALOAD opcode (treating it's return type as plain Object), - // so we should refine the relevant part in our intepreter - if (suspendHere() != "OK") throw RuntimeException("fail 1") - result += s - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/kt12958.kt b/backend.native/tests/external/codegen/box/coroutines/kt12958.kt deleted file mode 100644 index 898aa866d02..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/kt12958.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// WITH_CONTINUATION -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(v: V): V = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> String): String { - var result = "fail" - c.startCoroutine(handleResultContinuation { - result = it - }) - - return result -} - -fun foo(): String = builder { - // A piece of code for next statement: - // INVOKEVIRTUAL suspendHere - // CHECKCAST [B - // - // Analyzer uses `newValue` method for estimation of type generated by CHECKCAST insn, - // but for arrays `newValue` returned just Basic.REFERENCE_VALUE, thus we didn't add necessary checkcasts - // for variables spilled into fields - val data2 = suspendHere(ByteArray(2)) - - suspendHere("") - data2.size.toString() -} - -fun box(): String { - if (foo() != "2") return "fail 1" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/kt15016.kt b/backend.native/tests/external/codegen/box/coroutines/kt15016.kt deleted file mode 100644 index b57740e55e7..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/kt15016.kt +++ /dev/null @@ -1,48 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* - -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED -import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn -import kotlin.coroutines.experimental.startCoroutine - -class Bar(val x: Any) -inline fun Any.map(transform: (Any) -> Any) { - when (this) { - is Foo -> Bar(transform(value)) - } -} - -class Foo(val value: Any) { - companion object { - inline fun of(f: () -> Unit): Any = try { - Foo(f()) - } catch(ex: Exception) { - Foo(Unit) - } - } -} - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - Foo.of { - - }.map { - result = suspendHere() - Unit - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/kt15017.kt b/backend.native/tests/external/codegen/box/coroutines/kt15017.kt deleted file mode 100644 index 8833e3c0d33..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/kt15017.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.startCoroutine - -class Controller { - suspend inline fun suspendInlineThrow(v: String): String = throw RuntimeException(v) - suspend inline fun suspendInline(v: String) = v -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -class OK - -fun box(): String { - var result = "" - - builder { - result = try { suspendInlineThrow("OK") } catch (e: RuntimeException) { e.message!! } -// result = suspendInline("OK") - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt b/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt deleted file mode 100644 index 0040d7d273d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt +++ /dev/null @@ -1,56 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var result = "" - var ok = false - suspend fun suspendHere(v: String): Unit = suspendCoroutineOrReturn { x -> - result += v - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.ok = true - }) - if (!controller.ok) throw RuntimeException("Fail ok") - return controller.result -} - -fun box(): String { - val r1 = builder { - for (i in 5..6) { - suspendHere(i.toString()) - } - } - - if (r1 != "56") return "fail 1: $r1" - - val r2 = builder { - var i = 7 - while (i <= 8) { - suspendHere(i.toString()) - i++ - } - } - - if (r2 != "78") return "fail 2: $r2" - - val r3 = builder { - var i = 9 - do { - suspendHere(i.toString()) - i++ - } while (i <= 10); - } - - if (r3 != "910") return "fail 3: $r3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt b/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt deleted file mode 100644 index 01b91ba8a30..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt +++ /dev/null @@ -1,45 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - var wasHandleResultCalled = false - c.startCoroutine(handleResultContinuation { - wasHandleResultCalled = true - }) - - if (!wasHandleResultCalled) throw RuntimeException("fail 1") -} - -fun box(): String { - var result = 0 - - builder { - result++ - - if (suspendHere() != "OK") throw RuntimeException("fail 2") - - result-- - } - - if (result != 0) return "fail 3" - - builder { - --result - - if (suspendHere() != "OK") throw RuntimeException("fail 4") - - ++result - } - - if (result != 0) return "fail 5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt b/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt deleted file mode 100644 index 47bf76f5fa4..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt +++ /dev/null @@ -1,47 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - var wasHandleResultCalled = false - c.startCoroutine(handleResultContinuation { - wasHandleResultCalled = true - }) - - if (!wasHandleResultCalled) throw RuntimeException("fail 1") -} - -var varWithCustomSetter: String = "" - set(value) { - if (field != "") throw RuntimeException("fail 2") - field = value - } - -fun box(): String { - var result = "" - - builder { - result += "O" - - if (suspendHere() != "OK") throw RuntimeException("fail 3") - - result += "K" - } - - if (result != "OK") return "fail 4" - - builder { - if (suspendHere() != "OK") throw RuntimeException("fail 5") - - varWithCustomSetter = "OK" - } - - return varWithCustomSetter -} diff --git a/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt b/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt deleted file mode 100644 index d4ebf0b9400..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var ok = false - var v = "fail" - suspend fun suspendHere(v: String): Unit = suspendCoroutineOrReturn { x -> - this.v = v - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.ok = true - }) - if (!controller.ok) throw RuntimeException("Fail 1") - return controller.v -} - -fun box(): String { - - return builder { - suspendHere("OK") - } -} diff --git a/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt b/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt deleted file mode 100644 index a1e04353a0b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendWithValue(result: () -> String): String = suspendCoroutineOrReturn { x -> - x.resume(result()) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - fun ok() = "OK" - result = suspendWithValue(::ok) - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt b/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt deleted file mode 100644 index c2147c44556..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt +++ /dev/null @@ -1,30 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED -import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn - -class OkDelegate { - operator fun getValue(receiver: Any?, property: Any?): String = "OK" -} - -suspend fun suspendWithValue(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED -} - -fun launch(c: suspend () -> String): String { - var result: String = "fail: result not assigned" - c.startCoroutine(handleResultContinuation { value -> - result = value - }) - return result -} - -fun box(): String { - return launch { - val ok by OkDelegate() - ok - } -} diff --git a/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendCall.kt b/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendCall.kt deleted file mode 100644 index 48a506eb0a2..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendCall.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun getLong(): Long = suspendCoroutineOrReturn { x -> - x.resume(1234567890123L) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(r: LongRange): Long = suspendCoroutineOrReturn { x -> - x.resume(r.start + r.endInclusive) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = 0L - - builder { - result = suspendHere(1L..getLong()) - } - - if (result != 1234567890124L) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendFun.kt b/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendFun.kt deleted file mode 100644 index 6570d321cb9..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/longRangeInSuspendFun.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(r: LongRange): Long = suspendCoroutineOrReturn { x -> - x.resume(r.start + r.endInclusive) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = 0L - - builder { - result = suspendHere(1L..1234567890123L) - } - - if (result != 1234567890124L) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt b/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt deleted file mode 100644 index 56eef56af1d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -var res = "" - -suspend fun foo(y: A?): String { - val origin: String? = y?.z - if (origin != null) { - baz(origin) - baz(origin) - } - - return res -} - -suspend fun baz(y: String): Unit = suspendCoroutineOrReturn { x -> - res += y[res.length] - x.resume(Unit) - COROUTINE_SUSPENDED -} - -class A(val z: String) - -fun box(): String { - var result = "" - - builder { - result = foo(A("OK")) - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt deleted file mode 100644 index 3675315f0ca..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt +++ /dev/null @@ -1,33 +0,0 @@ -// MODULE: lib -// FILE: lib.kt -inline fun foo(x: String = "OK"): String { - return x + x -} - -// MODULE: main(lib, support) -// FILE: main.kt -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var result = "" - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - override fun resume(value: Unit) { - } - override fun resumeWithException(exception: Throwable) { - } - }) -} - -fun box(): String { - builder { - result = foo() - } - if (result != "OKOK") return "fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModule.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModule.kt deleted file mode 100644 index 07c92a70254..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModule.kt +++ /dev/null @@ -1,68 +0,0 @@ -// WITH_COROUTINES -// WITH_RUNTIME - -// MODULE: lib(support) -// FILE: lib.kt - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var continuation: () -> Unit = { } -var log = "" -var finished = false - -suspend fun foo(v: T): T = suspendCoroutineOrReturn { x -> - continuation = { - x.resume(v) - } - log += "foo($v);" - COROUTINE_SUSPENDED -} - -inline suspend fun bar(v: String) { - log += "before bar($v);" - foo("1:$v") - log += "inside bar($v);" - foo("2:$v") - log += "after bar($v);" -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(handleResultContinuation { - continuation = { } - finished = true - }) -} - -// MODULE: main(lib) -// FILE: main.kt - -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun baz() { - bar("A") - log += "between bar;" - bar("B") -} - -val expectedString = - "before bar(A);foo(1:A);@;inside bar(A);foo(2:A);@;after bar(A);" + - "between bar;" + - "before bar(B);foo(1:B);@;inside bar(B);foo(2:B);@;after bar(B);" - -fun box(): String { - builder { - baz() - } - - while (!finished) { - log += "@;" - continuation() - } - - if (log != expectedString) return "fail: $log" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt deleted file mode 100644 index a5abc7f09a3..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleOverride.kt +++ /dev/null @@ -1,79 +0,0 @@ -// IGNORE_BACKEND: JVM -// WITH_COROUTINES -// WITH_RUNTIME - -// MODULE: lib(support) -// FILE: lib.kt - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var continuation: () -> Unit = { } -var log = "" -var finished = false - -suspend fun foo(v: T): T = suspendCoroutineOrReturn { x -> - continuation = { - x.resume(v) - } - log += "foo($v);" - COROUTINE_SUSPENDED -} - -interface I { - suspend fun bar() -} - -class A(val v: String) : I { - override inline suspend fun bar() { - log += "before bar($v);" - foo("1:$v") - log += "inside bar($v);" - foo("2:$v") - log += "after bar($v);" - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(handleResultContinuation { - continuation = { } - finished = true - }) -} - -// MODULE: main(lib) -// FILE: main.kt - -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun baz() { - val a = A("A") - a.bar() - - log += "between bar;" - - val b: I = A("B") - b.bar() -} - -val expectedString = - "before bar(A);foo(1:A);@;inside bar(A);foo(2:A);@;after bar(A);" + - "between bar;" + - "before bar(B);foo(1:B);@;inside bar(B);foo(2:B);@;after bar(B);" - -fun box(): String { - builder { - baz() - } - - while (!finished) { - log += "@;" - continuation() - } - - if (log != expectedString) return "fail: $log" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt deleted file mode 100644 index 4052708cca0..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineMultiModuleWithController.kt +++ /dev/null @@ -1,76 +0,0 @@ -// WITH_COROUTINES -// WITH_RUNTIME - -// MODULE: lib(support) -// FILE: lib.kt - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var continuation: () -> Unit = { } -var log = "" -var finished = false - -class C { - var v: String = "" - - inline suspend fun bar() { - log += "before bar($v);" - foo("1:$v") - log += "inside bar($v);" - foo("2:$v") - log += "after bar($v);" - } -} - -suspend fun foo(v: T): T = suspendCoroutineOrReturn { x -> - continuation = { - x.resume(v) - } - log += "foo($v);" - COROUTINE_SUSPENDED -} - -fun C.builder(c: suspend C.() -> Unit) { - c.startCoroutine(this, handleResultContinuation { - continuation = { } - finished = true - }) -} - -// MODULE: main(lib) -// FILE: main.kt - -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun C.baz() { - v = "A" - bar() - log += "between bar;" - v = "B" - bar() -} - -val expectedString = - "before bar(A);foo(1:A);@;inside bar(A);foo(2:A);@;after bar(A);" + - "between bar;" + - "before bar(B);foo(1:B);@;inside bar(B);foo(2:B);@;after bar(B);" - -fun box(): String { - var c = C() - - c.builder { - baz() - } - - while (!finished) { - log += "@;" - continuation() - } - - if (log != expectedString) return "fail: $log" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt deleted file mode 100644 index a495e263bf0..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// MODULE: controller(support) -// FILE: controller.kt -package lib -import helpers.* - -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -// MODULE: main(controller, support) -// FILE: main.kt -import lib.* -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt deleted file mode 100644 index 236984b79b8..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt +++ /dev/null @@ -1,103 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var lastSuspension: Continuation? = null - var result = "fail" - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - lastSuspension = x - COROUTINE_SUSPENDED - } - - fun hasNext() = lastSuspension != null - fun next() { - val x = lastSuspension!! - lastSuspension = null - x.resume("56") - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller1 = Controller() - val controller2 = Controller() - - c.startCoroutine(controller1, EmptyContinuation) - c.startCoroutine(controller2, EmptyContinuation) - - runControllers(controller1, controller2) -} - -// TODO: additional parameters are not supported yet -//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { -// val controller1 = Controller() -// val controller2 = Controller() -// -// c(controller1, 1234567890123456789L, "Q").resume(Unit) -// c(controller2, 1234567890123456789L, "Q").resume(Unit) -// -// runControllers(controller1, controller2) -//} - -private fun runControllers(controller1: Controller, controller2: Controller) { - while (controller1.hasNext()) { - if (!controller2.hasNext()) throw RuntimeException("fail 1") - - if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") - - controller1.next() - controller2.next() - } - - if (controller2.hasNext()) throw RuntimeException("fail 2") - - if (controller1.result != "OK") throw RuntimeException("fail 3") - if (controller2.result != "OK") throw RuntimeException("fail 4") -} - -fun box(): String { - // no suspension - builder { - result = "OK" - } - - // 1 suspension - builder { - if (suspendHere() != "56") return@builder - result = "OK" - } - - // 2 suspensions - builder { - if (suspendHere() != "56") return@builder - suspendHere() - result = "OK" - } - - // with capture - - var x = "O" - var y = "K" - - // no suspension - builder { - result = x + y - } - - // 1 suspension - builder { - if (suspendHere() != "56") return@builder - result = x + y - } - - // 2 suspensions - builder { - if (suspendHere() != "56") return@builder - suspendHere() - result = x + y - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt deleted file mode 100644 index 328d8a86bc8..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt +++ /dev/null @@ -1,92 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var lastSuspension: Continuation? = null - var result = "fail" - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - lastSuspension = x - COROUTINE_SUSPENDED - } - - fun hasNext() = lastSuspension != null - fun next() { - val x = lastSuspension!! - lastSuspension = null - x.resume("56") - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller1 = Controller() - val controller2 = Controller() - - c.startCoroutine(controller1, EmptyContinuation) - c.startCoroutine(controller2, EmptyContinuation) - - runControllers(controller1, controller2) -} - -// TODO: additional parameters are not supported yet -//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { -// val controller1 = Controller() -// val controller2 = Controller() -// -// c(controller1, 1234567890123456789L, "Q").resume(Unit) -// c(controller2, 1234567890123456789L, "Q").resume(Unit) -// -// runControllers(controller1, controller2) -//} - -private fun runControllers(controller1: Controller, controller2: Controller) { - while (controller1.hasNext()) { - if (!controller2.hasNext()) throw RuntimeException("fail 1") - - if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") - - controller1.next() - controller2.next() - } - - if (controller2.hasNext()) throw RuntimeException("fail 2") - - if (controller1.result != "OK") throw RuntimeException("fail 3") - if (controller2.result != "OK") throw RuntimeException("fail 4") -} - -inline fun run(b: () -> Unit) { - b() -} - -fun box(): String { - // with capture and params - - var x = "O" - var y = "K" - - // inlined - run { - // no suspension - builder { - result = x + y - } - - // 1 suspension - builder { - if (suspendHere() != "56") return@builder - result = x + y - } - - // 2 suspensions - builder { - if (suspendHere() != "56") return@builder - suspendHere() - result = x + y - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt deleted file mode 100644 index f9966c09e39..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt +++ /dev/null @@ -1,94 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var lastSuspension: Continuation? = null - var result = "fail" - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - lastSuspension = x - COROUTINE_SUSPENDED - } - - fun hasNext() = lastSuspension != null - fun next() { - val x = lastSuspension!! - lastSuspension = null - x.resume("56") - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller1 = Controller() - val controller2 = Controller() - - c.startCoroutine(controller1, EmptyContinuation) - c.startCoroutine(controller2, EmptyContinuation) - - runControllers(controller1, controller2) -} - -// TODO: additional parameters are not supported yet -//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { -// val controller1 = Controller() -// val controller2 = Controller() -// -// c(controller1, 1234567890123456789L, "Q").resume(Unit) -// c(controller2, 1234567890123456789L, "Q").resume(Unit) -// -// runControllers(controller1, controller2) -//} - -private fun runControllers(controller1: Controller, controller2: Controller) { - while (controller1.hasNext()) { - if (!controller2.hasNext()) throw RuntimeException("fail 1") - - if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") - - controller1.next() - controller2.next() - } - - if (controller2.hasNext()) throw RuntimeException("fail 2") - - if (controller1.result != "OK") throw RuntimeException("fail 3") - if (controller2.result != "OK") throw RuntimeException("fail 4") -} - -inline fun run(b: () -> Unit) { - b() -} - -fun box(): String { - // with capture and params - var x = "O" - - // inlined - run { - var y = "K" - - { - // no suspension - builder { - result = "OK" - } - - // 1 suspension - builder { - if (suspendHere() != "56") return@builder - result = "OK" - } - - // 2 suspensions - builder { - if (suspendHere() != "56") return@builder - suspendHere() - result = "OK" - } - }() - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt deleted file mode 100644 index 261e28bbe76..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt +++ /dev/null @@ -1,92 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var lastSuspension: Continuation? = null - var result = "fail" - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - lastSuspension = x - COROUTINE_SUSPENDED - } - - fun hasNext() = lastSuspension != null - fun next() { - val x = lastSuspension!! - lastSuspension = null - x.resume("56") - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller1 = Controller() - val controller2 = Controller() - - c.startCoroutine(controller1, EmptyContinuation) - c.startCoroutine(controller2, EmptyContinuation) - - runControllers(controller1, controller2) -} - -// TODO: additional parameters are not supported yet -//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { -// val controller1 = Controller() -// val controller2 = Controller() -// -// c(controller1, 1234567890123456789L, "Q").resume(Unit) -// c(controller2, 1234567890123456789L, "Q").resume(Unit) -// -// runControllers(controller1, controller2) -//} - -private fun runControllers(controller1: Controller, controller2: Controller) { - while (controller1.hasNext()) { - if (!controller2.hasNext()) throw RuntimeException("fail 1") - - if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") - - controller1.next() - controller2.next() - } - - if (controller2.hasNext()) throw RuntimeException("fail 2") - - if (controller1.result != "OK") throw RuntimeException("fail 3") - if (controller2.result != "OK") throw RuntimeException("fail 4") -} - -inline fun run(b: () -> Unit) { - b() -} - -fun box(): String { - var x = "O" - - { - var y = "K" - // inlined - run { - // no suspension - builder { - result = "OK" - } - - // 1 suspension - builder { - if (suspendHere() != "56") return@builder - result = "OK" - } - - // 2 suspensions - builder { - if (suspendHere() != "56") return@builder - suspendHere() - result = "OK" - } - } - } () - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt b/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt deleted file mode 100644 index 00f56d8a33c..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt +++ /dev/null @@ -1,116 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -var wasCalled = false -class Controller { - val postponedActions = ArrayList<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> String) { - c.startCoroutine(this, handleResultContinuation { - globalResult = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { - val controller = Controller() - - globalResult = "#" - wasCalled = false - if (!expectException) { - controller.run(c) - } - else { - try { - controller.run(c) - globalResult = "fail: exception was not thrown" - } catch (e: Exception) { - globalResult = e.message!! - } - } - - if (!wasCalled) { - throw RuntimeException("fail wasCalled") - } - - if (globalResult != "OK") { - throw RuntimeException("fail $globalResult") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -fun box(): String { - builder { - try { - try { - suspendWithValue("") - suspendWithValue("OK") - } - catch (e: RuntimeException) { - suspendWithValue("fail 1") - } - } finally { - wasCalled = true - } - } - - builder { - try { - try { - suspendWithException(RuntimeException("M1")) - } - catch (e: RuntimeException) { - if (e.message != "M1") throw RuntimeException("fail 2") - wasCalled = true - suspendWithValue("OK") - } - } catch (e: Exception) { - suspendWithValue("fail 3") - } - } - - builder { - try { - try { - suspendWithException(Exception("M2")) - } - catch (e: RuntimeException) { - suspendWithValue("fail 4") - } finally { - wasCalled = true - } - } catch (e: Exception) { - if (e.message != "M2") throw RuntimeException("fail 5") - suspendWithValue("OK") - } - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt b/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt deleted file mode 100644 index 67f38388a8a..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -fun builder(c: suspend () -> Int): Int { - var res = 0 - c.startCoroutine(handleResultContinuation { - res = it - }) - - return res -} - -fun box(): String { - var result = "" - - val handledResult = builder { - result = "OK" - 56 - } - - if (handledResult != 56) return "fail 1: $handledResult" - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt deleted file mode 100644 index e0c9fda657d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt +++ /dev/null @@ -1,48 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var cResult = 0 - suspend fun suspendHere(v: Int): Int = suspendCoroutineOrReturn { x -> - x.resume(v * 2) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Int): Controller { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.cResult = it - }) - - return controller -} - -inline fun foo(x: (Int) -> Unit) { - for (i in 1..2) { - x(i) - } -} - -fun box(): String { - var result = "" - - val controllerResult = builder { - result += "-" - foo { - result += suspendHere(it).toString() - if (it == 2) return@builder 56 - } - // Should be unreachable - result += "+" - 1 - }.cResult - - if (result != "-24") return "fail 1: $result" - if (controllerResult != 56) return "fail 2: $controllerResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt deleted file mode 100644 index a7d30544230..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt +++ /dev/null @@ -1,53 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var cResult = 0 - suspend fun suspendHere(v: Int): Int = suspendCoroutineOrReturn { x -> - x.resume(v * 2) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Int): Controller { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.cResult = it - }) - - return controller -} - -inline fun foo(x: (Int) -> Unit) { - for (i in 1..2) { - run { - x(i) - } - } -} - -fun box(): String { - var result = "" - - val controllerResult = builder { - result += "-" - foo { - run { - result += suspendHere(it).toString() - if (it == 2) return@builder 56 - } - } - // Should be unreachable - result += "+" - 1 - }.cResult - - if (result != "-24") return "fail 1: $result" - if (controllerResult != 56) return "fail 2: $controllerResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt b/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt deleted file mode 100644 index 1ec19b6a9fc..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt +++ /dev/null @@ -1,78 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun box(): String { - async { - O.foo() - O.foo("second") - } - while (!finished) { - result += "--;" - proceed() - } - - finished = false - asyncSuspend { - O.foo() - O.foo("second") - } - while (!finished) { - result += "--;" - proceed() - } - - val expected = "before(first);--;after(first);before(second);--;after(second);--;done;" - if (result != expected + expected) return "fail: $result" - - return "OK" -} - -interface I { - suspend fun foo(x: String = "first") -} - -object O : I { - override suspend fun foo(x: String) { - result += "before($x);" - sleep() - result += "after($x);" - } -} - -suspend fun sleep(): Unit = suspendCoroutine { c -> - proceed = { c.resume(Unit) } -} - -fun async(f: suspend () -> Unit) { - f.startCoroutine(object : Continuation { - override fun resume(x: Unit) { - proceed = { - result += "done;" - finished = true - } - } - override fun resumeWithException(x: Throwable) {} - override val context = EmptyCoroutineContext - }) -} - -fun asyncSuspend(f: suspend () -> Unit) { - val coroutine = f.createCoroutine(object : Continuation { - override fun resume(x: Unit) { - proceed = { - result += "done;" - finished = true - } - } - override fun resumeWithException(x: Throwable) {} - override val context = EmptyCoroutineContext - }) - coroutine.resume(Unit) -} - -var result = "" -var proceed: () -> Unit = { } -var finished = false diff --git a/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt deleted file mode 100644 index c693392c26f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt +++ /dev/null @@ -1,42 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun box(): String { - var result = 0 - - builder { - result = factorial(4) - } - - while (postponed != null) { - postponed!!() - } - - if (result != 24) return "fail1: $result" - if (log != "1;1;2;6;24;") return "fail2: $log" - - return "OK" -} - -suspend fun factorial(a: Int): Int = if (a > 0) suspendHere(factorial(a - 1) * a) else suspendHere(1) - -suspend fun suspendHere(value: Int): Int = suspendCoroutineOrReturn { x -> - postponed = { - log += "$value;" - x.resume(value) - } - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(handleResultContinuation { - postponed = null - }) -} - -var postponed: (() -> Unit)? = { } - -var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt b/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt deleted file mode 100644 index 81fa92a38f1..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt +++ /dev/null @@ -1,32 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Int): Int { - var res = 0 - c.startCoroutine(handleResultContinuation { - res = it - }) - - return res -} - -fun box(): String { - var result = "" - - val handledResult = builder { - result = suspendHere() - return@builder 56 - } - - if (handledResult != 56) return "fail 1: $handledResult" - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/simple.kt b/backend.native/tests/external/codegen/box/coroutines/simple.kt deleted file mode 100644 index ae03b0d56af..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/simple.kt +++ /dev/null @@ -1,24 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/simpleException.kt b/backend.native/tests/external/codegen/box/coroutines/simpleException.kt deleted file mode 100644 index 2307339a201..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/simpleException.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resumeWithException(RuntimeException("OK")) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - try { - suspendHere() - result = "fail" - } catch (e: RuntimeException) { - result = "OK" - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt deleted file mode 100644 index f8bd4873718..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Int): Int { - var res = 0 - - c.createCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(data: Int) { - res = data - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }).resume(Unit) - - return res -} - - - -fun box(): String { - var result = "" - - val handledResult = builder { - result = suspendHere() - 56 - } - - if (handledResult != 56) return "fail 1: $handledResult" - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt deleted file mode 100644 index efc497ee9e2..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = throw RuntimeException("OK") -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = try { suspendHere() } catch (e: RuntimeException) { e.message!! } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt deleted file mode 100644 index e1957340d17..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// WITH_REFLECT -// CHECK_NOT_CALLED: suspendInline_61zpoe$ -// CHECK_NOT_CALLED: suspendInline_6r51u9$ -// CHECK_NOT_CALLED: suspendInline -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend inline fun suspendInline(v: String): String = v - - suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b()) - - suspend inline fun suspendInline(): String = suspendInline({ T::class.simpleName!! }) -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -class OK - -fun box(): String { - var result = "" - - builder { - result = suspendInline("56") - if (result != "56") throw RuntimeException("fail 1") - - result = suspendInline { "57" } - if (result != "57") throw RuntimeException("fail 2") - - result = suspendInline() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt deleted file mode 100644 index a68cf5d57db..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere() = "OK" -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt deleted file mode 100644 index 9e7f00ef2bc..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt +++ /dev/null @@ -1,50 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): Int = suspendCoroutineOrReturn { x -> - 1 - } - suspend fun suspendThere(): String = suspendCoroutineOrReturn { x -> - "?" - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result += "-" - for (i in 0..10000) { - if (i % 2 == 0) { - result += suspendHere().toString() - } - else if (i == 3) { - result += suspendThere() - } - } - result += "+" - } - - var mustBe = "-" - for (i in 0..10000) { - if (i % 2 == 0) { - mustBe += "1" - } - else if (i == 3) { - mustBe += "?" - } - } - mustBe += "+" - - if (result != mustBe) return "fail: $result/$mustBe" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt b/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt deleted file mode 100644 index 6742910c6ac..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt +++ /dev/null @@ -1,32 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> String) { - c.startCoroutine(handleResultContinuation { - globalResult = it - }) -} - -fun box(): String { - - var condition = true - - builder { - if (condition) { - suspendWithValue("OK") - } else { - suspendWithValue("fail 1") - } - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt deleted file mode 100644 index 99d50f8d734..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt +++ /dev/null @@ -1,48 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED - -fun box(): String { - async { - log += "1;" - wait() - log += "2;" - } - - while (postponed != null) { - log += "suspended;" - postponed!!() - } - - if (log != "1;wait2;suspended;wait;suspended;2;") return "fail: $log" - - return "OK" -} - -fun async(f: suspend () -> Unit) { - f.startCoroutine(handleResultContinuation { - postponed = null - }) -} - -suspend fun wait(): Unit { - wait2() - log += "wait;" - return suspendCoroutineOrReturn { c -> - postponed = { c.resume(Unit) } - COROUTINE_SUSPENDED - } -} - -suspend fun wait2(): Unit = suspendCoroutineOrReturn { c -> - log += "wait2;" - postponed = { c.resume(Unit) } - COROUTINE_SUSPENDED -} - -var postponed: (() -> Unit)? = { } - -var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt b/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt deleted file mode 100644 index 47f3b910a9b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.startCoroutine -import kotlin.coroutines.experimental.intrinsics.* - -interface TestInterface { - suspend fun toInt(): Int = suspendCoroutineOrReturn { x -> - x.resume(56) - COROUTINE_SUSPENDED - } -} - -class TestClass2 : TestInterface { -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = -1 - builder { - result = TestClass2().toInt() - } - - if (result != 56) return "fail 1: $result" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt b/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt deleted file mode 100644 index 5de17bdedb8..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendThere() - - suspend fun suspendThere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt deleted file mode 100644 index c4599e8c742..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt +++ /dev/null @@ -1,38 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(v: Int): Int = suspendCoroutineOrReturn { x -> - x.resume(v * 2) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -inline fun foo(x: (Int) -> Unit) { - for (i in 1..2) { - x(i) - } -} - -fun box(): String { - var result = "" - - builder { - result += "-" - foo { - result += suspendHere(it).toString() - } - result += "+" - } - - if (result != "-24+") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt deleted file mode 100644 index 73233d3b3b6..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES - -// FILE: stuff.kt -package stuff -import helpers.* - -import kotlin.coroutines.experimental.intrinsics.* - -object Host { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - - -// FILE: test.kt -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import stuff.Host.suspendHere - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt deleted file mode 100644 index b57aa353705..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt +++ /dev/null @@ -1,32 +0,0 @@ -// IGNORE_BACKEND: JVM -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* - -// TODO: looks like this is a bug in JVM backend -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: A): A = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -class A(val value: String) { - operator suspend fun plus(other: A) = suspendThere(A(value + other.value)) -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - - -fun box(): String { - var a = A("O") - - builder { - a += A("K") - } - - return a.value -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt deleted file mode 100644 index 4e2c9a69149..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt +++ /dev/null @@ -1,106 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var log = "" - var resumeIndex = 0 - - suspend fun suspendWithValue(value: T): T = suspendCoroutineOrReturn { continuation -> - log += "suspend($value);" - continuation.resume(value) - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(value: String): Unit = suspendCoroutineOrReturn { continuation -> - log += "error($value);" - continuation.resumeWithException(RuntimeException(value)) - COROUTINE_SUSPENDED - } -} - -abstract class ContinuationDispatcher : AbstractCoroutineContextElement(ContinuationInterceptor), ContinuationInterceptor { - abstract fun dispatchResume(value: T, continuation: Continuation): Boolean - abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean - override fun interceptContinuation(continuation: Continuation): Continuation = DispatchedContinuation(this, continuation) -} - -private class DispatchedContinuation( - val dispatcher: ContinuationDispatcher, - val continuation: Continuation -): Continuation { - override val context: CoroutineContext = continuation.context - - override fun resume(value: T) { - if (!dispatcher.dispatchResume(value, continuation)) - continuation.resume(value) - } - - override fun resumeWithException(exception: Throwable) { - if (!dispatcher.dispatchResumeWithException(exception, continuation)) - continuation.resumeWithException(exception) - } -} - -fun test(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation(object: ContinuationDispatcher() { - private fun dispatchResume(block: () -> Unit) { - val id = controller.resumeIndex++ - controller.log += "before $id;" - block() - controller.log += "after $id;" - } - - override fun

dispatchResume(data: P, continuation: Continuation

): Boolean { - dispatchResume { - continuation.resume(data) - } - return true - } - - override fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean { - dispatchResume { - continuation.resumeWithException(exception) - } - return true - } - })) - return controller.log -} - -suspend fun Controller.foo() = suspendWithValue("") + suspendWithValue("O") - -suspend fun Controller.test1() { - val o = foo() - val k = suspendWithValue("K") - log += "$o$k;" -} - -suspend fun Controller.test2() { - try { - foo() - - suspendWithException("OK") - log += "ignore;" - } - catch (e: RuntimeException) { - log += "${e.message};" - } -} - -fun box(): String { - var result = test { - test1() - } - if (result != "before 0;suspend();before 1;suspend(O);before 2;suspend(K);before 3;OK;after 3;after 2;after 1;after 0;") return "fail1: $result" - - result = test { - test2() - } - if (result != "before 0;suspend();before 1;suspend(O);before 2;error(OK);before 3;OK;after 3;after 2;after 1;after 0;") return "fail2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt deleted file mode 100644 index 4088d4cc9f2..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt +++ /dev/null @@ -1,113 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var exception: Throwable? = null - val postponedActions = ArrayList<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> Unit) { - c.startCoroutine(this, handleExceptionContinuation { - exception = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller = Controller() - controller.run(c) - - if (controller.exception?.message != "OK") { - throw RuntimeException("Unexpected result: ${controller.exception?.message}") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -suspend fun justContinue(): Unit = suspendCoroutineOrReturn { x -> - x.resume(Unit) - - COROUTINE_SUSPENDED -} - -suspend fun Controller.test1() { - justContinue() - throw RuntimeException("OK") -} - -suspend fun Controller.test2() { - justContinue() - commonThrow(RuntimeException("OK")) -} - -suspend fun Controller.test3() { - justContinue() - suspendWithException(RuntimeException("OK")) -} - -suspend fun Controller.test4() { - justContinue() - try { - suspendWithException(RuntimeException("fail 1")) - } catch (e: RuntimeException) { - suspendWithException(RuntimeException("OK")) - } -} - -suspend fun Controller.test5() { - justContinue() - try { - suspendWithException(Exception("OK")) - } catch (e: RuntimeException) { - suspendWithException(RuntimeException("fail 3")) - throw RuntimeException("fail 4") - } -} - -fun box(): String { - builder { - test1() - } - - builder { - test2() - } - - builder { - test3() - } - - builder { - test4() - } - - builder { - test5() - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt deleted file mode 100644 index 360e8d70bc1..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend inline fun suspendHere(crossinline block: () -> String): String { - return suspendThere(block()) + suspendThere(block()) -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - var q = "O" - result = suspendHere { - val r = q - q = "K" - r - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt deleted file mode 100644 index 38629523faa..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED -import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn - -class MyTest { - suspend fun act(value: String): String = suspendCoroutineOrReturn { - it.resume(value) - COROUTINE_SUSPENDED - } -} - -inline suspend fun testAsync(noinline routine: suspend MyTest.() -> T): T = routine(MyTest()) - -inline suspend fun Iterable.test() = testAsync { - var sum = "" - for (v in this@test) { - sum += act(v) - } - sum -} - -fun builder(x: suspend () -> Unit) { - x.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var res = "" - builder { - res = listOf("O", "K").test() - } - - return res -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt deleted file mode 100644 index f13526f6416..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class A(val v: String) { - suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v) -} - -fun builder(c: suspend A.() -> Unit) { - c.startCoroutine(A("K"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt deleted file mode 100644 index 62da22fa57d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED -import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn - -class MyTest { - suspend fun act(value: String): String = suspendCoroutineOrReturn { - it.resume(value) - COROUTINE_SUSPENDED - } -} - -suspend fun testAsync(routine: suspend MyTest.() -> T): T = routine(MyTest()) - -suspend fun Iterable.test() = testAsync { - var sum = "" - for (v in this@test) { - sum += act(v) - } - sum -} - -fun builder(x: suspend () -> Unit) { - x.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var res = "" - builder { - res = listOf("O", "K").test() - } - - return res -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt deleted file mode 100644 index 0d22667d747..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/openFunWithJava.kt +++ /dev/null @@ -1,60 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// FILE: main.kt -// TARGET_BACKEND: JVM -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - - -open class A(val v: String) { - suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v) -} - -class B(v: String) : A(v) { - override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56") -} - -fun builder(c: suspend A.() -> Unit) { - c.startCoroutine(B("K"), EmptyContinuation) -} - -fun box(): String { - var result = JavaClass.foo() - - if (result != "OK56") return "fail 1: $result" - - return "OK" -} - -// FILE: JavaClass.java -import kotlin.coroutines.experimental.*; -public class JavaClass { - public static String foo() { - final String[] res = new String[1]; - - new B("K").suspendHere(new Continuation() { - @Override - public CoroutineContext getContext() { - return EmptyCoroutineContext.INSTANCE; - } - - @Override - public void resume(String s) { - res[0] = s; - } - - @Override - public void resumeWithException(Throwable throwable) { - } - }); - - return res[0]; - } -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt deleted file mode 100644 index 2b069d242d6..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt +++ /dev/null @@ -1,139 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -import kotlin.reflect.KProperty - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -class A(val x: String) { - var isSetValueCalled = false - var isProvideDelegateCalled = false - var isMinusAssignCalled = false - var isIncCalled = false - operator suspend fun component1() = suspendThere(x + "K") - operator suspend fun getValue(thisRef: Any?, property: KProperty<*>) = suspendThere(x + "K") - operator suspend fun setValue(thisRef: Any?, property: KProperty<*>, value: String): Unit = suspendCoroutineOrReturn { x -> - if (value != "56") return@suspendCoroutineOrReturn Unit - isSetValueCalled = true - x.resume(Unit) - COROUTINE_SUSPENDED - } - - operator suspend fun provideDelegate(host: Any?, p: Any): A = suspendCoroutineOrReturn { x -> - isProvideDelegateCalled = true - x.resume(this) - COROUTINE_SUSPENDED - } - - operator suspend fun plus(y: String) = suspendThere(x + y) - operator suspend fun unaryPlus() = suspendThere(x + "K") - - operator suspend fun inc(): A = suspendCoroutineOrReturn { x -> - isIncCalled = true - x.resume(this) - COROUTINE_SUSPENDED - } - - operator suspend fun minusAssign(y: String): Unit = suspendCoroutineOrReturn { x -> - if (y != "56") return@suspendCoroutineOrReturn Unit - isMinusAssignCalled = true - x.resume(Unit) - COROUTINE_SUSPENDED - } -// See KT-16221 -// operator suspend fun contains(y: String): Boolean = suspendCoroutineOrReturn { x -> -// x.resume(y == "56") -// COROUTINE_SUSPENDED -// } - - operator suspend fun compareTo(y: String): Int = suspendCoroutineOrReturn { x -> - x.resume("56".compareTo(y)) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -var a = A("O") - -suspend fun foo1() { - var x by a - - if (x != "OK") throw RuntimeException("fail 1") - - x = "56" - - if (!a.isSetValueCalled || !a.isProvideDelegateCalled) throw RuntimeException("fail 2") -} - -suspend fun foo2() { - val (y) = a - if (y != "OK") throw RuntimeException("fail 3") -} - -suspend fun foo3() { - val y = a + "K" - if (y != "OK") throw RuntimeException("fail 4") -} - -suspend fun foo4() { - val y = + a - if (y != "OK") throw RuntimeException("fail 5") -} - -// TODO: KT-15930 -//suspend fun foo5() { -// a -= "56" -// if (!a.isMinusAssignCalled) throw RuntimeException("fail 6") -//} - -suspend fun foo6() { - var y = a++ - if (!y.isIncCalled) throw RuntimeException("fail 7") -} - -suspend fun foo7() { - a.isIncCalled = false - val y = ++a - if (!y.isIncCalled) throw RuntimeException("fail 8") -} - -//suspend fun foo8() { -// if ("1" in a) throw RuntimeException("fail 9") -// if (!("1" !in a)) throw RuntimeException("fail 9") -// -// if ("56" in a) throw RuntimeException("fail 10") -// if (!("56" !in a)) throw RuntimeException("fail 11") -//} - -suspend fun checkCompareTo(v: String) = (a < v) == ("56" < v) - -suspend fun foo9() { - if (!checkCompareTo("55")) throw RuntimeException("fail 12") - if (!checkCompareTo("56")) throw RuntimeException("fail 13") - if (!checkCompareTo("57")) throw RuntimeException("fail 14") -} - -fun box(): String { - - builder { - foo1() - foo2() - foo3() - foo4() - //foo5() - foo6() - foo7() - //foo8() - foo9() - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt deleted file mode 100644 index b8d8d409a18..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class X { - var res = "" - suspend fun execute() { - a() - b() - } - - private suspend fun a() { - res += suspendThere("O") - res += suspendThere("K") - } - - private suspend fun b() { - res += suspendThere("5") - res += suspendThere("6") - } -} - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend X.() -> Unit) { - c.startCoroutine(X(), EmptyContinuation) -} - -fun box(): String { - var result = "" - builder { - execute() - result = res - } - - if (result != "OK56") return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt deleted file mode 100644 index f29775db5f6..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -var x = true -private suspend fun foo(): String { - if (x) { - return suspendCoroutineOrReturn { - it.resume("OK") - COROUTINE_SUSPENDED - } - } - - return "fail" -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var res = "" - builder { - res = foo() - } - - return res -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt deleted file mode 100644 index ba957747645..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(suspend: Boolean): String { - if (!suspend) return "O" - - return suspendThere("") + suspendThere("K") -} -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere(false) + suspendHere(true) - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt deleted file mode 100644 index 211888c934c..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(): String = suspendThere("O") + suspendThere("K") - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt deleted file mode 100644 index 49a322a5136..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -open class A(val v: String) { - suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v) -} - -class B(v: String) : A(v) { - override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56") -} - -fun builder(c: suspend A.() -> Unit) { - c.startCoroutine(B("K"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - if (result != "OK56") return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt deleted file mode 100644 index 6763e99ab1f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallAbstractClass.kt +++ /dev/null @@ -1,41 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -abstract class A(val v: String) { - suspend abstract fun foo(v: String): String - - suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - open suspend fun suspendHere(): String = foo("O") + suspendThere(v) -} - -class B(v: String) : A(v) { - override suspend fun foo(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56") -} - -fun builder(c: suspend A.() -> Unit) { - c.startCoroutine(B("K"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - if (result != "OK56") return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt deleted file mode 100644 index 3913958cdb8..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/superCallInterface.kt +++ /dev/null @@ -1,38 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -interface A { - val v: String - - suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v) -} - -interface A2 : A { - override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56") -} - -class B(override val v: String) : A2 - -fun builder(c: suspend A.() -> Unit) { - c.startCoroutine(B("K"), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - if (result != "OK56") return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt deleted file mode 100644 index 7c2d1ca1c86..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt +++ /dev/null @@ -1,32 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(): String { - val k = "K" - val x = suspendThere("O") - val y = x + suspendThere(k) - - return y -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt deleted file mode 100644 index a8c381a5e64..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -suspend fun foo(): String { - var a = "OK" - var i = 0 - val x: suspend () -> String = { - suspendHere(a[i++].toString()) - } - - return x() + x.invoke() -} - - -fun box(): String { - var result = "" - - builder { - result = foo() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt deleted file mode 100644 index 88c63c02c73..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt +++ /dev/null @@ -1,32 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -suspend fun foo(c: suspend Double.(Long, Int, String) -> String) = (1.0).c(56L, 55, "abc") - -fun box(): String { - var result = "" - var final = "" - - builder { - final = foo { l, i, s -> - result = suspendHere("$this#$l#$i#$s") - "OK" - } - } - - if (result != "1.0#56#55#abc" && result != "1#56#55#abc") return "fail: $result" - - return final -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt deleted file mode 100644 index eee4b341107..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt +++ /dev/null @@ -1,38 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -suspend fun foo1(c: suspend () -> Unit) = c() -suspend fun foo2(c: suspend String.() -> Int) = "2".c() -suspend fun foo3(c: suspend (String) -> Int) = c("3") - -fun box(): String { - var result = "" - - builder { - foo1 { - result = suspendHere("begin#") - } - - val q2 = foo2 { result += suspendHere(this) + "#"; 1 } - val q3 = foo3 { result += suspendHere(it); 2 } - - if (q2 != 1) throw RuntimeException("fail q2") - if (q3 != 2) throw RuntimeException("fail q3") - } - - if (result != "begin#2#3") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt deleted file mode 100644 index 345d7ecbfd5..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt +++ /dev/null @@ -1,42 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var i = 0 - suspend fun suspendHere(): Int = suspendCoroutineOrReturn { x -> - x.resume(i++) - COROUTINE_SUSPENDED - } - suspend fun suspendThere(): String = suspendCoroutineOrReturn { x -> - x.resume("?") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result += "-" - for (i in 0..5) { - if (i % 2 == 0) { - result += suspendHere().toString() - } - else if (i == 3) { - result += suspendThere() - } - } - result += "+" - } - - if (result != "-01?2+") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt deleted file mode 100644 index 6b567b1e0bf..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt +++ /dev/null @@ -1,100 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("K") - COROUTINE_SUSPENDED - } - - suspend fun suspendWithArgument(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - suspend fun suspendWithDouble(v: Double): Double = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -class A(val first: String, val second: String) { - override fun toString() = "$first$second" -} -class B(val first: String, val second: String, val third: String) { - override fun toString() = "$first$second$third" -} - -class C(val first: Long, val second: Double, val third: String) { - override fun toString() = "$first#$second#$third" -} - - -fun box(): String { - var result = "OK" - - builder { - var local: Any = A("O", suspendHere()) - - if (local.toString() != "OK") { - result = "fail 1: $local" - return@builder - } - - local = A(suspendWithArgument("O"), suspendHere()) - - if (local.toString() != "OK") { - result = "fail 2: $local" - return@builder - } - - local = B("#", suspendWithArgument("O"), suspendHere()) - - if (local.toString() != "#OK") { - result = "fail 3: $local" - return@builder - } - - local = B(suspendWithArgument("#"), "O", suspendHere()) - - if (local.toString() != "#OK") { - result = "fail 4: $local" - return@builder - } - - local = B("#", B("", "O", suspendWithArgument("")).toString(), suspendHere()) - - if (local.toString() != "#OK") { - result = "fail 5: $local" - return@builder - } - - val condition = local.toString() == "#OK" - - local = B( - if (!condition) "1" else suspendWithArgument("#"), - if (condition) suspendWithArgument("O") else "2", - if (condition) suspendHere() else suspendWithArgument("3")) - - if (local.toString() != "#OK") { - result = "fail 5: $local" - return@builder - } - - local = C(1234567890123L, suspendWithDouble(3.14), suspendWithArgument("OK")) - - if (local.toString() != "1234567890123#3.14#OK") { - result = "fail 5: $local" - return@builder - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt deleted file mode 100644 index 026ef54eb65..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionEvaluationOrder.kt +++ /dev/null @@ -1,58 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// IGNORE_BACKEND: NATIVE - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("K") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -val logger = StringBuilder() - -class A(val first: String, val second: String) { - init { - logger.append("A.;") - } - - override fun toString() = "$first$second" - - companion object { - init { - logger.append("A.;") - } - } -} - -inline fun logged(message: String, result: () -> T): T { - logger.append(message) - return result() -} - -fun box(): String { - var result = "OK" - - builder { - var local: Any = A(logged("args;") { "O" }, suspendHere()) - - if (local.toString() != "OK") { - result = "fail 1: $local" - return@builder - } - } - - if (logger.toString() != "args;A.;A.;") { - return "Fail: '$logger'" - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt deleted file mode 100644 index d68f224d6ce..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstructionWithJumpOut.kt +++ /dev/null @@ -1,152 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("K") - COROUTINE_SUSPENDED - } - - suspend fun suspendWithArgument(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } - - suspend fun suspendWithDouble(v: Double): Double = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -class A(val first: String, val second: String) { - override fun toString() = "$first$second" -} - -class B(val first: String, val second: String, val third: String) { - override fun toString() = "$first$second$third" -} - -class C(val a: Long, val b: Double, val c: Int, val d: String) { - override fun toString() = "$a#$b#$c#$d" -} - -val condition = true - -fun box(): String { - var result = "OK" - - builder { - for (count in 0..3) { - val local = A(if (count > 0) break else "O", suspendHere()) - - if (count > 0) { - result = "fail 1: count=$count" - return@builder - } - - if (local.toString() != "OK") { - result = "fail 1: $local" - return@builder - } - } - - for (count in 0..3) { - val local = B(if (count > 0) break else "#", suspendWithArgument("O"), suspendHere()) - - if (count > 0) { - result = "fail 2: count=$count" - return@builder - } - - if (local.toString() != "#OK") { - result = "fail 2: $local" - return@builder - } - } - - for (count in 0..3) { - val local = B(suspendWithArgument("#"), if (count > 0) break else "O", suspendHere()) - - if (count > 0) { - result = "fail 3: count=$count" - return@builder - } - - if (local.toString() != "#OK") { - result = "fail 3: $local" - return@builder - } - } - - for (count in 0..3) { - val local = B( - "#", - B("", - if (count > 0) break else "O", - suspendWithArgument("") - ).toString(), - suspendHere() - ) - - if (count > 0) { - result = "fail 4: count=$count" - return@builder - } - - if (local.toString() != "#OK") { - result = "fail 4: $local" - return@builder - } - } - - loop@for (count in 0..3) { - val local = B( - if (!condition) "1" else suspendWithArgument("#"), - when { - count > 0 -> break@loop - condition -> suspendWithArgument("O") - else -> "2" - }, - if (condition) suspendHere() else suspendWithArgument("3") - ) - - if (count > 0) { - result = "fail 5: count=$count" - return@builder - } - - if (local.toString() != "#OK") { - result = "fail 5: $local" - return@builder - } - } - - for (count in 0..3) { - val local = C( - 1234567890123L, - suspendWithDouble(3.14), - 42, - if (count > 0) break else suspendWithArgument("OK") - ) - - if (count > 0) { - result = "fail 6: count=$count" - return@builder - } - - if (local.toString() != "1234567890123#3.14#42#OK") { - result = "fail 6: $local" - return@builder - } - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt deleted file mode 100644 index 91271e456fb..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt +++ /dev/null @@ -1,40 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class TestClass { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("K") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun foo(x: String, y: String?) = x + (y ?: "") - -fun box(): String { - var result = "" - - var instance: TestClass? = null - - builder { - result = foo("OK", instance?.suspendHere()) - } - - if (result != "OK") return "fail 1: $result" - - result = "" - instance = TestClass() - builder { - result = foo("O", instance?.suspendHere()) - } - - if (result != "OK") return "fail 2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt deleted file mode 100644 index 2d4f6790b9d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class TestClass { - suspend fun toInt(): Int = suspendCoroutineOrReturn { x -> - x.resume(14) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = 0 - - var instance: TestClass? = null - - builder { - result = 42 + (instance?.toInt() ?: 0) - } - - if (result != 42) return "fail 1: $result" - - instance = TestClass() - builder { - result = 42 + (instance?.toInt() ?: 0) - } - - if (result != 56) return "fail 2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt deleted file mode 100644 index b8f4a5f4a78..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt +++ /dev/null @@ -1,31 +0,0 @@ -// IGNORE_BACKEND: JS -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// CHECK_BYTECODE_LISTING -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -inline suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -// There's no state machine in the suspendHere, since it's inline -inline suspend fun suspendHere(): String = suspendThere("O") + suspendThere("K") -// There should be a state machine for mainSuspend as it has two suspend non-tail calls inlined -suspend fun mainSuspend() = suspendHere() - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = mainSuspend() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt deleted file mode 100644 index 20416637b3d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -// CHECK_BYTECODE_LISTING -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -inline suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(): String = suspendThere("O") - -// There is a kind of redundant state machine generated for complexSuspend: -// it's basically has the only suspend call just before return, but there is -// a redundant CHECKCAST String in the run's lambda, so we have to insert the state machine. -// TODO: Think of avoiding such redundant casts -suspend fun complexSuspend(): String { - return run { - suspendThere("K") - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() + complexSuspend() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt deleted file mode 100644 index 353f5f3f5a4..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// CHECK_BYTECODE_LISTING -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - COROUTINE_SUSPENDED -} - -suspend fun suspendHere(): String = suspendThere("OK") - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt deleted file mode 100644 index 1f1fcb98b80..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt +++ /dev/null @@ -1,30 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun foo(x: Any): Int { - return if (x == "56") suspendHere() else 13 -} - -suspend fun suspendHere(): Int = suspendCoroutineOrReturn { x -> - x.resume(56) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = -1 - - builder { - result = foo("56") - } - - if (result != 56) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt deleted file mode 100644 index c3fe2873410..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun foo(x: Any): Int { - return try { - suspendHere() - } catch (e: Throwable) { - 13 - } -} - -suspend fun suspendHere(): Int = suspendCoroutineOrReturn { x -> - x.resume(56) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = -1 - - builder { - result = foo("56") - } - - if (result != 56) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt deleted file mode 100644 index 5e0dc9747db..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun foo(x: Any): Int { - return when { - x == "56" -> suspendHere() - else -> 13 - } -} - -suspend fun suspendHere(): Int = suspendCoroutineOrReturn { x -> - x.resume(56) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = -1 - - builder { - result = foo("56") - } - - if (result != 56) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt deleted file mode 100644 index 3dc260dc183..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt +++ /dev/null @@ -1,53 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* - -fun box(): String { - async { - val a = foo(23) - log(a) - val b = foo(42) - log(b) - } - while (!finished) { - log("--") - proceed() - } - - if (result != "suspend:23;--;23;suspend:42;--;42;--;done;") return "fail: $result" - - return "OK" -} - -var result = "" - -fun log(message: Any) { - result += "$message;" -} - -var proceed: () -> Unit = { } -var finished = false - -suspend fun bar(x: Int): Int = suspendCoroutine { c -> - log("suspend:$x") - proceed = { c.resume(x) } -} - -inline suspend fun foo(x: Int) = bar(x) - -fun async(a: suspend () -> Unit) { - a.startCoroutine(object : Continuation { - override fun resume(value: Unit) { - proceed = { - log("done") - finished = true - } - } - - override fun resumeWithException(e: Throwable) { - } - - override val context = EmptyCoroutineContext - }) -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt deleted file mode 100644 index 6736cdbe9e0..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt +++ /dev/null @@ -1,179 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -var wasCalled = false -class Controller { - val postponedActions = ArrayList<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> String) { - c.startCoroutine(this, handleResultContinuation { - globalResult = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { - val controller = Controller() - - globalResult = "#" - wasCalled = false - if (!expectException) { - controller.run(c) - } - else { - try { - controller.run(c) - globalResult = "fail: exception was not thrown" - } catch (e: Exception) { - globalResult = e.message!! - } - } - - if (!wasCalled) { - throw RuntimeException("fail wasCalled") - } - - if (globalResult != "OK") { - throw RuntimeException("fail $globalResult") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -fun box(): String { - builder { - try { - suspendWithValue("") - suspendWithValue("OK") - } catch (e: RuntimeException) { - suspendWithValue("fail 1") - } finally { - suspendWithValue("ignored 1") - wasCalled = true - } - } - - builder { - try { - suspendWithException(RuntimeException("M")) - } catch (e: RuntimeException) { - if (e.message != "M") throw RuntimeException("fail 2") - suspendWithValue("OK") - } finally { - suspendWithValue("ignored 2") - wasCalled = true - } - } - - builder(expectException = true) { - try { - suspendWithException(Exception("OK")) - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 3") - } finally { - suspendWithValue("ignored 3") - wasCalled = true - } - } - - builder(expectException = true) { - try { - suspendWithException(Exception("OK")) - } catch (e: RuntimeException) { - suspendWithValue("fail") - return@builder "xyz" - } finally { - suspendWithValue("ignored 4") - wasCalled = true - } - } - - builder { - try { - suspendWithException(Exception("M2")) - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 4") - } catch (e: Exception) { - if (e.message != "M2") throw Exception("fail 5: ${e.message}") - suspendWithValue("OK") - } finally { - suspendWithValue("ignored 4") - wasCalled = true - } - } - - builder { - try { - suspendWithValue("123") - commonThrow(RuntimeException("M3")) - suspendWithValue("456") - } catch (e: RuntimeException) { - if (e.message != "M3") throw Exception("fail 6: ${e.message}") - suspendWithValue("OK") - } finally { - suspendWithValue("ignored 5") - wasCalled = true - } - } - - builder(expectException = true) { - try { - suspendWithValue("123") - commonThrow(Exception("OK")) - suspendWithValue("456") - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 7") - } finally { - suspendWithValue("ignored 6") - wasCalled = true - } - } - - builder { - try { - suspendWithValue("123") - commonThrow(Exception("M3")) - suspendWithValue("456") - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 8") - } catch (e: Exception) { - if (e.message != "M3") throw Exception("fail 9: ${e.message}") - suspendWithValue("OK") - } finally { - suspendWithValue("ignored 7") - wasCalled = true - } - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt deleted file mode 100644 index 2c720c010d2..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt +++ /dev/null @@ -1,153 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -var wasCalled = false -class Controller { - val postponedActions = ArrayList<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> String) { - c.startCoroutine(this, handleResultContinuation { - globalResult = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { - val controller = Controller() - - globalResult = "#" - wasCalled = false - if (!expectException) { - controller.run(c) - } - else { - try { - controller.run(c) - globalResult = "fail: exception was not thrown" - } catch (e: Exception) { - globalResult = e.message!! - } - } - - if (!wasCalled) { - throw RuntimeException("fail wasCalled") - } - - if (globalResult != "OK") { - throw RuntimeException("fail $globalResult") - } -} - -fun commonThrow(t: Throwable) { - throw t -} - -fun box(): String { - builder { - try { - suspendWithValue("") - wasCalled = true - suspendWithValue("OK") - } catch (e: RuntimeException) { - suspendWithValue("fail 1") - } - } - - builder { - try { - suspendWithException(RuntimeException("M")) - } catch (e: RuntimeException) { - if (e.message != "M") throw RuntimeException("fail 2") - wasCalled = true - suspendWithValue("OK") - } - } - - builder(expectException = true) { - try { - wasCalled = true - suspendWithException(Exception("OK")) - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 3") - } - } - - builder { - try { - suspendWithException(Exception("M2")) - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 4") - } catch (e: Exception) { - if (e.message != "M2") throw Exception("fail 5: ${e.message}") - wasCalled = true - suspendWithValue("OK") - } - } - - builder { - try { - suspendWithValue("123") - commonThrow(RuntimeException("M3")) - suspendWithValue("456") - } catch (e: RuntimeException) { - if (e.message != "M3") throw Exception("fail 6: ${e.message}") - wasCalled = true - suspendWithValue("OK") - } - } - - builder(expectException = true) { - try { - suspendWithValue("123") - wasCalled = true - commonThrow(Exception("OK")) - suspendWithValue("456") - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 7") - } - } - - builder { - try { - suspendWithValue("123") - commonThrow(Exception("M3")) - suspendWithValue("456") - } catch (e: RuntimeException) { - suspendWithValue("fail") - throw RuntimeException("fail 8") - } catch (e: Exception) { - if (e.message != "M3") throw Exception("fail 9: ${e.message}") - wasCalled = true - suspendWithValue("OK") - } - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt deleted file mode 100644 index 4a6d7d0bf11..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(v: String): String = suspendCoroutineOrReturn { x -> - x.resume(v) - - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -inline fun run(block: () -> Unit) { - block() -} - -fun box(): String { - var result = "" - run { - builder { - try { - result += suspendHere("O") - } finally { - result += suspendHere("K") - } - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt deleted file mode 100644 index 9c2d48c87b2..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt +++ /dev/null @@ -1,100 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var globalResult = "" -var wasCalled = false -class Controller { - val postponedActions = mutableListOf<() -> Unit>() - - suspend fun suspendWithValue(v: String): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resume(v) - } - - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(e: Exception): String = suspendCoroutineOrReturn { x -> - postponedActions.add { - x.resumeWithException(e) - } - - COROUTINE_SUSPENDED - } - - fun run(c: suspend Controller.() -> String) { - c.startCoroutine(this, handleResultContinuation { - globalResult = it - }) - while (postponedActions.isNotEmpty()) { - postponedActions[0]() - postponedActions.removeAt(0) - } - } -} - -fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { - val controller = Controller() - - globalResult = "#" - wasCalled = false - if (!expectException) { - controller.run(c) - } - else { - try { - controller.run(c) - globalResult = "fail: exception was not thrown" - } catch (e: Exception) { - globalResult = e.message!! - } - } - - if (!wasCalled) { - throw RuntimeException("fail wasCalled") - } - - if (globalResult != "OK") { - throw RuntimeException("fail $globalResult") - } -} - -fun commonThrow() { - throw RuntimeException("OK") -} - -fun box(): String { - builder { - try { - suspendWithValue("OK") - } finally { - if (suspendWithValue("G") != "G") throw RuntimeException("fail 1") - wasCalled = true - } - } - - builder(expectException = true) { - try { - suspendWithException(RuntimeException("OK")) - } finally { - if (suspendWithValue("G") != "G") throw RuntimeException("fail 2") - wasCalled = true - } - } - - builder(expectException = true) { - try { - suspendWithValue("OK") - commonThrow() - suspendWithValue("OK") - } finally { - if (suspendWithValue("G") != "G") throw RuntimeException("fail 3") - wasCalled = true - } - } - - return globalResult -} diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt deleted file mode 100644 index e8dfb09649b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt +++ /dev/null @@ -1,50 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - var wasResumeCalled = false - c.startCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(value: Unit) { - wasResumeCalled = true - } - - override fun resumeWithException(exception: Throwable) { - - } - }) - - if (!wasResumeCalled) throw RuntimeException("fail 1") -} - -fun box(): String { - var result = "" - - builder { - run { - if (result == "") return@builder - } - suspendHere() - throw RuntimeException("fail 2") - } - - result = "fail1" - - builder { - run { - if (result == "") return@builder - } - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt deleted file mode 100644 index 623e3dbb236..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt +++ /dev/null @@ -1,46 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - var wasResumeCalled = false - c.startCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(value: Unit) { - wasResumeCalled = true - } - - override fun resumeWithException(exception: Throwable) { - - } - }) - - if (!wasResumeCalled) throw RuntimeException("fail 1") -} - -fun box(): String { - var result = "" - - builder { - if (result == "") return@builder - suspendHere() - throw RuntimeException("fail 2") - } - - result = "fail" - - builder { - if (result == "") return@builder - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt deleted file mode 100644 index a56b3e5e4ed..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var result = "0" - - -suspend fun suspendHere(x: Int): Unit { - run { - if (x == 0) return - if (x == 1) return@suspendHere - } - - result = "OK" - return suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - builder { - if (suspendHere(0) != Unit) throw RuntimeException("fail 1") - if (suspendHere(1) != Unit) throw RuntimeException("fail 2") - if (suspendHere(2) != Unit) throw RuntimeException("fail 3") - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt deleted file mode 100644 index 3430a0d10ad..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -var result = "0" - -suspend fun suspendHere(x: Int): Unit { - if (x == 0) return - result = "OK" - return suspendCoroutineOrReturn { x -> - x.resume(Unit) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - builder { - suspendHere(0) - suspendHere(1) - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/varSpilling/kt19475.kt b/backend.native/tests/external/codegen/box/coroutines/varSpilling/kt19475.kt deleted file mode 100644 index b18b763100d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/varSpilling/kt19475.kt +++ /dev/null @@ -1,32 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = arrayListOf() - - builder { - while (true) { - if (result.size == 0) { - break - } - } - - for (i in 1..2) { - result.add(suspendHere()) - } - } - - return result[0] -} diff --git a/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt b/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt deleted file mode 100644 index 0f09377dbfa..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt +++ /dev/null @@ -1,46 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun foo(value: String): String = suspendCoroutineOrReturn { x -> - x.resume(value) - COROUTINE_SUSPENDED -} - -fun bar(x: String?, y: String, z: String): String { - if (x != null) throw RuntimeException("fail 0") - return y + z -} - -suspend fun baz1(): String { - return bar(null, foo("O"), foo("K")) -} - -suspend fun baz2(): String { - var x = null - - for (i in 1..3) { - x = null - } - - return bar(x, foo("O"), foo("K")) -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = baz1() - - if (result != "OK") throw RuntimeException("fail 1") - result = baz2() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt deleted file mode 100644 index fa02930895c..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "fail 1" - builder { - // Initialize var with Int value - for (i in 1..1) { - if (i != 1) continue - } - - // This variable should take the same slot as 'i' had - var s: String - - // We should not spill 's' to continuation field because it's not initialized - // More precisely it contains a value of wrong type (it conflicts with contents of local var table), - // so an attempt of spilling may lead to problems on Android - if (suspendHere() == "OK") { - s = "OK" - } - else { - s = "fail 2" - } - - result = s - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt deleted file mode 100644 index 024392c2b04..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "fail 1" - builder { - // Initialize var with Int value - try { - var i: String = "abc" - i = "123" - } finally { } - - // This variable should take the same slot as 'i' had - var s: String - - // We shout not spill 's' to continuation field because it's not effectively initialized - // But we do this because it's not illegal (at least in Android/OpenJDK VM's) - if (suspendHere() == "OK") { - s = "OK" - } - else { - s = "fail 2" - } - - result = s - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/arrayParams.kt b/backend.native/tests/external/codegen/box/dataClasses/arrayParams.kt deleted file mode 100644 index 3c55fb1a0dd..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/arrayParams.kt +++ /dev/null @@ -1,10 +0,0 @@ -data class A(val x: Array, val y: IntArray) - -fun foo(x: Array, y: IntArray) = A(x, y) - -fun box(): String { - val a = Array(0, {0}) - val b = IntArray(0) - val (x, y) = foo(a, b) - return if (a == x && b == y) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/changingVarParam.kt b/backend.native/tests/external/codegen/box/dataClasses/changingVarParam.kt deleted file mode 100644 index 56f9c63561f..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/changingVarParam.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class A(var string: String) - -fun box(): String { - val a = A("Fail") - a.string = "OK" - val (result) = a - return result -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt deleted file mode 100644 index 5211d6889ae..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt +++ /dev/null @@ -1,29 +0,0 @@ -data class A(val a: Int = 1, val b: String = "$a") {} - -fun box() : String { - var result = "" - val a = A() - val b = a.copy() - if (b.a == 1 && b.b == "1") { - result += "1" - } - - val c = a.copy(a = 2) - if (c.a == 2 && c.b == "1") { - result += "2" - } - - val d = a.copy(b = "2") - if (d.a == 1 && d.b == "2") { - result += "3" - } - - val e = a.copy(a = 2, b = "2") - if (e.a == 2 && e.b == "2") { - result += "4" - } - if (result == "1234") { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/copyInObjectNestedDataClass.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/copyInObjectNestedDataClass.kt deleted file mode 100644 index 935389c50cb..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/copyInObjectNestedDataClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -class Bar(val name: String) - -abstract class Foo { - public abstract fun foo(): String -} - -fun box(): String { - return object: Foo() { - inner class NestedFoo(val bar: Bar) { - fun copy(bar: Bar) = NestedFoo(bar) - } - - override fun foo(): String { - return NestedFoo(Bar("Fail")).copy(bar = Bar("OK")).bar.name - } - }.foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/kt12708.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/kt12708.kt deleted file mode 100644 index e3c5e6485b9..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/kt12708.kt +++ /dev/null @@ -1,15 +0,0 @@ -// LANGUAGE_VERSION: 1.1 - -fun box(): String { - val a: A = B(1) - a.copy(1) - a.component1() - return "OK" -} - -interface A { - fun copy(x: Int): A - fun component1(): Any -} - -data class B(val x: Int) : A diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/kt3033.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/kt3033.kt deleted file mode 100644 index 7fc12756d88..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/kt3033.kt +++ /dev/null @@ -1,10 +0,0 @@ -data class A(val a: Double, val b: Double) - -fun box() : String { - val a = A(1.0, 1.0) - val b = a.copy() - if (b.a == 1.0 && b.b == 1.0) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/valInConstructorParams.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/valInConstructorParams.kt deleted file mode 100644 index a340685014e..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/valInConstructorParams.kt +++ /dev/null @@ -1,29 +0,0 @@ -data class A(val a: Int, val b: String) {} - -fun box() : String { - var result = "" - val a = A(1, "a") - val b = a.copy() - if (b.a == 1 && b.b == "a") { - result += "1" - } - - val c = a.copy(a = 2) - if (c.a == 2 && c.b == "a") { - result += "2" - } - - val d = a.copy(b = "b") - if (d.a == 1 && d.b == "b") { - result += "3" - } - - val e = a.copy(a = 2, b = "b") - if (e.a == 2 && e.b == "b") { - result += "4" - } - if (result == "1234") { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/varInConstructorParams.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/varInConstructorParams.kt deleted file mode 100644 index 6cd1a25ae2c..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/varInConstructorParams.kt +++ /dev/null @@ -1,29 +0,0 @@ -data class A(var a: Int, var b: String) {} - -fun box() : String { - var result = "" - val a = A(1, "a") - val b = a.copy() - if (b.a == 1 && b.b == "a") { - result += "1" - } - - val c = a.copy(a = 2) - if (c.a == 2 && c.b == "a") { - result += "2" - } - - val d = a.copy(b = "b") - if (d.a == 1 && d.b == "b") { - result += "3" - } - - val e = a.copy(a = 2, b = "b") - if (e.a == 2 && e.b == "b") { - result += "4" - } - if (result == "1234") { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/withGenericParameter.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/withGenericParameter.kt deleted file mode 100644 index 83a4d82db02..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/withGenericParameter.kt +++ /dev/null @@ -1,14 +0,0 @@ -data class A(val a: Foo) {} - -class Foo(val a: T) { } - -fun box() : String { - val f1 = Foo("a") - val f2 = Foo("b") - val a = A(f1) - val b = a.copy(f2) - if (b.a.a == "b") { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/copy/withSecondaryConstructor.kt b/backend.native/tests/external/codegen/box/dataClasses/copy/withSecondaryConstructor.kt deleted file mode 100644 index f997cea7708..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/copy/withSecondaryConstructor.kt +++ /dev/null @@ -1,9 +0,0 @@ -data class A(val o: String, val k: String) { - constructor() : this("O", "k") -} - -fun box(): String { - val a = A().copy(k = "K") - return a.o + a.k -} - diff --git a/backend.native/tests/external/codegen/box/dataClasses/doubleParam.kt b/backend.native/tests/external/codegen/box/dataClasses/doubleParam.kt deleted file mode 100644 index 7c4f6be1a75..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/doubleParam.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -val NAN = Double.NaN - -data class A(val x: Double) - -fun box(): String { - if (A(+0.0) == A(-0.0)) return "Fail: +0.0 == -0.0" - if (A(+0.0).hashCode() == A(-0.0).hashCode()) return "Fail: hash(+0.0) == hash(-0.0)" - - if (A(NAN) != A(NAN)) return "Fail: NaN != NaN" - if (A(NAN).hashCode() != A(NAN).hashCode()) return "Fail: hash(NaN) != hash(NaN)" - - val s = HashSet() - for (times in 1..5) { - s.add(A(3.14)) - s.add(A(+0.0)) - s.add(A(-0.0)) - s.add(A(-2.72)) - s.add(A(NAN)) - } - - if (A(3.14) !in s) return "Fail: 3.14 not found" - if (A(+0.0) !in s) return "Fail: +0.0 not found" - if (A(-0.0) !in s) return "Fail: -0.0 not found" - if (A(-2.72) !in s) return "Fail: -2.72 not found" - if (A(NAN) !in s) return "Fail: NaN not found" - - return if (s.size == 5) "OK" else "Fail $s" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclared.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclared.kt deleted file mode 100644 index 65e9e5b9bcf..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclared.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class A(val x: Int) { - override fun equals(other: Any?): Boolean = false -} - -fun box(): String { - val a = A(0) - return if (a.equals(a)) "fail" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclaredWrongSignature.kt deleted file mode 100644 index 8fc5ee1e118..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/alreadyDeclaredWrongSignature.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -data class B(val x: Int) { - fun equals(other: B): Boolean = false -} - -data class C(val x: Int) { - fun equals(): Boolean = false -} - -data class D(val x: Int) { - fun equals(other: Any?, another: String): Boolean = false -} - -data class E(val x: Int) { - fun equals(x: E): Boolean = false - override fun equals(x: Any?): Boolean = false -} - -fun box(): String { - B::class.java.getDeclaredMethod("equals", Any::class.java) - B::class.java.getDeclaredMethod("equals", B::class.java) - - C::class.java.getDeclaredMethod("equals", Any::class.java) - C::class.java.getDeclaredMethod("equals") - - D::class.java.getDeclaredMethod("equals", Any::class.java) - D::class.java.getDeclaredMethod("equals", Any::class.java, String::class.java) - - E::class.java.getDeclaredMethod("equals", Any::class.java) - E::class.java.getDeclaredMethod("equals", E::class.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/genericarray.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/genericarray.kt deleted file mode 100644 index eaf4b04032e..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/genericarray.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class A(val v: Array) - -fun box() : String { - val myArray = arrayOf(0, 1, 2) - if(A(myArray) == A(arrayOf(0, 1, 2))) return "fail" - if(A(myArray) != A(myArray)) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/intarray.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/intarray.kt deleted file mode 100644 index 85eb1bec509..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/intarray.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class A(val v: IntArray) - -fun box() : String { - val myArray = intArrayOf(0, 1, 2) - if(A(myArray) == A(intArrayOf(0, 1, 2))) return "fail" - if(A(myArray) != A(myArray)) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/nullother.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/nullother.kt deleted file mode 100644 index bb0f764e061..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/nullother.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Dummy { - override fun equals(other: Any?) = true -} - -data class A(val v: Any?) - -fun box() : String { - val a = A(Dummy()) - val b: A? = null - return if(a != b && b != a) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/equals/sameinstance.kt b/backend.native/tests/external/codegen/box/dataClasses/equals/sameinstance.kt deleted file mode 100644 index 04a1cfdc4f1..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/equals/sameinstance.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val arg: Any? = null) - -fun box() : String { - val a = A() - val b = a - return if(b == a) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/floatParam.kt b/backend.native/tests/external/codegen/box/dataClasses/floatParam.kt deleted file mode 100644 index aaa8f2b5e2f..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/floatParam.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -val NAN = Float.NaN - -data class A(val x: Float) - -fun box(): String { - if (A(+0f) == A(-0f)) return "Fail: +0 == -0" - if (A(+0f).hashCode() == A(-0f).hashCode()) return "Fail: hash(+0) == hash(-0)" - - if (A(NAN) != A(NAN)) return "Fail: NaN != NaN" - if (A(NAN).hashCode() != A(NAN).hashCode()) return "Fail: hash(NaN) != hash(NaN)" - - val s = HashSet() - for (times in 1..5) { - s.add(A(3.14f)) - s.add(A(+0f)) - s.add(A(-0f)) - s.add(A(-2.72f)) - s.add(A(NAN)) - } - - if (A(3.14f) !in s) return "Fail: 3.14 not found" - if (A(+0f) !in s) return "Fail: +0 not found" - if (A(-0f) !in s) return "Fail: -0 not found" - if (A(-2.72f) !in s) return "Fail: -2.72 not found" - if (A(NAN) !in s) return "Fail: NaN not found" - - return if (s.size == 5) "OK" else "Fail $s" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/genericParam.kt b/backend.native/tests/external/codegen/box/dataClasses/genericParam.kt deleted file mode 100644 index 5bf58f528f7..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/genericParam.kt +++ /dev/null @@ -1,12 +0,0 @@ -data class A(val x: T) - -fun box(): String { - val a = A(42) - if (a.component1() != 42) return "Fail a: ${a.component1()}" - - val b = A(239.toLong()) - if (b.component1() != 239.toLong()) return "Fail b: ${b.component1()}" - - val c = A("OK") - return c.component1() -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclared.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclared.kt deleted file mode 100644 index ee7b621c974..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclared.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val x: Int) { - override fun hashCode(): Int = -3 -} - -fun box(): String { - return if (A(0).hashCode() == -3) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt deleted file mode 100644 index 254e1b93220..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -data class A(val x: Int) { - fun hashCode(other: Any): Int = 0 -} - -data class B(val x: Int) { - fun hashCode(other: B, another: Any): Int = 0 -} - -fun box(): String { - A::class.java.getDeclaredMethod("hashCode") - A::class.java.getDeclaredMethod("hashCode", Any::class.java) - - B::class.java.getDeclaredMethod("hashCode") - B::class.java.getDeclaredMethod("hashCode", B::class.java, Any::class.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/array.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/array.kt deleted file mode 100644 index 083fde96ce0..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/array.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -data class A(val a: IntArray, var b: Array) - -fun box() : String { - if( A(intArrayOf(1,2,3),arrayOf("239")).hashCode() != 31*java.util.Arrays.hashCode(intArrayOf(0,1,2)) + "239".hashCode()) "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt deleted file mode 100644 index e231e75a57b..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Boolean) - -fun box() : String { - if (A(true).hashCode() != 1) return "fail1" - if (A(false).hashCode() !=0) return "fail2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/byte.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/byte.kt deleted file mode 100644 index ce33977b555..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/byte.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Byte) - -fun box() : String { - val v1 = A(10.toByte()).hashCode() - val v2 = (10.toByte() as Byte?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/char.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/char.kt deleted file mode 100644 index e2ac5e67291..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/char.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Char) - -fun box() : String { - val v1 = A('a').hashCode() - val v2 = ('a' as Char?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/double.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/double.kt deleted file mode 100644 index f0899ad1b59..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/double.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Double) - -fun box() : String { - val v1 = A(-10.toDouble()).hashCode() - val v2 = (-10.toDouble() as Double?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/float.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/float.kt deleted file mode 100644 index 41dc25c43c4..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/float.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Float) - -fun box() : String { - val v1 = A(-10.toFloat()).hashCode() - val v2 = (-10.toFloat() as Float?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/genericNull.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/genericNull.kt deleted file mode 100644 index 6987eab9670..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/genericNull.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val t: T) - -fun box(): String { - val h = A(null).hashCode() - if (h != 0) return "Fail $h" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/int.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/int.kt deleted file mode 100644 index 0596e4c72af..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/int.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Int) - -fun box() : String { - val v1 = A(-10.toInt()).hashCode() - val v2 = (-10.toInt() as Int?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/long.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/long.kt deleted file mode 100644 index 067593cb672..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/long.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Long) - -fun box() : String { - val v1 = A(-10.toLong()).hashCode() - val v2 = (-10.toLong() as Long?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/null.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/null.kt deleted file mode 100644 index 75777abec50..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/null.kt +++ /dev/null @@ -1,16 +0,0 @@ -data class A(val a: Any?, var x: Int) -data class B(val a: Any?) -data class C(val a: Int, var x: Int?) -data class D(val a: Int?) - -fun box() : String { - if( A(null,19).hashCode() != 19) "fail" - if( A(239,19).hashCode() != (239*31+19)) "fail" - if( B(null).hashCode() != 0) "fail" - if( B(239).hashCode() != 239) "fail" - if( C(239,19).hashCode() != (239*31+19)) "fail" - if( C(239,null).hashCode() != 239*31) "fail" - if( D(239).hashCode() != (239)) "fail" - if( D(null).hashCode() != 0) "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/short.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/short.kt deleted file mode 100644 index 5e220e27cfc..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/short.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val a: Short) - -fun box() : String { - val v1 = A(10.toShort()).hashCode() - val v2 = (10.toShort() as Short?)!!.hashCode() - return if( v1 == v2 ) "OK" else "$v1 $v2" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/kt5002.kt b/backend.native/tests/external/codegen/box/dataClasses/kt5002.kt deleted file mode 100644 index d624ca5b93c..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/kt5002.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.io.Serializable - -public data class Pair ( - public val first: A, - public val second: B -) : Serializable - -fun box(): String { - val p = Pair(42, "OK") - val q = Pair(42, "OK") - if (p != q) return "Fail equals" - if (p.hashCode() != q.hashCode()) return "Fail hashCode" - if (p.toString() != q.toString()) return "Fail toString" - return p.second -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/mixedParams.kt b/backend.native/tests/external/codegen/box/dataClasses/mixedParams.kt deleted file mode 100644 index 90637df9768..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/mixedParams.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class A(var x: Int, val z: Int) - -fun box(): String { - val a = A(1, 3) - if (a.component1() != 1) return "Fail: ${a.component1()}" - if (a.component2() != 3) return "Fail: ${a.component2()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/multiDeclaration.kt b/backend.native/tests/external/codegen/box/dataClasses/multiDeclaration.kt deleted file mode 100644 index c74ea42a4a3..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/multiDeclaration.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val x: Int, val y: Any?, val z: String) - -fun box(): String { - val a = A(42, null, "OK") - val (x, y, z) = a - return if (x == 42 && y == null) z else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/multiDeclarationFor.kt b/backend.native/tests/external/codegen/box/dataClasses/multiDeclarationFor.kt deleted file mode 100644 index b7756b0c036..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/multiDeclarationFor.kt +++ /dev/null @@ -1,17 +0,0 @@ -data class A(val x: Int, val y: String) - -fun box(): String { - val arr = Array(5) { - i -> A(i, i.toString()) - } - - var sum = 0 - var str = "" - - for ((x, y) in arr) { - sum += x - str += y - } - - return if (sum == 0+1+2+3+4 && str == "01234") "OK" else "Fail ${sum} ${str}" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt b/backend.native/tests/external/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt deleted file mode 100644 index 4e655f2d38e..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -abstract class Base { - final override fun toString() = "OK" - final override fun hashCode() = 42 - final override fun equals(other: Any?) = false -} - -data class DataClass(val field: String) : Base() - -fun box(): String { - val d = DataClass("x") - - if (d.toString() != "OK") return "Fail toString" - if (d.hashCode() != 42) return "Fail hashCode" - if (d.equals(d) != false) return "Fail equals" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt b/backend.native/tests/external/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt deleted file mode 100644 index 32287fbd597..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt +++ /dev/null @@ -1,19 +0,0 @@ -// See KT-6206 Always generate hashCode() and equals() for data classes even if base classes have non-trivial analogs - -abstract class Base { - override fun toString() = "Fail" - override fun hashCode() = -42 - override fun equals(other: Any?) = false -} - -data class DataClass(val field: String) : Base() - -fun box(): String { - val d = DataClass("x") - - if (d.toString() != "DataClass(field=x)") return "Fail toString" - if (d.hashCode() != "x".hashCode()) return "Fail hashCode" - if (d.equals(d) == false) return "Fail equals" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/privateValParams.kt b/backend.native/tests/external/codegen/box/dataClasses/privateValParams.kt deleted file mode 100644 index d667588ab98..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/privateValParams.kt +++ /dev/null @@ -1,13 +0,0 @@ -data class D(private val x: Long, private val y: Char) { - fun foo() = "${component1()}${component2()}" -} - -fun box(): String { - val d1 = D(42L, 'a') - val d2 = D(42L, 'a') - if (d1 != d2) return "Fail equals" - if (d1.hashCode() != d2.hashCode()) return "Fail hashCode" - if (d1.toString() != d2.toString()) return "Fail toString" - if (d1.foo() != d2.foo()) return "Fail foo" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclared.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclared.kt deleted file mode 100644 index f95ea92633c..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclared.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(val x: Int) { - override fun toString(): String = "!" -} - -fun box(): String { - return if (A(0).toString() == "!") "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt deleted file mode 100644 index e343bb06260..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -data class A(val x: Int) { - fun toString(other: Any): String = "" -} - -data class B(val x: Int) { - fun toString(other: B, another: Any): String = "" -} - -fun box(): String { - A::class.java.getDeclaredMethod("toString") - A::class.java.getDeclaredMethod("toString", Any::class.java) - - B::class.java.getDeclaredMethod("toString") - B::class.java.getDeclaredMethod("toString", B::class.java, Any::class.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/arrayParams.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/arrayParams.kt deleted file mode 100644 index c195530bf54..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/arrayParams.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -data class A(val x: Array?, val y: IntArray?) - -fun box(): String { - var ts = A(Array(2, {it}), IntArray(3)).toString() - if(ts != "A(x=[0, 1], y=[0, 0, 0])") return ts - - ts = A(null, IntArray(3)).toString() - if(ts != "A(x=null, y=[0, 0, 0])") return ts - - ts = A(null, null).toString() - if(ts != "A(x=null, y=null)") return ts - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/changingVarParam.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/changingVarParam.kt deleted file mode 100644 index 0268af29435..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/changingVarParam.kt +++ /dev/null @@ -1,11 +0,0 @@ -data class A(var string: String) - -fun box(): String { - val a = A("Fail") - if(a.toString() != "A(string=Fail)") return "fail" - - a.string = "OK" - if("$a" != "A(string=OK)") return a.toString() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/genericParam.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/genericParam.kt deleted file mode 100644 index 794bad5dbe1..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/genericParam.kt +++ /dev/null @@ -1,11 +0,0 @@ -data class A(val x: T) - -fun box(): String { - val a = A(42) - if ("$a" != "A(x=42)") return "$a" - - val b = A(239.toLong()) - if ("$b" != "A(x=239)") return "$b" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/mixedParams.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/mixedParams.kt deleted file mode 100644 index a8e9b7dbd20..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/mixedParams.kt +++ /dev/null @@ -1,7 +0,0 @@ -data class A(var x: Int, val z: Int?) - -fun box(): String { - val a = A(1, null) - if("$a" != "A(x=1, z=null)") return "$a" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/toString/unitComponent.kt b/backend.native/tests/external/codegen/box/dataClasses/toString/unitComponent.kt deleted file mode 100644 index 72e5965b320..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/toString/unitComponent.kt +++ /dev/null @@ -1,6 +0,0 @@ -data class A(val x: Unit) - -fun box(): String { - val a = A(Unit) - return if ("$a" == "A(x=kotlin.Unit)") "OK" else "$a" -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/twoValParams.kt b/backend.native/tests/external/codegen/box/dataClasses/twoValParams.kt deleted file mode 100644 index 91b918b1a8c..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/twoValParams.kt +++ /dev/null @@ -1,6 +0,0 @@ -data class A(val x: Int, val y: String) - -fun box(): String { - val a = A(42, "OK") - return if (a.component1() == 42) a.component2() else a.component1().toString() -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/twoVarParams.kt b/backend.native/tests/external/codegen/box/dataClasses/twoVarParams.kt deleted file mode 100644 index 053cfe55892..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/twoVarParams.kt +++ /dev/null @@ -1,9 +0,0 @@ -data class A(var x: Int, var y: String) - -fun box(): String { - val a = A(21, "K") - if (a.component1() != 21 || a.component2() != "K") return "Fail" - a.x *= 2 - a.y = "O" + a.component2() - return if (a.component1() == 42) a.component2() else a.component1().toString() -} diff --git a/backend.native/tests/external/codegen/box/dataClasses/unitComponent.kt b/backend.native/tests/external/codegen/box/dataClasses/unitComponent.kt deleted file mode 100644 index b70b461ab91..00000000000 --- a/backend.native/tests/external/codegen/box/dataClasses/unitComponent.kt +++ /dev/null @@ -1,6 +0,0 @@ -data class A(val x: Unit) - -fun box(): String { - val a = A(Unit) - return if (a.component1() is Unit) "OK" else "Fail ${a.component1()}" -} diff --git a/backend.native/tests/external/codegen/box/deadCodeElimination/emptyVariableRange.kt b/backend.native/tests/external/codegen/box/deadCodeElimination/emptyVariableRange.kt deleted file mode 100644 index c162fbeec34..00000000000 --- a/backend.native/tests/external/codegen/box/deadCodeElimination/emptyVariableRange.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(): Int { - return 1 - // val xyz has empty live range because everything after return will be removed as dead - val xyz = 1 -} - -fun box(): String { - assertEquals(1, foo()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRange.kt b/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRange.kt deleted file mode 100644 index 4d685fb2a0c..00000000000 --- a/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRange.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - try { - return "OK" - if (1 == 1) { - val z = 2 - } - if (3 == 3) { - val z = 4 - } - } finally { - - } -} diff --git a/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRangeInFinally.kt b/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRangeInFinally.kt deleted file mode 100644 index 071bd50aa47..00000000000 --- a/backend.native/tests/external/codegen/box/deadCodeElimination/intersectingVariableRangeInFinally.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - try { - return "OK" - } finally { - if (1 == 1) { - val z = 2 - } - if (3 == 3) { - val z = 4 - } - } -} diff --git a/backend.native/tests/external/codegen/box/deadCodeElimination/kt14357.kt b/backend.native/tests/external/codegen/box/deadCodeElimination/kt14357.kt deleted file mode 100644 index 377a6facdac..00000000000 --- a/backend.native/tests/external/codegen/box/deadCodeElimination/kt14357.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - if (false) { - try { - null!! - } catch (e: Exception) { - throw e - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotation.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotation.kt deleted file mode 100644 index f7e1453599d..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotation.kt +++ /dev/null @@ -1,11 +0,0 @@ -annotation class A(val a: Int = 0) - -@A fun test1() = 1 -@A(2) fun test2() = 1 - -fun box(): String { - if ((test1() + test2()) == 2) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotationWithEmptyArray.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotationWithEmptyArray.kt deleted file mode 100644 index 1bf88131f44..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/annotationWithEmptyArray.kt +++ /dev/null @@ -1,8 +0,0 @@ -annotation class Anno(val x: Array = emptyArray()) - -@Anno fun test1() = 1 -@Anno(arrayOf("K")) fun test2() = 2 - -fun box(): String { - return if (test1() + test2() == 3) "OK" else "Fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt deleted file mode 100644 index cfd12c58f64..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class A(value: Int = 1) - -fun box(): String { - val constructors = A::class.java.getConstructors().filter { !it.isSynthetic() } - return if (constructors.size == 2) "OK" else constructors.size.toString() -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1.kt deleted file mode 100644 index db8161f1911..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A(val a: Int = 0) - -fun box(): String { - if (A().a == 0 && A(1).a == 1) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1InnerClass.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1InnerClass.kt deleted file mode 100644 index 588b0cf1c60..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs1InnerClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - inner class B(val a: String = "a", val b: Int = 55, val c: String = "c") -} - -fun box(): String { - val bDefault = A().B() - val b = A().B("aa", 66, "cc") - if (bDefault.a == "a" && bDefault.b == 55 && bDefault.c == "c") { - if (b.a == "aa" && b.b == 66 && b.c == "cc") { - return "OK" - } - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs2.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs2.kt deleted file mode 100644 index 9a22d318336..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/defArgs2.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A(val a: Int = 0, val b: String = "a") - -fun box(): String { - val a1 = A() - val a2 = A(1) - val a3 = A(b = "b") - val a4 = A(2, "c") - if (a1.a != 0 && a1.b != "a") return "fail" - if (a2.a != 1 && a2.b != "a") return "fail" - if (a3.a != 0 && a3.b != "b") return "fail" - if (a4.a != 2 && a4.b != "c") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/doubleDefArgs1InnerClass.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/doubleDefArgs1InnerClass.kt deleted file mode 100644 index cc9737c3e47..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/doubleDefArgs1InnerClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - inner class B(val a: Double = 1.0, val b: Int = 55, val c: String = "c") -} - -fun box(): String { - val bDefault = A().B() - val b = A().B(2.0, 66, "cc") - if (bDefault.a == 1.0 && bDefault.b == 55 && bDefault.c == "c") { - if (b.a == 2.0 && b.b == 66 && b.c == "cc") { - return "OK" - } - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enum.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/enum.kt deleted file mode 100644 index edc9e061d4c..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enum.kt +++ /dev/null @@ -1,11 +0,0 @@ -enum class A(val a: Int = 1) { - FIRST(), - SECOND(2) -} - -fun box(): String { - if (A.FIRST.a == 1 && A.SECOND.a == 2) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt deleted file mode 100644 index 339ab868c0d..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class Foo(val a: Int = 1, val b: String) { - B(2, "b"), - C(b = "b") -} - -fun box(): String { - if (Foo.B.a != 2 || Foo.B.b != "b") return "fail" - if (Foo.C.a != 1 || Foo.C.b != "b") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt deleted file mode 100644 index 7a7d6db0814..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class Foo(val a: Int = 1, val b: String = "a") { - A(), - B(2, "b"), - C(b = "b"), - D(a = 2) -} - -fun box(): String { - if (Foo.A.a != 1 || Foo.A.b != "a") return "fail" - if (Foo.B.a != 2 || Foo.B.b != "b") return "fail" - if (Foo.C.a != 1 || Foo.C.b != "b") return "fail" - if (Foo.D.a != 2 || Foo.D.b != "a") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt deleted file mode 100644 index e461fd6a32e..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class Foo(val a: Double = 1.0, val b: Double = 1.0) { - A(), - B(2.0, 2.0), - C(b = 2.0), - D(a = 2.0) -} - -fun box(): String { - if (Foo.A.a != 1.0 || Foo.A.b != 1.0) return "fail" - if (Foo.B.a != 2.0 || Foo.B.b != 2.0) return "fail" - if (Foo.C.a != 1.0 || Foo.C.b != 2.0) return "fail" - if (Foo.D.a != 2.0 || Foo.D.b != 1.0) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt2852.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt2852.kt deleted file mode 100644 index 9a5434a99cf..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt2852.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val o = object { - inner class A(val value: String = "OK") - } - - return o.A().value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt3060.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt3060.kt deleted file mode 100644 index ca4275a7403..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/kt3060.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Foo private constructor(val param: String = "OK") { - companion object { - val s = Foo() - } -} - -fun box(): String { - Foo.s.param - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/constructor/manyArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/constructor/manyArgs.kt deleted file mode 100644 index ac3eab5136f..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/constructor/manyArgs.kt +++ /dev/null @@ -1,216 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class A(val a: Int = 1, - val b: Int = 2, - val c: Int = 3, - val d: Int = 4, - val e: Int = 5, - val f: Int = 6, - val g: Int = 7, - val h: Int = 8, - val i: Int = 9, - val j: Int = 10, - val k: Int = 11, - val l: Int = 12, - val m: Int = 13, - val n: Int = 14, - val o: Int = 15, - val p: Int = 16, - val q: Int = 17, - val r: Int = 18, - val s: Int = 19, - val t: Int = 20, - val u: Int = 21, - val v: Int = 22, - val w: Int = 23, - val x: Int = 24, - val y: Int = 25, - val z: Int = 26, - val aa: Int = 27, - val bb: Int = 28, - val cc: Int = 29, - val dd: Int = 30, - val ee: Int = 31, - val ff: Int = 32) { - override fun toString(): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" - } -} - -class B(val a: Int = 1, - val b: Int = 2, - val c: Int = 3, - val d: Int = 4, - val e: Int = 5, - val f: Int = 6, - val g: Int = 7, - val h: Int = 8, - val i: Int = 9, - val j: Int = 10, - val k: Int = 11, - val l: Int = 12, - val m: Int = 13, - val n: Int = 14, - val o: Int = 15, - val p: Int = 16, - val q: Int = 17, - val r: Int = 18, - val s: Int = 19, - val t: Int = 20, - val u: Int = 21, - val v: Int = 22, - val w: Int = 23, - val x: Int = 24, - val y: Int = 25, - val z: Int = 26, - val aa: Int = 27, - val bb: Int = 28, - val cc: Int = 29, - val dd: Int = 30, - val ee: Int = 31, - val ff: Int = 32, - val gg: Int = 33, - val hh: Int = 34, - val ii: Int = 35, - val jj: Int = 36, - val kk: Int = 37, - val ll: Int = 38, - val mm: Int = 39, - val nn: Int = 40) { - override fun toString(): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + - "$gg $hh $ii $jj $kk $ll $mm $nn" - } -} - -class C(val a: Int = 1, - val b: Int = 2, - val c: Int = 3, - val d: Int = 4, - val e: Int = 5, - val f: Int = 6, - val g: Int = 7, - val h: Int = 8, - val i: Int = 9, - val j: Int = 10, - val k: Int = 11, - val l: Int = 12, - val m: Int = 13, - val n: Int = 14, - val o: Int = 15, - val p: Int = 16, - val q: Int = 17, - val r: Int = 18, - val s: Int = 19, - val t: Int = 20, - val u: Int = 21, - val v: Int = 22, - val w: Int = 23, - val x: Int = 24, - val y: Int = 25, - val z: Int = 26, - val aa: Int = 27, - val bb: Int = 28, - val cc: Int = 29, - val dd: Int = 30, - val ee: Int = 31, - val ff: Int = 32, - val gg: Int = 33, - val hh: Int = 34, - val ii: Int = 35, - val jj: Int = 36, - val kk: Int = 37, - val ll: Int = 38, - val mm: Int = 39, - val nn: Int = 40, - val oo: Int = 41, - val pp: Int = 42, - val qq: Int = 43, - val rr: Int = 44, - val ss: Int = 45, - val tt: Int = 46, - val uu: Int = 47, - val vv: Int = 48, - val ww: Int = 49, - val xx: Int = 50, - val yy: Int = 51, - val zz: Int = 52, - val aaa: Int = 53, - val bbb: Int = 54, - val ccc: Int = 55, - val ddd: Int = 56, - val eee: Int = 57, - val fff: Int = 58, - val ggg: Int = 59, - val hhh: Int = 60, - val iii: Int = 61, - val jjj: Int = 62, - val kkk: Int = 63, - val lll: Int = 64, - val mmm: Int = 65, - val nnn: Int = 66, - val ooo: Int = 67, - val ppp: Int = 68, - val qqq: Int = 69, - val rrr: Int = 70) { - override fun toString(): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + - "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + - "$mmm $nnn $ooo $ppp $qqq $rrr" - } -} - -fun box(): String { - val test1 = A(4, e = 8, f = 15, w = 16, aa = 23, ff = 42).toString() - val test2 = A::class.java.newInstance().toString() - val test3 = A(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, - u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1).toString() - if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { - return "test1 = $test1" - } - if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { - return "test2 = $test2" - } - if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test3 = $test3" - } - - val test4 = B(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55).toString() - val test5 = B::class.java.newInstance().toString() - val test6 = B(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, - w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, - jj = 5, kk = 4, ll = 3, mm = 2, nn = 1).toString() - if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { - return "test4 = $test4" - } - if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { - return "test5 = $test5" - } - if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test6 = $test6" - } - - val test7 = C(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7).toString() - val test8 = C::class.java.newInstance().toString() - val test9 = C(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, - 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, - uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, - ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1).toString() - if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + - "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { - return "test7 = $test7" - } - if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + - "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { - return "test8 = $test8" - } - if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + - "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test9 = $test9" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/convention/incWithDefaultInGetter.kt b/backend.native/tests/external/codegen/box/defaultArguments/convention/incWithDefaultInGetter.kt deleted file mode 100644 index a576bf5b852..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/convention/incWithDefaultInGetter.kt +++ /dev/null @@ -1,26 +0,0 @@ -var inc: String = "" - -class X { - var result: String = "fail" - - operator fun get(name: String, type: String = "none") = name + inc + type - - operator fun set(name: String, s: String) { - result = name + s; - } -} - -operator fun String.inc(): String { - inc = this + "1" - return this + "1" -} - -fun box(): String { - var x = X() - val res = ++x["a"] - if (x.result != "aanone1") return "fail 1: ${x.result}" - - if (res != "aanone1none") return "fail 2: ${res}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/convention/kt9140.kt b/backend.native/tests/external/codegen/box/defaultArguments/convention/kt9140.kt deleted file mode 100644 index ea677b74a84..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/convention/kt9140.kt +++ /dev/null @@ -1,11 +0,0 @@ -class X { - operator fun get(name: String, type: String = "none") = name + type -} - -fun box(): String { - if (X().get("a") != "anone") return "fail 1: ${X().get("a")}" - - if (X()["a"] != "anone") return "fail 2: ${X()["a"]}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/convention/plusAssignWithDefaultInGetter.kt b/backend.native/tests/external/codegen/box/defaultArguments/convention/plusAssignWithDefaultInGetter.kt deleted file mode 100644 index 0b6f63450de..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/convention/plusAssignWithDefaultInGetter.kt +++ /dev/null @@ -1,31 +0,0 @@ -class X { - var result: String = "fail" - - operator fun get(name: String, type: String = "none") = name + type - - operator fun set(name: String, s: String) { - result = name + s; - } -} - -class Y { - var result: String = "fail" - - operator fun get(name: String, type: String = "no", type2: String = "ne") = name + type + type2 - - operator fun set(name: String, s: String) { - result = name + s; - } -} - -fun box(): String { - var x = X() - x["a"] += "OK" - if (x.result != "aanoneOK") return "fail: ${x.result}" - - var y = Y() - y["a"] += "OK" - if (y.result != "aanoneOK") return "fail: ${y.result}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/abstractClass.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/abstractClass.kt deleted file mode 100644 index c1cc5d0bd9e..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/abstractClass.kt +++ /dev/null @@ -1,16 +0,0 @@ -abstract class Base { - abstract fun foo(a: String = "abc"): String -} - -class Derived: Base() { - override fun foo(a: String): String { - return a - } -} - -fun box(): String { - val result = Derived().foo() - if (result != "abc") return "Fail: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverride.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverride.kt deleted file mode 100644 index b2ad3e749c2..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverride.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class Foo { - open fun foo(x: CharSequence = "O"): CharSequence = x -} -class Bar(): Foo() { - override fun foo(x: CharSequence): String { // Note the covariant return type - return x.toString() + "K" - } -} - -fun box() = Bar().foo() diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt deleted file mode 100644 index 9f24919d51d..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class Foo { - open fun foo(x: CharSequence = "O"): CharSequence = x -} -class Bar: Foo() { - override fun foo(x: CharSequence): T { // Note the covariant return type - return (x.toString() + "K") as T - } -} - -fun box() = Bar().foo() diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt deleted file mode 100644 index 82984a99369..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt +++ /dev/null @@ -1,205 +0,0 @@ -fun Int.foo(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" -} - -fun String.bar(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + - "$gg $hh $ii $jj $kk $ll $mm $nn" -} - -fun Char.baz(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40, - oo: Int = 41, - pp: Int = 42, - qq: Int = 43, - rr: Int = 44, - ss: Int = 45, - tt: Int = 46, - uu: Int = 47, - vv: Int = 48, - ww: Int = 49, - xx: Int = 50, - yy: Int = 51, - zz: Int = 52, - aaa: Int = 53, - bbb: Int = 54, - ccc: Int = 55, - ddd: Int = 56, - eee: Int = 57, - fff: Int = 58, - ggg: Int = 59, - hhh: Int = 60, - iii: Int = 61, - jjj: Int = 62, - kkk: Int = 63, - lll: Int = 64, - mmm: Int = 65, - nnn: Int = 66, - ooo: Int = 67, - ppp: Int = 68, - qqq: Int = 69, - rrr: Int = 70): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + - "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + - "$mmm $nnn $ooo $ppp $qqq $rrr" -} - -fun box(): String { - val test1 = 1.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) - val test2 = 1.foo() - val test3 = 1.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, - u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) - if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { - return "test1 = $test1" - } - if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { - return "test2 = $test2" - } - if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test3 = $test3" - } - - val test4 = "".bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) - val test5 = "".bar() - val test6 = "".bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, - w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, - jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) - if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { - return "test4 = $test4" - } - if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { - return "test5 = $test5" - } - if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test6 = $test6" - } - - val test7 = 'a'.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) - val test8 = 'a'.baz() - val test9 = 'a'.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, - 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, - uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, - ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) - if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + - "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { - return "test7 = $test7" - } - if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + - "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { - return "test8 = $test8" - } - if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + - "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test9 = $test9" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunction.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunction.kt deleted file mode 100644 index b985d4b6467..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunction.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun Int.foo(a: Int = 1): Int { - return a -} - -fun box(): String { - if (1.foo() != 1) return "fail" - if (1.foo(2) != 2) return "fail" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDouble.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDouble.kt deleted file mode 100644 index 8b4b1fbd712..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDouble.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun Double.foo(a: Double = 1.0): Double { - return a -} - -fun box(): String { - if (1.0.foo() != 1.0) return "fail" - if (1.0.foo(2.0) != 2.0) return "fail" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt deleted file mode 100644 index 9c36a1335a3..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double { - return a + b -} - -fun box(): String { - if (1.0.foo() != 2.0) return "fail" - if (1.0.foo(2.0, 2.0) != 4.0) return "fail" - if (1.0.foo(a = 2.0) != 3.0) return "fail" - if (1.0.foo(b = 2.0) != 3.0) return "fail" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInClassObject.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInClassObject.kt deleted file mode 100644 index 876be1766c2..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInClassObject.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - companion object { - fun Int.foo(a: Int = 1): Int { - return a - } - - fun test(): String { - if (1.foo() != 1) return "fail" - if (1.foo(2) != 2) return "fail" - return "OK" - } - } -} - -fun box(): String { - return A.test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInObject.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInObject.kt deleted file mode 100644 index d16105ac6b3..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionInObject.kt +++ /dev/null @@ -1,15 +0,0 @@ -object A { - fun Int.foo(a: Int = 1): Int { - return a - } - - fun test(): String { - if (1.foo() != 1) return "fail" - if (1.foo(2) != 2) return "fail" - return "OK" - } -} - -fun box(): String { - return A.test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionWithOneDefArg.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionWithOneDefArg.kt deleted file mode 100644 index c905daed1b2..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/extentionFunctionWithOneDefArg.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun Int.foo(a: Int = 1, b: String): Int { - return a -} - -fun box(): String { - if (1.foo(b = "b") != 1) return "fail" - if (1.foo(2, "b") != 2) return "fail" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/funInTrait.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/funInTrait.kt deleted file mode 100644 index 06b181e10b6..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/funInTrait.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface Foo { - fun foo(a: Double = 1.0): Double -} - -class FooImpl : Foo { - override fun foo(a: Double): Double { - return a - } -} -fun box(): String { - if (FooImpl().foo() != 1.0) return "fail" - if (FooImpl().foo(2.0) != 2.0) return "fail" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunction.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunction.kt deleted file mode 100644 index 35a3e575fe4..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunction.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - fun Int.foo(a: Int = 1): Int { - return a - } - - fun test(): String { - if (1.foo() != 1) return "fail" - if (1.foo(2) != 2) return "fail" - return "OK" - } -} - -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDouble.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDouble.kt deleted file mode 100644 index a18b571e32b..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDouble.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - fun Double.foo(a: Double = 1.0): Double { - return a - } - - fun test(): String { - if (1.0.foo() != 1.0) return "fail" - if (1.0.foo(2.0) != 2.0) return "fail" - return "OK" - } -} - -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt deleted file mode 100644 index 844f5e88ef4..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double { - return a + b - } - - fun test(): String { - if (1.0.foo() != 2.0) return "fail" - if (1.0.foo(2.0, 2.0) != 4.0) return "fail" - if (1.0.foo(a = 2.0) != 3.0) return "fail" - if (1.0.foo(b = 2.0) != 3.0) return "fail" - return "OK" - } -} - -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt deleted file mode 100644 index 3ed1be3d6c4..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt +++ /dev/null @@ -1,211 +0,0 @@ -class A { - fun Int.foo(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" - } - - fun String.bar(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + - "$gg $hh $ii $jj $kk $ll $mm $nn" - } - - fun Char.baz(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40, - oo: Int = 41, - pp: Int = 42, - qq: Int = 43, - rr: Int = 44, - ss: Int = 45, - tt: Int = 46, - uu: Int = 47, - vv: Int = 48, - ww: Int = 49, - xx: Int = 50, - yy: Int = 51, - zz: Int = 52, - aaa: Int = 53, - bbb: Int = 54, - ccc: Int = 55, - ddd: Int = 56, - eee: Int = 57, - fff: Int = 58, - ggg: Int = 59, - hhh: Int = 60, - iii: Int = 61, - jjj: Int = 62, - kkk: Int = 63, - lll: Int = 64, - mmm: Int = 65, - nnn: Int = 66, - ooo: Int = 67, - ppp: Int = 68, - qqq: Int = 69, - rrr: Int = 70): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + - "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + - "$mmm $nnn $ooo $ppp $qqq $rrr" - } - - fun test(): String { - val test1 = 1.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) - val test2 = 1.foo() - val test3 = 1.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, - u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) - if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { - return "test1 = $test1" - } - if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { - return "test2 = $test2" - } - if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test3 = $test3" - } - - val test4 = "".bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) - val test5 = "".bar() - val test6 = "".bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, - w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, - jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) - if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { - return "test4 = $test4" - } - if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { - return "test5 = $test5" - } - if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test6 = $test6" - } - - val test7 = 'a'.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) - val test8 = 'a'.baz() - val test9 = 'a'.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, - 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, - uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, - ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) - if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + - "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { - return "test7 = $test7" - } - if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + - "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { - return "test8 = $test8" - } - if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + - "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test9 = $test9" - } - - return "OK" - } -} - -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/kt5232.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/kt5232.kt deleted file mode 100644 index 8b91d2bd2d5..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/kt5232.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface A { - fun visit(a:String, b:String="") : String = b + a -} - -class B : A { - override fun visit(a:String, b:String) : String = b + a -} - -fun box(): String { - val result = B().visit("K", "O") - if (result != "OK") return "fail $result" - - return B().visit("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/memberFunctionManyArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/memberFunctionManyArgs.kt deleted file mode 100644 index def2549e106..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/memberFunctionManyArgs.kt +++ /dev/null @@ -1,208 +0,0 @@ -class A() { - fun foo(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" - } - - fun bar(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + - "$gg $hh $ii $jj $kk $ll $mm $nn" - } - - fun baz(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40, - oo: Int = 41, - pp: Int = 42, - qq: Int = 43, - rr: Int = 44, - ss: Int = 45, - tt: Int = 46, - uu: Int = 47, - vv: Int = 48, - ww: Int = 49, - xx: Int = 50, - yy: Int = 51, - zz: Int = 52, - aaa: Int = 53, - bbb: Int = 54, - ccc: Int = 55, - ddd: Int = 56, - eee: Int = 57, - fff: Int = 58, - ggg: Int = 59, - hhh: Int = 60, - iii: Int = 61, - jjj: Int = 62, - kkk: Int = 63, - lll: Int = 64, - mmm: Int = 65, - nnn: Int = 66, - ooo: Int = 67, - ppp: Int = 68, - qqq: Int = 69, - rrr: Int = 70): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + - "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + - "$mmm $nnn $ooo $ppp $qqq $rrr" - } -} - -fun box(): String { - val a = A() - val test1 = a.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) - val test2 = a.foo() - val test3 = a.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, - u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) - if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { - return "test1 = $test1" - } - if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { - return "test2 = $test2" - } - if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test3 = $test3" - } - - val test4 = a.bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) - val test5 = a.bar() - val test6 = a.bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, - w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, - jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) - if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { - return "test4 = $test4" - } - if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { - return "test5 = $test5" - } - if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test6 = $test6" - } - - val test7 = a.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) - val test8 = a.baz() - val test9 = a.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, - 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, - uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, - ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) - if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + - "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { - return "test7 = $test7" - } - if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + - "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { - return "test8 = $test8" - } - if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + - "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test9 = $test9" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/mixingNamedAndPositioned.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/mixingNamedAndPositioned.kt deleted file mode 100644 index 7b3aebeec18..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/mixingNamedAndPositioned.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun foo(a: String = "Companion", b: Int = 1, c: Long = 2): String { - return "$a $b $c" -} - -fun box(): String { - val test1 = foo("test1", 2, c = 3) - if (test1 != "test1 2 3") return test1 - - val test2 = foo("test2", c = 3) - if (test2 != "test2 1 3") return test2 - - val test3 = foo("test3", b = 3) - if (test3 != "test3 3 2") return test3 - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/topLevelManyArgs.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/topLevelManyArgs.kt deleted file mode 100644 index 1086f23b45f..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/topLevelManyArgs.kt +++ /dev/null @@ -1,205 +0,0 @@ -fun foo(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" -} - -fun bar(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + - "$gg $hh $ii $jj $kk $ll $mm $nn" -} - -fun baz(a: Int = 1, - b: Int = 2, - c: Int = 3, - d: Int = 4, - e: Int = 5, - f: Int = 6, - g: Int = 7, - h: Int = 8, - i: Int = 9, - j: Int = 10, - k: Int = 11, - l: Int = 12, - m: Int = 13, - n: Int = 14, - o: Int = 15, - p: Int = 16, - q: Int = 17, - r: Int = 18, - s: Int = 19, - t: Int = 20, - u: Int = 21, - v: Int = 22, - w: Int = 23, - x: Int = 24, - y: Int = 25, - z: Int = 26, - aa: Int = 27, - bb: Int = 28, - cc: Int = 29, - dd: Int = 30, - ee: Int = 31, - ff: Int = 32, - gg: Int = 33, - hh: Int = 34, - ii: Int = 35, - jj: Int = 36, - kk: Int = 37, - ll: Int = 38, - mm: Int = 39, - nn: Int = 40, - oo: Int = 41, - pp: Int = 42, - qq: Int = 43, - rr: Int = 44, - ss: Int = 45, - tt: Int = 46, - uu: Int = 47, - vv: Int = 48, - ww: Int = 49, - xx: Int = 50, - yy: Int = 51, - zz: Int = 52, - aaa: Int = 53, - bbb: Int = 54, - ccc: Int = 55, - ddd: Int = 56, - eee: Int = 57, - fff: Int = 58, - ggg: Int = 59, - hhh: Int = 60, - iii: Int = 61, - jjj: Int = 62, - kkk: Int = 63, - lll: Int = 64, - mmm: Int = 65, - nnn: Int = 66, - ooo: Int = 67, - ppp: Int = 68, - qqq: Int = 69, - rrr: Int = 70): String { - return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + - "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + - "$mmm $nnn $ooo $ppp $qqq $rrr" -} - -fun box(): String { - val test1 = foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) - val test2 = foo() - val test3 = foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, - u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) - if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { - return "test1 = $test1" - } - if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { - return "test2 = $test2" - } - if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test3 = $test3" - } - - val test4 = bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) - val test5 = bar() - val test6 = bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, - w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, - jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) - if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { - return "test4 = $test4" - } - if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { - return "test5 = $test5" - } - if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test6 = $test6" - } - - val test7 = baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) - val test8 = baz() - val test9 = baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, - 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, - uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, - ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) - if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + - "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { - return "test7 = $test7" - } - if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + - "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { - return "test8 = $test8" - } - if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + - "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { - return "test9 = $test9" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/function/trait.kt b/backend.native/tests/external/codegen/box/defaultArguments/function/trait.kt deleted file mode 100644 index 91bafe072f3..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/function/trait.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface Base { - fun bar(a: String = "abc"): String = a + " from interface" -} - -class Derived: Base { - override fun bar(a: String): String = a + " from class" -} - -fun box(): String { - val result = Derived().bar() - if (result != "abc from class") return "Fail: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/implementedByFake.kt b/backend.native/tests/external/codegen/box/defaultArguments/implementedByFake.kt deleted file mode 100644 index b29a016f166..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/implementedByFake.kt +++ /dev/null @@ -1,40 +0,0 @@ -// IGNORE_BACKEND: JVM - -interface I { - val prop: T - - fun f(x: String = "1"): String - - fun g(x: String = "2"): String - - fun h(x: T = prop): T -} - -open class A { - open fun f(x: String) = x - - open fun g(x: T) = x - - open fun h(x: String) = x -} - -class B : A(), I { - override val prop - get() = "3" -} - -fun box(): String { - val i: I = B() - var result = i.f() + i.g() + i.h() - if (result != "123") return "fail1: $result" - - val b = B() - result = b.f() + b.g() + b.h() - if (result != "123") return "fail2: $result" - - val a: A = B() - result = a.f("q") + a.g("w") + a.h("e") - if (result != "qwe") return "fail3: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt b/backend.native/tests/external/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt deleted file mode 100644 index b74007df30e..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface I { - fun foo(x: Int = 23): String -} - -abstract class Base : I - -class C : Base(), I { - override fun foo(x: Int) = "C:$x" -} - -fun box(): String { - val x: I = C() - val r = x.foo() + ";" + x.foo(42) - if (r != "C:23;C:42") return "fail: $r" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/kt6382.kt b/backend.native/tests/external/codegen/box/defaultArguments/kt6382.kt deleted file mode 100644 index 07910e2cf12..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/kt6382.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - return if (A().run() == "Aabc") "OK" else "fail" -} - -public class A { - fun run() = - with ("abc") { - show() - } - - private fun String.show(p: Boolean = false): String = getName() + this - - private fun getName() = "A" -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/private/memberExtensionFunction.kt b/backend.native/tests/external/codegen/box/defaultArguments/private/memberExtensionFunction.kt deleted file mode 100644 index 01167805ef4..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/private/memberExtensionFunction.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - private fun Int.foo(other: Int = 5): Int = this + other - - inner class B { - fun bar() = 37.foo() - } -} - -fun box() = if (A().B().bar() == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/defaultArguments/private/memberFunction.kt b/backend.native/tests/external/codegen/box/defaultArguments/private/memberFunction.kt deleted file mode 100644 index 64fe7c2de65..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/private/memberFunction.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-5786 NoSuchMethodError: no accessor for private fun with default arguments - -class A { - private fun foo(result: String = "OK"): String = result - - companion object { - fun bar() = A().foo() - } -} - -fun box() = A.bar() diff --git a/backend.native/tests/external/codegen/box/defaultArguments/private/primaryConstructor.kt b/backend.native/tests/external/codegen/box/defaultArguments/private/primaryConstructor.kt deleted file mode 100644 index 7b4ba263678..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/private/primaryConstructor.kt +++ /dev/null @@ -1,16 +0,0 @@ -var state: String = "Fail" - -class A private constructor(x: String = "OK") { - init { - state = x - } - - companion object { - fun foo() = A() - } -} - -fun box(): String { - A.foo() - return state -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/private/secondaryConstructor.kt b/backend.native/tests/external/codegen/box/defaultArguments/private/secondaryConstructor.kt deleted file mode 100644 index ea7569669e5..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/private/secondaryConstructor.kt +++ /dev/null @@ -1,16 +0,0 @@ -var state: String = "Fail" - -class A { - private constructor(x: String = "OK") { - state = x - } - - companion object { - fun foo() = A() - } -} - -fun box(): String { - A.foo() - return state -} diff --git a/backend.native/tests/external/codegen/box/defaultArguments/protected.kt b/backend.native/tests/external/codegen/box/defaultArguments/protected.kt deleted file mode 100644 index be1243f96c6..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/protected.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: Foo.kt - -package foo - -open class Foo() { - protected fun foo(value: Boolean = false) = if (!value) "OK" else "fail5" -} - -// FILE: Bar.kt - -package bar - -import foo.Foo - -class Bar() : Foo() { - fun execute(): String { - return { foo() } () - } -} - -fun box(): String { - return Bar().execute() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt2789.kt b/backend.native/tests/external/codegen/box/defaultArguments/signature/kt2789.kt deleted file mode 100644 index 043b0d071a3..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt2789.kt +++ /dev/null @@ -1,23 +0,0 @@ -interface FooTrait { - fun make(size: Int = 16) : T - - fun makeFromTraitImpl() : T = make() -} - -class FooClass : FooTrait { - override fun make(size: Int): String { - return "$size" - } -} - -fun box(): String { - val explicitParam = FooClass().make(16) - val defaultRes = FooClass().make() - val defaultTraitRes = FooClass().makeFromTraitImpl() - if (explicitParam != defaultRes) return "fail 1: ${explicitParam} != ${defaultRes}" - if (explicitParam != "16") return "fail 2: ${explicitParam}" - - if (explicitParam != defaultTraitRes) return "fail 3: ${explicitParam} != ${defaultTraitRes}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9428.kt b/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9428.kt deleted file mode 100644 index b9d89105d37..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9428.kt +++ /dev/null @@ -1,23 +0,0 @@ -open class Player(val name: String) -open class SlashPlayer(name: String) : Player(name) - -public abstract class Game { - abstract fun getPlayer(name: String, create: Boolean = true): T? -} - -class SimpleGame : Game() { - override fun getPlayer(name: String, create: Boolean): SlashPlayer? { - return if (create) { - SlashPlayer(name) - } - else null - } -} - -fun box(): String { - val player1 = SimpleGame().getPlayer("fail", false) - if (player1 != null) return "fail 1" - - val player2 = SimpleGame().getPlayer("OK") - return player2!!.name -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9924.kt b/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9924.kt deleted file mode 100644 index 8366f26008e..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/signature/kt9924.kt +++ /dev/null @@ -1,13 +0,0 @@ -abstract class A { - abstract fun test(a: T, b:Boolean = false) : String -} - -class B : A() { - override fun test(a: String, b: Boolean): String { - return a - } -} - -fun box(): String { - return B().test("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/defaultArguments/simpleFromOtherFile.kt b/backend.native/tests/external/codegen/box/defaultArguments/simpleFromOtherFile.kt deleted file mode 100644 index e039250e9ef..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/simpleFromOtherFile.kt +++ /dev/null @@ -1,7 +0,0 @@ -// FILE: 1.kt - -fun box() = ok() - -// FILE: 2.kt - -fun ok(res: String = "OK") = res diff --git a/backend.native/tests/external/codegen/box/defaultArguments/superCallCheck.kt b/backend.native/tests/external/codegen/box/defaultArguments/superCallCheck.kt deleted file mode 100644 index 918a68ed0d8..00000000000 --- a/backend.native/tests/external/codegen/box/defaultArguments/superCallCheck.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -open class MyClass { - fun def(i: Int = 0): Int { - return i - } -} - -fun box():String { - val method = MyClass::class.java.getMethod("def\$default", MyClass::class.java, Int::class.java, Int::class.java, Any::class.java) - val result = method.invoke(null, MyClass(), -1, 1, null) - - if (result != 0) return "fail 1: $result" - - var failed = false - try { - method.invoke(null, MyClass(), -1, 1, "fail") - } - catch(e: Exception) { - val cause = e.cause - if (cause is UnsupportedOperationException && cause.message!!.startsWith("Super calls")) { - failed = true - } - } - - return if (!failed) "fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt b/backend.native/tests/external/codegen/box/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt deleted file mode 100644 index b409bd753ab..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt +++ /dev/null @@ -1,15 +0,0 @@ -import kotlin.reflect.KProperty - -// KT-5612 - -class Delegate { - operator fun getValue(thisRef: Any?, prop: KProperty<*>): String { - return "OK" - } -} - -val prop by Delegate() - -val a = prop - -fun box() = a diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/capturePropertyInClosure.kt b/backend.native/tests/external/codegen/box/delegatedProperty/capturePropertyInClosure.kt deleted file mode 100644 index 3c03bc94ca8..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/capturePropertyInClosure.kt +++ /dev/null @@ -1,23 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -class B { - private var value: Int by Delegate() - - public fun test() { - fun foo() { - value = 1 - } - foo() - } -} - -fun box(): String { - B().test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/castGetReturnType.kt b/backend.native/tests/external/codegen/box/delegatedProperty/castGetReturnType.kt deleted file mode 100644 index cc106890792..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/castGetReturnType.kt +++ /dev/null @@ -1,13 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -class AImpl { - val prop: Number by Delegate() -} - -fun box(): String { - return if(AImpl().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/castSetParameter.kt b/backend.native/tests/external/codegen/box/delegatedProperty/castSetParameter.kt deleted file mode 100644 index 3d3e7a7806a..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/castSetParameter.kt +++ /dev/null @@ -1,26 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = Derived() - operator fun getValue(t: Any?, p: KProperty<*>): Derived { - inner = Derived(inner.a + "-get") - return inner - } - operator fun setValue(t: Any?, p: KProperty<*>, i: Base) { inner = Derived(inner.a + "-" + i.a + "-set") } -} - -class A { - var prop: Derived by Delegate() -} - -fun box(): String { - val c = A() - if(c.prop.a != "derived-get") return "fail get ${c.prop.a}" - c.prop = Derived() - if (c.prop.a != "derived-get-derived-set-get") return "fail set ${c.prop.a}" - return "OK" -} - -open class Base(open val a: String = "base") - -class Derived(override val a: String = "derived"): Base() diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateAsInnerClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateAsInnerClass.kt deleted file mode 100644 index 9b503ccce83..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateAsInnerClass.kt +++ /dev/null @@ -1,19 +0,0 @@ -import kotlin.reflect.KProperty - -class A { - var prop: Int by Delegate() - - class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } - } -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByOtherProperty.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateByOtherProperty.kt deleted file mode 100644 index 7ec7f0c9151..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByOtherProperty.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -class A { - val p = Delegate() - var prop: Int by p -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelFun.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelFun.kt deleted file mode 100644 index 5900d71c985..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelFun.kt +++ /dev/null @@ -1,21 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -fun foo() = Delegate() - -class A { - var prop: Int by foo() -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelProperty.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelProperty.kt deleted file mode 100644 index 22f7b1b2ed3..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateByTopLevelProperty.kt +++ /dev/null @@ -1,21 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -val p = Delegate() - -class A { - var prop: Int by p -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtProperty.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtProperty.kt deleted file mode 100644 index 4eac9e2dc73..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtProperty.kt +++ /dev/null @@ -1,14 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: A, p: KProperty<*>): Int = 1 -} - -val A.prop: Int by Delegate() - -class A { -} - -fun box(): String { - return if(A().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt deleted file mode 100644 index 7cdaca652eb..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: F.A, p: KProperty<*>): Int = 1 -} - -class F { - val A.prop: Int by Delegate() - - class A { - } - - fun foo(): Int { - return A().prop - } -} - -fun box(): String { - return if(F().foo() == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/delegateWithPrivateSet.kt b/backend.native/tests/external/codegen/box/delegatedProperty/delegateWithPrivateSet.kt deleted file mode 100644 index d44684bb4c8..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/delegateWithPrivateSet.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME -// See KT-10107: 'Variable must be initialized' for delegate with private set - -class My { - var delegate: String by kotlin.properties.Delegates.notNull() - private set - - init { - delegate = "OK" - } -} - -fun box() = My().delegate diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/extensionDelegatesWithSameNames.kt b/backend.native/tests/external/codegen/box/delegatedProperty/extensionDelegatesWithSameNames.kt deleted file mode 100644 index ec5f37c0536..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/extensionDelegatesWithSameNames.kt +++ /dev/null @@ -1,14 +0,0 @@ -open class C - -object O : C() - -object K : C() - -class D(val value: String) { - operator fun getValue(thisRef: C, property: Any): String = value -} - -val O.prop by D("O") -val K.prop by D("K") - -fun box() = O.prop + K.prop diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt b/backend.native/tests/external/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt deleted file mode 100644 index 1e796085d97..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A(val o: String) - -interface I { - val k: String -} - -inline operator fun A.getValue(thisRef: I, property: Any): String = o + thisRef.k - -class B(override val k: String) : I - -val B.prop by A("O") - -fun box() = B("K").prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegate.kt b/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegate.kt deleted file mode 100644 index f1072a6c339..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegate.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate(var inner: T) { - operator fun getValue(t: Any?, p: KProperty<*>): T = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } -} - -class A { - inner class B { - var prop: Int by Delegate(1) - } -} - -fun box(): String { - val c = A().B() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast1.kt b/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast1.kt deleted file mode 100644 index 8c9fb39c472..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast1.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -import kotlin.reflect.KProperty - -class Delegate(var inner: T) { - operator fun getValue(t: Any?, p: KProperty<*>): T = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } -} - -val del = Delegate("zzz") - -class A { - inner class B { - var prop: String by del - } -} - -inline fun asFailsWithCCE(block: () -> Unit) { - try { - block() - } - catch (e: ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("Should throw ClassCastException, got $e") - } - throw AssertionError("Should throw ClassCastException, no exception thrown") -} - -fun box(): String { - val c = A().B() - - (del as Delegate).inner = 10 - asFailsWithCCE { c.prop } // does not fail in JS due KT-8135. - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast2.kt b/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast2.kt deleted file mode 100644 index 117dbfdba04..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/genericDelegateUncheckedCast2.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: JVM, JS, NATIVE - -import kotlin.reflect.KProperty - -class Delegate(var inner: T) { - operator fun getValue(t: Any?, p: KProperty<*>): T = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } -} - -val del = Delegate("zzz") - -class A { - inner class B { - var prop: String by del - } -} - -inline fun asFailsWithCCE(block: () -> Unit) { - try { - block() - } - catch (e: ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("Should throw ClassCastException, got $e") - } - throw AssertionError("Should throw ClassCastException, no exception thrown") -} - -fun box(): String { - val c = A().B() - - (del as Delegate).inner = null - asFailsWithCCE { c.prop } // does not fail in JVM, JS due KT-8135. - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt b/backend.native/tests/external/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt deleted file mode 100644 index cfcaceb9ebc..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: Var.kt -package pvar - -open class PVar(private var value: T) { - protected operator fun getValue(thisRef: Any?, prop: Any?) = value - - protected operator fun setValue(thisRef: Any?, prop: Any?, newValue: T) { - value = newValue - } -} - -// FILE: test.kt -import pvar.* - -class C : PVar(42L) { - inner class Inner { - var x by this@C - } -} - -fun box(): String { - val inner = C().Inner() - inner.x = 1L - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFun.kt b/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFun.kt deleted file mode 100644 index c08af8aeca2..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFun.kt +++ /dev/null @@ -1,14 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { -} - -operator fun Delegate.getValue(t: Any?, p: KProperty<*>): Int = 1 - -class A { - val prop: Int by Delegate() -} - -fun box(): String { - return if(A().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFunInClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFunInClass.kt deleted file mode 100644 index 653c844066e..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/getAsExtensionFunInClass.kt +++ /dev/null @@ -1,13 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { -} - -class A { - operator fun Delegate.getValue(t: Any?, p: KProperty<*>): Int = 1 - val prop: Int by Delegate() -} - -fun box(): String { - return if(A().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt b/backend.native/tests/external/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt deleted file mode 100644 index d897d52b0b4..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -// No kotlin-reflect.jar in this test -// WITH_RUNTIME - -import kotlin.reflect.KProperty - -object Delegate { - operator fun getValue(instance: Any?, property: KProperty<*>) = "" -} - -val foo: String by Delegate - -fun box(): String { - try { - ::foo.getDelegate() - return "Fail: error should have been thrown" - } - catch (e: KotlinReflectionNotSupportedError) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/inClassVal.kt b/backend.native/tests/external/codegen/box/delegatedProperty/inClassVal.kt deleted file mode 100644 index 0878fe18868..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/inClassVal.kt +++ /dev/null @@ -1,13 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -class A { - val prop: Int by Delegate() -} - -fun box(): String { - return if(A().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/inClassVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/inClassVar.kt deleted file mode 100644 index 4541763a721..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/inClassVar.kt +++ /dev/null @@ -1,19 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -class A { - var prop: Int by Delegate() -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/inTrait.kt b/backend.native/tests/external/codegen/box/delegatedProperty/inTrait.kt deleted file mode 100644 index 10a1746e561..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/inTrait.kt +++ /dev/null @@ -1,17 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -interface A { - val prop: Int -} - -class AImpl: A { - override val prop: Int by Delegate() -} - -fun box(): String { - return if(AImpl().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/inferredPropertyType.kt b/backend.native/tests/external/codegen/box/delegatedProperty/inferredPropertyType.kt deleted file mode 100644 index 50d8ad91411..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/inferredPropertyType.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate(var inner: T) { - operator fun getValue(t: Any?, p: KProperty<*>): T = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } -} - -class A { - inner class B { - var prop by Delegate(1) - } -} - -fun box(): String { - val c = A().B() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/kt4138.kt b/backend.native/tests/external/codegen/box/delegatedProperty/kt4138.kt deleted file mode 100644 index ebc8032374e..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/kt4138.kt +++ /dev/null @@ -1,39 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate(var inner: T) { - operator fun getValue(t: Any?, p: KProperty<*>): T = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } -} - - -class Foo (val f: Int) { - @kotlin.native.ThreadLocal - companion object { - val A: Foo by Delegate(Foo(11)) - var B: Foo by Delegate(Foo(11)) - } -} - -interface FooTrait { - @kotlin.native.ThreadLocal - companion object { - val A: Foo by Delegate(Foo(11)) - var B: Foo by Delegate(Foo(11)) - } -} - -fun box() : String { - if (Foo.A.f != 11) return "fail 1" - if (Foo.B.f != 11) return "fail 2" - - Foo.B = Foo(12) - if (Foo.B.f != 12) return "fail 3" - - if (FooTrait.A.f != 11) return "fail 4" - if (FooTrait.B.f != 11) return "fail 5" - - FooTrait.B = Foo(12) - if (FooTrait.B.f != 12) return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/kt6722.kt b/backend.native/tests/external/codegen/box/delegatedProperty/kt6722.kt deleted file mode 100644 index f680293e6dc..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/kt6722.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -interface T { -} - -fun box(): String { - val a = "OK" - val t = object : T { - val foo by lazy { - a - } - } - return t.foo -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/kt9712.kt b/backend.native/tests/external/codegen/box/delegatedProperty/kt9712.kt deleted file mode 100644 index dd4f6cf1945..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/kt9712.kt +++ /dev/null @@ -1,24 +0,0 @@ -// WITH_RUNTIME - -import kotlin.properties.Delegates - -object X { - public var O: String - by Delegates.observable("O") { prop, old, new -> } - private set -} - -open class A { - public var K: String - by Delegates.observable("") { prop, old, new -> } - protected set -} - -class B : A() { - init { - K = "K" - } -} - -fun box(): String = - X.O + B().K diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVal.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVal.kt deleted file mode 100644 index 52a0de0cd68..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVal.kt +++ /dev/null @@ -1,14 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -inline fun run(f: () -> T) = f() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -fun box(): String { - val prop: Int by Delegate() - return run { if (prop == 1) "OK" else "fail" } -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt deleted file mode 100644 index bb21f1e3b52..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt +++ /dev/null @@ -1,14 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -fun run(f: () -> T) = f() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -fun box(): String { - val prop: Int by Delegate() - return run { if (prop == 1) "OK" else "fail" } -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVar.kt deleted file mode 100644 index d655e965ab1..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVar.kt +++ /dev/null @@ -1,20 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -inline fun run(f: () -> T) = f() - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { - inner = i - } -} - -fun box(): String { - var prop: Int by Delegate() - run { prop = 2 } - if (prop != 2) return "fail get" - return run { if (prop != 2) "fail set" else "OK" } -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt deleted file mode 100644 index 8ac07a3f364..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt +++ /dev/null @@ -1,20 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -fun run(f: () -> T) = f() - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { - inner = i - } -} - -fun box(): String { - var prop: Int by Delegate() - run { prop = 2 } - if (prop != 2) return "fail get" - return run { if (prop != 2) "fail set" else "OK" } -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineGetValue.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineGetValue.kt deleted file mode 100644 index 80a60fd6e61..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineGetValue.kt +++ /dev/null @@ -1,12 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - inline operator fun getValue(t: Any?, p: KProperty<*>): String = p.name -} - -fun box(): String { - val OK: String by Delegate() - return OK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineOperators.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineOperators.kt deleted file mode 100644 index 98198d4acd4..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/inlineOperators.kt +++ /dev/null @@ -1,19 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - inline operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - inline operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { - inner = i - } -} - -fun box(): String { - var prop: Int by Delegate() - if (prop != 1) return "fail get" - prop = 2 - if (prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt12891.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/kt12891.kt deleted file mode 100644 index 683c4fca841..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt12891.kt +++ /dev/null @@ -1,5 +0,0 @@ -//WITH_RUNTIME -fun box(): String { - val x by lazy { "OK" } - return x -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt13557.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/kt13557.kt deleted file mode 100644 index dd49cb336dd..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt13557.kt +++ /dev/null @@ -1,14 +0,0 @@ -//WITH_REFLECT - -import kotlin.properties.Delegates - -fun box(): String { - var foo: String by Delegates.notNull(); - - object { - fun baz() { - foo = "OK" - } - }.baz() - return foo -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt16864.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/kt16864.kt deleted file mode 100644 index 99b3011a5c4..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt16864.kt +++ /dev/null @@ -1,13 +0,0 @@ - -object Whatever { - operator fun getValue(thisRef: Any?, prop: Any?) = "OK" -} - -fun box(): String { - val key by Whatever - return { - object { - val keys = key - }.keys - } () -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt19690.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/kt19690.kt deleted file mode 100644 index 03821c10db8..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/kt19690.kt +++ /dev/null @@ -1,17 +0,0 @@ -//WITH_REFLECT - -import kotlin.properties.Delegates - -interface MyInterface { - fun something(): String { - var foo: String by Delegates.notNull(); - foo = "OK" - return foo - } -} - -fun box(): String { - return object : MyInterface { - - }.something() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVal.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/localVal.kt deleted file mode 100644 index cd3f7178453..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVal.kt +++ /dev/null @@ -1,12 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -fun box(): String { - val prop: Int by Delegate() - return if (prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/localValNoExplicitType.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/localValNoExplicitType.kt deleted file mode 100644 index 20e86275732..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/localValNoExplicitType.kt +++ /dev/null @@ -1,12 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -fun box(): String { - val prop by Delegate() - return if (prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/localVar.kt deleted file mode 100644 index 606bc60c871..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVar.kt +++ /dev/null @@ -1,19 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { - inner = i - } -} - -fun box(): String { - var prop: Int by Delegate() - if (prop != 1) return "fail get" - prop = 2 - if (prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt b/backend.native/tests/external/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt deleted file mode 100644 index b9e51893775..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt +++ /dev/null @@ -1,19 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { - inner = i - } -} - -fun box(): String { - var prop by Delegate() - if (prop != 1) return "fail get" - prop = 2 - if (prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/privateSetterKPropertyIsNotMutable.kt b/backend.native/tests/external/codegen/box/delegatedProperty/privateSetterKPropertyIsNotMutable.kt deleted file mode 100644 index 41ac519cecc..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/privateSetterKPropertyIsNotMutable.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.KMutableProperty -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -object Delegate { - operator fun getValue(thiz: My, property: KProperty<*>): String { - if (property !is KMutableProperty<*>) return "Fail: property is not a KMutableProperty" - property as KMutableProperty1 - - try { - property.set(thiz, "") - return "Fail: property.set should cause IllegalCallableAccessException" - } - catch (e: IllegalCallableAccessException) { - // OK - } - - property.isAccessible = true - property.set(thiz, "") - - return "OK" - } - - operator fun setValue(thiz: My, property: KProperty<*>, value: String) { - } -} - -class My { - var delegate: String by Delegate - private set -} - -fun box() = My().delegate diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/privateVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/privateVar.kt deleted file mode 100644 index 33faef3e3b1..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/privateVar.kt +++ /dev/null @@ -1,22 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -class A { - private var prop: Int by Delegate() - - fun test(): String { - if(prop != 1) return "fail get" - prop = 2 - if (prop != 2) return "fail set" - return "OK" - } -} - -fun box(): String { - return A().test() -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt b/backend.native/tests/external/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt deleted file mode 100644 index e6a328dd6a8..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.util.IdentityHashMap -import kotlin.reflect.KProperty - -class A { - var foo: Int by IntHandler - - companion object { - var bar: Any? by AnyHandler - } -} - -val baz: String by StringHandler - - - -val metadatas = IdentityHashMap, Unit>() - -fun record(p: KProperty<*>) = metadatas.put(p, Unit) - -object IntHandler { - operator fun getValue(t: Any?, p: KProperty<*>): Int { record(p); return 42 } - operator fun setValue(t: Any?, p: KProperty<*>, value: Int) { record(p) } -} - -object AnyHandler { - operator fun getValue(t: Any?, p: KProperty<*>): Any? { record(p); return 3.14 } - operator fun setValue(t: Any?, p: KProperty<*>, value: Any?) { record(p) } -} - -object StringHandler { - operator fun getValue(t: Any?, p: KProperty<*>): String { record(p); return p.name } - operator fun setValue(t: Any?, p: KProperty<*>, value: String) { record(p) } -} - -fun box(): String { - val a = A() - a.foo = 42 - a.foo = a.foo + baz.length - a.foo = 239 - A.bar = baz + a.foo - baz + A.bar - - if (metadatas.keys.size != 3) - return "Fail: only three instances of KProperty should have been created\n${metadatas.keys}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt b/backend.native/tests/external/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt deleted file mode 100644 index 76bb953d48f..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.properties.Delegates - -open class A { - protected var value: T by Delegates.notNull() - private set -} - -class B : A() - -fun box(): String { - B() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/differentReceivers.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/differentReceivers.kt deleted file mode 100644 index 990b7d63455..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/differentReceivers.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -class MyClass(val value: String) - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun MyClass.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf(${this.value});") { this.value } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -val testO by runLogged("O;") { MyClass("O") } -val testK by runLogged("K;") { "K" } -val testOK = runLogged("OK;") { testO + testK } - -fun box(): String { - assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrder.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrder.kt deleted file mode 100644 index c837b248604..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrder.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -val testO by runLogged("O;") { "O" } -val testK by runLogged("K;") { "K" } -val testOK = runLogged("OK;") { testO + testK } - -fun box(): String { - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrderVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrderVar.kt deleted file mode 100644 index e31915c332d..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/evaluationOrderVar.kt +++ /dev/null @@ -1,38 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -val dispatcher = hashMapOf() - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String { - dispatcher[this] = this - return runLogged("tdf($this);") { this } -} - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get(${dispatcher[this]});") { dispatcher[this]!! } - -operator fun String.setValue(receiver: Any?, p: Any, newValue: String) { - dispatcher[this] = newValue - runLogged("set(${dispatcher[this]});") { dispatcher[this]!! } -} - -var testO by runLogged("K;") { "K" } -var testK by runLogged("O;") { "O" } -val testOK = runLogged("OK;") { - testO = "O" - testK = "K" - testO + testK -} - -fun box(): String { - assertEquals("K;tdf(K);O;tdf(O);OK;set(O);set(K);get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/extensionDelegated.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/extensionDelegated.kt deleted file mode 100644 index f44e553e7f7..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/extensionDelegated.kt +++ /dev/null @@ -1,16 +0,0 @@ -import kotlin.reflect.KProperty - -var log = "" - -class UserDataProperty(val key: String) { - operator fun getValue(thisRef: R, desc: KProperty<*>) = thisRef.toString() + key - - operator fun setValue(thisRef: R, desc: KProperty<*>, value: String?) { log += "set"} -} - - -var String.calc: String by UserDataProperty("K") - -fun box(): String { - return "O".calc -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/generic.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/generic.kt deleted file mode 100644 index 36ec4bb9508..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/generic.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -open class MyClass(val value: String) { - override fun toString(): String { - return value - } -} - -inline fun runLogged(entry: String, action: () -> L): L { - log += entry - return action() -} - -operator fun P.provideDelegate(host: Any?, p: Any): P = - runLogged("tdf(${this.value});") { this } - -operator fun V.getValue(receiver: Any?, p: Any): V = - runLogged("get($this);") { this } - -val testO by runLogged("O;") { MyClass("O") } -val testK by runLogged("K;") { "K" } -val testOK = runLogged("OK;") { testO.value + testK } - -fun box(): String { - assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt deleted file mode 100644 index 788f19e57d0..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt +++ /dev/null @@ -1,14 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate(val value: String) { - operator fun provideDelegate(instance: A, property: KProperty<*>): Delegate = Delegate(instance.value) - operator fun getValue(instance: Any?, property: KProperty<*>) = value -} - -class A(val value: String) { - val result: String by Delegate("Fail") -} - -fun box(): String { - return A("OK").result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inClass.kt deleted file mode 100644 index e1456a8bd0f..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inClass.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -class Test { - val testO by runLogged("O;") { "O" } - val testK by runLogged("K;") { "K" } - val testOK = runLogged("OK;") { testO + testK } -} - -fun box(): String { - assertEquals("", log) - val test = Test() - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return test.testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inlineProvideDelegate.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inlineProvideDelegate.kt deleted file mode 100644 index 3ce685006b0..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/inlineProvideDelegate.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -inline operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -val testO by runLogged("O;") { "O" } -val testK by runLogged("K;") { "K" } -val testOK = runLogged("OK;") { testO + testK } - -fun box(): String { - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/jvmStaticInObject.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/jvmStaticInObject.kt deleted file mode 100644 index 4ed34e5382c..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/jvmStaticInObject.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -// IGNORE_BACKEND: JS, NATIVE - -import kotlin.test.* - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -object Test { - fun foo() {} - @JvmStatic val testO by runLogged("O;") { "O" } - @JvmStatic val testK by runLogged("K;") { "K" } - @JvmStatic val testOK = runLogged("OK;") { testO + testK } -} - -fun box(): String { - assertEquals("", log) - Test.foo() - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return Test.testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt15437.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt15437.kt deleted file mode 100644 index 85d54e3cc18..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt15437.kt +++ /dev/null @@ -1,12 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate = this - operator fun getValue(instance: Any?, property: KProperty<*>) = "OK" -} - -val result: String by Delegate() - -fun box(): String { - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt16441.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt16441.kt deleted file mode 100644 index 1e93734c254..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt16441.kt +++ /dev/null @@ -1,16 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun provideDelegate(thisRef: Any?, property: KProperty<*>) = this - operator fun getValue(thisRef: Any?, property: KProperty<*>) = "OK" -} - -class TestClass { - companion object { - val test by Delegate() - } -} - -fun box(): String { - return TestClass.test -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt18902.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt18902.kt deleted file mode 100644 index 9b20ca39800..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/kt18902.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -import kotlin.properties.ReadOnlyProperty -import kotlin.reflect.KProperty - -class Delegate: ReadOnlyProperty { - override fun getValue(thisRef: Test, property: KProperty<*>) = "OK" -} - -class Provider { - operator fun provideDelegate(thisRef: Test, property: KProperty<*>) = Delegate() -} - -class Test { - companion object { - val instance = Test() - } - - val message by Provider() -} - -fun box() = Test.instance.message \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/local.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/local.kt deleted file mode 100644 index e010f9f1242..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/local.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -fun box(): String { - val testO by runLogged("O;") { "O" } - val testK by runLogged("K;") { "K" } - val testOK = runLogged("OK;") { testO + testK } - - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt deleted file mode 100644 index 1018b841950..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf($this);") { this } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - -fun box(): String { - val testO by runLogged("O;") { "O" } - val testK by runLogged("K;") { "K" } - val testOK = runLogged("OK;") { testO + testK } - - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt deleted file mode 100644 index 387236a5640..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -var log: String = "" - -class MyClass(val value: String) - -fun runLogged(entry: String, action: () -> String): String { - log += entry - return action() -} - -fun runLogged2(entry: String, action: () -> MyClass): MyClass { - log += entry - return action() -} - -operator fun MyClass.provideDelegate(host: Any?, p: Any): String = - runLogged("tdf(${this.value});") { this.value } - -operator fun String.getValue(receiver: Any?, p: Any): String = - runLogged("get($this);") { this } - - -fun box(): String { - val testO by runLogged2("O;") { MyClass("O") } - val testK by runLogged("K;") { "K" } - val testOK = runLogged("OK;") { testO + testK } - - assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) - return testOK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/memberExtension.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/memberExtension.kt deleted file mode 100644 index 7cfa5f86b0c..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/memberExtension.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -object Host { - class StringDelegate(val s: String) { - operator fun getValue(receiver: String, p: Any) = receiver + s - } - - operator fun String.provideDelegate(host: Any?, p: Any) = StringDelegate(this) - - val String.plusK by "K" - - val ok = "O".plusK -} - -fun box(): String = Host.ok \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt b/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt deleted file mode 100644 index 549b1b249e4..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* -import kotlin.reflect.KProperty - -var log: String = "" - -inline fun runLogged(entry: String, action: () -> T): T { - log += entry - return action() -} - -operator fun String.provideDelegate(host: Any?, p: KProperty<*>): String = - if (p.name == this) runLogged("tdf($this);") { this } else "fail 1" - -operator fun String.getValue(receiver: Any?, p: KProperty<*>): String = - if (p.name == this) runLogged("get($this);") { this } else "fail 2" - -val O by runLogged("O;") { "O" } -val K by runLogged("K;") { "K" } -val OK = runLogged("OK;") { O + K } - -fun box(): String { - assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) - return OK -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFun.kt b/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFun.kt deleted file mode 100644 index 69924d135ff..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFun.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner -} - -operator fun Delegate.setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } - -class A { - var prop: Int by Delegate() -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFunInClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFunInClass.kt deleted file mode 100644 index ef2ddccf0f6..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/setAsExtensionFunInClass.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner -} - -class A { - operator fun Delegate.setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } - - var prop: Int by Delegate() -} - -fun box(): String { - val c = A() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/stackOverflowOnCallFromGetValue.kt b/backend.native/tests/external/codegen/box/delegatedProperty/stackOverflowOnCallFromGetValue.kt deleted file mode 100644 index 6e1dd50372e..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/stackOverflowOnCallFromGetValue.kt +++ /dev/null @@ -1,57 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.InvocationTargetException -import kotlin.reflect.* - -object Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String { - (p as? KProperty0)?.get() - (p as? KProperty1)?.get(O) - (p as? KProperty2)?.get(O, O) - return "Fail" - } - - operator fun setValue(t: Any?, p: KProperty<*>, v: String) { - (p as? KMutableProperty0)?.set(v) - (p as? KMutableProperty1)?.set(O, v) - (p as? KMutableProperty2)?.set(O, O, v) - } -} - -var topLevel: String by Delegate -object O { - var member: String by Delegate - var O.memExt: String by Delegate -} - -fun check(lambda: () -> Unit) { - try { - lambda() - } catch (e: Throwable) { - if (e !is InvocationTargetException && e !is StackOverflowError) { - throw RuntimeException("The current implementation uses reflection to get the value of the property," + - "so either InvocationTargetException or StackOverflowError should have happened", - e) - } - return - } - throw AssertionError("Getting the property value with .get() from getValue() or setting it with .set() in setValue() " + - "is effectively an endless recursion and should fail") -} - -fun box(): String { - check { topLevel } - check { topLevel = "" } - check { O.member } - check { O.member = "" } - with (O) { - check { O.memExt } - check { O.memExt = "" } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVal.kt b/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVal.kt deleted file mode 100644 index e28913fabbe..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVal.kt +++ /dev/null @@ -1,11 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -val prop: Int by Delegate() - -fun box(): String { - return if(prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVar.kt b/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVar.kt deleted file mode 100644 index 688405e32de..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/topLevelVar.kt +++ /dev/null @@ -1,16 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -var prop: Int by Delegate() - -fun box(): String { - if(prop != 1) return "fail get" - prop = 2 - if (prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/twoPropByOneDelegete.kt b/backend.native/tests/external/codegen/box/delegatedProperty/twoPropByOneDelegete.kt deleted file mode 100644 index d73aadaf604..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/twoPropByOneDelegete.kt +++ /dev/null @@ -1,22 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate(val f: (T) -> Int) { - operator fun getValue(t: T, p: KProperty<*>): Int = f(t) -} - -val p = Delegate { t -> t.foo() } - -class A(val i: Int) { - val prop: Int by p - - fun foo(): Int { - return i - } -} - -fun box(): String { - if(A(1).prop != 1) return "fail get1" - if(A(10).prop != 10) return "fail get2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/useKPropertyLater.kt b/backend.native/tests/external/codegen/box/delegatedProperty/useKPropertyLater.kt deleted file mode 100644 index 6f09d50151e..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/useKPropertyLater.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_REFLECT - -import kotlin.reflect.* - -val properties = HashSet>() - -object Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String { - properties.add(p) - return "" - } - - operator fun setValue(t: Any?, p: KProperty<*>, v: String) { - properties.add(p) - } -} - -var topLevel: String by Delegate -object O { - var member: String by Delegate - var O.memExt: String by Delegate -} - -fun box(): String { - topLevel = "" - O.member = "" - with (O) { - O.memExt = "" - } - - for (p in HashSet(properties)) { - // None of these should fail - - (p as? KProperty0)?.get() - (p as? KProperty1)?.get(O) - (p as? KProperty2)?.get(O, O) - - (p as? KMutableProperty0)?.set("") - (p as? KMutableProperty1)?.set(O, "") - (p as? KMutableProperty2)?.set(O, O, "") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/useReflectionOnKProperty.kt b/backend.native/tests/external/codegen/box/delegatedProperty/useReflectionOnKProperty.kt deleted file mode 100644 index ac69d29fe35..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/useReflectionOnKProperty.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String { - p.parameters - p.returnType - p.annotations - return p.toString() - } -} - -val prop: String by Delegate() - -fun box() = if (prop == "val prop: kotlin.String") "OK" else "Fail: $prop" diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/valInInnerClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/valInInnerClass.kt deleted file mode 100644 index 43cda384acc..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/valInInnerClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 -} - -class A { - inner class B { - val prop: Int by Delegate() - } -} - -fun box(): String { - return if(A().B().prop == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/delegatedProperty/varInInnerClass.kt b/backend.native/tests/external/codegen/box/delegatedProperty/varInInnerClass.kt deleted file mode 100644 index 4b99bb19003..00000000000 --- a/backend.native/tests/external/codegen/box/delegatedProperty/varInInnerClass.kt +++ /dev/null @@ -1,21 +0,0 @@ -import kotlin.reflect.KProperty - -class Delegate { - var inner = 1 - operator fun getValue(t: Any?, p: KProperty<*>): Int = inner - operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } -} - -class A { - inner class B { - var prop: Int by Delegate() - } -} - -fun box(): String { - val c = A().B() - if(c.prop != 1) return "fail get" - c.prop = 2 - if (c.prop != 2) return "fail set" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/delegation/delegationToVal.kt b/backend.native/tests/external/codegen/box/delegation/delegationToVal.kt deleted file mode 100644 index 4abbca2775a..00000000000 --- a/backend.native/tests/external/codegen/box/delegation/delegationToVal.kt +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -interface IActing { - fun act(): String -} - -class CActing(val value: String = "OK") : IActing { - override fun act(): String = value -} - -// final so no need in delegate field -class Test(val acting: CActing = CActing()) : IActing by acting { -} - -// even if open so we don't need delegate field -open class Test2(open val acting: CActing = CActing()) : IActing by acting { -} - -// even if open the backing field is final, so we don't need delegate field -class Test3() : Test2() { - override val acting = CActing("OKOK") -} - -fun box(): String { - try { - Test::class.java.getDeclaredField("\$\$delegate_0") - return "\$\$delegate_0 field generated for class Test but should not" - } - catch (e: NoSuchFieldException) { - // ok - } - - try { - Test2::class.java.getDeclaredField("\$\$delegate_0") - return "\$\$delegate_0 field generated for class Test but should not" - } - catch (e: NoSuchFieldException) { - // ok - } - - if (Test3().acting.act() != "OKOK") return "Fail Test3" - - val test = Test() - return test.act() -} diff --git a/backend.native/tests/external/codegen/box/delegation/delegationWithPrivateConstructor.kt b/backend.native/tests/external/codegen/box/delegation/delegationWithPrivateConstructor.kt deleted file mode 100644 index 448cbec7c35..00000000000 --- a/backend.native/tests/external/codegen/box/delegation/delegationWithPrivateConstructor.kt +++ /dev/null @@ -1,17 +0,0 @@ -class MyObject private constructor(val delegate: Interface) : Interface by delegate { - constructor() : this(Delegate()) -} - -class Delegate : Interface { - override fun greet(): String { - return "OK" - } -} - -private interface Interface { - fun greet(): String -} - -fun box(): String { - return MyObject().greet() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt b/backend.native/tests/external/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt deleted file mode 100644 index 52dd706636f..00000000000 --- a/backend.native/tests/external/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt +++ /dev/null @@ -1,20 +0,0 @@ -// LANGUAGE_VERSION: 1.0 - -public interface Base { - fun test() = "base fail" -} - -public interface Base2 : Base { - override fun test() = "base 2fail" -} - -class Delegate : Base { - override fun test(): String { - return "OK" - } -} - -fun box(): String { - return object : Base2, Base by Delegate() { - }.test() -} diff --git a/backend.native/tests/external/codegen/box/delegation/kt8154.kt b/backend.native/tests/external/codegen/box/delegation/kt8154.kt deleted file mode 100644 index 86550e49f60..00000000000 --- a/backend.native/tests/external/codegen/box/delegation/kt8154.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface A { - fun foo(): T -} - -interface B : A - -class BImpl(a: A) : B, A by a - -fun box(): String { - val b: B = BImpl(object : A { - override fun foo() = "OK" - }) - - if (b.foo() != "OK") return "fail 1" - - val a: A = b - - return a.foo() -} diff --git a/backend.native/tests/external/codegen/box/delegation/withDefaultParameters.kt b/backend.native/tests/external/codegen/box/delegation/withDefaultParameters.kt deleted file mode 100644 index dd9e8a968f6..00000000000 --- a/backend.native/tests/external/codegen/box/delegation/withDefaultParameters.kt +++ /dev/null @@ -1,60 +0,0 @@ -// IGNORE_BACKEND: JVM - -var log = "" -fun log(a: String) { - log += a + ";" -} - -interface C { - fun foo(x: Int): Unit { - log("C.foo($x)") - } -} - -interface I { - fun foo(x: Int = 1): Unit -} - -class G(c: C) : C by c, I -class H(c: C) : I, C by c - -fun test1() { - log = "" - - val g1 = G(object: C {}) - g1.foo(2) - g1.foo() - val g2 = G(object: C { - override fun foo(x: Int) { - log("[2] object:C.foo($x)") - } - }) - g2.foo(2) - g2.foo() -} - -fun test2() { - log = "" - - val h1 = H(object: C {}) - h1.foo(2) - h1.foo() - val h2 = H(object: C { - override fun foo(x: Int) { - log("[2] object:C.foo($x)") - } - }) - h2.foo(2) - h2.foo() -} - - -fun box(): String { - test1() - if (log != "C.foo(2);C.foo(1);[2] object:C.foo(2);[2] object:C.foo(1);") return "fail1: $log" - - test2() - if (log != "C.foo(2);C.foo(1);[2] object:C.foo(2);[2] object:C.foo(1);") return "fail2: $log" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/extensionComponents.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/extensionComponents.kt deleted file mode 100644 index 201e2cb3a60..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/extensionComponents.kt +++ /dev/null @@ -1,21 +0,0 @@ -class A(val x: String, val y: String, val z: T) - -fun foo(a: A, block: (A) -> String): String = block(a) - -operator fun A<*>.component1() = x - -object B { - operator fun A<*>.component2() = y -} - -fun B.bar(): String { - - operator fun A.component3() = z - - val x = foo(A("O", "K", 123)) { (x, y, z) -> x + y + z.toString() } - if (x != "OK123") return "fail 1: $x" - - return "OK" -} - -fun box() = B.bar() diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/generic.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/generic.kt deleted file mode 100644 index 4dadddb91cd..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/generic.kt +++ /dev/null @@ -1,11 +0,0 @@ -data class A(val x: T, val y: F) - -fun foo(a: A, block: (A) -> String) = block(a) - -fun box(): String { - val x = foo(A("OK", 1)) { (x, y) -> x + (y.toString()) } - - if (x != "OK1") return "fail1: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/inline.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/inline.kt deleted file mode 100644 index 6835b91f21c..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/inline.kt +++ /dev/null @@ -1,5 +0,0 @@ -data class A(val x: String, val y: String) - -inline fun foo(a: A, block: (A) -> String): String = block(a) - -fun box() = foo(A("O", "K")) { (x, y) -> x + y } diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/otherParameters.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/otherParameters.kt deleted file mode 100644 index f973aca1710..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/otherParameters.kt +++ /dev/null @@ -1,11 +0,0 @@ -data class A(val x: String, val y: String) - -fun foo(a: A, block: (Int, A, String) -> String): String = block(1, a, "#") - -fun box(): String { - val x = foo(A("O", "K")) { i, (x, y), v -> i.toString() + x + y + v } - - if (x != "1OK#") return "fail 1: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/simple.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/simple.kt deleted file mode 100644 index 50523e3fec4..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/simple.kt +++ /dev/null @@ -1,5 +0,0 @@ -data class A(val x: String, val y: String) - -fun foo(a: A, block: (A) -> String): String = block(a) - -fun box() = foo(A("O", "K")) { (x, y) -> x + y } diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/stdlibUsages.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/stdlibUsages.kt deleted file mode 100644 index fe527e1237d..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/stdlibUsages.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val r1 = listOf("O", "K", "fail").let { - (x, y) -> x + y - } - - - if (r1 != "OK") return "fail 1: $r1" - - val r2 = listOf(Pair("O", "K")).map { (x, y) -> x + y }[0] - - if (r2 != "OK") return "fail 2: $r2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/underscoreNames.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/underscoreNames.kt deleted file mode 100644 index 8db07f7778e..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/underscoreNames.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - operator fun component1() = "O" - operator fun component2(): String = throw RuntimeException("fail 0") - operator fun component3() = "K" -} - -fun foo(a: A, block: (A) -> String): String = block(a) - -fun box() = foo(A()) { (x, _, y) -> x + y } diff --git a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/withIndexed.kt b/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/withIndexed.kt deleted file mode 100644 index 13280feb86e..00000000000 --- a/backend.native/tests/external/codegen/box/destructuringDeclInLambdaParam/withIndexed.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME -data class Station( - val id: String?, - val name: String, - val distance: Int) - -fun box(): String { - var result = "" - // See KT-14399 - listOf(Station("O", "K", 56)).forEachIndexed { i, (id, name, distance) -> result += "$id$name$distance" } - if (result != "OK56") return "fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/inference/kt6176.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/inference/kt6176.kt deleted file mode 100644 index 15a7a2e94e2..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/inference/kt6176.kt +++ /dev/null @@ -1,25 +0,0 @@ -// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST - -fun foo(f: () -> R): R = f() - -fun some(v: T?, b: T): T { - return foo { - if (v != null) { - v - } - else { - b - } - } -} - -fun some1(v: T?, b: T): T { - return foo { if (v != null) v else b } -} - -fun box() = when { - some(1, 2) != 1 -> "fail 1" - some(null, 2) != 2 -> "fail 2" - some1(1, 2) != 1 -> "fail 3" - else -> "OK" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt deleted file mode 100644 index 5f7fbce55f9..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - companion object { - operator fun invoke(i: Int) = i - } -} - -fun box() = if (A(42) == 42) "OK" else "fail" - diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt deleted file mode 100644 index b808ed09f6a..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface B - -operator fun B.invoke(i: Int) = i - -class A { - companion object: B { - } -} - -fun box() = if (A(42) == 42) "OK" else "fail" - diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt deleted file mode 100644 index dcc924a9ba8..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - class Nested { - companion object { - operator fun invoke(i: Int) = i - } - } -} - -fun box() = if (A.Nested(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt deleted file mode 100644 index 85b73084d1a..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt +++ /dev/null @@ -1,11 +0,0 @@ -import A.Nested - -class A { - class Nested { - companion object { - operator fun invoke(i: Int) = i - } - } -} - -fun box() = if (Nested(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt deleted file mode 100644 index 6491d8e0cc9..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class A { - ONE, - TWO; - - operator fun invoke(i: Int) = i -} - -fun box() = if (A.ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt deleted file mode 100644 index 95eb4b9c827..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class A { - ONE, - TWO -} - -operator fun A.invoke(i: Int) = i - -fun box() = if (A.ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt deleted file mode 100644 index d627dad85a8..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt +++ /dev/null @@ -1,10 +0,0 @@ -import A.ONE - -enum class A { - ONE, - TWO; - - operator fun invoke(i: Int) = i -} - -fun box() = if (ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt deleted file mode 100644 index 53ecfc65908..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt +++ /dev/null @@ -1,10 +0,0 @@ -import A.ONE - -enum class A { - ONE, - TWO -} - -operator fun A.invoke(i: Int) = i - -fun box() = if (ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt deleted file mode 100644 index e14c1acefc4..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt +++ /dev/null @@ -1,5 +0,0 @@ -object A - -operator fun A.invoke(i: Int) = i - -fun box() = if (A(42) == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt deleted file mode 100644 index fc16215881c..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt +++ /dev/null @@ -1,5 +0,0 @@ -object A { - operator fun invoke(i: Int) = i -} - -fun box() = if (A(42) == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgs.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgs.kt deleted file mode 100644 index 77551daaaf2..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgs.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int = 0, e : Any = "a") { - if (!e.equals("a")) { - throw IllegalArgumentException() - } - if (x > 0) { - test(x - 1) - } -} - -fun box() : String { - test(100000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt deleted file mode 100644 index 2f924b56908..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -open class A { - open fun foo(s: String = "OK") = s -} - -class B : A() { - override tailrec fun foo(s: String): String { - return if (s == "OK") s else foo() - } -} - -fun box() = B().foo("FAIL") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/extensionTailCall.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/extensionTailCall.kt deleted file mode 100644 index e9873fc4a14..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/extensionTailCall.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun Int.foo(x: Int) { - if (x == 0) return - return 1.foo(x - 1) -} - -fun box(): String { - 1.foo(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt deleted file mode 100644 index 15eb0203244..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun noTails() { - // nothing here -} - -fun box(): String { - noTails() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt deleted file mode 100644 index c6b15a3234d..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun badTails(x : Int) : Int { - if (x < 50 && x != 10 && x > 0) { - return 1 + badTails(x - 1) - } - else if (x == 10) { - @Suppress("NON_TAIL_RECURSIVE_CALL") - return 1 + badTails(x - 1) - } else if (x >= 50) { - return badTails(x - 1) - } - return 0 -} - -fun box(): String { - badTails(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt deleted file mode 100644 index 06b569df4d4..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -fun withoutAnnotation(x : Int) : Int { - if (x > 0) { - return 1 + withoutAnnotation(x - 1) - } - return 0 -} - -fun box(): String { - val r = withoutAnnotation(10) - if (r == 10) return "OK" - return "Fail $r" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt deleted file mode 100644 index 4642b88c175..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt +++ /dev/null @@ -1,10 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec infix fun Int.test(x : Int) : Int { - if (this > 1) { - return (this - 1) test x - } - return this -} - -fun box() : String = if (1000000.test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt deleted file mode 100644 index 09212b1ad4b..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec infix fun Int.foo(x: Int) { - if (x == 0) return - val xx = x - 1 - return 1 foo xx -} - -fun box(): String { - 1 foo 1000000 - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt deleted file mode 100644 index d758897bde5..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(counter : Int) : Int? { - if (counter < 0) return null - if (counter == 0) return 777 - - return test(-1) ?: test(-2) ?: test(counter - 1) -} - -fun box() : String = - if (test(100000) == 777) "OK" - else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt deleted file mode 100644 index 307a0163bca..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -class B { - inner class C { - tailrec fun h(counter : Int) { - if (counter > 0) { - this@C.h(counter - 1) - } - } - - tailrec fun h2(x : Any) { - this@B.h2("no recursion") // keep vigilance - } - - } - - fun makeC() : C = C() - - fun h2(x : Any) { - } -} - -fun box() : String { - B().makeC().h(1000000) - B().makeC().h2(0) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/loops.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/loops.kt deleted file mode 100644 index 0eac7241a86..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/loops.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int { - var z = if (x > 3) 3 else x - while (z > 0) { - if (z > 10) { - return test(x - 1) - } - test(0) - z = z - 1 - } - - return 1 -} - -fun box() : String = if (test(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt deleted file mode 100644 index 597ca8dd231..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int { - if (x == 1) { - if (x != 1) { - test(0) - return test(0) - } else { - return test(x + test(0)) - } - } else if (x > 0) { - return test(x - 1) - } - return -1 -} - -fun box() : String = if (test(1000000) == -1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realIteratorFoldl.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realIteratorFoldl.kt deleted file mode 100644 index a4523b4320d..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realIteratorFoldl.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun Iterator.foldl(acc : A, foldFunction : (e : T, acc : A) -> A) : A = - if (!hasNext()) acc - else foldl(foldFunction(next(), acc), foldFunction) - -fun box() : String { - val sum = (1..1000000).iterator().foldl(0) { e : Int, acc : Long -> - acc + e - } - - return if (sum == 500000500000) "OK" else "FAIL: $sum" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt deleted file mode 100644 index f78c458a8e6..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -fun escapeChar(c : Char) : String? = when (c) { - '\\' -> "\\\\" - '\n' -> "\\n" - '"' -> "\\\"" - else -> "" + c -} - -tailrec fun String.escape(i : Int = 0, result : StringBuilder = StringBuilder()) : String = - if (i == length) result.toString() - else escape(i + 1, result.append(escapeChar(get(i)))) - -fun box() : String { - "test me not \\".escape() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt deleted file mode 100644 index 2772ef3c3a2..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt +++ /dev/null @@ -1,10 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun String.repeat(num : Int, acc : StringBuilder = StringBuilder()) : String = - if (num == 0) acc.toString() - else repeat(num - 1, acc.append(this)) - -fun box() : String { - val s = "a".repeat(10000) - return if (s.length == 10000) "OK" else "FAIL: ${s.length}" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt deleted file mode 100644 index e53fc49a214..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun foo() { - bar { - foo() - } -} - -fun bar(a: Any) {} - -fun box(): String { - foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt deleted file mode 100644 index c6e5fe2a79f..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun foo() { - fun bar() { - foo() - } -} - -fun box(): String { - foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt deleted file mode 100644 index cf6ac28a2b1..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt +++ /dev/null @@ -1,13 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -fun test() { - tailrec fun g3(counter : Int) { - if (counter > 0) { g3(counter - 1) } - } - g3(1000000) -} - -fun box() : String { - test() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt deleted file mode 100644 index f974aac542d..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int { - return if (x == 1) { - test(x - 1) - 1 + test(x - 1) - } else if (x > 0) { - test(x - 1) - } else { - 0 - } -} - -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt deleted file mode 100644 index 94541e9b0ad..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(counter : Int) : Int { - if (counter == 0) return 0 - - try { - throw Exception() - } catch (e : Exception) { - return test(counter - 1) - } -} - -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt deleted file mode 100644 index 37c8bde1bd5..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(counter : Int) : Int { - if (counter == 0) return 0 - - try { - // do nothing - } finally { - return test(counter - 1) - } -} - -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt deleted file mode 100644 index a91a01c4007..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(counter : Int) : Int { - if (counter == 0) return 0 - - try { - // do nothing - } finally { - if (counter > 0) { - return test(counter - 1) - } - } - - return -1 -} - -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInParentheses.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInParentheses.kt deleted file mode 100644 index 6a05a80c18d..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInParentheses.kt +++ /dev/null @@ -1,11 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun foo(x: Int) { - if (x == 0) return - (return foo(x - 1)) -} - -fun box(): String { - foo(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt deleted file mode 100644 index f3c225f251e..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(counter : Int) : Int { - if (counter == 0) return 0 - - try { - return test(counter - 1) - } catch (any : Throwable) { - return -1 - } -} - -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt deleted file mode 100644 index 7d2cf67bd63..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int = - if (x == 1) { - test(x - 1) - 1 + test(x - 1) - } else if (x > 0) { - test(x - 1) - } else { - 0 - } - -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt deleted file mode 100644 index 497f0456cf8..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int { - if (x == 10) { - return 1 + test(x - 1) - } - if (x > 0) { - return test(x - 1) - } - return 0 -} - -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt deleted file mode 100644 index 5e41e54a3cb..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Int { - if (x == 0) { - return 0 - } else if (x == 10) { - test(0) - return 1 + test(x - 1) - } else { - return test(x - 1) - } -} - -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/sum.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/sum.kt deleted file mode 100644 index 461f09c5ec1..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/sum.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun sum(x: Long, sum: Long): Long { - if (x == 0.toLong()) return sum - return sum(x - 1, sum + x) -} - -fun box() : String { - val sum = sum(1000000, 0) - if (sum != 500000500000.toLong()) return "Fail $sum" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt deleted file mode 100644 index 92fd0bf3ffb..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt +++ /dev/null @@ -1,13 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun foo(x: Int) { - return if (x > 0) { - (foo(x - 1)) - } - else Unit -} - -fun box(): String { - foo(1000000) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInParentheses.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInParentheses.kt deleted file mode 100644 index d0c54318be0..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailCallInParentheses.kt +++ /dev/null @@ -1,11 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun foo(x: Int) { - if (x == 0) return - return (foo(x - 1)) -} - -fun box(): String { - foo(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt deleted file mode 100644 index a69c34bd44c..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(go: Boolean) : Unit { - if (!go) return - try { - test(false) - } catch (any : Exception) { - test(false) - } finally { - test(false) - } -} - -fun box(): String { - test(true) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt deleted file mode 100644 index b067a3c5717..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -class A { - tailrec fun f1(c : Int) { - if (c > 0) { - this.f1(c - 1) - } - } - - tailrec fun f2(c : Int) { - if (c > 0) { - f2(c - 1) - } - } - - tailrec fun f3(a : A) { - a.f3(a) // non-tail recursion, could be potentially resolved by condition if (a == this) f3() else a.f3() - } -} - -fun box() : String { - A().f1(1000000) - A().f2(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt deleted file mode 100644 index 9324f76ad43..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun test(x : Int) : Unit { - if (x == 1) { - test(x - 1) - } else if (x == 2) { - test(x - 1) - return - } else if (x == 3) { - test(x - 1) - if (x == 3) { - test(x - 1) - } - return - } else if (x > 0) { - test(x - 1) - } -} - -fun box() : String { - test(1000000) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt deleted file mode 100644 index c87fb69a91e..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun withWhen(counter : Int) : Int = - when (counter) { - 0 -> counter - 50 -> 1 + withWhen(counter - 1) - else -> withWhen(counter - 1) - } - -fun box() : String = if (withWhen(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt deleted file mode 100644 index 9ceaf639f08..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt +++ /dev/null @@ -1,16 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun withWhen(counter : Int, d : Any) : Int = - when (counter) { - 0 -> counter - 1, 2 -> withWhen(counter - 1, "1,2") - in 3..49 -> withWhen(counter - 1, "3..49") - 50 -> 1 + withWhen(counter - 1, "50") - !in 0..50 -> withWhen(counter - 1, "!0..50") - else -> withWhen(counter - 1, "else") - } - -fun box() : String = if (withWhen(100000, "test") == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithIs.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithIs.kt deleted file mode 100644 index d86ee798725..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithIs.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun withWhen(counter : Int, d : Any) : Int = - if (counter == 0) { - 0 - } - else if (counter == 5) { - withWhen(counter - 1, 999) - } - else - when (d) { - is String -> withWhen(counter - 1, "is String") - is Number -> withWhen(counter, "is Number") - else -> throw IllegalStateException() - } - -fun box() : String = if (withWhen(100000, "test") == 0) "OK" else "FAIL" diff --git a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt b/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt deleted file mode 100644 index 154371bacee..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND_WITHOUT_CHECK: JS - -tailrec fun withWhen2(counter : Int) : Int = - when { - counter == 0 -> counter - counter == 50 -> 1 + withWhen2(counter - 1) - withWhen2(0) == 0 -> withWhen2(counter - 1) - else -> 1 - } - -fun box() : String = if (withWhen2(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/diagnostics/vararg/kt4172.kt b/backend.native/tests/external/codegen/box/diagnostics/vararg/kt4172.kt deleted file mode 100644 index 80e1489d641..00000000000 --- a/backend.native/tests/external/codegen/box/diagnostics/vararg/kt4172.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - main(array()) - return "OK" -} - -fun main(args: Array) { - D.foo(array()) -} - -object D { - fun foo(array: Array) = array -} - -@Suppress("UNCHECKED_CAST") -inline fun array(vararg t : T) : Array = t as Array \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/elvis/genericNull.kt b/backend.native/tests/external/codegen/box/elvis/genericNull.kt deleted file mode 100644 index beb1cb723f2..00000000000 --- a/backend.native/tests/external/codegen/box/elvis/genericNull.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo(t: T) { - (t ?: 42).toInt() -} - -fun box(): String { - foo(null) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt b/backend.native/tests/external/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt deleted file mode 100644 index af26c6e87f2..00000000000 --- a/backend.native/tests/external/codegen/box/elvis/kt6694ExactAnnotationForElvis.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface PsiElement { - fun findChildByType(i: Int): T? = - if (i == 42) JetOperationReferenceExpression() as T else throw Exception() -} -interface JetSimpleNameExpression : PsiElement { - fun getReferencedNameElement(): PsiElement -} -class JetOperationReferenceExpression : JetSimpleNameExpression { - override fun getReferencedNameElement() = this -} -class JetLabelReferenceExpression : JetSimpleNameExpression { - public override fun getReferencedNameElement(): PsiElement = - findChildByType(42) ?: this -} - -fun box(): String { - val element = JetLabelReferenceExpression().getReferencedNameElement() - return if (element is JetOperationReferenceExpression) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/elvis/nullNullOk.kt b/backend.native/tests/external/codegen/box/elvis/nullNullOk.kt deleted file mode 100644 index e25fe160183..00000000000 --- a/backend.native/tests/external/codegen/box/elvis/nullNullOk.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = null ?: null ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/elvis/primitive.kt b/backend.native/tests/external/codegen/box/elvis/primitive.kt deleted file mode 100644 index bd3edd1a725..00000000000 --- a/backend.native/tests/external/codegen/box/elvis/primitive.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - if ((42 ?: 239) != 42) return "Fail Int" - if ((42.toLong() ?: 239.toLong()) != 42.toLong()) return "Fail Long" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/abstractMethodInEnum.kt b/backend.native/tests/external/codegen/box/enum/abstractMethodInEnum.kt deleted file mode 100644 index 0d3ed6de674..00000000000 --- a/backend.native/tests/external/codegen/box/enum/abstractMethodInEnum.kt +++ /dev/null @@ -1,9 +0,0 @@ -enum class A() { - ENTRY(){ override fun t() = "OK"}; - - abstract fun t(): String -} - -fun f(a: A) = a.t() - -fun box()= f(A.ENTRY) diff --git a/backend.native/tests/external/codegen/box/enum/abstractNestedClass.kt b/backend.native/tests/external/codegen/box/enum/abstractNestedClass.kt deleted file mode 100644 index 3994bd54e17..00000000000 --- a/backend.native/tests/external/codegen/box/enum/abstractNestedClass.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class E { - ENTRY; - - abstract class Nested -} - -fun box(): String { - E.ENTRY - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/asReturnExpression.kt b/backend.native/tests/external/codegen/box/enum/asReturnExpression.kt deleted file mode 100644 index c001e02763a..00000000000 --- a/backend.native/tests/external/codegen/box/enum/asReturnExpression.kt +++ /dev/null @@ -1,14 +0,0 @@ -// http://youtrack.jetbrains.com/issue/KT-2167 - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo() = Season.SPRING - -fun box() = - if (foo() == Season.SPRING) "OK" - else "fail" diff --git a/backend.native/tests/external/codegen/box/enum/classForEnumEntry.kt b/backend.native/tests/external/codegen/box/enum/classForEnumEntry.kt deleted file mode 100644 index b82f41487f8..00000000000 --- a/backend.native/tests/external/codegen/box/enum/classForEnumEntry.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -enum class IssueState { - DEFAULT, - FIXED { - override fun ToString() = "K" - }; - - open fun ToString(): String = "O" -} - -fun box(): String { - val field = IssueState::class.java.getField("FIXED") - - val typeName = field.type.name - if (typeName != "IssueState") return "Fail type name: $typeName" - - val className = field.get(null).javaClass.name - if (className != "IssueState\$FIXED") return "Fail class name: $className" - - val classLoader = IssueState::class.java.classLoader - classLoader.loadClass("IssueState\$FIXED") - try { - classLoader.loadClass("IssueState\$DEFAULT") - return "Fail: no class should have been generated for DEFAULT" - } - catch (e: Exception) { - // ok - } - - return IssueState.DEFAULT.ToString() + IssueState.FIXED.ToString() -} diff --git a/backend.native/tests/external/codegen/box/enum/companionObjectInEnum.kt b/backend.native/tests/external/codegen/box/enum/companionObjectInEnum.kt deleted file mode 100644 index 3e6d423f64e..00000000000 --- a/backend.native/tests/external/codegen/box/enum/companionObjectInEnum.kt +++ /dev/null @@ -1,22 +0,0 @@ -enum class Game { - ROCK, - PAPER, - SCISSORS; - - companion object { - fun foo() = ROCK - val bar = PAPER - val values2 = values() - val scissors = valueOf("SCISSORS") - } -} - -fun box(): String { - if (Game.foo() != Game.ROCK) return "Fail 1" - if (Game.bar != Game.PAPER) return "Fail 2: ${Game.bar}" - if (Game.values().size != 3) return "Fail 3" - if (Game.valueOf("SCISSORS") != Game.SCISSORS) return "Fail 4" - if (Game.values2.size != 3) return "Fail 5" - if (Game.scissors != Game.SCISSORS) return "Fail 6" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass.kt b/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass.kt deleted file mode 100644 index 6be3fd7d077..00000000000 --- a/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass.kt +++ /dev/null @@ -1,24 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class A { - X { - val x = "OK" - - inner class Inner { - inner class Inner2 { - inner class Inner3 { - val y = x - } - } - } - - val z = Inner().Inner2().Inner3() - - override val test: String - get() = z.y - }; - - abstract val test: String -} - -fun box() = A.X.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass2.kt b/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass2.kt deleted file mode 100644 index 63377128f1f..00000000000 --- a/backend.native/tests/external/codegen/box/enum/deepInnerClassInEnumEntryClass2.kt +++ /dev/null @@ -1,23 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class A { - X { - val k = "K" - - val anonObject = object { - inner class Inner { - val x = "O" + k - } - - val innerX = Inner().x - - override fun toString() = innerX - } - - override val test = anonObject.toString() - }; - - abstract val test: String -} - -fun box() = A.X.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt b/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt deleted file mode 100644 index fcdaf5b62ae..00000000000 --- a/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt +++ /dev/null @@ -1,6 +0,0 @@ -enum class Test(val str: String = "OK") { - OK -} - -fun box(): String = - Test.OK.str \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithVararg.kt b/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithVararg.kt deleted file mode 100644 index f293632dffa..00000000000 --- a/backend.native/tests/external/codegen/box/enum/defaultCtor/constructorWithVararg.kt +++ /dev/null @@ -1,7 +0,0 @@ -enum class Test(vararg xs: Int) { - OK; - val values = xs -} - -fun box(): String = - if (Test.OK.values.size == 0) "OK" else "Fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithDefaultArguments.kt b/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithDefaultArguments.kt deleted file mode 100644 index fb08b98daab..00000000000 --- a/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithDefaultArguments.kt +++ /dev/null @@ -1,7 +0,0 @@ -enum class Test(val x: Int, val str: String) { - OK; - constructor(x: Int = 0) : this(x, "OK") -} - -fun box(): String = - Test.OK.str \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithVararg.kt b/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithVararg.kt deleted file mode 100644 index 15c5ad34e9c..00000000000 --- a/backend.native/tests/external/codegen/box/enum/defaultCtor/secondaryConstructorWithVararg.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class Test(val x: Int, val str: String) { - OK; - constructor(vararg xs: Int) : this(xs.size + 42, "OK") -} - -fun box(): String = - if (Test.OK.x == 42) - Test.OK.str - else - "Fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/emptyConstructor.kt b/backend.native/tests/external/codegen/box/enum/emptyConstructor.kt deleted file mode 100644 index c82a4ac41c3..00000000000 --- a/backend.native/tests/external/codegen/box/enum/emptyConstructor.kt +++ /dev/null @@ -1,8 +0,0 @@ -package test - -enum class My(val s: String) { - ENTRY; - constructor(): this("OK") -} - -fun box() = My.ENTRY.s diff --git a/backend.native/tests/external/codegen/box/enum/emptyEnumValuesValueOf.kt b/backend.native/tests/external/codegen/box/enum/emptyEnumValuesValueOf.kt deleted file mode 100644 index 6cad0c98a04..00000000000 --- a/backend.native/tests/external/codegen/box/enum/emptyEnumValuesValueOf.kt +++ /dev/null @@ -1,13 +0,0 @@ -enum class Empty - -fun box(): String { - if (Empty.values().size != 0) return "Fail: ${Empty.values()}" - - try { - val found = Empty.valueOf("nonExistentEntry") - return "Fail: $found" - } - catch (e: Exception) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/enum/enumCompanionInit.kt b/backend.native/tests/external/codegen/box/enum/enumCompanionInit.kt deleted file mode 100644 index ec4d98952aa..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumCompanionInit.kt +++ /dev/null @@ -1,48 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -var result = "" - -enum class E(a: String) { - X("x"), - Y("y"); - - init { - result += "E.init($a);" - } - - companion object { - init { - result += "E.companion.init;" - val value = E.values()[0].name - result += "$value;" - } - } -} - -enum class F(a: String) { - X("x"), - Y("y"); - - init { - result += "F.init($a);" - } - - companion object { - init { - result += "F.companion.init;" - } - - fun foo() { - result += "F.foo();$X;" - } - } -} - -fun box(): String { - val y = E.Y - result += "${y.name};" - F.foo() - if (result != "E.init(x);E.init(y);E.companion.init;X;Y;F.init(x);F.init(y);F.companion.init;F.foo();X;") return "fail: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt b/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt deleted file mode 100644 index 135eeffae89..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt +++ /dev/null @@ -1,24 +0,0 @@ -interface IFoo { - fun foo(): String -} - -interface IBar { - fun bar(): String -} - -abstract class Base(val x: IFoo) - -enum class Test : IFoo, IBar { - FOO { - // FOO referenced from inner class constructor with uninitialized 'this' - inner class Inner : Base(FOO) - - val z = Inner() - - override fun foo() = "OK" - - override fun bar() = z.x.foo() - } -} - -fun box() = Test.FOO.bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt b/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt deleted file mode 100644 index 7745c582462..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt +++ /dev/null @@ -1,24 +0,0 @@ -interface IFoo { - fun foo(): String -} - -interface IBar { - fun bar(): String -} - -enum class Test : IFoo, IBar { - FOO { - // FOO referenced from inner class constructor with initialized 'this' - inner class Inner { - val fooFoo = FOO.foo() - } - - val z = Inner() - - override fun foo() = "OK" - - override fun bar() = z.fooFoo - } -} - -fun box() = Test.FOO.bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt b/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt deleted file mode 100644 index 635103b8b02..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt +++ /dev/null @@ -1,23 +0,0 @@ -interface IFoo { - fun foo(): String -} - -interface IBar { - fun bar(): String -} - -enum class Test : IFoo, IBar { - FOO { - // FOO referenced from inner class constructor with initialized 'this', - // in delegate initializer - inner class Inner : IFoo by FOO - - val z = Inner() - - override fun foo() = "OK" - - override fun bar() = z.foo() - } -} - -fun box() = Test.FOO.bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/enumInheritedFromTrait.kt b/backend.native/tests/external/codegen/box/enum/enumInheritedFromTrait.kt deleted file mode 100644 index 8171865caed..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumInheritedFromTrait.kt +++ /dev/null @@ -1,16 +0,0 @@ -package test - -fun box() = MyEnum.E1.f() + MyEnum.E2.f() - -enum class MyEnum : T { - E1 { - override fun f() = "O" - }, - E2 { - override fun f() = "K" - } -} - -interface T { - fun f(): String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/enumShort.kt b/backend.native/tests/external/codegen/box/enum/enumShort.kt deleted file mode 100644 index 78935006d2b..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumShort.kt +++ /dev/null @@ -1,11 +0,0 @@ -enum class Color(val rgb: Int) { - RED(0xff0000), - GREEN(0x00ff00), - BLUE(0x0000ff); -} - -fun foo(): Int { - return Color.RED.rgb + Color.GREEN.rgb + Color.BLUE.rgb -} - -fun box() = if (foo() == 0xffffff) "OK" else "Fail: ${foo()}" diff --git a/backend.native/tests/external/codegen/box/enum/enumWithLambdaParameter.kt b/backend.native/tests/external/codegen/box/enum/enumWithLambdaParameter.kt deleted file mode 100644 index d41886a5370..00000000000 --- a/backend.native/tests/external/codegen/box/enum/enumWithLambdaParameter.kt +++ /dev/null @@ -1,19 +0,0 @@ -// KT-4423 Enum with function not compiled - -enum class Sign(val str: String, val func: (x: Int, y: Int) -> Int){ - plus("+", { x, y -> x + y }), - - mult("*", { x, y -> x * y }) { - override fun toString() = "${func(4,5)}" - } -} - -fun box(): String { - val sum = Sign.plus.func(2, 3) - if (sum != 5) return "Fail 1: $sum" - - val product = Sign.mult.toString() - if (product != "20") return "Fail 2: $product" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/inPackage.kt b/backend.native/tests/external/codegen/box/enum/inPackage.kt deleted file mode 100644 index 388eb0a0dd3..00000000000 --- a/backend.native/tests/external/codegen/box/enum/inPackage.kt +++ /dev/null @@ -1,14 +0,0 @@ -package test - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo(): Season = Season.SPRING - -fun box() = - if (foo() == Season.SPRING) "OK" - else "fail" diff --git a/backend.native/tests/external/codegen/box/enum/inclassobj.kt b/backend.native/tests/external/codegen/box/enum/inclassobj.kt deleted file mode 100644 index 5006013d4b7..00000000000 --- a/backend.native/tests/external/codegen/box/enum/inclassobj.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box() = if(Context.operatingSystemType == Context.Companion.OsType.OTHER) "OK" else "fail" - -public class Context -{ - companion object - { - public enum class OsType { - LINUX, - OTHER; - } - - public val operatingSystemType: OsType - get() = OsType.OTHER - } -} diff --git a/backend.native/tests/external/codegen/box/enum/inner.kt b/backend.native/tests/external/codegen/box/enum/inner.kt deleted file mode 100644 index 01ef380fbc3..00000000000 --- a/backend.native/tests/external/codegen/box/enum/inner.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - enum class E { - OK - } -} - -fun box() = A.E.OK.toString() diff --git a/backend.native/tests/external/codegen/box/enum/innerClassInEnumEntryClass.kt b/backend.native/tests/external/codegen/box/enum/innerClassInEnumEntryClass.kt deleted file mode 100644 index 0dd565a3374..00000000000 --- a/backend.native/tests/external/codegen/box/enum/innerClassInEnumEntryClass.kt +++ /dev/null @@ -1,20 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class A { - X { - val x = "OK" - - inner class Inner { - val y = x - } - - val z = Inner() - - override val test: String - get() = z.y - }; - - abstract val test: String -} - -fun box() = A.X.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass.kt b/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass.kt deleted file mode 100644 index ecb03132ed7..00000000000 --- a/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass.kt +++ /dev/null @@ -1,19 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class A { - X { - val x = "OK" - - inner class Inner { - fun foo() = x - } - - val z = Inner() - - override val test = z.foo() - }; - - abstract val test: String -} - -fun box() = A.X.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass2.kt b/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass2.kt deleted file mode 100644 index 2868f51c1e0..00000000000 --- a/backend.native/tests/external/codegen/box/enum/innerClassMethodInEnumEntryClass2.kt +++ /dev/null @@ -1,19 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class A { - X { - val x = "OK" - - inner class Inner { - fun foo() = this@X.x - } - - val z = Inner() - - override val test = z.foo() - }; - - abstract val test: String -} - -fun box() = A.X.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/innerWithExistingClassObject.kt b/backend.native/tests/external/codegen/box/enum/innerWithExistingClassObject.kt deleted file mode 100644 index 139345cc14a..00000000000 --- a/backend.native/tests/external/codegen/box/enum/innerWithExistingClassObject.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - companion object {} - enum class E { - OK - } -} - -fun box() = A.E.OK.toString() diff --git a/backend.native/tests/external/codegen/box/enum/kt1119.kt b/backend.native/tests/external/codegen/box/enum/kt1119.kt deleted file mode 100644 index 6445197faee..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt1119.kt +++ /dev/null @@ -1,12 +0,0 @@ -enum class Direction() { - NORTH { - val someSpecialValue = "OK" - - override fun f() = someSpecialValue - }; - - - abstract fun f():String -} - -fun box() = Direction.NORTH.f() diff --git a/backend.native/tests/external/codegen/box/enum/kt20651.kt b/backend.native/tests/external/codegen/box/enum/kt20651.kt deleted file mode 100644 index 8845e4c6d48..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt20651.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class Test(val x: String, val closure1: () -> String) { - FOO("O", { FOO.x }) { - override val y: String = "K" - val closure2 = { y } // Implicit 'FOO' - override val z: String = closure2() - }; - - abstract val y: String - abstract val z: String - - fun test() = closure1() + z -} - -fun box() = Test.FOO.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt20651_inlineLambda.kt b/backend.native/tests/external/codegen/box/enum/kt20651_inlineLambda.kt deleted file mode 100644 index d1f12734575..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt20651_inlineLambda.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class Test(val x: String, val closure1: () -> String) { - FOO("O", run { { FOO.x } }) { - override val y: String = "K" - val closure2 = { y } // Implicit 'FOO' - override val z: String = closure2() - }; - - abstract val y: String - abstract val z: String - - fun test() = closure1() + z -} - -fun box() = Test.FOO.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt20651a.kt b/backend.native/tests/external/codegen/box/enum/kt20651a.kt deleted file mode 100644 index 4bdecd58654..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt20651a.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class Foo( - val x: String, - val callback: () -> String -) { - FOO("OK", { FOO.x }) -} - -fun box() = Foo.FOO.callback() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt20651b.kt b/backend.native/tests/external/codegen/box/enum/kt20651b.kt deleted file mode 100644 index 477e3036569..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt20651b.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface Callback { - fun invoke(): String -} - -enum class Foo( - val x: String, - val callback: Callback -) { - FOO( - "OK", - object : Callback { - override fun invoke() = FOO.x - } - ) -} - -fun box() = Foo.FOO.callback.invoke() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt2350.kt b/backend.native/tests/external/codegen/box/enum/kt2350.kt deleted file mode 100644 index d4a363062b3..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt2350.kt +++ /dev/null @@ -1,7 +0,0 @@ -enum class A(val b: String) { - E1("OK"){ override fun t() = b }; - - abstract fun t(): String -} - -fun box()= A.E1.t() diff --git a/backend.native/tests/external/codegen/box/enum/kt7257.kt b/backend.native/tests/external/codegen/box/enum/kt7257.kt deleted file mode 100644 index 78dca7e9610..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class X { - B { - val value2 = "K" - override val value = "O".let { it + value2 } - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectInit.kt b/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectInit.kt deleted file mode 100644 index 2cc9963d5c6..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectInit.kt +++ /dev/null @@ -1,17 +0,0 @@ -enum class X { - B { - val value2 = "K" - - val anonObject = object { - val value3 = "O" + value2 - - override fun toString(): String = value3 - } - - override val value = anonObject.toString() - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectMethod.kt b/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectMethod.kt deleted file mode 100644 index 4f5e5ce5bda..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_anonObjectMethod.kt +++ /dev/null @@ -1,16 +0,0 @@ -enum class X { - B { - val value2 = "K" - - val anonObject = object { - override fun toString(): String = - "O" + value2 - } - - override val value = anonObject.toString() - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_boundReference1.kt b/backend.native/tests/external/codegen/box/enum/kt7257_boundReference1.kt deleted file mode 100644 index 8c9f07718e0..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_boundReference1.kt +++ /dev/null @@ -1,21 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class X { - B { - val k = "K" - - inner class Inner { - fun foo() = "O" + k - } - - val inner = Inner() - - val bmr = inner::foo - - override val value = bmr.invoke() - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_boundReference2.kt b/backend.native/tests/external/codegen/box/enum/kt7257_boundReference2.kt deleted file mode 100644 index e34bc6403ba..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_boundReference2.kt +++ /dev/null @@ -1,18 +0,0 @@ -enum class X { - B { - - override val value = "OK" - - val bmr = B::value.get() - - override fun foo(): String { - return bmr - } - }; - - abstract val value: String - - abstract fun foo(): String -} - -fun box() = X.B.foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_boundReferenceWithImplicitReceiver.kt b/backend.native/tests/external/codegen/box/enum/kt7257_boundReferenceWithImplicitReceiver.kt deleted file mode 100644 index 0b89217da3e..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_boundReferenceWithImplicitReceiver.kt +++ /dev/null @@ -1,15 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -enum class X { - B { - override val value = "OK" - - override val test = ::value.get() - }; - - abstract val value: String - - abstract val test: String -} - -fun box() = X.B.test \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_explicitReceiver.kt b/backend.native/tests/external/codegen/box/enum/kt7257_explicitReceiver.kt deleted file mode 100644 index 44c3183a50a..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_explicitReceiver.kt +++ /dev/null @@ -1,11 +0,0 @@ -enum class X { - B { - override val value2 = "K" - override val value = "O" + B.value2 - }; - - abstract val value2: String - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_fullyQualifiedReceiver.kt b/backend.native/tests/external/codegen/box/enum/kt7257_fullyQualifiedReceiver.kt deleted file mode 100644 index 384e2daa331..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_fullyQualifiedReceiver.kt +++ /dev/null @@ -1,11 +0,0 @@ -enum class X { - B { - override val value2 = "K" - override val value = "O" + X.B.value2 - }; - - abstract val value2: String - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_namedLocalFun.kt b/backend.native/tests/external/codegen/box/enum/kt7257_namedLocalFun.kt deleted file mode 100644 index 5438d725fba..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_namedLocalFun.kt +++ /dev/null @@ -1,17 +0,0 @@ -enum class X { - B { - val value2 = "K" - - val value3: String - init { - fun foo() = value2 - value3 = "O" + foo() - } - - override val value = value3 - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt7257_notInline.kt b/backend.native/tests/external/codegen/box/enum/kt7257_notInline.kt deleted file mode 100644 index 3851efb5669..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt7257_notInline.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun T.letNoInline(fn: (T) -> R) = - fn(this) - -enum class X { - B { - val value2 = "K" - override val value = "O".letNoInline { it + value2 } - }; - - abstract val value: String -} - -fun box() = X.B.value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt9711.kt b/backend.native/tests/external/codegen/box/enum/kt9711.kt deleted file mode 100644 index 096316ed24b..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt9711.kt +++ /dev/null @@ -1,13 +0,0 @@ -enum class X { - - B { - val value2 = "OK" - override val value = { value2 } - }; - - abstract val value: () -> String -} - -fun box(): String { - return X.B.value() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/kt9711_2.kt b/backend.native/tests/external/codegen/box/enum/kt9711_2.kt deleted file mode 100644 index 8642ed92784..00000000000 --- a/backend.native/tests/external/codegen/box/enum/kt9711_2.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -enum class IssueState { - - FIXED { - override fun ToString() = D().k - - fun s() = "OK" - - class D { - val k = s() - } - }; - - open fun ToString() : String = "fail" -} - -fun box(): String { - return IssueState.FIXED.ToString() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/manyDefaultParameters.kt b/backend.native/tests/external/codegen/box/enum/manyDefaultParameters.kt deleted file mode 100644 index a094da96f27..00000000000 --- a/backend.native/tests/external/codegen/box/enum/manyDefaultParameters.kt +++ /dev/null @@ -1,55 +0,0 @@ -enum class ClassTemplate( - // var bug: Int = 1, - var code: Int, - var nameTemplate: Int = 1, - - val parent: Int = 1, - val previous: Int = 1, - val progressionEquivalent: Int = 1, - - var idDiscipline: Int = 1, - var strictRunningOrder: Int = 1, - var pointsMethod: Int = 1, - - var noTimeFaults: Int = 1, - var combineHeights: Int = 1, - - var column: Int = 1, - var runningOrderSort: Int = 1, - var programme: Int = 1, - var eliminationTime: Int = 1, - var courseTimeCode: Int = 1, - var teamSize: Int = 1, - var sponsor: Int = 1, - var lateEntryCredits: Int = 1, - var lateEntryFee: Int = 1, - - var courseLengthNeeded: Int = 1, - - var discretionaryCourseTime: Int = 1, - var isRelay: Int = 1, - var isQualifier: Int = 1, - var generateChildren: Int = 1, - var feedFromParent: Int = 1, - - var isNfcAllowed: Int = 1, - var isAddOnAllowed: Int = 1, - var isSpecialEntry: Int = 1, - var isUkaProgression: Int = 1, - var canEnterDirectly: Int = 1, - var isPointRanked: Int = 1, - var isPointRankedDesc: Int = 1 -) { - UNDEFINED(code = 56, nameTemplate = 3), - BLAH(code = 57, nameTemplate = 4) -} - -fun box(): String { - val x = ClassTemplate.UNDEFINED - val y = ClassTemplate.BLAH - - if (x.code != 56 || x.nameTemplate != 3 || x.isAddOnAllowed != 1) return "fail 1" - if (y.code != 57 || y.nameTemplate != 4 || y.isAddOnAllowed != 1) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/modifierFlags.kt b/backend.native/tests/external/codegen/box/enum/modifierFlags.kt deleted file mode 100644 index 180aaf96346..00000000000 --- a/backend.native/tests/external/codegen/box/enum/modifierFlags.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import java.lang.reflect.Modifier - -enum class En { - Y -} - -fun box(): String { - val klass = En::class.java - val superclass = klass.superclass.name - if (superclass != "java.lang.Enum") "Fail superclass: $superclass" - - val enumModifiers = klass.modifiers - if ((enumModifiers and 0x4000) == 0) return "Fail ACC_ENUM on class" - if ((enumModifiers and Modifier.FINAL) == 0) return "Fail FINAL on class" - - val entry = klass.getField("Y") - val entryModifiers = entry.modifiers - if ((entryModifiers and 0x4000) == 0) return "Fail ACC_ENUM on entry" - if ((entryModifiers and Modifier.FINAL) == 0) return "Fail FINAL on entry" - if ((entryModifiers and Modifier.STATIC) == 0) return "Fail FINAL on entry" - if ((entryModifiers and Modifier.PUBLIC) == 0) return "Fail FINAL on entry" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/noClassForSimpleEnum.kt b/backend.native/tests/external/codegen/box/enum/noClassForSimpleEnum.kt deleted file mode 100644 index 03384f24b5b..00000000000 --- a/backend.native/tests/external/codegen/box/enum/noClassForSimpleEnum.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -enum class State { - O, - K -} - -fun box(): String { - val field = State::class.java.getField("O") - val className = field.get(null).javaClass.name - if (className != "State") return "Fail: $className" - - return "${State.O.name}${State.K.name}" -} diff --git a/backend.native/tests/external/codegen/box/enum/objectInEnum.kt b/backend.native/tests/external/codegen/box/enum/objectInEnum.kt deleted file mode 100644 index 9f19d3c1704..00000000000 --- a/backend.native/tests/external/codegen/box/enum/objectInEnum.kt +++ /dev/null @@ -1,20 +0,0 @@ -enum class E { - ENTRY, - SUBCLASS { - object O { - fun foo() = 2 - } - override fun bar() = O.foo() - }; - - object O { - fun foo() = 1 - } - open fun bar() = O.foo() -} - -fun box(): String { - if (E.ENTRY.bar() != 1) return "Fail 1" - if (E.SUBCLASS.bar() != 2) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/enum/ordinal.kt b/backend.native/tests/external/codegen/box/enum/ordinal.kt deleted file mode 100644 index d66c3e0ae4e..00000000000 --- a/backend.native/tests/external/codegen/box/enum/ordinal.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class State { - _0, - _1, - _2, - _3 -} - -fun box() = if(State._0.ordinal == 0 && State._1.ordinal == 1 && State._2.ordinal == 2 && State._3.ordinal == 3) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/enum/simple.kt b/backend.native/tests/external/codegen/box/enum/simple.kt deleted file mode 100644 index ed48d29a5d9..00000000000 --- a/backend.native/tests/external/codegen/box/enum/simple.kt +++ /dev/null @@ -1,12 +0,0 @@ -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo(): Season = Season.SPRING - -fun box() = - if (foo() == Season.SPRING) "OK" - else "fail" diff --git a/backend.native/tests/external/codegen/box/enum/sortEnumEntries.kt b/backend.native/tests/external/codegen/box/enum/sortEnumEntries.kt deleted file mode 100644 index 8b894a1ffe2..00000000000 --- a/backend.native/tests/external/codegen/box/enum/sortEnumEntries.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import Game.* - -enum class Game { - ROCK, - PAPER, - SCISSORS, - LIZARD, - SPOCK -} - -fun box(): String { - val a = arrayOf(LIZARD, SCISSORS, SPOCK, ROCK, PAPER) - a.sort() - val str = a.joinToString(" ") - return if (str == "ROCK PAPER SCISSORS LIZARD SPOCK") "OK" else "Fail: $str" -} diff --git a/backend.native/tests/external/codegen/box/enum/superCallInEnumLiteral.kt b/backend.native/tests/external/codegen/box/enum/superCallInEnumLiteral.kt deleted file mode 100644 index 11507d9d147..00000000000 --- a/backend.native/tests/external/codegen/box/enum/superCallInEnumLiteral.kt +++ /dev/null @@ -1,18 +0,0 @@ -package test - -fun box() = E.E1.f() + E.E2.f() - -enum class E { - E1 { - override fun f(): String { - return super.f() + "O" - } - }, - E2 { - override fun f(): String { - return super.f() + "K" - } - }; - - open fun f() = "" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/enum/toString.kt b/backend.native/tests/external/codegen/box/enum/toString.kt deleted file mode 100644 index b4890365b12..00000000000 --- a/backend.native/tests/external/codegen/box/enum/toString.kt +++ /dev/null @@ -1,6 +0,0 @@ -enum class State { - O, - K -} - -fun box() = "${State.O}${State.K}" diff --git a/backend.native/tests/external/codegen/box/enum/valueof.kt b/backend.native/tests/external/codegen/box/enum/valueof.kt deleted file mode 100644 index 89aeaa9cce6..00000000000 --- a/backend.native/tests/external/codegen/box/enum/valueof.kt +++ /dev/null @@ -1,22 +0,0 @@ -enum class Color { - RED, - BLUE -} - -fun throwsOnGreen(): Boolean { - try { - Color.valueOf("GREEN") - return false - } - catch (e: Exception) { - return true - } -} - -fun box() = if( - Color.valueOf("RED") == Color.RED - && Color.valueOf("BLUE") == Color.BLUE - && Color.values()[0] == Color.RED - && Color.values()[1] == Color.BLUE - && throwsOnGreen() - ) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/evaluate/char.kt b/backend.native/tests/external/codegen/box/evaluate/char.kt deleted file mode 100644 index 06d5b9d24d7..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/char.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package test - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val c1: Int) - -@Ann('a' - 'a') class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.c1 != 0) return "fail : expected = ${1}, actual = ${annotation.c1}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/divide.kt b/backend.native/tests/external/codegen/box/evaluate/divide.kt deleted file mode 100644 index 38dcc8cb811..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/divide.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val b: Byte, - val s: Short, - val i: Int, - val l: Long -) - -@Ann(1 / 1, 1 / 1, 1 / 1, 1 / 1) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.b != 1.toByte()) return "fail 1" - if (annotation.s != 1.toShort()) return "fail 2" - if (annotation.i != 1) return "fail 2" - if (annotation.l != 1.toLong()) return "fail 2" - return "OK" -} - -// EXPECTED: Ann[b = IntegerValueType(1): IntegerValueType(1), i = IntegerValueType(1): IntegerValueType(1), l = IntegerValueType(1): IntegerValueType(1), s = IntegerValueType(1): IntegerValueType(1)] diff --git a/backend.native/tests/external/codegen/box/evaluate/intrinsics.kt b/backend.native/tests/external/codegen/box/evaluate/intrinsics.kt deleted file mode 100644 index 44599301319..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/intrinsics.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Int, - val p2: Short, - val p3: Byte, - val p4: Int, - val p5: Int, - val p6: Int -) - -val prop1: Int = 1 or 1 -val prop2: Short = 1 and 1 -val prop3: Byte = 1 xor 1 -val prop4: Int = 1 shl 1 -val prop5: Int = 1 shr 1 -val prop6: Int = 1 ushr 1 - -@Ann(1 or 1, 1 and 1, 1 xor 1, 1 shl 1, 1 shr 1, 1 ushr 1) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/kt9443.kt b/backend.native/tests/external/codegen/box/evaluate/kt9443.kt deleted file mode 100644 index 9a8946a9e79..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/kt9443.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME - -abstract class BaseClass { - protected open val menuId: Int = 0 - - public fun run(): Pair = - "$menuId" to (menuId == 0) -} - -class ImplClass: BaseClass() { - override val menuId: Int = 3 -} - -public fun box(): String { - val result = ImplClass().run() - - if (result != ("3" to false)) return "Fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/maxValue.kt b/backend.native/tests/external/codegen/box/evaluate/maxValue.kt deleted file mode 100644 index a1f919bb03f..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/maxValue.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Int, - val p2: Int, - val p3: Int, - val p4: Int, - val p5: Long, - val p6: Long -) - -@Ann( - p1 = java.lang.Byte.MAX_VALUE + 1, - p2 = java.lang.Short.MAX_VALUE + 1, - p3 = java.lang.Integer.MAX_VALUE + 1, - p4 = java.lang.Integer.MAX_VALUE + 1, - p5 = java.lang.Integer.MAX_VALUE + 1.toLong(), - p6 = java.lang.Long.MAX_VALUE + 1 -) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != 128) return "fail 1, expected = ${128}, actual = ${annotation.p1}" - if (annotation.p2 != 32768) return "fail 2, expected = ${32768}, actual = ${annotation.p2}" - if (annotation.p3 != -2147483648) return "fail 3, expected = ${-2147483648}, actual = ${annotation.p3}" - if (annotation.p4 != -2147483648) return "fail 4, expected = ${-2147483648}, actual = ${annotation.p4}" - if (annotation.p5 != 2147483648.toLong()) return "fail 5, expected = ${2147483648}, actual = ${annotation.p5}" - if (annotation.p6 != java.lang.Long.MAX_VALUE + 1) return "fail 5, expected = ${java.lang.Long.MAX_VALUE + 1}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/maxValueByte.kt b/backend.native/tests/external/codegen/box/evaluate/maxValueByte.kt deleted file mode 100644 index 82cd51d0364..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/maxValueByte.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Int, - val p2: Byte, - val p4: Int, - val p5: Int -) - -@Ann( - p1 = java.lang.Byte.MAX_VALUE + 1, - p2 = 1 + 1, - p4 = 1 + 1, - p5 = 1.toByte() + 1 -) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != 128) return "fail 1, expected = ${128}, actual = ${annotation.p1}" - if (annotation.p2 != 2.toByte()) return "fail 2, expected = ${2}, actual = ${annotation.p2}" - if (annotation.p4 != 2) return "fail 4, expected = ${2}, actual = ${annotation.p4}" - if (annotation.p5 != 2) return "fail 5, expected = ${2}, actual = ${annotation.p5}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/maxValueInt.kt b/backend.native/tests/external/codegen/box/evaluate/maxValueInt.kt deleted file mode 100644 index 177fd8cb2c8..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/maxValueInt.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Int, - val p2: Int, - val p4: Long, - val p5: Int -) - -@Ann( - p1 = java.lang.Integer.MAX_VALUE + 1, - p2 = 1 + 1, - p4 = 1 + 1, - p5 = 1.toInt() + 1.toInt() -) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != -2147483648) return "fail 1, expected = ${-2147483648}, actual = ${annotation.p1}" - if (annotation.p2 != 2) return "fail 2, expected = ${2}, actual = ${annotation.p2}" - if (annotation.p4 != 2.toLong()) return "fail 4, expected = ${2}, actual = ${annotation.p4}" - if (annotation.p5 != 2) return "fail 5, expected = ${2}, actual = ${annotation.p5}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/minus.kt b/backend.native/tests/external/codegen/box/evaluate/minus.kt deleted file mode 100644 index d0892dadd08..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/minus.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -val prop1: Byte = 1 - 1 -val prop2: Short = 1 - 1 -val prop3: Int = 1 - 1 -val prop4: Long = 1 - 1 -val prop5: Double = 1.0 - 1.0 -val prop6: Float = 1.0.toFloat() - 1.0.toFloat() - -@Ann(1 - 1, 1 - 1, 1 - 1, 1 - 1, 1.0 - 1.0, 1.0.toFloat() - 1.0.toFloat()) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/mod.kt b/backend.native/tests/external/codegen/box/evaluate/mod.kt deleted file mode 100644 index dbfe458a3ce..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/mod.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -val prop1: Byte = 1 % 1 -val prop2: Short = 1 % 1 -val prop3: Int = 1 % 1 -val prop4: Long = 1 % 1 -val prop5: Double = 1.0 % 1.0 -val prop6: Float = 1.0.toFloat() % 1.0.toFloat() - -@Ann(1 % 1, 1 % 1, 1 % 1, 1 % 1, 1.0 % 1.0, 1.0.toFloat() % 1.0.toFloat()) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/multiply.kt b/backend.native/tests/external/codegen/box/evaluate/multiply.kt deleted file mode 100644 index 8dfd50cd2d2..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/multiply.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -val prop1: Byte = 1 * 1 -val prop2: Short = 1 * 1 -val prop3: Int = 1 * 1 -val prop4: Long = 1 * 1 -val prop5: Double = 1.0 * 1.0 -val prop6: Float = 1.0.toFloat() * 1.0.toFloat() - -@Ann(1 * 1, 1 * 1, 1 * 1, 1 * 1, 1.0 * 1.0, 1.0.toFloat() * 1.0.toFloat()) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/parenthesized.kt b/backend.native/tests/external/codegen/box/evaluate/parenthesized.kt deleted file mode 100644 index 417358d64e0..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/parenthesized.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -val prop1: Byte = (1 + 2) * 2 -val prop2: Short = (1 + 2) * 2 -val prop3: Int = (1 + 2) * 2 -val prop4: Long = (1 + 2) * 2 -val prop5: Double = (1.0 + 2) * 2 -val prop6: Float = (1.toFloat() + 2) * 2 - -@Ann((1 + 2) * 2, (1 + 2) * 2, (1 + 2) * 2, (1 + 2) * 2, (1.0 + 2) * 2, (1.toFloat() + 2) * 2) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/plus.kt b/backend.native/tests/external/codegen/box/evaluate/plus.kt deleted file mode 100644 index 622a3728343..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/plus.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -val prop1: Byte = 1 + 1 -val prop2: Short = 1 + 1 -val prop3: Int = 1 + 1 -val prop4: Long = 1 + 1 -val prop5: Double = 1.0 + 1.0 -val prop6: Float = 1.0.toFloat() + 1.0.toFloat() - -@Ann(1 + 1, 1 + 1, 1 + 1, 1 + 1, 1.0 + 1.0, 1.0.toFloat() + 1.0.toFloat()) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/simpleCallBinary.kt b/backend.native/tests/external/codegen/box/evaluate/simpleCallBinary.kt deleted file mode 100644 index b141e7002cb..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/simpleCallBinary.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Int, - val p2: Int, - val p3: Int, - val p4: Int, - val p5: Int -) - -const val prop1: Int = 1.plus(1) -const val prop2: Int = 1.minus(1) -const val prop3: Int = 1.times(1) -const val prop4: Int = 1.div(1) -const val prop5: Int = 1.mod(1) - -@Ann(prop1, prop2, prop3, prop4, prop5) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/unaryMinus.kt b/backend.native/tests/external/codegen/box/evaluate/unaryMinus.kt deleted file mode 100644 index 7d3e5bdcaed..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/unaryMinus.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -const val prop1: Byte = -1 -const val prop2: Short = -1 -const val prop3: Int = -1 -const val prop4: Long = -1 -const val prop5: Double = -1.0 -const val prop6: Float = -1.0.toFloat() - -@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/evaluate/unaryPlus.kt b/backend.native/tests/external/codegen/box/evaluate/unaryPlus.kt deleted file mode 100644 index 2ab595d7f83..00000000000 --- a/backend.native/tests/external/codegen/box/evaluate/unaryPlus.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val p1: Byte, - val p2: Short, - val p3: Int, - val p4: Long, - val p5: Double, - val p6: Float -) - -const val prop1: Byte = +1 -const val prop2: Short = +1 -const val prop3: Int = +1 -const val prop4: Long = +1 -const val prop5: Double = +1.0 -const val prop6: Float = +1.0.toFloat() - -@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass - -fun box(): String { - val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! - if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" - if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" - if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" - if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" - if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" - if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/exclExcl/genericNull.kt b/backend.native/tests/external/codegen/box/exclExcl/genericNull.kt deleted file mode 100644 index 0d4f831dfb7..00000000000 --- a/backend.native/tests/external/codegen/box/exclExcl/genericNull.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo(t: T) { - t!! -} - -fun box(): String { - try { - foo(null) - } catch (e: Exception) { - return "OK" - } - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/exclExcl/primitive.kt b/backend.native/tests/external/codegen/box/exclExcl/primitive.kt deleted file mode 100644 index d7815756041..00000000000 --- a/backend.native/tests/external/codegen/box/exclExcl/primitive.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - 42!! - 42.toLong()!! - return "OK"!! -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/executionOrder.kt b/backend.native/tests/external/codegen/box/extensionFunctions/executionOrder.kt deleted file mode 100644 index 38cdf5f0d5b..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/executionOrder.kt +++ /dev/null @@ -1,19 +0,0 @@ -var result = "" - -fun getReceiver() : Int { - result += "getReceiver->" - return 1 -} - -fun getFun(b : Int.(Int)->Unit): Int.(Int)->Unit { - result += "getFun()->" - return b -} - -fun box(): String { - getReceiver().(getFun({ result +="End" }))(1) - - if(result != "getFun()->getReceiver->End") return "fail $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1061.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1061.kt deleted file mode 100644 index 051768c9c74..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1061.kt +++ /dev/null @@ -1,7 +0,0 @@ -//KT-1061 Can't call function defined as a val - -object X { - val doit = { i: Int -> i } -} - -fun box() : String = if (X.doit(3) == 3) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1249.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1249.kt deleted file mode 100644 index 8078f5443fe..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1249.kt +++ /dev/null @@ -1,12 +0,0 @@ -//KT-1249 IllegalStateException invoking function property -class TestClass(val body : () -> Unit) : Any() { - fun run() { - body() - } -} - -fun box() : String { - TestClass({}).run() - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1290.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1290.kt deleted file mode 100644 index 19f03dc8883..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1290.kt +++ /dev/null @@ -1,14 +0,0 @@ -//KT-1290 Method property in constructor causes NPE - -class Foo(val filter: (T) -> Boolean) { - public fun bar(tee: T) : Boolean { - return filter(tee); - } -} - -fun foo() = Foo({ i: Int -> i < 5 }).bar(2) - -fun box() : String { - if (!foo()) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt13312.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt13312.kt deleted file mode 100644 index 097fa273eb5..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt13312.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun test1(f: (Int) -> Int) = f(1) - -fun test2(f: Int.() -> Int) = 2.f() - -class A(val foo: Int.() -> Int) - -fun box(): String { - val a: (Int) -> Int = { it } - val b: Int.() -> Int = { this } - - if (test1(a) != 1) return "fail 1a" - if (test1(b) != 1) return "fail 1b" - if (test2(a) != 2) return "fail 2a" - if (test2(b) != 2) return "fail 2b" - - val x = A({ this }) - - if (x.foo(3) != 3) return "fail 3" - if (with(x) { foo(4) } != 4) return "fail 4" - if (with(x) { 5.foo() } != 5) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1776.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1776.kt deleted file mode 100644 index 5174d4cc374..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1776.kt +++ /dev/null @@ -1,20 +0,0 @@ -interface Expr { - public fun ttFun() : Int = 12 -} - -class Num(val value : Int) : Expr - -fun Expr.sometest() : Int { - if (this is Num) { - value - return value - } - return 0; -} - - -fun box() : String { - if (Num(11).sometest() != 11) return "fail ${Num(11).sometest()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1953.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1953.kt deleted file mode 100644 index c7f72f666f5..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1953.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val sb = StringBuilder() - operator fun String.unaryPlus() { - sb.append(this) - } - - +"OK" - return sb.toString()!! -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt1953_class.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt1953_class.kt deleted file mode 100644 index e2feab63b56..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt1953_class.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - private val sb: StringBuilder = StringBuilder() - - operator fun String.unaryPlus() { - sb.append(this) - } - - fun foo(): String { - +"OK" - return sb.toString()!! - } -} - -fun box(): String = A().foo() diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt3285.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt3285.kt deleted file mode 100644 index 2874bcdb2e8..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt3285.kt +++ /dev/null @@ -1,32 +0,0 @@ -var sayResult = "" - -class NoiseMaker { - fun say(str: String) { sayResult += str } -} - -fun noiseMaker(f: NoiseMaker.() -> Unit) { - val noiseMaker = NoiseMaker() - noiseMaker.f() -} - -abstract class Pet { - fun NoiseMaker.playWith(friend: T) { - say("Playing with " + friend) - } - - abstract fun play(): Unit -} - -class Doggy(): Pet() { - override fun play() = noiseMaker { - say("Time to play! ") - playWith("my owner!") - } -} - -fun box(): String { - Doggy().play() - if (sayResult != "Time to play! Playing with my owner!") return "fail: $sayResult" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt3298.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt3298.kt deleted file mode 100644 index d0f83531a69..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt3298.kt +++ /dev/null @@ -1,13 +0,0 @@ -var result = "" -fun result(r: String) { result = r } - -object Foo { - private operator fun String.unaryPlus() = "(" + this + ")" - - fun foo() = { result(+"Stuff") }() -} - -fun box(): String { - Foo.foo() - return if (result == "(Stuff)") "OK" else "Fail $result" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt3646.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt3646.kt deleted file mode 100644 index c3f758cf9a5..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt3646.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun test(cl: Int.() -> Int):Int = 11.cl() - -class Foo { - val a = test { this } -} - -fun box(): String { - if (Foo().a != 11) return "fail" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt3969.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt3969.kt deleted file mode 100644 index 1e34286ea50..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt3969.kt +++ /dev/null @@ -1,19 +0,0 @@ -var result = "Fail" - -class A - -operator fun A.inc(s: String = "OK"): A { - result = s - return this -} - -fun box(): String { - var a = A() - a++ - if (result != "OK") return "Fail 1" - - result = "Fail" - ++a - - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt4228.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt4228.kt deleted file mode 100644 index 9906d20305f..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt4228.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - companion object -} - -val foo: Any.() -> Unit = {} - -fun test() { - A.(foo)() -} - -fun box(): String { - test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt475.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt475.kt deleted file mode 100644 index f81998986f4..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt475.kt +++ /dev/null @@ -1,17 +0,0 @@ - -fun box() : String { - val array = ArrayList() - array.add("0") - array.add("1") - array.add("2") - array.last = "5" - return if(array.length == 3 && array.last == "5") "OK" else "fail" -} - -var ArrayList.length : Int - get() = size - set(value: Int) = throw Error() - -var ArrayList.last : T - get() = get(size-1)!! - set(el : T) { set(size-1, el) } diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt5467.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt5467.kt deleted file mode 100644 index 5d5ab0473a5..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt5467.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun String.foo() : String { - fun Int.bar() : String { - fun Long.baz() : String { - val x = this@foo - val y = this@bar - val z = this@baz - return "$x $y $z" - } - return 0L.baz() - } - return 42.bar() -} - -fun box() : String { - val result = "OK".foo() - - if (result != "OK 42 0") return "fail: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt606.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt606.kt deleted file mode 100644 index c2199521e9e..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt606.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package kt606 - -//KT-606 wrong resolved call - -class StandardPipelineFactory(val config : ChannelPipeline.() -> Unit) : ChannelPipelineFactory { - override fun getPipeline() : ChannelPipeline { - val pipeline : ChannelPipeline = DefaultChannelPipeline() - pipeline.config() - return pipeline - } -} - -interface ChannelPipeline { - fun print(any: Any) -} - -class DefaultChannelPipeline : ChannelPipeline { - override fun print(any: Any) { - System.out?.println(any) - } - -} - -interface ChannelPipelineFactory { - fun getPipeline() : ChannelPipeline -} - -fun box() : String { - StandardPipelineFactory({ print("OK") }).getPipeline() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/kt865.kt b/backend.native/tests/external/codegen/box/extensionFunctions/kt865.kt deleted file mode 100644 index b461ec16a08..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/kt865.kt +++ /dev/null @@ -1,17 +0,0 @@ -class Template() { - val collected = ArrayList() - - operator fun String.unaryPlus() { - collected.add(this@unaryPlus) - } - - fun test() { - + "239" - } -} - -fun box() : String { - val u = Template() - u.test() - return if(u.collected.size == 1 && u.collected.get(0) == "239") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/nested2.kt b/backend.native/tests/external/codegen/box/extensionFunctions/nested2.kt deleted file mode 100644 index 9c0aecd0ffb..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/nested2.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box() : String { - val y = 12 - val op = { x:Int -> (x + y).toString() } - - val op2 : Int.(Int) -> String = { op(this + it) } - - return if("27" == 5.op2(10)) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/shared.kt b/backend.native/tests/external/codegen/box/extensionFunctions/shared.kt deleted file mode 100644 index 3cf651590a4..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/shared.kt +++ /dev/null @@ -1,13 +0,0 @@ -infix fun T.mustBe(t : T) { - assert("$this must be $t") {this == t} -} - -inline fun assert(message : String, condition : () -> Boolean) { - if (!condition()) - throw AssertionError(message) -} - -fun box() : String { - "lala" mustBe "lala" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/simple.kt b/backend.native/tests/external/codegen/box/extensionFunctions/simple.kt deleted file mode 100644 index 101e52661bf..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/simple.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun StringBuilder.first() = this.get(0) - -fun foo() = StringBuilder("foo").first() - -fun box() = if (foo() == 'f') "OK" else "Fail ${foo()}" diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/thisMethodInObjectLiteral.kt b/backend.native/tests/external/codegen/box/extensionFunctions/thisMethodInObjectLiteral.kt deleted file mode 100644 index cf541e2edb4..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/thisMethodInObjectLiteral.kt +++ /dev/null @@ -1,15 +0,0 @@ -class Test { - private fun T.self() = object{ - fun calc() : T { - return this@self - } - } - - fun box() : Int { - return 1.self().calc() + 1 - } -} - -fun box() : String { - return if (Test().box() == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/virtual.kt b/backend.native/tests/external/codegen/box/extensionFunctions/virtual.kt deleted file mode 100644 index cc8a6a72f1a..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/virtual.kt +++ /dev/null @@ -1,24 +0,0 @@ -class Request(val path: String) { - -} - -class Handler() { - fun Int.times(op: ()-> Unit) { - for(i in 0..this) - op() - } - -// fun Request.getPath() : String { -// val sb = java.lang.StringBuilder() -// 10.times { -// sb.append(path)?.append(this) -// } -// return sb.toString() as String -// } - - fun Request.getPath() = path - - fun test(request: Request) = request.getPath() -} - -fun box() : String = if(Handler().test(Request("239")) == "239") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/extensionFunctions/whenFail.kt b/backend.native/tests/external/codegen/box/extensionFunctions/whenFail.kt deleted file mode 100644 index 80f001027b1..00000000000 --- a/backend.native/tests/external/codegen/box/extensionFunctions/whenFail.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun StringBuilder.takeFirst(): Char { - if (this.length == 0) return 0.toChar() - val c = this.get(0) - this.deleteCharAt(0) - return c -} - -fun foo(expr: StringBuilder): Int { - val c = expr.takeFirst() - when(c) { - 0.toChar() -> throw Exception("zero") - else -> throw Exception("nonzero" + c) - } -} - -fun box(): String { - try { - foo(StringBuilder()) - return "Fail" - } - catch (e: Exception) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/accessorForPrivateSetter.kt b/backend.native/tests/external/codegen/box/extensionProperties/accessorForPrivateSetter.kt deleted file mode 100644 index 6dae405db6d..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/accessorForPrivateSetter.kt +++ /dev/null @@ -1,21 +0,0 @@ -class A { - var result = "Fail" - - private var Int.foo: String - get() = result - private set(value) { - result = value - } - - fun run(): String { - class O { - fun run() { - 42.foo = "OK" - } - } - O().run() - return (-42).foo - } -} - -fun box() = A().run() diff --git a/backend.native/tests/external/codegen/box/extensionProperties/genericValForPrimitiveType.kt b/backend.native/tests/external/codegen/box/extensionProperties/genericValForPrimitiveType.kt deleted file mode 100644 index 787ea1c0245..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/genericValForPrimitiveType.kt +++ /dev/null @@ -1,39 +0,0 @@ -val T.valProp: T - get() = this - -class A { - val int: Int = 0 - val long: Long = 0.toLong() - val short: Short = 0.toShort() - val byte: Byte = 0.toByte() - val double: Double = 0.0 - val float: Float = 0.0f - val char: Char = '0' - val bool: Boolean = false - - operator fun invoke() { - int.valProp - long.valProp - short.valProp - byte.valProp - double.valProp - float.valProp - char.valProp - bool.valProp - } -} - -fun box(): String { - 0.valProp - false.valProp - '0'.valProp - 0.0.valProp - 0.0f.valProp - 0.toByte().valProp - 0.toShort().valProp - 0.toLong().valProp - - A()() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionProperties/genericValMultipleUpperBounds.kt b/backend.native/tests/external/codegen/box/extensionProperties/genericValMultipleUpperBounds.kt deleted file mode 100644 index 3f338755bd8..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/genericValMultipleUpperBounds.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.io.Serializable - -val T.valProp: T where T : Number, T : Serializable - get() = this - -fun box(): String { - 0.valProp - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/genericVarForPrimitiveType.kt b/backend.native/tests/external/codegen/box/extensionProperties/genericVarForPrimitiveType.kt deleted file mode 100644 index a96514698c8..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/genericVarForPrimitiveType.kt +++ /dev/null @@ -1,40 +0,0 @@ -var T.varProp: T - get() = this - set(value: T) {} - -class A { - var int: Int = 0 - var long: Long = 0.toLong() - var short: Short = 0.toShort() - var byte: Byte = 0.toByte() - var double: Double = 0.0 - var float: Float = 0.0f - var char: Char = '0' - var bool: Boolean = false - - operator fun invoke() { - int.varProp = int - long.varProp = long - short.varProp = short - byte.varProp = byte - double.varProp = double - float.varProp = float - char.varProp = char - bool.varProp = bool - } -} - -fun box(): String { - 0.varProp = 0 - false.varProp = false - '0'.varProp = '0' - 0.0.varProp = 0.0 - 0.0f.varProp = 0.0f - 0.toByte().varProp = 0.toByte() - 0.toShort().varProp = 0.toShort() - 0.toLong().varProp = 0.toLong() - - A()() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClass.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClass.kt deleted file mode 100644 index 7f1d8387e59..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Test { - val Int.foo: String - get() = "OK" - - fun test(): String { - return 1.foo - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClassLongTypeInReceiver.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClassLongTypeInReceiver.kt deleted file mode 100644 index f4a3c12530b..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClassLongTypeInReceiver.kt +++ /dev/null @@ -1,28 +0,0 @@ -class Test { - var doubleStorage = "fail" - var longStorage = "fail" - - var Double.foo: String - get() = doubleStorage - set(value) { - doubleStorage = value - } - - var Long.bar: String - get() = longStorage - set(value) { - longStorage = value - } - - fun test(): String { - val d = 1.0 - d.foo = "O" - val l = 1L - l.bar = "K" - return d.foo + l.bar - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithGetter.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClassWithGetter.kt deleted file mode 100644 index e14ca8e686f..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithGetter.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Test { - val Int.foo: String - get() { - return "OK" - } - - fun test(): String { - return 1.foo - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateGetter.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateGetter.kt deleted file mode 100644 index b16ace4a6f0..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateGetter.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Test { - private val Int.foo: String - get() { - return "OK" - } - - fun test(): String { - return 1.foo - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateSetter.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateSetter.kt deleted file mode 100644 index de02691a5ac..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithPrivateSetter.kt +++ /dev/null @@ -1,19 +0,0 @@ -class Test { - var storage = "Fail" - - var Int.foo: String - get() = storage - private set(str: String) { - storage = str - } - - fun test(): String { - val i = 1 - i.foo = "OK" - return i.foo - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithSetter.kt b/backend.native/tests/external/codegen/box/extensionProperties/inClassWithSetter.kt deleted file mode 100644 index c562b29e92e..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/inClassWithSetter.kt +++ /dev/null @@ -1,19 +0,0 @@ -class Test { - var storage = "Fail" - - var Int.foo: String - get() = storage - set(value) { - storage = value - } - - fun test(): String { - val i = 1 - i.foo = "OK" - return i.foo - } -} - -fun box(): String { - return Test().test() -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/kt9897.kt b/backend.native/tests/external/codegen/box/extensionProperties/kt9897.kt deleted file mode 100644 index b65b93e4960..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/kt9897.kt +++ /dev/null @@ -1,42 +0,0 @@ -@kotlin.native.ThreadLocal -object Test { - var z = "0" - var l = 0L - - fun changeObject(): String { - "1".someProperty += 1 - return z - } - - fun changeLong(): Long { - 2L.someProperty -= 1 - return l - } - - var String.someProperty: Int - get() { - return this.length - } - set(left) { - z += this + left - } - - var Long.someProperty: Long - get() { - return l - } - set(left) { - l += this + left - } - -} - -fun box(): String { - val changeObject = Test.changeObject() - if (changeObject != "012") return "fail 1: $changeObject" - - val changeLong = Test.changeLong() - if (changeLong != 1L) return "fail 1: $changeLong" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionProperties/kt9897_topLevel.kt b/backend.native/tests/external/codegen/box/extensionProperties/kt9897_topLevel.kt deleted file mode 100644 index 9ff0dd42c22..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/kt9897_topLevel.kt +++ /dev/null @@ -1,38 +0,0 @@ -var z = "0" -var l = 0L - -fun changeObject(): String { - "1".someProperty += 1 - return z -} - -fun changeLong(): Long { - 2L.someProperty -= 1 - return l -} - -var String.someProperty: Int - get() { - return this.length - } - set(left) { - z += this + left - } - -var Long.someProperty: Long - get() { - return l - } - set(left) { - l += this + left - } - -fun box(): String { - val changeObject = changeObject() - if (changeObject != "012") return "fail 1: $changeObject" - - val changeLong = changeLong() - if (changeLong != 1L) return "fail 1: $changeLong" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/extensionProperties/topLevel.kt b/backend.native/tests/external/codegen/box/extensionProperties/topLevel.kt deleted file mode 100644 index df0abcea24e..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/topLevel.kt +++ /dev/null @@ -1,6 +0,0 @@ -val Int.foo: String - get() = "OK" - -fun box(): String { - return 1.foo -} diff --git a/backend.native/tests/external/codegen/box/extensionProperties/topLevelLongTypeInReceiver.kt b/backend.native/tests/external/codegen/box/extensionProperties/topLevelLongTypeInReceiver.kt deleted file mode 100644 index b00288453a2..00000000000 --- a/backend.native/tests/external/codegen/box/extensionProperties/topLevelLongTypeInReceiver.kt +++ /dev/null @@ -1,22 +0,0 @@ -var fooStorage = "Fail" -var barStorage = "Fail" - -var Double.foo: String - get() = fooStorage - set(value) { - fooStorage = value - } - -var Long.bar: String - get() = barStorage - set(value) { - barStorage = value - } - -fun box(): String { - val d = 1.0 - d.foo = "O" - val l = 1L - l.bar = "K" - return d.foo + l.bar -} diff --git a/backend.native/tests/external/codegen/box/external/jvmStaticExternal.kt b/backend.native/tests/external/codegen/box/external/jvmStaticExternal.kt deleted file mode 100644 index 6fbc3f124df..00000000000 --- a/backend.native/tests/external/codegen/box/external/jvmStaticExternal.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package foo - -class WithNative { - companion object { - @JvmStatic external fun bar(l: Long, s: String): Double - } -} - -object ObjWithNative { - @JvmStatic external fun bar(l: Long, s: String): Double -} - -fun box(): String { - var d = 0.0 - try { - d = WithNative.bar(1, "") - return "Link error expected" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.WithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message - } - - try { - d = ObjWithNative.bar(1, "") - return "Link error expected on object" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.message - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/external/jvmStaticExternalPrivate.kt b/backend.native/tests/external/codegen/box/external/jvmStaticExternalPrivate.kt deleted file mode 100644 index 125d7eb8ed2..00000000000 --- a/backend.native/tests/external/codegen/box/external/jvmStaticExternalPrivate.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -class C { - companion object { - private @JvmStatic external fun foo() - } - - fun bar() { - foo() - } -} - -fun box(): String { - try { - C().bar() - return "Link error expected" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "C.foo()V") return "Fail 1: " + e.message - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/external/withDefaultArg.kt b/backend.native/tests/external/codegen/box/external/withDefaultArg.kt deleted file mode 100644 index 5cda0c9c789..00000000000 --- a/backend.native/tests/external/codegen/box/external/withDefaultArg.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package foo - -object ObjWithNative { - external fun foo(x: Int = 1): Double - - @JvmStatic external fun bar(l: Long, s: String = ""): Double -} - -external fun topLevel(x: Int = 1): Double - -fun box(): String { - var d = 0.0 - - try { - d = ObjWithNative.bar(1) - return "Link error expected on object" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message - } - - try { - d = ObjWithNative.foo() - return "Link error expected on object" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.message - } - - try { - d = topLevel() - return "Link error expected on object" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.WithDefaultArgKt.topLevel(I)D") return "Fail 3: " + e.message - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fakeOverride/diamondFunction.kt b/backend.native/tests/external/codegen/box/fakeOverride/diamondFunction.kt deleted file mode 100644 index da73cd28d7f..00000000000 --- a/backend.native/tests/external/codegen/box/fakeOverride/diamondFunction.kt +++ /dev/null @@ -1,31 +0,0 @@ -interface T { - fun foo(): Unit -} - -open class A : T { - override fun foo() {} -} - -interface B : T - -class C : A(), B -class D : B, A() -class E : A(), B, T -class F : B, A(), T -class G : A(), T, B -class H : B, T, A() -class I : T, A(), B -class J : T, B, A() - -fun box(): String { - C().foo() - D().foo() - E().foo() - F().foo() - G().foo() - H().foo() - I().foo() - J().foo() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fakeOverride/function.kt b/backend.native/tests/external/codegen/box/fakeOverride/function.kt deleted file mode 100644 index af0e02f4f49..00000000000 --- a/backend.native/tests/external/codegen/box/fakeOverride/function.kt +++ /dev/null @@ -1,35 +0,0 @@ -interface T { - fun foo(): Unit -} - -open class A : T { - override fun foo(): Unit {} -} - -class B : A(), T -class C : T, A() - -interface U : T -class D : U, A() -class E : A(), U -class F : U, T, A() -class G : T, U, A() -class H : U, A(), T -class I : T, A(), U -class J : A(), U, T -class K : A(), T, U - -fun box(): String { - B().foo() - C().foo() - D().foo() - E().foo() - F().foo() - G().foo() - H().foo() - I().foo() - J().foo() - K().foo() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fakeOverride/propertyGetter.kt b/backend.native/tests/external/codegen/box/fakeOverride/propertyGetter.kt deleted file mode 100644 index c032e3ab837..00000000000 --- a/backend.native/tests/external/codegen/box/fakeOverride/propertyGetter.kt +++ /dev/null @@ -1,37 +0,0 @@ -interface T { - val foo: String -} - -open class A : T { - override val foo: String = "" -} - -class B : A(), T -class C : T, A() - -interface U : T - -class D : U, A() -class E : A(), U -class F : U, T, A() -class G : T, U, A() -class H : U, A(), T -class I : T, A(), U -class J : A(), U, T -class K : A(), T, U - -fun box(): String { - B().foo - C().foo - - D().foo - E().foo - F().foo - G().foo - H().foo - I().foo - J().foo - K().foo - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fakeOverride/propertySetter.kt b/backend.native/tests/external/codegen/box/fakeOverride/propertySetter.kt deleted file mode 100644 index c2f623ba448..00000000000 --- a/backend.native/tests/external/codegen/box/fakeOverride/propertySetter.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface T { - var result: String -} - -open class A : T { - override var result: String - get() = "" - set(value) {} -} - -class B : A(), T -class C : T, A() - -fun box(): String { - B().result = "" - C().result = "" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fieldRename/constructorAndClassObject.kt b/backend.native/tests/external/codegen/box/fieldRename/constructorAndClassObject.kt deleted file mode 100644 index 7bf67aa45a1..00000000000 --- a/backend.native/tests/external/codegen/box/fieldRename/constructorAndClassObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -class Test(val prop: String) { - - companion object { - public val prop : String = "CO"; - } - -} - - -fun box() : String { - val obj = Test("OK"); - - if (Test.prop != "CO") return "fail1"; - - return obj.prop; -} diff --git a/backend.native/tests/external/codegen/box/fieldRename/delegates.kt b/backend.native/tests/external/codegen/box/fieldRename/delegates.kt deleted file mode 100644 index 83501722a0e..00000000000 --- a/backend.native/tests/external/codegen/box/fieldRename/delegates.kt +++ /dev/null @@ -1,28 +0,0 @@ -import kotlin.reflect.KProperty - -public open class TestDelegate(private val initializer: () -> T) { - private var value: T? = null - - operator open fun getValue(thisRef: Any?, desc: KProperty<*>): T { - if (value == null) { - value = initializer() - } - return value!! - } - - operator open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : T) { - value = svalue - } -} - -class A {} -class B {} - -public val A.s: String by TestDelegate( {"OK2"}) -public val B.s: String by TestDelegate( {"OK"}) - -fun box() : String { - if (A().s != "OK2") return "fail1" - - return B().s -} diff --git a/backend.native/tests/external/codegen/box/fieldRename/genericPropertyWithItself.kt b/backend.native/tests/external/codegen/box/fieldRename/genericPropertyWithItself.kt deleted file mode 100644 index ea584c3a917..00000000000 --- a/backend.native/tests/external/codegen/box/fieldRename/genericPropertyWithItself.kt +++ /dev/null @@ -1,14 +0,0 @@ -public class MPair ( - public val first: A -) { - override fun equals(o: Any?): Boolean { - val t = o as MPair<*> - return first == t.first - } -} - -fun box(): String { - val a = MPair("O") - a.equals(a) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/finallyAndFinally.kt b/backend.native/tests/external/codegen/box/finally/finallyAndFinally.kt deleted file mode 100644 index e902bc8746f..00000000000 --- a/backend.native/tests/external/codegen/box/finally/finallyAndFinally.kt +++ /dev/null @@ -1,39 +0,0 @@ -class MyString { - var s = "" - operator fun plus(x : String) : MyString { - s += x - return this - } - - override fun toString(): String { - return s - } -} - - -fun test1() : MyString { - var r = MyString() - try { - r + "Try1" - - try { - r + "Try2" - if (true) - return r - } finally { - r + "Finally2" - if (true) { - return r - } - } - - return r - } finally { - r + "Finally1" - } -} - - -fun box(): String { - return if (test1().toString() == "Try1Try2Finally2Finally1") "OK" else "fail: ${test1()}" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/kt3549.kt b/backend.native/tests/external/codegen/box/finally/kt3549.kt deleted file mode 100644 index 8e6f09f2aff..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt3549.kt +++ /dev/null @@ -1,41 +0,0 @@ -fun test1() : String { - var s = ""; - try { - try { - s += "Try"; - throw Exception() - } catch (x : Exception) { - s += "Catch"; - throw x - } finally { - s += "Finally"; - } - } catch (x : Exception) { - return s - } -} - -fun test2() : String { - var s = ""; - - try { - s += "Try"; - throw Exception() - } catch (x : Exception) { - s += "Catch"; - } finally { - s += "Finally"; - } - - return s -} - - - -fun box() : String { - if (test1() != "TryCatchFinally") return "fail1: ${test1()}" - - if (test2() != "TryCatchFinally") return "fail2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/finally/kt3706.kt b/backend.native/tests/external/codegen/box/finally/kt3706.kt deleted file mode 100644 index 923e3aa045a..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt3706.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun f(): Int { - try { - return 0 - } - finally { - try { // culprit ?? remove this try-catch and it works. - } catch (ignore: Exception) { - } - } -} - -fun box(): String { - if (f() != 0) return "fail1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/kt3867.kt b/backend.native/tests/external/codegen/box/finally/kt3867.kt deleted file mode 100644 index 8e41ea804b5..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt3867.kt +++ /dev/null @@ -1,46 +0,0 @@ -fun fail() = if (true) throw RuntimeException() else 1 - -fun test1(): String { - var r = "" - try { - try { - r += "Try" - return r - } catch (e: RuntimeException) { - r += "Catch" - return r - } - finally { - r += "Finally" - fail() - } - } catch (e: RuntimeException) { - return r - } -} - -fun test2(): String { - var r = "" - try { - try { - r += "Try" - } catch (e: RuntimeException) { - r += "Catch" - } - finally { - r += "Finally" - fail() - } - } catch (e: RuntimeException) { - return r - } - return r + "Fail" -} - -fun box(): String { - if (test1() != "TryFinally") return "fail1: ${test1()}" - - if (test2() != "TryFinally") return "fail2: ${test2()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/kt3874.kt b/backend.native/tests/external/codegen/box/finally/kt3874.kt deleted file mode 100644 index fa0a4259d12..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt3874.kt +++ /dev/null @@ -1,35 +0,0 @@ -fun test1(): String { - var r = "" - for (i in 1..2) { - try { - r += "O" - continue - } finally { - r += "K" - break - } - } - return r -} - -fun test2(): String { - var r = "" - for (i in 1..2) { - try { - r += "O" - break - } finally { - r += "K" - continue - } - } - return r -} - -fun box(): String { - if (test1() != "OK") return "fail1: ${test1()}" - - if (test2() != "OKOK") return "fail2: ${test2()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/kt3894.kt b/backend.native/tests/external/codegen/box/finally/kt3894.kt deleted file mode 100644 index 83930d88fbd..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt3894.kt +++ /dev/null @@ -1,36 +0,0 @@ -class MyString { - var s = "" - operator fun plus(x : String) : MyString { - s += x - return this - } - - override fun toString(): String { - return s - } -} - -fun test1() : MyString { - var r = MyString() - while (true) { - try { - r + "Try" - - if (true) { - r + "Break" - break - } - - } finally { - return r + "Finally" - } - } -} - - - -fun box(): String { - if (test1().toString() != "TryBreakFinally") return "fail1: ${test1().toString()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/kt4134.kt b/backend.native/tests/external/codegen/box/finally/kt4134.kt deleted file mode 100644 index 24e4750d089..00000000000 --- a/backend.native/tests/external/codegen/box/finally/kt4134.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun io(s: R, a: (R) -> T): T { - try { - return a(s) - } finally { - try { - s.toString() - } catch(e: Exception) { - //NOP - } - } -} - -fun box() : String { - return io(("OK"), {it}) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/loopAndFinally.kt b/backend.native/tests/external/codegen/box/finally/loopAndFinally.kt deleted file mode 100644 index 88425e55ac0..00000000000 --- a/backend.native/tests/external/codegen/box/finally/loopAndFinally.kt +++ /dev/null @@ -1,69 +0,0 @@ -//KT-3869 Loops and finally: outer finally block not run - -class MyString { - var s = "" - operator fun plus(x : String) : MyString { - s += x - return this - } - - override fun toString(): String { - return s - } -} - -fun test1() : MyString { - var r = MyString() - try { - r + "Try" - - while(r.toString() != "") { - return r + "Loop" - } - - return r + "Fail" - } finally { - r + "Finally" - } -} - -fun test2() : MyString { - var r = MyString() - try { - r + "Try" - - do { - if (r.toString() != "") { - return r + "Loop" - } - } while (r.toString() != "") - - return r + "Fail" - } finally { - r + "Finally" - } -} - -fun test3() : MyString { - var r = MyString() - try { - r + "Try" - - for(i in 1..2) { - r + "Loop" - return r - } - - return r + "Fail" - } finally { - r + "Finally" - } -} - -fun box(): String { - if (test1().toString() != "TryLoopFinally") return "fail1: ${test1()}" - if (test2().toString() != "TryLoopFinally") return "fail2: ${test2()}" - if (test3().toString() != "TryLoopFinally") return "fail3: ${test3()}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/notChainCatch.kt b/backend.native/tests/external/codegen/box/finally/notChainCatch.kt deleted file mode 100644 index 18e5573b318..00000000000 --- a/backend.native/tests/external/codegen/box/finally/notChainCatch.kt +++ /dev/null @@ -1,98 +0,0 @@ -fun unsupportedEx() { - if (true) throw UnsupportedOperationException() -} - -fun runtimeEx() { - if (true) throw RuntimeException() -} - -fun test1() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - } catch (x : UnsupportedOperationException) { - s += "Catch"; - runtimeEx() - } catch (e: RuntimeException) { - s += "WrongCatch" - } - } catch (x : RuntimeException) { - return s - } - return s + "Failed" -} - -fun test1WithFinally() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - } catch (x : UnsupportedOperationException) { - s += "Catch"; - runtimeEx() - } catch (e: RuntimeException) { - s += "WrongCatch" - } finally { - s += "Finally" - } - } catch (x : RuntimeException) { - return s - } - return s + "Failed" -} - -fun test2() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - return s - } catch (x : UnsupportedOperationException) { - s += "Catch"; - runtimeEx() - return s - } catch (e: RuntimeException) { - s += "WrongCatch" - } - } catch (x : RuntimeException) { - return s - } - return s + "Failed" -} - -fun test2WithFinally() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - return s - } catch (x : UnsupportedOperationException) { - s += "Catch"; - runtimeEx() - return s - } catch (e: RuntimeException) { - s += "WrongCatch" - } finally { - s += "Finally" - } - } catch (x : RuntimeException) { - return s - } - return s + "Failed" -} - - - -fun box() : String { - if (test1() != "TryCatch") return "fail1: ${test1()}" - if (test1WithFinally() != "TryCatchFinally") return "fail2: ${test1WithFinally()}" - - if (test2() != "TryCatch") return "fail3: ${test2()}" - if (test2WithFinally() != "TryCatchFinally") return "fail4: ${test2WithFinally()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/finally/tryFinally.kt b/backend.native/tests/external/codegen/box/finally/tryFinally.kt deleted file mode 100644 index 39928fbec60..00000000000 --- a/backend.native/tests/external/codegen/box/finally/tryFinally.kt +++ /dev/null @@ -1,45 +0,0 @@ -fun unsupportedEx() { - if (true) throw UnsupportedOperationException() -} - -fun runtimeEx() { - if (true) throw RuntimeException() -} - -fun test1WithFinally() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - } finally { - s += "Finally" - } - } catch (x : RuntimeException) { - return s - } - return s + "Failed" -} - - -fun test2WithFinally() : String { - var s = ""; - try { - try { - s += "Try"; - unsupportedEx() - return s - } finally { - s += "Finally" - } - } catch (x : RuntimeException) { - return s - } -} - -fun box() : String { - if (test1WithFinally() != "TryFinally") return "fail2: ${test1WithFinally()}" - - if (test2WithFinally() != "TryFinally") return "fail4: ${test2WithFinally()}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/finally/tryLoopTry.kt b/backend.native/tests/external/codegen/box/finally/tryLoopTry.kt deleted file mode 100644 index 0a969975070..00000000000 --- a/backend.native/tests/external/codegen/box/finally/tryLoopTry.kt +++ /dev/null @@ -1,36 +0,0 @@ -//test for appropriate - -class MyString { - var s = "" - operator fun plus(x : String) : MyString { - s += x - return this - } - - override fun toString(): String { - return s - } -} - - -fun test1() : MyString { - var r = MyString() - try { - r + "Try1" - for(i in 1..1) { - try { - r + "Try2" - } finally { - return r + "Finally2" - } - } - - } finally { - r + "Finally1" - } - return r + "Fail" -} - -fun box(): String { - return if (test1().toString() == "Try1Try2Finally2Finally1") "OK" else "fail: ${test1()}" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/fullJdk/charBuffer.kt b/backend.native/tests/external/codegen/box/fullJdk/charBuffer.kt deleted file mode 100644 index 7d7f2702e91..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/charBuffer.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TARGET_BACKEND: JVM - -// FULL_JDK - -import java.nio.CharBuffer - -fun box(): String { - val cb = CharBuffer.wrap("OK") - cb.position(1) - val o = cb[0] - val k = (cb as CharSequence).get(0) - return o.toString() + k -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/ifInWhile.kt b/backend.native/tests/external/codegen/box/fullJdk/ifInWhile.kt deleted file mode 100644 index 8831f244021..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/ifInWhile.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM - -// FULL_JDK - -fun box() : String { - val processors = Runtime.getRuntime()!!.availableProcessors() - var threadNum = 1 - while(threadNum <= 1024) { - if(threadNum < 2 * processors) - threadNum += 1 - else - threadNum *= 2 - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/intCountDownLatchExtension.kt b/backend.native/tests/external/codegen/box/fullJdk/intCountDownLatchExtension.kt deleted file mode 100644 index de02f10104e..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/intCountDownLatchExtension.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM - -// FULL_JDK - -import java.util.concurrent.atomic.AtomicInteger -import java.util.concurrent.CountDownLatch -import java.util.concurrent.locks.ReentrantLock - -fun Int.latch(op: CountDownLatch.() -> T) : T { - val cdl = CountDownLatch(this) - val res = cdl.op() - cdl.await() - return res -} - -fun id(op: () -> Unit) = op() - -fun box() : String { - 1.latch{ - id { - countDown() - } - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/kt434.kt b/backend.native/tests/external/codegen/box/fullJdk/kt434.kt deleted file mode 100644 index 1037c13e217..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/kt434.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM - -// FULL_JDK - -import java.net.* - -fun String.decodeURI(encoding : String) : String? = - try { - URLDecoder.decode(this, encoding) - } - catch (e : Throwable) { - null - } - -fun box() : String { - return if("hhh".decodeURI("") == null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/native/nativePropertyAccessors.kt b/backend.native/tests/external/codegen/box/fullJdk/native/nativePropertyAccessors.kt deleted file mode 100644 index 56140cace52..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/native/nativePropertyAccessors.kt +++ /dev/null @@ -1,54 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FULL_JDK - -class C { - companion object { - val defaultGetter: Int = 1 - external get - - var defaultSetter: Int = 1 - external get - external set - } - - val defaultGetter: Int = 1 - external get - - var defaultSetter: Int = 1 - external get - external set -} - -val defaultGetter: Int = 1 - external get - -var defaultSetter: Int = 1 - external get - external set - -fun check(body: () -> Unit, signature: String): String? { - try { - body() - return "Link error expected" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != signature) return "Fail $signature: " + e.message - } - - return null -} - -fun box(): String { - return check({defaultGetter}, "NativePropertyAccessorsKt.getDefaultGetter()I") - ?: check({defaultSetter = 1}, "NativePropertyAccessorsKt.setDefaultSetter(I)V") - - ?: check({C.defaultGetter}, "C\$Companion.getDefaultGetter()I") - ?: check({C.defaultSetter = 1}, "C\$Companion.setDefaultSetter(I)V") - - ?: check({C().defaultGetter}, "C.getDefaultGetter()I") - ?: check({C().defaultSetter = 1}, "C.setDefaultSetter(I)V") - - ?: "OK" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/native/simpleNative.kt b/backend.native/tests/external/codegen/box/fullJdk/native/simpleNative.kt deleted file mode 100644 index 94b2a5e8e52..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/native/simpleNative.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FULL_JDK - -package foo - -class WithNative { - external fun foo() -} - -fun box(): String { - try { - WithNative().foo() - return "Link error expected" - } - catch (e: java.lang.UnsatisfiedLinkError) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/native/topLevel.kt b/backend.native/tests/external/codegen/box/fullJdk/native/topLevel.kt deleted file mode 100644 index aa675eef76c..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/native/topLevel.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FULL_JDK - -package foo - -external fun bar(l: Long, s: String): Double - -fun box(): String { - var d = 0.0 - - try { - d = bar(1, "") - return "Link error expected on object" - } - catch (e: java.lang.UnsatisfiedLinkError) { - if (e.message != "foo.TopLevelKt.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt b/backend.native/tests/external/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt deleted file mode 100644 index b61651eedad..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM - -// FULL_JDK - -import java.util.* - -fun box(): String { - val a = ArrayList() as AbstractList - a.add(null) - try { - val b: String = a[0] - return "Fail: an exception should be thrown" - } catch (e: IllegalStateException) { - val st = (e as java.lang.Throwable).getStackTrace() - if (st.size < 5) { - return "Fail: very small stack trace, should at least have current function and JUnit reflective calls: ${Arrays.toString(st)}" - } - val top = st[0] - if (!(top.getClassName() == "PlatformTypeAssertionStackTraceKt" && top.getMethodName() == "box")) { - return "Fail: top stack trace element should be PlatformTypeAssertionStackTraceKt.box() from default package, but was $top" - } - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/regressions/kt15112.kt b/backend.native/tests/external/codegen/box/fullJdk/regressions/kt15112.kt deleted file mode 100644 index cc816864f21..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/regressions/kt15112.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FULL_JDK -// WITH_RUNTIME -// IGNORE_BACKEND: JS, NATIVE - -import java.util.concurrent.locks.ReentrantReadWriteLock -import kotlin.concurrent.read -import kotlin.concurrent.write - -private val evalStateLock = ReentrantReadWriteLock() -private val classLoaderLock = ReentrantReadWriteLock() -val compiledClasses = arrayListOf("") - -fun box(): String = evalStateLock.write { - classLoaderLock.read { - classLoaderLock.write { - "write" - } - - compiledClasses.forEach { - it - } - } - - classLoaderLock.read { - compiledClasses.map { it } - } - - "OK" -} diff --git a/backend.native/tests/external/codegen/box/fullJdk/regressions/kt1770.kt b/backend.native/tests/external/codegen/box/fullJdk/regressions/kt1770.kt deleted file mode 100644 index be5c7263878..00000000000 --- a/backend.native/tests/external/codegen/box/fullJdk/regressions/kt1770.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FULL_JDK -// WITH_RUNTIME - -//This front-end problem test added to box ones only cause of FULL_JDK support -import org.w3c.dom.Element - -class MyElement(e: Element): Element by e { - fun bar() = "OK" -} - -fun box() : String { - val touch = MyElement::class.java - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/coerceVoidToArray.kt b/backend.native/tests/external/codegen/box/functions/coerceVoidToArray.kt deleted file mode 100644 index 695a3a50187..00000000000 --- a/backend.native/tests/external/codegen/box/functions/coerceVoidToArray.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun a(): IntArray? = null - -fun b(): Nothing = throw Exception() - -fun foo(): IntArray = a() ?: b() - - -fun box(): String { - try { - foo() - } catch (e: Exception) { - return "OK" - } - - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/coerceVoidToObject.kt b/backend.native/tests/external/codegen/box/functions/coerceVoidToObject.kt deleted file mode 100644 index 660ea0d44ec..00000000000 --- a/backend.native/tests/external/codegen/box/functions/coerceVoidToObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun a(): String? = null - -fun b(): Nothing = throw Exception() - -fun foo(): String = a() ?: b() - - -fun box(): String { - try { - foo() - } catch (e: Exception) { - return "OK" - } - - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/dataLocalVariable.kt b/backend.native/tests/external/codegen/box/functions/dataLocalVariable.kt deleted file mode 100644 index 4d3c84e1085..00000000000 --- a/backend.native/tests/external/codegen/box/functions/dataLocalVariable.kt +++ /dev/null @@ -1,8 +0,0 @@ -// TODO: Enable when JS backend gets support of Java class library -// IGNORE_BACKEND: JS, NATIVE -fun ok(b: Boolean) = if (b) "OK" else "Fail" - -fun box(): String { - val data = java.util.Arrays.asList("foo", "bar")!! - return ok(data.contains("foo")) -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs.kt b/backend.native/tests/external/codegen/box/functions/defaultargs.kt deleted file mode 100644 index 726a4d4db10..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs.kt +++ /dev/null @@ -1,12 +0,0 @@ -open abstract class B { - fun foo(arg: Int = 239 + 1) : Int = arg -} - -class C() : B() { -} - -fun box() : String { - if(C().foo(10) != 10) return "fail" - if(C().foo() != 240) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs1.kt b/backend.native/tests/external/codegen/box/functions/defaultargs1.kt deleted file mode 100644 index 5666dd5603d..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs1.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + this.toString() + suffix - -fun box() : String { - if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail" - if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail" - if("mama".toPrefixedString("papa", "239") != "papamama239") return "fail" - if("mama".toPrefixedString("papa") != "papamama") return "fail" - if("mama".toPrefixedString() != "mama") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs2.kt b/backend.native/tests/external/codegen/box/functions/defaultargs2.kt deleted file mode 100644 index 710cc126ad2..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs2.kt +++ /dev/null @@ -1,34 +0,0 @@ -class T4( - val c1: Boolean, - val c2: Boolean, - val c3: Boolean, - val c4: String -) { - override fun equals(o: Any?): Boolean { - if (o !is T4) return false; - return c1 == o.c1 && - c2 == o.c2 && - c3 == o.c3 && - c4 == o.c4 - } -} - -fun reformat( - str : String, - normalizeCase : Boolean = true, - uppercaseFirstLetter : Boolean = true, - divideByCamelHumps : Boolean = true, - wordSeparator : String = " " -) = - T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) - - -fun box() : String { - val expected = T4(true, true, true, " ") - if(reformat("", true, true, true, " ") != expected) return "fail" - if(reformat("", true, true, true) != expected) return "fail" - if(reformat("", true, true) != expected) return "fail" - if(reformat("", true) != expected) return "fail" - if(reformat("") != expected) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs3.kt b/backend.native/tests/external/codegen/box/functions/defaultargs3.kt deleted file mode 100644 index df755765779..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs3.kt +++ /dev/null @@ -1,15 +0,0 @@ - -class C() { - fun Any.toMyPrefixedString(prefix: String = "", suffix: String="") : String = prefix + " " + suffix - - fun testReceiver() : String { - val res : String = "mama".toMyPrefixedString("111", "222") - return res - } - -} - -fun box() : String { - if(C().testReceiver() != "111 222") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs4.kt b/backend.native/tests/external/codegen/box/functions/defaultargs4.kt deleted file mode 100644 index b98b9a95d64..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs4.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface A { - fun bar2(arg: Int = 239) : Int - - fun bar(arg: Int = 240) : Int = bar2(arg/2) -} - -open abstract class B : A { - override fun bar2(arg: Int) : Int = arg -} - -class C : B() - -fun box() : String { - if(C().bar(10) != 5) return "fail" - if(C().bar() != 120) return "fail" - if(C().bar2() != 239) return "fail" - if(C().bar2(10) != 10) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs5.kt b/backend.native/tests/external/codegen/box/functions/defaultargs5.kt deleted file mode 100644 index 91dc6f6be40..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs5.kt +++ /dev/null @@ -1,13 +0,0 @@ -open abstract class B { - abstract fun foo2(arg: Int = 239) : Int -} - -class C : B() { - override fun foo2(arg: Int) : Int = arg -} - -fun box() : String { - if(C().foo2() != 239) return "fail" - if(C().foo2(10) != 10) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs6.kt b/backend.native/tests/external/codegen/box/functions/defaultargs6.kt deleted file mode 100644 index 90c4e943d5d..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs6.kt +++ /dev/null @@ -1,7 +0,0 @@ -interface A { - fun foo(x: Int, y: Int = x + 20, z: Int = y * 2) = z -} - -class B : A {} - -fun box() = if (B().foo(1) == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/functions/defaultargs7.kt b/backend.native/tests/external/codegen/box/functions/defaultargs7.kt deleted file mode 100644 index 107929fad00..00000000000 --- a/backend.native/tests/external/codegen/box/functions/defaultargs7.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A(val expected: Int) { - fun foo(x: Int, y: Int = x + 20, z: Int = y * 2) = z == expected -} - -fun box() = if (A(42).foo(1)) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/functions/ea33909.kt b/backend.native/tests/external/codegen/box/functions/ea33909.kt deleted file mode 100644 index f4022e8ba28..00000000000 --- a/backend.native/tests/external/codegen/box/functions/ea33909.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - return justPrint(9.compareTo(4)) -} - -fun justPrint(value: Int): String { - return if (value > 0) "OK" else "Fail $value" -} diff --git a/backend.native/tests/external/codegen/box/functions/fakeDescriptorWithSeveralOverridenOne.kt b/backend.native/tests/external/codegen/box/functions/fakeDescriptorWithSeveralOverridenOne.kt deleted file mode 100644 index 0086f8ab719..00000000000 --- a/backend.native/tests/external/codegen/box/functions/fakeDescriptorWithSeveralOverridenOne.kt +++ /dev/null @@ -1,23 +0,0 @@ -interface Named { - abstract fun getName() : String; -} - -interface MemberDescriptor : Named {} - -interface ClassifierDescriptor : Named {} - -interface ClassDescriptor : MemberDescriptor, ClassifierDescriptor {} - -class ClassDescriptorImpl : ClassDescriptor { - override fun getName(): String { - return "OK" - } -} - -class A(val descriptor : ClassDescriptor) { - val result : String = descriptor.getName() -} - -fun box(): String { - return A(ClassDescriptorImpl()).result -} diff --git a/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpression.kt b/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpression.kt deleted file mode 100644 index 0936de3f951..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpression.kt +++ /dev/null @@ -1,32 +0,0 @@ -val foo1 = fun Any.(): String { -return "239" + this -} - -val foo2 = fun Int.(i : Int) : Int = this + i - -fun fooT1() = fun (t : T) = t.toString() - -annotation class A - -fun box() : String { - if(10.foo1() != "23910") return "foo1 fail" - if(10.foo2(1) != 11) return "foo2 fail" - - if(1.(fun Int.() = this + 1)() != 2) return "test 3 failed"; - if( (fun () = 1)() != 1) return "test 4 failed"; - if( (fun (i: Int) = i)(1) != 1) return "test 5 failed"; - if( 1.(fun Int.(i: Int) = i + this)(1) != 2) return "test 6 failed"; - if( (fooT1()("mama")) != "mama") return "test 7 failed"; - - val a = @A fun Int.() = this + 1 - if (1.a() != 2) return "test 8 failed" - val b = ( fun Int.() = this + 1) - if (1.b() != 2) return "test 9 failed" - val c = (c@ fun Int.() = this + 1) - if (1.c() != 2) return "test 10 failed" - - val d = d@ fun (): Int { return@d 4} - if (d() != 4) return "test 11 failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpressionWithThisReference.kt b/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpressionWithThisReference.kt deleted file mode 100644 index 7d62448bf94..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionExpression/functionExpressionWithThisReference.kt +++ /dev/null @@ -1,35 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -fun Int.thisRef1() = fun () = this -fun Int.thisRef2() = fun (): Int {return this} - -fun T.genericThisRef1() = fun () = this -fun T.genericThisRef2() = fun (): T {return this} - -val Int.valThisRef1: () -> Int get() = fun () = this -val Int.valThisRef2: () -> Int get() = fun (): Int {return this} - -val T.valGenericThisRef1: ()->T get() = fun () = this -val T.valGenericThisRef2: ()->T get() = fun (): T {return this} - -val T.withLabel1: ()->T get() = fun () = this@withLabel1 -val T.withLabel2: ()->T get() = fun (): T {return this@withLabel2} - -fun box(): String { - if (1.thisRef1()() != 1) return "Test 1 failed" - if (2.thisRef2()() != 2) return "Test 2 failed" - - if (3.genericThisRef1()() != 3) return "Test 3 failed" - if (4.genericThisRef2()() != 4) return "Test 4 failed" - - if (5.valThisRef1() != 5) return "Test 5 failed" - if (6.valThisRef2() != 6) return "Test 6 failed" - - if (7.valGenericThisRef1() != 7) return "Test 7 failed" - if (8.valGenericThisRef2() != 8) return "Test 8 failed" - - if ("bar".withLabel1() != "bar") return "Test 9 failed" - if ("bar".withLabel2() != "bar") return "Test 10 failed" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/functionExpression/functionLiteralExpression.kt b/backend.native/tests/external/codegen/box/functions/functionExpression/functionLiteralExpression.kt deleted file mode 100644 index 5ee7f510702..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionExpression/functionLiteralExpression.kt +++ /dev/null @@ -1,27 +0,0 @@ -fun Any.foo1() : ()-> String { - return { "239" + this } -} - -fun Int.foo2() : (i : Int) -> Int { - return { x -> x + this } -} - -fun fooT1(t : T) = { t.toString() } - -fun fooT2(t: T) = { x:T -> t.toString() + x.toString() } - -object t - -fun box() : String { - if( (10.foo1())() != "23910") return "foo1 fail" - if( (10.foo2())(1) != 11 ) return "foo2 fail" - - if(1.(fun Int.() = this + 1)() != 2) return "test 3 failed"; - if( {1}() != 1) return "test 4 failed"; - if( {x : Int -> x}(1) != 1) return "test 5 failed"; - if( 1.(fun Int.(x: Int) = x + this)(1) != 2) return "test 6 failed"; - if( t.(fun Any.() = this)() != t) return "test 7 failed"; - if( (fooT1("mama"))() != "mama") return "test 8 failed"; - if( (fooT2("mama"))("papa") != "mamapapa") return "test 9 failed"; - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/functionExpression/underscoreParameters.kt b/backend.native/tests/external/codegen/box/functions/functionExpression/underscoreParameters.kt deleted file mode 100644 index b25ca696000..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionExpression/underscoreParameters.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K") - -fun box() = foo(fun(x: String, _: String, y: String) = x + y) diff --git a/backend.native/tests/external/codegen/box/functions/functionNtoString.kt b/backend.native/tests/external/codegen/box/functions/functionNtoString.kt deleted file mode 100644 index 8ec080de4c6..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionNtoString.kt +++ /dev/null @@ -1,38 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun check(expected: String, obj: Any?) { - val actual = obj.toString() - if (actual != expected) - throw AssertionError("Expected: $expected, actual: $actual") -} - -fun box(): String { - check("() -> kotlin.Unit", - { -> }) - check("() -> kotlin.Int", - { -> 42 }) - check("(kotlin.String) -> kotlin.Long", - fun (s: String) = 42.toLong()) - check("(kotlin.Int, kotlin.Int) -> kotlin.Unit", - { x: Int, y: Int -> }) - - check("kotlin.Int.() -> kotlin.Unit", - fun Int.() {}) - check("kotlin.Unit.() -> kotlin.Int?", - fun Unit.(): Int? = 42) - check("kotlin.String.(kotlin.String?) -> kotlin.Long", - fun String.(s: String?): Long = 42.toLong()) - check("kotlin.collections.List.(kotlin.collections.MutableSet<*>, kotlin.Nothing) -> kotlin.Unit", - fun List.(x: MutableSet<*>, y: Nothing) {}) - - check("(kotlin.IntArray, kotlin.ByteArray, kotlin.ShortArray, kotlin.CharArray, kotlin.LongArray, kotlin.BooleanArray, kotlin.FloatArray, kotlin.DoubleArray) -> kotlin.Array", - fun (ia: IntArray, ba: ByteArray, sa: ShortArray, ca: CharArray, la: LongArray, za: BooleanArray, fa: FloatArray, da: DoubleArray): Array = null!!) - - check("(kotlin.Array>>>) -> kotlin.Comparable", - fun (a: Array>>>): Comparable = null!!) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/functionNtoStringGeneric.kt b/backend.native/tests/external/codegen/box/functions/functionNtoStringGeneric.kt deleted file mode 100644 index 0b31b944bf8..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionNtoStringGeneric.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun bar(): String { - return { t: T -> t }.toString() -} - -class Baz { - fun baz(v: V): String { - return (fun(t: List): V = v).toString() - } -} - -open class Foo>(val lambda: (T) -> U) -class Bar : Foo>({ listOf(it) }) - -fun box(): String { - assertEquals("(T) -> T", bar()) - assertEquals("(kotlin.collections.List) -> V", Baz().baz("")) - assertEquals("(T) -> kotlin.collections.List", Bar().lambda.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/functionNtoStringNoReflect.kt b/backend.native/tests/external/codegen/box/functions/functionNtoStringNoReflect.kt deleted file mode 100644 index d1ee567b648..00000000000 --- a/backend.native/tests/external/codegen/box/functions/functionNtoStringNoReflect.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun check(expected: String, obj: Any?) { - val actual = obj.toString() - if (actual != expected) - throw AssertionError("Expected: $expected, actual: $actual") -} - -fun box(): String { - check("Function0", - { -> }) - check("Function0", - { -> 42 }) - check("Function1", - fun (s: String) = 42.toLong()) - check("Function2", - { x: Int, y: Int -> }) - - check("Function1", - fun Int.() {}) - check("Function1", - fun Unit.(): Int? = 42) - check("Function2", - fun String.(s: String?): Long = 42.toLong()) - check("Function3, java.util.Set, ?, kotlin.Unit>", - fun List.(x: MutableSet<*>, y: Nothing) {}) - - check("Function8", - fun (ia: IntArray, ba: ByteArray, sa: ShortArray, ca: CharArray, la: LongArray, za: BooleanArray, fa: FloatArray, da: DoubleArray): Array = null!!) - - check("Function1[][][], java.lang.Comparable>", - fun (a: Array>>>): Comparable = null!!) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/infixRecursiveCall.kt b/backend.native/tests/external/codegen/box/functions/infixRecursiveCall.kt deleted file mode 100644 index 6670cdc54b0..00000000000 --- a/backend.native/tests/external/codegen/box/functions/infixRecursiveCall.kt +++ /dev/null @@ -1,8 +0,0 @@ -infix fun Int.test(x : Int) : Int { - if (this > 1) { - return (this - 1) test x - } - return this -} - -fun box() : String = if (10.test(10) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/castFunctionToExtension.kt b/backend.native/tests/external/codegen/box/functions/invoke/castFunctionToExtension.kt deleted file mode 100644 index cb638d7b24f..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/castFunctionToExtension.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val f = fun (s: String): String = s - val g = f as String.() -> String - if ("OK".g() != "OK") return "Fail 1" - - val h = fun String.(): String = this - val i = h as (String) -> String - if (i("OK") != "OK") return "Fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/invoke/extensionInvokeOnExpr.kt b/backend.native/tests/external/codegen/box/functions/invoke/extensionInvokeOnExpr.kt deleted file mode 100644 index 35496700fd7..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/extensionInvokeOnExpr.kt +++ /dev/null @@ -1,21 +0,0 @@ -class A - -class B { - operator fun A.invoke() = "##" - operator fun A.invoke(i: Int) = "#${i}" -} - -fun foo() = A() - -fun B.test(): String { - if (A()() != "##") return "fail1" - if (A()(1) != "#1") return "fail2" - if (foo()() != "##") return "fail3" - if (foo()(42) != "#42") return "fail4" - if ((foo())(42) != "#42") return "fail5" - if ({ -> A()}()() != "##") return "fail6" - if ({ -> A()}()(37) != "#37") return "fail7" - return "OK" -} - -fun box(): String = B().test() diff --git a/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt b/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt deleted file mode 100644 index f277bae8b6e..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt +++ /dev/null @@ -1,14 +0,0 @@ -class TestClass { - companion object { - inline operator fun invoke(task: () -> T) = task() - } -} - -fun box(): String { - val test1 = TestClass { "K" } - if (test1 != "K") return "fail1, 'test1' == $test1" - - val ok = "OK" - - val x = TestClass { return ok } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt b/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt deleted file mode 100644 index de3ac9fbc73..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt +++ /dev/null @@ -1,10 +0,0 @@ -class TestClass { - inline operator fun invoke(task: () -> T) = task() -} - -fun box(): String { - val test = TestClass() - val ok = "OK" - - val x = test { return ok } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/invoke.kt b/backend.native/tests/external/codegen/box/functions/invoke/invoke.kt deleted file mode 100644 index 15b6c093721..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/invoke.kt +++ /dev/null @@ -1,28 +0,0 @@ -package invoke - -fun test1(predicate: (Int) -> Int, i: Int) = predicate(i) - -fun test2(predicate: (Int) -> Int, i: Int) = predicate.invoke(i) - -class Method { - operator fun invoke(i: Int) = i -} - -fun test3(method: Method, i: Int) = method.invoke(i) - -fun test4(method: Method, i: Int) = method(i) - -class Method2 {} - -operator fun Method2.invoke(s: String) = s - -fun test5(method2: Method2, s: String) = method2(s) - -fun box() : String { - if (test1({ it }, 1) != 1) return "fail 1" - if (test2({ it }, 2) != 2) return "fail 2" - if (test3(Method(), 3) != 3) return "fail 3" - if (test4(Method(), 4) != 4) return "fail 4" - if (test5(Method2(), "s") != "s") return "fail5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/invoke/invokeOnExprByConvention.kt b/backend.native/tests/external/codegen/box/functions/invoke/invokeOnExprByConvention.kt deleted file mode 100644 index 16e174b8db5..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/invokeOnExprByConvention.kt +++ /dev/null @@ -1,20 +0,0 @@ -//KT-3217 Invoke convention after function invocation doesn't work -//KT-2728 Can't compile A()() - -class A { - operator fun invoke() = "##" - operator fun invoke(i: Int) = "#${i}" -} - -fun foo() = A() - -fun box(): String { - if (A()() != "##") return "fail1" - if (A()(1) != "#1") return "fail2" - if (foo()() != "##") return "fail3" - if (foo()(42) != "#42") return "fail4" - if ((foo())(42) != "#42") return "fail5" - if ({ -> A()}()() != "##") return "fail6" - if ({ -> A()}()(37) != "#37") return "fail7" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/invokeOnSyntheticProperty.kt b/backend.native/tests/external/codegen/box/functions/invoke/invokeOnSyntheticProperty.kt deleted file mode 100644 index f96125385a1..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/invokeOnSyntheticProperty.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - public String getO() { - return "O"; - } -} - -// FILE: main.kt - -// KT-9522 Allow invoke convention for synthetic property - -operator fun String.invoke() = this + "K" - -fun box(): String { - return JavaClass().o(); -} diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3189.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3189.kt deleted file mode 100644 index be9a0f42107..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3189.kt +++ /dev/null @@ -1,15 +0,0 @@ -//KT-3189 Function invoke is called with no reason - -fun box(): String { - - val bad = Bad({ 1 }) - - return if (bad.test() == 1) "OK" else "fail" -} - -class Bad(val a: () -> Int) { - - fun test(): Int = a() - - operator fun invoke(): Int = 2 -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3190.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3190.kt deleted file mode 100644 index e5191fff338..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3190.kt +++ /dev/null @@ -1,26 +0,0 @@ -//KT-3190 Compiler crash if function called 'invoke' calls a closure -// IGNORE_BACKEND: JS -// JS backend does not allow to implement Function{N} interfaces - -fun box(): String { - val test = Cached({ it + 2 }) - return if (test(1) == 3) "OK" else "fail" -} - -class Cached(private val generate: (K)->V): Function1 { - val store = HashMap() - - // Everything works just fine if 'invoke' method is renamed to, for example, 'get' - override fun invoke(p1: K) = store.getOrPut(p1) { generate(p1) } -} - -//from library -fun MutableMap.getOrPut(key: K, defaultValue: ()-> V) : V { - if (this.containsKey(key)) { - return this.get(key) as V - } else { - val answer = defaultValue() - this.put(key, answer) - return answer - } -} diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3297.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3297.kt deleted file mode 100644 index 026ac7a3b37..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3297.kt +++ /dev/null @@ -1,17 +0,0 @@ -//KT-3297 Calling the wrong function inside an extension method to the Function0 class - -infix fun Function0.or(alt: () -> R): R { - try { - return this() - } catch (e: Exception) { - return alt() - } -} - -fun box(): String { - return { - throw RuntimeException("fail") - } or { - "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3450getAndInvoke.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3450getAndInvoke.kt deleted file mode 100644 index 012853d3a69..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3450getAndInvoke.kt +++ /dev/null @@ -1,13 +0,0 @@ -//KT-3450 get and invoke are not parsed in one expression - -public class A(val s: String) { - - operator fun get(i: Int) : A = A("$s + $i") - - operator fun invoke(builder : A.() -> String): String = builder() -} -fun x(y : String) : A = A(y) - -fun foo() = x("aaa")[42] { "$s!!" } - -fun box() = if (foo() == "aaa + 42!!") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3631invokeOnString.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3631invokeOnString.kt deleted file mode 100644 index 8f18fbcb585..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3631invokeOnString.kt +++ /dev/null @@ -1,5 +0,0 @@ -//KT-3631 String.invoke doesn't work with literals - -operator fun String.invoke(i: Int) = "$this$i" - -fun box() = if ("a"(12) == "a12") "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3772.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3772.kt deleted file mode 100644 index 622f571b489..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3772.kt +++ /dev/null @@ -1,21 +0,0 @@ -//KT-3772 Invoke and overload resolution ambiguity - -open class A { - fun invoke(f: A.() -> Unit) = 1 -} - -class B { - operator fun invoke(f: B.() -> Unit) = 2 -} - -open class C -val C.attr: A get() = A() - -open class D: C() -val D.attr: B get() = B() - - -fun box(): String { - val d = D() - return if (d.attr {} == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3821invokeOnThis.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3821invokeOnThis.kt deleted file mode 100644 index d15d396965a..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3821invokeOnThis.kt +++ /dev/null @@ -1,8 +0,0 @@ -//KT-3821 Invoke convention doesn't work for `this` - -class A() { - operator fun invoke() = 42 - fun foo() = this() // Expecting a function type, but found A -} - -fun box() = if (A().foo() == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/invoke/kt3822invokeOnThis.kt b/backend.native/tests/external/codegen/box/functions/invoke/kt3822invokeOnThis.kt deleted file mode 100644 index 7d8bb7ef55c..00000000000 --- a/backend.native/tests/external/codegen/box/functions/invoke/kt3822invokeOnThis.kt +++ /dev/null @@ -1,11 +0,0 @@ -//KT-3822 Compiler crashes when use invoke convention with `this` in class which extends Function0 -// IGNORE_BACKEND: JS -// JS backend does not allow to implement Function{N} interfaces - -class B() : Function0 { - override fun invoke() = true - - fun foo() = this() // Exception -} - -fun box() = if (B().foo()) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/kt1038.kt b/backend.native/tests/external/codegen/box/functions/kt1038.kt deleted file mode 100644 index 36770408c78..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1038.kt +++ /dev/null @@ -1,64 +0,0 @@ -//KT-1038 Cannot compile lazy iterators - -class YieldingIterator(val yieldingFunction : ()->T?) : Iterator -{ - var current : T? = yieldingFunction() - override fun next(): T { - val next = current; - if (next != null) - { - current = yieldingFunction() - return next - } - else throw IndexOutOfBoundsException() - } - override fun hasNext(): Boolean = current != null -} - -class YieldingIterable(val yielderFactory : ()->(()->T?)) : Iterable -{ - override fun iterator(): Iterator = YieldingIterator(yielderFactory()) -} - -public fun Iterable.lazy() : Iterable - { - return YieldingIterable { - val iterator = this.iterator(); - { if (iterator.hasNext()) iterator.next() else null } - } - } - -infix fun Iterable.where(predicate : (TItem)->Boolean) : Iterable - { - return YieldingIterable { - val iterator = this.iterator() - fun yielder() : TItem? { - while(iterator.hasNext()) - { - val next = iterator.next() - if (predicate(next)) - return next - } - return null - } - { yielder() } - } - } - -infix fun Iterable.select(selector : (TItem)->TResult) : Iterable - { - return YieldingIterable { - val iterator = this.iterator(); - { if(iterator.hasNext()) selector(iterator.next()) else null } - } - } - -fun box() : String { - val x = 0..100 - val filtered = x where { it % 2 == 0 } - val xx = x select { it * 2 } - var res = 0 - for (x in xx) - res += x - return if (res == 10100) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt1199.kt b/backend.native/tests/external/codegen/box/functions/kt1199.kt deleted file mode 100644 index 6560f431d58..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1199.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - - -interface MyIterator { - operator fun hasNext() : Boolean - operator fun next() : T -} - -operator fun T?.iterator() = object : MyIterator { - var hasNext = this@iterator != null - private set - override fun hasNext() = hasNext - - override fun next() : T { - if (hasNext) { - hasNext = false - return this@iterator!! - } - throw java.util.NoSuchElementException() - } -} - -fun box() : String { - var k = 0 - for (i in 1) { - k++ - } - return if(k == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt1413.kt b/backend.native/tests/external/codegen/box/functions/kt1413.kt deleted file mode 100644 index 15b496fb9b9..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1413.kt +++ /dev/null @@ -1,26 +0,0 @@ -package t - -interface I{ - fun f() -} - -class Test{ - fun foo(){ - val i : I = object : I { - override fun f() { - fun local(){ - bar() - } - local() - } - } - i.f() - } - - fun bar(){} -} - -fun box() : String { - Test().foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt1649_1.kt b/backend.native/tests/external/codegen/box/functions/kt1649_1.kt deleted file mode 100644 index 849bf5525ff..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1649_1.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - val method : (() -> Unit)? -} - -fun test(a : A) { - if (a.method != null) { - a.method!!() - } -} - -class B : A { - override val method = { } -} - -fun box(): String { - test(B()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt1649_2.kt b/backend.native/tests/external/codegen/box/functions/kt1649_2.kt deleted file mode 100644 index 33f420dc3f9..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1649_2.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - val method : () -> Unit? -} - -fun test(a : A) { - if (a.method != null) { - a.method!!() - } -} - -class B : A { - override val method = { } -} - -fun box(): String { - test(B()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt1739.kt b/backend.native/tests/external/codegen/box/functions/kt1739.kt deleted file mode 100644 index a990645b61a..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt1739.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -public class RunnableFunctionWrapper(val f : () -> Unit) : Runnable { - public override fun run() { - f() - } -} - -fun box() : String { - var res = "" - RunnableFunctionWrapper({ res = "OK" }).run() - return res -} diff --git a/backend.native/tests/external/codegen/box/functions/kt2270.kt b/backend.native/tests/external/codegen/box/functions/kt2270.kt deleted file mode 100644 index 27d631e3d2f..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2270.kt +++ /dev/null @@ -1,6 +0,0 @@ -class A( - val i : Int, - val j : Int = i -) - -fun box() = if (A(1).j == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/functions/kt2271.kt b/backend.native/tests/external/codegen/box/functions/kt2271.kt deleted file mode 100644 index efc623a6519..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2271.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun foo(i: Int, j: Int = i) = j - -fun box() = if (foo(1) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/functions/kt2280.kt b/backend.native/tests/external/codegen/box/functions/kt2280.kt deleted file mode 100644 index 79debb72bdf..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2280.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - fun rmrf(i: Int) { - if (i > 0) rmrf(i - 1) - } - rmrf(5) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt2481.kt b/backend.native/tests/external/codegen/box/functions/kt2481.kt deleted file mode 100644 index ea353c41cb1..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2481.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box() = - B().method() - -public open class A(){ - public open fun method() : String = "OK" -} - -public class B(): A(){ - public override fun method() : String { - return ({ - super.method() - })() - } -} diff --git a/backend.native/tests/external/codegen/box/functions/kt2716.kt b/backend.native/tests/external/codegen/box/functions/kt2716.kt deleted file mode 100644 index 0ba57fd380a..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2716.kt +++ /dev/null @@ -1,11 +0,0 @@ -package someTest - -public class Some private constructor(val v: String) { - companion object { - public fun init(v: String): Some { - return Some(v) - } - } -} - -fun box() = Some.init("OK").v diff --git a/backend.native/tests/external/codegen/box/functions/kt2739.kt b/backend.native/tests/external/codegen/box/functions/kt2739.kt deleted file mode 100644 index 296dd3bc8c3..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2739.kt +++ /dev/null @@ -1,10 +0,0 @@ -// KT-2739 Error type inferred for hashSet(Pair, Pair, Pair) - -fun foo(vararg ts: T): T? = null - -class Pair(a: A) - -fun box(): String { - val v = foo(Pair(1)) - return if (v == null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt2929.kt b/backend.native/tests/external/codegen/box/functions/kt2929.kt deleted file mode 100644 index 4367923fc29..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt2929.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo(): Int { - val a = "test" - val b = "test" - return a.compareTo(b) -} - -fun box(): String = if(foo() == 0) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/functions/kt3214.kt b/backend.native/tests/external/codegen/box/functions/kt3214.kt deleted file mode 100644 index 8ff33fcad23..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt3214.kt +++ /dev/null @@ -1,33 +0,0 @@ -class A { - fun get(vararg x: Int) = x.size -} - -class B { - fun get(vararg x: Unit) = x.size -} - -fun test1(a: A): Int { - return a.get(1) -} - -fun test2(a: A): Int { - return a.get(1, 2) -} - -fun test3(b: B): Int { - return b.get(Unit, Unit) -} - - -fun box() : String { - var result = test1(A()) - if (result != 1) return "fail1: $result" - - result = test2(A()) - if (result != 2) return "fail2: $result" - - result = test3(B()) - if (result != 2) return "fail3: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt3313.kt b/backend.native/tests/external/codegen/box/functions/kt3313.kt deleted file mode 100644 index 5e2e887c2a8..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt3313.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo(t: T) { -} - -fun box(): String { - foo(null) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt3573.kt b/backend.native/tests/external/codegen/box/functions/kt3573.kt deleted file mode 100644 index e97d3620de0..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt3573.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Data - -fun newInit(f: Data.() -> Data) = Data().f() - -class TestClass { - val test: Data = newInit() { this } -} - -fun box() : String { - TestClass() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/kt3724.kt b/backend.native/tests/external/codegen/box/functions/kt3724.kt deleted file mode 100644 index e1e5edac345..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt3724.kt +++ /dev/null @@ -1,24 +0,0 @@ -class Comment() { - var article = "" -} - -fun new(body: Comment.() -> Unit) : Comment { - val c = Comment() - c.body() - return c -} - -open class Request(val handler : Any.() -> Comment) { - val s = handler().article -} - - -class A : Request ({ - new { - this.article = "OK" - } -}) - -fun box() : String { - return A().s -} diff --git a/backend.native/tests/external/codegen/box/functions/kt395.kt b/backend.native/tests/external/codegen/box/functions/kt395.kt deleted file mode 100644 index 310640226e0..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt395.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun Any.with(operation : Any.() -> Any) = operation().toString() - -val f = { a : Int -> } - -fun box () : String { - return if(20.with { - this - } == "20") - "OK" - else - "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt785.kt b/backend.native/tests/external/codegen/box/functions/kt785.kt deleted file mode 100644 index e3073856d42..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt785.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A() { - var x : Int = 0 - - var z = { - x++ - } -} - -fun box() : String { - val a = A() - a.z() //problem is here - return if (a.x == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/kt873.kt b/backend.native/tests/external/codegen/box/functions/kt873.kt deleted file mode 100644 index 21c3dcd3338..00000000000 --- a/backend.native/tests/external/codegen/box/functions/kt873.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box() : String { - val fps : Double = 1.toDouble() - var mspf : Long - { - if ((fps.toInt() == 0)) - mspf = 0 - else - mspf = (((1000.0 / fps)).toLong()) - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunction.kt b/backend.native/tests/external/codegen/box/functions/localFunction.kt deleted file mode 100644 index b43377b6ab1..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunction.kt +++ /dev/null @@ -1,46 +0,0 @@ -fun IntRange.forEach(body : (Int) -> Unit) { - for(i in this) { - body(i) - } -} - -fun box() : String { - var seed = 0 - - fun local(x: Int) { - fun deep() { - seed += x - } - fun deep2(x : Int) { - seed += x - } - fun Int.iter() { - seed += this - } - - deep() - deep2(-x) - x.iter() - seed += x - } - - for(i in 1..5) { - fun Int.iter() { - seed += this - } - - local(i) - (-i).iter() - } - - fun local2(y: Int) { - seed += y - } - - (1..5).forEach { - local2(it) - } - - - return if(seed == 30) "OK" else seed.toString() -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/callInlineLocalInLambda.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/callInlineLocalInLambda.kt deleted file mode 100644 index a59a7507800..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/callInlineLocalInLambda.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x: String, block: (String) -> String) = block(x) - -fun box(): String { - fun bar(y: String) = y + "cde" - - val res = foo("abc") { bar(it) } - - assertEquals("abccde", res) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambda.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambda.kt deleted file mode 100644 index 935d8b4963c..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambda.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x: String, block: (String) -> String) = block(x) - -fun box(): String { - val res = foo("abc") { - fun bar(y: String) = y + "cde" - bar(it) - } - - assertEquals("abccde", res) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage1.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage1.kt deleted file mode 100644 index 6609be78133..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage1.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x: String, block: (String) -> String) = block(x) - -fun box(): String { - val res = foo("abc") { - fun bar(y: String) = y + "cde" - foo(it) { bar(it) } - } - - assertEquals("abccde", res) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage2.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage2.kt deleted file mode 100644 index 158e845f9ad..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/definedWithinLambdaInnerUsage2.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x: String, block: (String) -> String) = block(x) -fun noInlineFoo(x: String, block: (String) -> String) = block(x) - -fun box(): String { - val res = foo("abc") { - fun bar(y: String) = y + "cde" - noInlineFoo(it) { bar(it) } - } - - assertEquals("abccde", res) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt2895.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt2895.kt deleted file mode 100644 index 76db2bdc71e..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt2895.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun outer() { - fun inner(i: Int) { - if (i > 0){ - { - it: Int -> inner(0) // <- invocation of literal itself is generated instead - }.invoke(1) - } - } - inner(1) -} - -fun box(): String { - outer() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt3308.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt3308.kt deleted file mode 100644 index b97dfa7fb79..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt3308.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - fun foo(t: T) = t - - return foo("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt3978.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt3978.kt deleted file mode 100644 index 03ba97cd9b7..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt3978.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box() : String { - - - fun local(i: Int = 1) : Int { - return i - } - - return if (local() != 1) "fail" else "OK" -} - diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119.kt deleted file mode 100644 index 746e41ee392..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo(f: (Int?) -> Int): Int { - return f(0) -} - -fun box() : String { - infix operator fun Int?.plus(a: Int) : Int = a!! + 2 - - if (foo { it + 1 } != 3) return "Fail 1" - if (foo { it plus 1 } != 3) return "Fail 2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119_2.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119_2.kt deleted file mode 100644 index edb647f84a9..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4119_2.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun box(): String { - infix fun Int.foo(a: Int): Int = a + 2 - - val s = object { - fun test(): Int { - return 1 foo 1 - } - } - - fun local(): Int { - return 1 foo 1 - } - - if (s.test() != 3) return "Fail" - - if (local() != 3) return "Fail" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4514.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4514.kt deleted file mode 100644 index c767d3f0352..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4514.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - fun String.f() = this - val vf: String.() -> String = { this } - - val localExt = "O".f() + "K"?.f() - if (localExt != "OK") return "localExt $localExt" - - return "O".vf() + "K"?.vf() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4777.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4777.kt deleted file mode 100644 index 27e83c06c12..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4777.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -var result = "Fail" - -val p = object : Runnable { - override fun run() { - fun T.id() = this - - result = "OK".id() - } -} - -fun box(): String { - p.run() - return result -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4783.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4783.kt deleted file mode 100644 index 5d5d9d55f6a..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4783.kt +++ /dev/null @@ -1,18 +0,0 @@ -class T(val value: Int) { -} - -fun local() : Int { - - operator fun T.get(s: Int): Int { - return s * this.value - } - - var t = T(11) - return t[2] -} - -fun box() : String { - if (local() != 22) return "fail1 ${local()} " - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4784.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4784.kt deleted file mode 100644 index 404fce279be..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4784.kt +++ /dev/null @@ -1,20 +0,0 @@ -open class T(var value: Int) {} - -fun plusAssign(): T { - - operator fun T.plusAssign(s: Int) { - value += s - } - - var t = T(1) - t += 1 - - return t -} - -fun box(): String { - val result = plusAssign().value - if (result != 2) return "fail 1: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4989.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/kt4989.kt deleted file mode 100644 index e4cee2aa56f..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/kt4989.kt +++ /dev/null @@ -1,28 +0,0 @@ -class It(val id: String) - -fun box(): String { - val projectId = "projectId" - val it = It("it") - - - fun selectMetaRunnerId(): String { - operator fun Int?.inc() = (this ?: 0) + 1 - var counter: Int? = null - fun path(metaRunnerId: String) = counter != 2 - - var i = 0 - while (true) { - val name = projectId + "_" + it.id + (if (counter == null) "" else "_$counter") - if (!path(name)) { - return name - } - counter++ - - i++ - if (i > 2) return "Infinity loop: $counter" - } - } - val X = selectMetaRunnerId() - if (X != projectId + "_" + it.id + "_2") return "fail: $X" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt deleted file mode 100644 index 709b1c9ac1e..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class T(var value: Int) {} - -fun localExtensionOnNullableParameter(): T { - - fun T.local(s: Int) { - value += s - } - - var t: T? = T(1) - t?.local(2) - - return t!! -} - - -fun box(): String { - val result = localExtensionOnNullableParameter().value - if (result != 3) return "fail 2: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/localFunctions/localFunctionInConstructor.kt b/backend.native/tests/external/codegen/box/functions/localFunctions/localFunctionInConstructor.kt deleted file mode 100644 index 5f294911561..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localFunctions/localFunctionInConstructor.kt +++ /dev/null @@ -1,15 +0,0 @@ -class Test { - - val property:Int - init { - fun local():Int { - return 10; - } - property = local(); - } - -} - -fun box(): String { - return if (Test().property == 10) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/functions/localReturnInsideFunctionExpression.kt b/backend.native/tests/external/codegen/box/functions/localReturnInsideFunctionExpression.kt deleted file mode 100644 index 5d3a5ad1a33..00000000000 --- a/backend.native/tests/external/codegen/box/functions/localReturnInsideFunctionExpression.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun simple() = fun (): Boolean { return true } - -fun withLabel() = l@ fun (): Boolean { return@l true } - -fun box(): String { - if (!simple()()) return "Test simple failed" - if (!withLabel()()) return "Test withLabel failed" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/nothisnoclosure.kt b/backend.native/tests/external/codegen/box/functions/nothisnoclosure.kt deleted file mode 100644 index 68369ae57eb..00000000000 --- a/backend.native/tests/external/codegen/box/functions/nothisnoclosure.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun foo(x: Int) {} - -fun loop(times : Int) { - var left = times - while(left > 0) { - val u : (value : Int) -> Unit = { - foo(it) - } - u(left--) - } -} - -fun box() : String { - loop(5) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/functions/prefixRecursiveCall.kt b/backend.native/tests/external/codegen/box/functions/prefixRecursiveCall.kt deleted file mode 100644 index 7fe750fc4ec..00000000000 --- a/backend.native/tests/external/codegen/box/functions/prefixRecursiveCall.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun String.unaryPlus() : String { - if (this == "") { - return "done" - } - return +"" -} - -fun box() : String = if (+"11" == "done") "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/recursiveCompareTo.kt b/backend.native/tests/external/codegen/box/functions/recursiveCompareTo.kt deleted file mode 100644 index aeafd27f6e0..00000000000 --- a/backend.native/tests/external/codegen/box/functions/recursiveCompareTo.kt +++ /dev/null @@ -1,11 +0,0 @@ -class C - -operator fun C.compareTo(o: C) : Int { - if (this == o) return 0 - if (o >= o) { - return 1 - } - return -1 -} - -fun box() : String = if (C() > C()) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/functions/recursiveIncrementCall.kt b/backend.native/tests/external/codegen/box/functions/recursiveIncrementCall.kt deleted file mode 100644 index b5985d5606c..00000000000 --- a/backend.native/tests/external/codegen/box/functions/recursiveIncrementCall.kt +++ /dev/null @@ -1,12 +0,0 @@ -operator fun String.inc() : String { - if (this == "") { - return "done" - } - var s = "" - return ++s -} - -fun box() : String { - var s = "11test" - return if (++s == "done") "OK" else "FAIL" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/hashPMap/empty.kt b/backend.native/tests/external/codegen/box/hashPMap/empty.kt deleted file mode 100644 index a7061b676d1..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/empty.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun box(): String { - val map = HashPMap.empty()!! - - assertEquals(0, map.size()) - - assertFalse(map.containsKey("")) - assertFalse(map.containsKey("abacaba")) - assertEquals(null, map[""]) - assertEquals(null, map["lol"]) - - // Check that doesn't create a new map - assertEquals(map, map.minus("")) - - // Check that all empty()s are equal - val other = HashPMap.empty()!! - assertEquals(map, other) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/hashPMap/manyNumbers.kt b/backend.native/tests/external/codegen/box/hashPMap/manyNumbers.kt deleted file mode 100644 index 21efec77fa0..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/manyNumbers.kt +++ /dev/null @@ -1,52 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import java.util.* -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun digitSum(number: Int): Int { - var x = number - var ans = 0 - while (x != 0) { - ans += x % 10 - x /= 10 - } - return ans -} - -val N = 1000000 - -fun box(): String { - var map = HashPMap.empty()!! - - for (x in 1..N) { - map = map.plus(x, digitSum(x))!! - } - - assertEquals(N, map.size()) - - // Check in reverse order just in case - for (x in N downTo 1) { - assertTrue(map.containsKey(x), "Not found: $x") - assertEquals(digitSum(x), map[x], "Incorrect value for $x") - } - - // Delete in random order - val list = (1..N).toCollection(ArrayList()) - Collections.shuffle(list, Random(42)) - for (x in list) { - map = map.minus(x)!! - } - - assertEquals(0, map.size()) - - for (x in 1..N) { - assertFalse(map.containsKey(x), "Incorrectly found: $x") - assertEquals(null, map[x], "Incorrectly found value for $x") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/hashPMap/rewriteWithDifferent.kt b/backend.native/tests/external/codegen/box/hashPMap/rewriteWithDifferent.kt deleted file mode 100644 index 741a3024365..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/rewriteWithDifferent.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun box(): String { - var map = HashPMap.empty()!! - - map = map.plus("lol", 42)!! - map = map.plus("lol", 239)!! - - assertEquals(1, map.size()) - assertTrue(map.containsKey("lol")) - assertFalse(map.containsKey("")) - assertEquals(239, map["lol"]) - assertEquals(null, map[""]) - - map = map.plus("", 0)!! - map = map.plus("", 2.71828)!! - map = map.plus("lol", 42)!! - map = map.plus("", 3.14)!! - - assertEquals(2, map.size()) - assertTrue(map.containsKey("lol")) - assertTrue(map.containsKey("")) - assertEquals(42, map["lol"]) - assertEquals(3.14, map[""]) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/hashPMap/rewriteWithEqual.kt b/backend.native/tests/external/codegen/box/hashPMap/rewriteWithEqual.kt deleted file mode 100644 index eb3642c5422..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/rewriteWithEqual.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun box(): String { - var map = HashPMap.empty()!! - - map = map.plus("lol", 42)!! - map = map.plus("lol", 42)!! - - assertEquals(1, map.size()) - assertTrue(map.containsKey("lol")) - assertFalse(map.containsKey("")) - assertEquals(42, map["lol"]) - assertEquals(null, map[""]) - - map = map.plus("", 0)!! - map = map.plus("", 0)!! - map = map.plus("lol", 42)!! - map = map.plus("", 0)!! - - assertEquals(2, map.size()) - assertTrue(map.containsKey("lol")) - assertTrue(map.containsKey("")) - assertEquals(42, map["lol"]) - assertEquals(0, map[""]) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/hashPMap/simplePlusGet.kt b/backend.native/tests/external/codegen/box/hashPMap/simplePlusGet.kt deleted file mode 100644 index 81a2aaceb34..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/simplePlusGet.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun box(): String { - var map = HashPMap.empty()!! - - map = map.plus("lol", 42)!! - - assertEquals(1, map.size()) - assertTrue(map.containsKey("lol")) - assertFalse(map.containsKey("")) - assertEquals(42, map["lol"]) - assertEquals(null, map[""]) - - map = map.plus("", 0)!! - - assertEquals(2, map.size()) - assertTrue(map.containsKey("lol")) - assertTrue(map.containsKey("")) - assertEquals(42, map["lol"]) - assertEquals(0, map[""]) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/hashPMap/simplePlusMinus.kt b/backend.native/tests/external/codegen/box/hashPMap/simplePlusMinus.kt deleted file mode 100644 index 2830c5d3122..00000000000 --- a/backend.native/tests/external/codegen/box/hashPMap/simplePlusMinus.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.internal.pcollections.HashPMap -import kotlin.test.* - -fun box(): String { - var map = HashPMap.empty()!! - - map = map.plus("lol", 42)!! - map = map.minus("lol")!! - - assertEquals(0, map.size()) - assertFalse(map.containsKey("lol")) - assertEquals(null, map["lol"]) - - map = map.plus("abc", "a")!! - map = map.minus("abc")!! - map = map.plus("abc", "d")!! - - assertEquals(1, map.size()) - assertTrue(map.containsKey("abc")) - assertEquals("d", map["abc"]) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ieee754/anyToReal.kt b/backend.native/tests/external/codegen/box/ieee754/anyToReal.kt deleted file mode 100644 index 3ba490d870e..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/anyToReal.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - val plusZero: Any = 0.0 - val minusZero: Any = -0.0 - if ((minusZero as Double) < (plusZero as Double)) return "fail 0" - - val plusZeroF: Any = 0.0F - val minusZeroF: Any = -0.0F - if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1" - - if ((minusZero as Double) != (plusZero as Double)) return "fail 3" - - if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/comparableTypeCast.kt b/backend.native/tests/external/codegen/box/ieee754/comparableTypeCast.kt deleted file mode 100644 index a4298207118..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/comparableTypeCast.kt +++ /dev/null @@ -1,14 +0,0 @@ -// IGNORE_BACKEND: JS -fun box(): String { - if ((-0.0 as Comparable) >= 0.0) return "fail 0" - if ((-0.0F as Comparable) >= 0.0F) return "fail 1" - - - if ((-0.0 as Comparable) == 0.0) return "fail 3" - if (-0.0 == (0.0 as Comparable)) return "fail 4" - - if ((-0.0F as Comparable) == 0.0F) return "fail 5" - if (-0.0F == (0.0F as Comparable)) return "fail 6" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/dataClass.kt b/backend.native/tests/external/codegen/box/ieee754/dataClass.kt deleted file mode 100644 index 8f05b07f453..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/dataClass.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class Test(val z1: Double, val z2: Double?) - -fun box(): String { - val x = Test(Double.NaN, Double.NaN) - val y = Test(Double.NaN, Double.NaN) - - return if (x == y) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/equalsDouble.kt b/backend.native/tests/external/codegen/box/ieee754/equalsDouble.kt deleted file mode 100644 index 28d5c90e7f6..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/equalsDouble.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun equals1(a: Double, b: Double) = a == b - -fun equals2(a: Double?, b: Double?) = a!! == b!! - -fun equals3(a: Double?, b: Double?) = a != null && b != null && a == b - -fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a == b else null!! - -fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double) a == b else null!! - - -fun box(): String { - if (-0.0 != 0.0) return "fail 0" - if (!equals1(-0.0, 0.0)) return "fail 1" - if (!equals2(-0.0, 0.0)) return "fail 2" - if (!equals3(-0.0, 0.0)) return "fail 3" - if (!equals4(-0.0, 0.0)) return "fail 4" - if (!equals5(-0.0, 0.0)) return "fail 5" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ieee754/equalsFloat.kt b/backend.native/tests/external/codegen/box/ieee754/equalsFloat.kt deleted file mode 100644 index 26187f688d0..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/equalsFloat.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun equals1(a: Float, b: Float) = a == b - -fun equals2(a: Float?, b: Float?) = a!! == b!! - -fun equals3(a: Float?, b: Float?) = a != null && b != null && a == b - -fun equals4(a: Float?, b: Float?) = if (a is Float && b is Float) a == b else null!! - -fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float) a == b else null!! - - -fun box(): String { - if (-0.0F != 0.0F) return "fail 0" - if (!equals1(-0.0F, 0.0F)) return "fail 1" - if (!equals2(-0.0F, 0.0F)) return "fail 2" - if (!equals3(-0.0F, 0.0F)) return "fail 3" - if (!equals4(-0.0F, 0.0F)) return "fail 4" - if (!equals5(-0.0F, 0.0F)) return "fail 5" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ieee754/equalsNaN.kt b/backend.native/tests/external/codegen/box/ieee754/equalsNaN.kt deleted file mode 100644 index 3198d0a818c..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/equalsNaN.kt +++ /dev/null @@ -1,224 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -@kotlin.native.ThreadLocal -object O { - var equalsCalled: Boolean = false - get(): Boolean { - val result = field - field = false - return result - } - set(v: Boolean) { - field = v - } - - override fun equals(a: Any?): Boolean { - equalsCalled = true - return true - } -} - -val A: Any = O - -fun testDouble(d: Double, v: T, vararg va: T) { - assertFalse(d == d, "Double: d != d") - assertFalse(d == v, "Double: d != v") - assertFalse(d == va[0], "Double: d != va[0]") - assertFalse(v == d, "Double: v != d") - assertFalse(v == v, "Double: v != v") - assertFalse(v == va[0], "Double: v != va[0]") - assertFalse(va[0] == d, "Double: va[0] != d") - assertFalse(va[0] == v, "Double: va[0] != v") - assertFalse(va[0] == va[0], "Double: va[0] != va[0]") - - assertTrue(d != d, "Double: d == d") - assertTrue(d != v, "Double: d == v") - assertTrue(d != va[0], "Double: d == va[0]") - assertTrue(v != d, "Double: v == d") - assertTrue(v != v, "Double: v == v") - assertTrue(v != va[0], "Double: v == va[0]") - assertTrue(va[0] != d, "Double: va[0] == d") - assertTrue(va[0] != v, "Double: va[0] == v") - assertTrue(va[0] != va[0], "Double: va[0] == va[0]") -} - -fun testFloat(d: Float, v: T, vararg va: T) { - assertFalse(d == d, "Float: d != d") - assertFalse(d == v, "Float: d != v") - assertFalse(d == va[0], "Float: d != va[0]") - assertFalse(v == d, "Float: v != d") - assertFalse(v == v, "Float: v != v") - assertFalse(v == va[0], "Float: v != va[0]") - assertFalse(va[0] == d, "Float: va[0] != d") - assertFalse(va[0] == v, "Float: va[0] != v") - assertFalse(va[0] == va[0], "Float: va[0] != va[0]") - - assertTrue(d != d, "Float: d == d") - assertTrue(d != v, "Float: d == v") - assertTrue(d != va[0], "Float: d == va[0]") - assertTrue(v != d, "Float: v == d") - assertTrue(v != v, "Float: v == v") - assertTrue(v != va[0], "Float: v == va[0]") - assertTrue(va[0] != d, "Float: va[0] == d") - assertTrue(va[0] != v, "Float: va[0] == v") - assertTrue(va[0] != va[0], "Float: va[0] == va[0]") -} - -var gdn: Any = Double.NaN -var gfn: Any = Float.NaN - -fun box(): String { - - // Double - - val dn = Double.NaN - val adn: Any = dn - val dnq: Double? = dn - val adnq: Any? = dn - - assertFalse(dn == dn, "Double: NaN == NaN") - assertTrue(dn == adn, "Double: NaN != (Any)NaN") - assertTrue(adn == dn, "Double: (Any)NaN != NaN") - assertTrue(adn == adn, "Double: (Any)NaN != (Any)NaN") - - assertFalse(dn == dnq, "Double: NaN == NaN?") - assertTrue(dn == adnq, "Double: NaN != (Any?)NaN") - assertTrue(adn == dnq, "Double: (Any)NaN != NaN?") - assertTrue(adn == adnq, "Double: (Any)NaN != (Any?)NaN") - - assertFalse(dnq == dn, "Double: NaN? == NaN") - assertTrue(dnq == adn, "Double: NaN? != (Any)NaN") - assertTrue(adnq == dn, "Double: (Any?)NaN != NaN") - assertTrue(adnq == adn, "Double: (Any?)NaN != (Any)NaN") - - assertFalse(dnq == dnq, "Double: NaN? == NaN?") - assertTrue(dnq == adnq, "Double: NaN? != (Any?)NaN") - assertTrue(adnq == dnq, "Double: (Any?)NaN != NaN?") - assertTrue(adnq == adnq, "Double: (Any?)NaN != (Any?)NaN") - - assertTrue(dn != dn, "Double: NaN == NaN") - assertFalse(dn != adn, "Double: NaN != (Any)NaN") - assertFalse(adn != dn, "Double: (Any)NaN != NaN") - assertFalse(adn != adn, "Double: (Any)NaN != (Any)NaN") - - assertTrue(dn != dnq, "Double: NaN == NaN?") - assertFalse(dn != adnq, "Double: NaN != (Any?)NaN") - assertFalse(adn != dnq, "Double: (Any)NaN != NaN?") - assertFalse(adn != adnq, "Double: (Any)NaN != (Any?)NaN") - - assertTrue(dnq != dn, "Double: NaN? == NaN") - assertFalse(dnq != adn, "Double: NaN? != (Any)NaN") - assertFalse(adnq != dn, "Double: (Any?)NaN != NaN") - assertFalse(adnq != adn, "Double: (Any?)NaN != (Any)NaN") - - assertTrue(dnq != dnq, "Double: NaN? == NaN?") - assertFalse(dnq != adnq, "Double: NaN? != (Any?)NaN") - assertFalse(adnq != dnq, "Double: (Any?)NaN != NaN?") - assertFalse(adnq != adnq, "Double: (Any?)NaN != (Any?)NaN") - - // Stable smart-casts - if (adn is Double) { - assertFalse(adn == adn, "Double smart-cast: NaN == NaN") - assertTrue(adn != adn, "Double smart-cast: NaN == NaN") - } - if (adnq is Double?) { - assertFalse(adnq == adnq, "Double? smart-cast: NaN? == NaN?") - assertTrue(adnq != adnq, "Double? smart-cast: NaN? == NaN?") - } - // Unstable smart-casts - if (gdn is Double) { - assertTrue(gdn == gdn, "Unstable Double smart-cast: NaN != NaN") - assertFalse(gdn != gdn, "Unstable Double smart-cast: NaN != NaN") - } - if (gdn is Double?) { - assertTrue(gdn == gdn, "Unstable Double smart-cast: NaN != NaN") - assertFalse(gdn != gdn, "Unstable Double smart-cast: NaN != NaN") - } - - // Explicit .equals - assertTrue(A == dn && O.equalsCalled, "A.equals not called for A == dn") - assertTrue(dn != A && !O.equalsCalled, "A.equals called for dn == A") - assertFalse(A != dn || !O.equalsCalled, "A.equals not called for A != dn") - assertFalse(dn == A || O.equalsCalled, "A.equals called for dn != A") - - // Generics and varags - testDouble(Double.NaN, Double.NaN, Double.NaN) - - // Float - - val fn = Float.NaN - val afn: Any = fn - val fnq: Float? = fn - val afnq: Any? = fn - - assertFalse(fn == fn, "Float: NaN == NaN") - assertTrue(fn == afn, "Float: NaN != (Any)NaN") - assertTrue(afn == fn, "Float: (Any)NaN != NaN") - assertTrue(afn == afn, "Float: (Any)NaN != (Any)NaN") - - assertFalse(fn == fnq, "Float: NaN == NaN?") - assertTrue(fn == afnq, "Float: NaN != (Any?)NaN") - assertTrue(afn == fnq, "Float: (Any)NaN != NaN?") - assertTrue(afn == afnq, "Float: (Any)NaN != (Any?)NaN") - - assertFalse(fnq == fn, "Float: NaN? == NaN") - assertTrue(fnq == afn, "Float: NaN? != (Any)NaN") - assertTrue(afnq == fn, "Float: (Any?)NaN != NaN") - assertTrue(afnq == afn, "Float: (Any?)NaN != (Any)NaN") - - assertFalse(fnq == fnq, "Float: NaN? == NaN?") - assertTrue(fnq == afnq, "Float: NaN? != (Any?)NaN") - assertTrue(afnq == fnq, "Float: (Any?)NaN != NaN?") - assertTrue(afnq == afnq, "Float: (Any?)NaN != (Any?)NaN") - - assertTrue(fn != fn, "Float: NaN == NaN") - assertFalse(fn != afn, "Float: NaN != (Any)NaN") - assertFalse(afn != fn, "Float: (Any)NaN != NaN") - assertFalse(afn != afn, "Float: (Any)NaN != (Any)NaN") - - assertTrue(fn != fnq, "Float: NaN == NaN?") - assertFalse(fn != afnq, "Float: NaN != (Any?)NaN") - assertFalse(afn != fnq, "Float: (Any)NaN != NaN?") - assertFalse(afn != afnq, "Float: (Any)NaN != (Any?)NaN") - - assertTrue(fnq != fn, "Float: NaN? == NaN") - assertFalse(fnq != afn, "Float: NaN? != (Any)NaN") - assertFalse(afnq != fn, "Float: (Any?)NaN != NaN") - assertFalse(afnq != afn, "Float: (Any?)NaN != (Any)NaN") - - assertTrue(fnq != fnq, "Float: NaN? == NaN?") - assertFalse(fnq != afnq, "Float: NaN? != (Any?)NaN") - assertFalse(afnq != fnq, "Float: (Any?)NaN != NaN?") - assertFalse(afnq != afnq, "Float: (Any?)NaN != (Any?)NaN") - - // Stable smart-casts - if (afn is Float) { - assertFalse(afn == afn, "Float smart-cast: NaN == NaN") - assertTrue(afn != afn, "Float smart-cast: NaN == NaN") - } - if (afnq is Float?) { - assertFalse(afnq == afnq, "Float? smart-cast: NaN? == NaN?") - assertTrue(afnq != afnq, "Float? smart-cast: NaN? == NaN?") - } - // Unstable smart-casts - if (gfn is Float) { - assertTrue(gfn == gfn, "Unstable Float smart-cast: NaN != NaN") - assertFalse(gfn != gfn, "Unstable Float smart-cast: NaN != NaN") - } - if (gfn is Float?) { - assertTrue(gfn == gfn, "Unstable Float smart-cast: NaN != NaN") - assertFalse(gfn != gfn, "Unstable Float smart-cast: NaN != NaN") - } - - assertTrue(A == fn && O.equalsCalled, "A.equals not called for A == fn") - assertTrue(fn != A && !O.equalsCalled, "A.equals called for fn == A") - assertFalse(A != fn || !O.equalsCalled, "A.equals not called for A != fn") - assertFalse(fn == A || O.equalsCalled, "A.equals called for fn != A") - - // Generics and varags - testFloat(Float.NaN, Float.NaN, Float.NaN) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/equalsNullableDouble.kt b/backend.native/tests/external/codegen/box/ieee754/equalsNullableDouble.kt deleted file mode 100644 index f6e04610024..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/equalsNullableDouble.kt +++ /dev/null @@ -1,34 +0,0 @@ -fun equals1(a: Double, b: Double?) = a == b - -fun equals2(a: Double?, b: Double?) = a!! == b!! - -fun equals3(a: Double?, b: Double?) = a != null && a == b - -fun equals4(a: Double?, b: Double?) = if (a is Double) a == b else null!! - -fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double?) a == b else null!! - -fun equals6(a: Any?, b: Any?) = if (a is Double? && b is Double) a == b else null!! - -fun equals7(a: Double?, b: Double?) = a == b - -fun equals8(a: Any?, b: Any?) = if (a is Double? && b is Double?) a == b else null!! - - -fun box(): String { - if (!equals1(-0.0, 0.0)) return "fail 1" - if (!equals2(-0.0, 0.0)) return "fail 2" - if (!equals3(-0.0, 0.0)) return "fail 3" - if (!equals4(-0.0, 0.0)) return "fail 4" - if (!equals5(-0.0, 0.0)) return "fail 5" - if (!equals6(-0.0, 0.0)) return "fail 6" - if (!equals7(-0.0, 0.0)) return "fail 7" - - if (!equals8(-0.0, 0.0)) return "fail 8" - if (!equals8(null, null)) return "fail 9" - if (equals8(null, 0.0)) return "fail 10" - if (equals8(0.0, null)) return "fail 11" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ieee754/equalsNullableFloat.kt b/backend.native/tests/external/codegen/box/ieee754/equalsNullableFloat.kt deleted file mode 100644 index 3ab6193b186..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/equalsNullableFloat.kt +++ /dev/null @@ -1,34 +0,0 @@ -fun equals1(a: Float, b: Float?) = a == b - -fun equals2(a: Float?, b: Float?) = a!! == b!! - -fun equals3(a: Float?, b: Float?) = a != null && a == b - -fun equals4(a: Float?, b: Float?) = if (a is Float) a == b else null!! - -fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float?) a == b else null!! - -fun equals6(a: Any?, b: Any?) = if (a is Float? && b is Float) a == b else null!! - -fun equals7(a: Float?, b: Float?) = a == b - -fun equals8(a: Any?, b: Any?) = if (a is Float? && b is Float?) a == b else null!! - - -fun box(): String { - if (!equals1(-0.0F, 0.0F)) return "fail 1" - if (!equals2(-0.0F, 0.0F)) return "fail 2" - if (!equals3(-0.0F, 0.0F)) return "fail 3" - if (!equals4(-0.0F, 0.0F)) return "fail 4" - if (!equals5(-0.0F, 0.0F)) return "fail 5" - if (!equals6(-0.0F, 0.0F)) return "fail 6" - if (!equals7(-0.0F, 0.0F)) return "fail 7" - - if (!equals8(-0.0F, 0.0F)) return "fail 8" - if (!equals8(null, null)) return "fail 9" - if (equals8(null, 0.0F)) return "fail 10" - if (equals8(0.0F, null)) return "fail 11" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ieee754/explicitCompareCall.kt b/backend.native/tests/external/codegen/box/ieee754/explicitCompareCall.kt deleted file mode 100644 index 40409e20e4c..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/explicitCompareCall.kt +++ /dev/null @@ -1,20 +0,0 @@ -// IGNORE_BACKEND: JS -fun less1(a: Double, b: Double) = a.compareTo(b) == -1 - -fun less2(a: Double?, b: Double?) = a!!.compareTo(b!!) == -1 - -fun less3(a: Double?, b: Double?) = a != null && b != null && a.compareTo(b) == -1 - -fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!! - -fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!! - -fun box(): String { - if (!less1(-0.0, 0.0)) return "fail 1" - if (!less2(-0.0, 0.0)) return "fail 2" - if (!less3(-0.0, 0.0)) return "fail 3" - if (!less4(-0.0, 0.0)) return "fail 4" - if (!less5(-0.0, 0.0)) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/explicitEqualsCall.kt b/backend.native/tests/external/codegen/box/ieee754/explicitEqualsCall.kt deleted file mode 100644 index 4a6f495d576..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/explicitEqualsCall.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: JS - -fun equals1(a: Double, b: Double) = a.equals(b) - -fun equals2(a: Double?, b: Double?) = a!!.equals(b!!) - -fun equals3(a: Double?, b: Double?) = a != null && b != null && a.equals(b) - -fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a.equals(b) else null!! - - -fun box(): String { - if ((-0.0).equals(0.0)) return "fail 0" - if (equals1(-0.0, 0.0)) return "fail 1" - if (equals2(-0.0, 0.0)) return "fail 2" - if (equals3(-0.0, 0.0)) return "fail 3" - if (equals4(-0.0, 0.0)) return "fail 4" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ieee754/generic.kt b/backend.native/tests/external/codegen/box/ieee754/generic.kt deleted file mode 100644 index 6d621ffd2c0..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/generic.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: b.kt - -class Foo(val minus0: T, val plus0: T) { - -} - -fun box(): String { - val foo = Foo(-0.0, 0.0) - val fooF = Foo(-0.0F, 0.0F) - - if (foo.minus0 < foo.plus0) return "fail 0" - if (fooF.minus0 < fooF.plus0) return "fail 1" - - if (foo.minus0 != foo.plus0) return "fail 3" - if (fooF.minus0 != fooF.plus0) return "fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/greaterDouble.kt b/backend.native/tests/external/codegen/box/ieee754/greaterDouble.kt deleted file mode 100644 index 2359ca5d077..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/greaterDouble.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun greater1(a: Double, b: Double) = a > b - -fun greater2(a: Double?, b: Double?) = a!! > b!! - -fun greater3(a: Double?, b: Double?) = a != null && b != null && a > b - -fun greater4(a: Double?, b: Double?) = if (a is Double && b is Double) a > b else null!! - -fun greater5(a: Any?, b: Any?) = if (a is Double && b is Double) a > b else null!! - -fun box(): String { - if (0.0 > -0.0) return "fail 0" - if (greater1(0.0, -0.0)) return "fail 1" - if (greater2(0.0, -0.0)) return "fail 2" - if (greater3(0.0, -0.0)) return "fail 3" - if (greater4(0.0, -0.0)) return "fail 4" - if (greater5(0.0, -0.0)) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/greaterFloat.kt b/backend.native/tests/external/codegen/box/ieee754/greaterFloat.kt deleted file mode 100644 index ebcf4ef7147..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/greaterFloat.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun greater1(a: Float, b: Float) = a > b - -fun greater2(a: Float?, b: Float?) = a!! > b!! - -fun greater3(a: Float?, b: Float?) = a != null && b != null && a > b - -fun greater4(a: Float?, b: Float?) = if (a is Float && b is Float) a > b else null!! - -fun greater5(a: Any?, b: Any?) = if (a is Float && b is Float) a > b else null!! - -fun box(): String { - if (0.0F > -0.0F) return "fail 0" - if (greater1(0.0F, -0.0F)) return "fail 1" - if (greater2(0.0F, -0.0F)) return "fail 2" - if (greater3(0.0F, -0.0F)) return "fail 3" - if (greater4(0.0F, -0.0F)) return "fail 4" - if (greater5(0.0F, -0.0F)) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/inline.kt b/backend.native/tests/external/codegen/box/ieee754/inline.kt deleted file mode 100644 index 58a844412bc..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/inline.kt +++ /dev/null @@ -1,49 +0,0 @@ -// IGNORE_BACKEND: JS - -inline fun less(a: Comparable, b: Double): Boolean { - return a < b -} - -inline fun equals(a: Comparable, b: Comparable): Boolean { - return a == b -} - -inline fun > lessGeneric(a: T, b: Double): Boolean { - return a < b -} - -inline fun > equalsGeneric(a: T, b: Double): Boolean { - return a == b -} - -inline fun > lessReified(a: T, b: Double): Boolean { - return a < b -} - -inline fun > equalsReified(a: T, b: T): Boolean { - return a == b -} - -inline fun less754(a: Double, b: Double): Boolean { - return a < b -} - -inline fun equals754(a: Double, b: Double): Boolean { - return a == b -} - -fun box(): String { - if (!less(-0.0, 0.0)) return "fail 1" - if (equals(-0.0, 0.0)) return "fail 2" - - if (!lessGeneric(-0.0, 0.0)) return "fail 3" - if (equalsGeneric(-0.0, 0.0)) return "fail 4" - - if (!lessReified(-0.0, 0.0)) return "fail 5" - if (equalsReified(-0.0, 0.0)) return "fail 6" - - if (less754(-0.0, 0.0)) return "fail 7" - if (!equals754(-0.0, 0.0)) return "fail 8" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/lessDouble.kt b/backend.native/tests/external/codegen/box/ieee754/lessDouble.kt deleted file mode 100644 index b25363bdb65..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/lessDouble.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun less1(a: Double, b: Double) = a < b - -fun less2(a: Double?, b: Double?) = a!! < b!! - -fun less3(a: Double?, b: Double?) = a != null && b != null && a < b - -fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a < b else null!! - -fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a < b else null!! - -fun box(): String { - if (-0.0 < 0.0) return "fail 0" - if (less1(-0.0, 0.0)) return "fail 1" - if (less2(-0.0, 0.0)) return "fail 2" - if (less3(-0.0, 0.0)) return "fail 3" - if (less4(-0.0, 0.0)) return "fail 4" - if (less5(-0.0, 0.0)) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/lessFloat.kt b/backend.native/tests/external/codegen/box/ieee754/lessFloat.kt deleted file mode 100644 index efea2decef4..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/lessFloat.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun less1(a: Float, b: Float) = a < b - -fun less2(a: Float?, b: Float?) = a!! < b!! - -fun less3(a: Float?, b: Float?) = a != null && b != null && a < b - -fun less4(a: Float?, b: Float?) = if (a is Float && b is Float) a < b else true - -fun less5(a: Any?, b: Any?) = if (a is Float && b is Float) a < b else true - -fun box(): String { - if (-0.0F < 0.0F) return "fail 0" - if (less1(-0.0F, 0.0F)) return "fail 1" - if (less2(-0.0F, 0.0F)) return "fail 2" - if (less3(-0.0F, 0.0F)) return "fail 3" - if (less4(-0.0F, 0.0F)) return "fail 4" - if (less5(-0.0F, 0.0F)) return "fail 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableAnyToReal.kt b/backend.native/tests/external/codegen/box/ieee754/nullableAnyToReal.kt deleted file mode 100644 index 7c4a950202f..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableAnyToReal.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - val plusZero: Any? = 0.0 - val minusZero: Any? = -0.0 - if ((minusZero as Double) < (plusZero as Double)) return "fail 0" - - val plusZeroF: Any? = 0.0F - val minusZeroF: Any? = -0.0F - if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1" - - if ((minusZero as Double) != (plusZero as Double)) return "fail 3" - - if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals.kt b/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals.kt deleted file mode 100644 index b9423f1135c..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals.kt +++ /dev/null @@ -1,25 +0,0 @@ -fun myEquals(a: Double?, b: Double?) = a == b - -fun myEquals1(a: Double?, b: Double) = a == b - -fun myEquals2(a: Double, b: Double?) = a == b - -fun myEquals0(a: Double, b: Double) = a == b - - -fun box(): String { - if (!myEquals(null, null)) return "fail 1" - if (myEquals(null, 0.0)) return "fail 2" - if (myEquals(0.0, null)) return "fail 3" - if (!myEquals(0.0, 0.0)) return "fail 4" - - if (myEquals1(null, 0.0)) return "fail 5" - if (!myEquals1(0.0, 0.0)) return "fail 6" - - if (myEquals2(0.0, null)) return "fail 7" - if (!myEquals2(0.0, 0.0)) return "fail 8" - - if (!myEquals0(0.0, 0.0)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals10.kt b/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals10.kt deleted file mode 100644 index aec2421eaa9..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleEquals10.kt +++ /dev/null @@ -1,26 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun myEquals(a: Double?, b: Double?) = a == b - -fun myEquals1(a: Double?, b: Double) = a == b - -fun myEquals2(a: Double, b: Double?) = a == b - -fun myEquals0(a: Double, b: Double) = a == b - - -fun box(): String { - if (!myEquals(null, null)) return "fail 1" - if (myEquals(null, 0.0)) return "fail 2" - if (myEquals(0.0, null)) return "fail 3" - if (!myEquals(0.0, 0.0)) return "fail 4" - - if (myEquals1(null, 0.0)) return "fail 5" - if (!myEquals1(0.0, 0.0)) return "fail 6" - - if (myEquals2(0.0, null)) return "fail 7" - if (!myEquals2(0.0, 0.0)) return "fail 8" - - if (!myEquals0(0.0, 0.0)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals.kt b/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals.kt deleted file mode 100644 index c10a2097d37..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals.kt +++ /dev/null @@ -1,25 +0,0 @@ -fun myNotEquals(a: Double?, b: Double?) = a != b - -fun myNotEquals1(a: Double?, b: Double) = a != b - -fun myNotEquals2(a: Double, b: Double?) = a != b - -fun myNotEquals0(a: Double, b: Double) = a != b - - -fun box(): String { - if (myNotEquals(null, null)) return "fail 1" - if (!myNotEquals(null, 0.0)) return "fail 2" - if (!myNotEquals(0.0, null)) return "fail 3" - if (myNotEquals(0.0, 0.0)) return "fail 4" - - if (!myNotEquals1(null, 0.0)) return "fail 5" - if (myNotEquals1(0.0, 0.0)) return "fail 6" - - if (!myNotEquals2(0.0, null)) return "fail 7" - if (myNotEquals2(0.0, 0.0)) return "fail 8" - - if (myNotEquals0(0.0, 0.0)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals10.kt b/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals10.kt deleted file mode 100644 index 7ec29384f5a..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableDoubleNotEquals10.kt +++ /dev/null @@ -1,26 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun myNotEquals(a: Double?, b: Double?) = a != b - -fun myNotEquals1(a: Double?, b: Double) = a != b - -fun myNotEquals2(a: Double, b: Double?) = a != b - -fun myNotEquals0(a: Double, b: Double) = a != b - - -fun box(): String { - if (myNotEquals(null, null)) return "fail 1" - if (!myNotEquals(null, 0.0)) return "fail 2" - if (!myNotEquals(0.0, null)) return "fail 3" - if (myNotEquals(0.0, 0.0)) return "fail 4" - - if (!myNotEquals1(null, 0.0)) return "fail 5" - if (myNotEquals1(0.0, 0.0)) return "fail 6" - - if (!myNotEquals2(0.0, null)) return "fail 7" - if (myNotEquals2(0.0, 0.0)) return "fail 8" - - if (myNotEquals0(0.0, 0.0)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals.kt b/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals.kt deleted file mode 100644 index 1b18e826ea7..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals.kt +++ /dev/null @@ -1,25 +0,0 @@ -fun myEquals(a: Float?, b: Float?) = a == b - -fun myEquals1(a: Float?, b: Float) = a == b - -fun myEquals2(a: Float, b: Float?) = a == b - -fun myEquals0(a: Float, b: Float) = a == b - - -fun box(): String { - if (!myEquals(null, null)) return "fail 1" - if (myEquals(null, 0.0F)) return "fail 2" - if (myEquals(0.0F, null)) return "fail 3" - if (!myEquals(0.0F, 0.0F)) return "fail 4" - - if (myEquals1(null, 0.0F)) return "fail 5" - if (!myEquals1(0.0F, 0.0F)) return "fail 6" - - if (myEquals2(0.0F, null)) return "fail 7" - if (!myEquals2(0.0F, 0.0F)) return "fail 8" - - if (!myEquals0(0.0F, 0.0F)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals10.kt b/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals10.kt deleted file mode 100644 index b6899058120..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableFloatEquals10.kt +++ /dev/null @@ -1,26 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun myEquals(a: Float?, b: Float?) = a == b - -fun myEquals1(a: Float?, b: Float) = a == b - -fun myEquals2(a: Float, b: Float?) = a == b - -fun myEquals0(a: Float, b: Float) = a == b - - -fun box(): String { - if (!myEquals(null, null)) return "fail 1" - if (myEquals(null, 0.0F)) return "fail 2" - if (myEquals(0.0F, null)) return "fail 3" - if (!myEquals(0.0F, 0.0F)) return "fail 4" - - if (myEquals1(null, 0.0F)) return "fail 5" - if (!myEquals1(0.0F, 0.0F)) return "fail 6" - - if (myEquals2(0.0F, null)) return "fail 7" - if (!myEquals2(0.0F, 0.0F)) return "fail 8" - - if (!myEquals0(0.0F, 0.0F)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals.kt b/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals.kt deleted file mode 100644 index 2add42c33d8..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals.kt +++ /dev/null @@ -1,25 +0,0 @@ -fun myNotEquals(a: Float?, b: Float?) = a != b - -fun myNotEquals1(a: Float?, b: Float) = a != b - -fun myNotEquals2(a: Float, b: Float?) = a != b - -fun myNotEquals0(a: Float, b: Float) = a != b - - -fun box(): String { - if (myNotEquals(null, null)) return "fail 1" - if (!myNotEquals(null, 0.0F)) return "fail 2" - if (!myNotEquals(0.0F, null)) return "fail 3" - if (myNotEquals(0.0F, 0.0F)) return "fail 4" - - if (!myNotEquals1(null, 0.0F)) return "fail 5" - if (myNotEquals1(0.0F, 0.0F)) return "fail 6" - - if (!myNotEquals2(0.0F, null)) return "fail 7" - if (myNotEquals2(0.0F, 0.0F)) return "fail 8" - - if (myNotEquals0(0.0F, 0.0F)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals10.kt b/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals10.kt deleted file mode 100644 index a9eeb821db4..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableFloatNotEquals10.kt +++ /dev/null @@ -1,26 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun myNotEquals(a: Float?, b: Float?) = a != b - -fun myNotEquals1(a: Float?, b: Float) = a != b - -fun myNotEquals2(a: Float, b: Float?) = a != b - -fun myNotEquals0(a: Float, b: Float) = a != b - - -fun box(): String { - if (myNotEquals(null, null)) return "fail 1" - if (!myNotEquals(null, 0.0F)) return "fail 2" - if (!myNotEquals(0.0F, null)) return "fail 3" - if (myNotEquals(0.0F, 0.0F)) return "fail 4" - - if (!myNotEquals1(null, 0.0F)) return "fail 5" - if (myNotEquals1(0.0F, 0.0F)) return "fail 6" - - if (!myNotEquals2(0.0F, null)) return "fail 7" - if (myNotEquals2(0.0F, 0.0F)) return "fail 8" - - if (myNotEquals0(0.0F, 0.0F)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/nullableIntEquals.kt b/backend.native/tests/external/codegen/box/ieee754/nullableIntEquals.kt deleted file mode 100644 index d0426edb842..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/nullableIntEquals.kt +++ /dev/null @@ -1,26 +0,0 @@ -//NB: special ieee754 arithmetic logic is not applied to Int comparison -fun myEquals(a: Int?, b: Int?) = a == b - -fun myEquals1(a: Int?, b: Int) = a == b - -fun myEquals2(a: Int, b: Int?) = a == b - -fun myEquals0(a: Int, b: Int) = a == b - - -fun box(): String { - if (!myEquals(null, null)) return "fail 1" - if (myEquals(null, 0)) return "fail 2" - if (myEquals(0, null)) return "fail 3" - if (!myEquals(0, 0)) return "fail 4" - - if (myEquals1(null, 0)) return "fail 5" - if (!myEquals1(0, 0)) return "fail 6" - - if (myEquals2(0, null)) return "fail 7" - if (!myEquals2(0, 0)) return "fail 8" - - if (!myEquals0(0, 0)) return "fail 9" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/safeCall.kt b/backend.native/tests/external/codegen/box/ieee754/safeCall.kt deleted file mode 100644 index 5133ddaef43..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/safeCall.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: JS -fun box(): String { - val plusZero: Double? = 0.0 - val minusZero: Double = -0.0 - - useBoxed(plusZero) - - if (plusZero?.equals(minusZero) ?: null!!) { - return "fail 1" - } - - if (plusZero?.compareTo(minusZero) ?: null!! != 1) { - return "fail 2" - } - - return "OK" -} - -fun useBoxed(a: Any?) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/smartCastToDifferentTypes.kt b/backend.native/tests/external/codegen/box/ieee754/smartCastToDifferentTypes.kt deleted file mode 100644 index 98b087e66e0..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/smartCastToDifferentTypes.kt +++ /dev/null @@ -1,14 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -fun box(): String { - val zero: Any = 0.0 - val floatZero: Any = -0.0F - if (zero is Double && floatZero is Float) { - if (zero == floatZero) return "fail 1" - - if (zero <= floatZero) return "fail 2" - - return "OK" - } - - return "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/when.kt b/backend.native/tests/external/codegen/box/ieee754/when.kt deleted file mode 100644 index de5b07e4889..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/when.kt +++ /dev/null @@ -1,28 +0,0 @@ -fun box(): String { - val plusZero: Any = 0.0 - val minusZero: Any = -0.0 - val nullDouble: Double? = null - if (plusZero is Double) { - when (plusZero) { - nullDouble -> { - return "fail 1" - } - -0.0 -> { - } - else -> return "fail 2" - } - - if (minusZero is Double) { - when (plusZero) { - nullDouble -> { - return "fail 3" - } - minusZero -> { - } - else -> return "fail 4" - } - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/when10.kt b/backend.native/tests/external/codegen/box/ieee754/when10.kt deleted file mode 100644 index cf42bdd6ac8..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/when10.kt +++ /dev/null @@ -1,29 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun box(): String { - val plusZero: Any = 0.0 - val minusZero: Any = -0.0 - val nullDouble: Double? = null - if (plusZero is Double) { - when (plusZero) { - nullDouble -> { - return "fail 1" - } - -0.0 -> { - } - else -> return "fail 2" - } - - if (minusZero is Double) { - when (plusZero) { - nullDouble -> { - return "fail 3" - } - minusZero -> { - } - else -> return "fail 4" - } - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/whenNoSubject.kt b/backend.native/tests/external/codegen/box/ieee754/whenNoSubject.kt deleted file mode 100644 index 308c9a24cfe..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/whenNoSubject.kt +++ /dev/null @@ -1,26 +0,0 @@ -fun box(): String { - val plusZero: Any = 0.0 - val minusZero: Any = -0.0 - if (plusZero is Double && minusZero is Double) { - when { - plusZero < minusZero -> { - return "fail 1" - } - - plusZero > minusZero -> { - return "fail 2" - } - else -> { - } - } - - - when { - plusZero == minusZero -> { - } - else -> return "fail 3" - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast.kt b/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast.kt deleted file mode 100644 index 31dcd7c4417..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast.kt +++ /dev/null @@ -1,27 +0,0 @@ -fun box(): String { - val nullValue: Any? = null - val nullDouble: Double? = null - val minusZero: Any = -0.0 - if (nullValue is Double?) { - when (nullValue) { - -0.0 -> { - return "fail 1" - } - nullDouble -> {} - else -> return "fail 2" - } - - if (minusZero is Double) { - when (nullValue) { - minusZero -> { - return "fail 3" - } - nullDouble -> { - } - else -> return "fail 4" - } - } - - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast10.kt b/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast10.kt deleted file mode 100644 index f497a7468b6..00000000000 --- a/backend.native/tests/external/codegen/box/ieee754/whenNullableSmartCast10.kt +++ /dev/null @@ -1,28 +0,0 @@ -// LANGUAGE_VERSION: 1.0 -fun box(): String { - val nullValue: Any? = null - val nullDouble: Double? = null - val minusZero: Any = -0.0 - if (nullValue is Double?) { - when (nullValue) { - -0.0 -> { - return "fail 1" - } - nullDouble -> {} - else -> return "fail 2" - } - - if (minusZero is Double) { - when (nullValue) { - minusZero -> { - return "fail 3" - } - nullDouble -> { - } - else -> return "fail 4" - } - } - - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/increment/arrayElement.kt b/backend.native/tests/external/codegen/box/increment/arrayElement.kt deleted file mode 100644 index e74d4d23515..00000000000 --- a/backend.native/tests/external/codegen/box/increment/arrayElement.kt +++ /dev/null @@ -1,69 +0,0 @@ -fun box(): String { - val aByte: Array = arrayOf(1) - val bByte: ByteArray = byteArrayOf(1) - - val aShort: Array = arrayOf(1) - val bShort: ShortArray = shortArrayOf(1) - - val aInt: Array = arrayOf(1) - val bInt: IntArray = intArrayOf(1) - - val aLong: Array = arrayOf(1) - val bLong: LongArray = longArrayOf(1) - - val aFloat: Array = arrayOf(1.0f) - val bFloat: FloatArray = floatArrayOf(1.0f) - - val aDouble: Array = arrayOf(1.0) - val bDouble: DoubleArray = doubleArrayOf(1.0) - - aByte[0]-- - bByte[0]-- - if (aByte[0] != bByte[0]) return "Failed post-decrement Byte: ${aByte[0]} != ${bByte[0]}" - - aByte[0]++ - bByte[0]++ - if (aByte[0] != bByte[0]) return "Failed post-increment Byte: ${aByte[0]} != ${bByte[0]}" - - aShort[0]-- - bShort[0]-- - if (aShort[0] != bShort[0]) return "Failed post-decrement Short: ${aShort[0]} != ${bShort[0]}" - - aShort[0]++ - bShort[0]++ - if (aShort[0] != bShort[0]) return "Failed post-increment Short: ${aShort[0]} != ${bShort[0]}" - - aInt[0]-- - bInt[0]-- - if (aInt[0] != bInt[0]) return "Failed post-decrement Int: ${aInt[0]} != ${bInt[0]}" - - aInt[0]++ - bInt[0]++ - if (aInt[0] != bInt[0]) return "Failed post-increment Int: ${aInt[0]} != ${bInt[0]}" - - aLong[0]-- - bLong[0]-- - if (aLong[0] != bLong[0]) return "Failed post-decrement Long: ${aLong[0]} != ${bLong[0]}" - - aLong[0]++ - bLong[0]++ - if (aLong[0] != bLong[0]) return "Failed post-increment Long: ${aLong[0]} != ${bLong[0]}" - - aFloat[0]++ - bFloat[0]++ - if (aFloat[0] != bFloat[0]) return "Failed post-increment Float: ${aFloat[0]} != ${bFloat[0]}" - - aFloat[0]-- - bFloat[0]-- - if (aFloat[0] != bFloat[0]) return "Failed post-decrement Float: ${aFloat[0]} != ${bFloat[0]}" - - aDouble[0]++ - bDouble[0]++ - if (aDouble[0] != bDouble[0]) return "Failed post-increment Double: ${aDouble[0]} != ${bDouble[0]}" - - aDouble[0]-- - bDouble[0]-- - if (aDouble[0] != bDouble[0]) return "Failed post-decrement Double: ${aDouble[0]} != ${bDouble[0]}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/assignPlusOnSmartCast.kt b/backend.native/tests/external/codegen/box/increment/assignPlusOnSmartCast.kt deleted file mode 100644 index f3b84e034bd..00000000000 --- a/backend.native/tests/external/codegen/box/increment/assignPlusOnSmartCast.kt +++ /dev/null @@ -1,8 +0,0 @@ -public fun box() : String { - var i : Int? - i = 10 - // assignPlus on a smart cast should work - i += 1 - - return if (11 == i) "OK" else "fail i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/augmentedAssignmentWithComplexRhs.kt b/backend.native/tests/external/codegen/box/increment/augmentedAssignmentWithComplexRhs.kt deleted file mode 100644 index cc9dccf660b..00000000000 --- a/backend.native/tests/external/codegen/box/increment/augmentedAssignmentWithComplexRhs.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -import kotlin.test.* - -var log = "" -var result = 20 -var doubleResult = 40.0 - -fun id(value: T) = value - -fun box(): String { - result += if (id("true") == "true") { - result += 10 - log += "true chosen;" - 3 - } - else { - 4 - } - - assertEquals(23, result) - - doubleResult += if (id("true") == "true") { - doubleResult += 100 - log += "true chosen;" - 2 - } - else { - 5 - } - - assertEquals(42, (doubleResult + 0.1).toInt()) - assertEquals("true chosen;true chosen;", log) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/classNaryGetSet.kt b/backend.native/tests/external/codegen/box/increment/classNaryGetSet.kt deleted file mode 100644 index 9b909a4e8e2..00000000000 --- a/backend.native/tests/external/codegen/box/increment/classNaryGetSet.kt +++ /dev/null @@ -1,16 +0,0 @@ -@kotlin.native.ThreadLocal -object A { - var x = 0 - - operator fun get(i1: Int, i2: Int, i3: Int): Int = x - - operator fun set(i1: Int, i2: Int, i3: Int, value: Int) { - x = value - } -} - -fun box(): String { - A.x = 0 - val xx = A[1, 2, 3]++ - return if (xx != 0 || A.x != 1) "Failed" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/increment/classWithGetSet.kt b/backend.native/tests/external/codegen/box/increment/classWithGetSet.kt deleted file mode 100644 index 97d2925acb4..00000000000 --- a/backend.native/tests/external/codegen/box/increment/classWithGetSet.kt +++ /dev/null @@ -1,117 +0,0 @@ -class AByte(var value: Byte) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Byte) { - value = newValue - } -} - -class AShort(var value: Short) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Short) { - value = newValue - } -} - -class AInt(var value: Int) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Int) { - value = newValue - } -} - -class ALong(var value: Long) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Long) { - value = newValue - } -} - -class AFloat(var value: Float) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Float) { - value = newValue - } -} - -class ADouble(var value: Double) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: Double) { - value = newValue - } -} - -fun box(): String { - val aByte = AByte(1) - var bByte: Byte = 1 - - val aShort = AShort(1) - var bShort: Short = 1 - - val aInt = AInt(1) - var bInt: Int = 1 - - val aLong = ALong(1) - var bLong: Long = 1 - - val aFloat = AFloat(1.0f) - var bFloat: Float = 1.0f - - val aDouble = ADouble(1.0) - var bDouble: Double = 1.0 - - aByte[0]++ - bByte++ - if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" - - aByte[0]-- - bByte-- - if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" - - aShort[0]++ - bShort++ - if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" - - aShort[0]-- - bShort-- - if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" - - aInt[0]++ - bInt++ - if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" - - aInt[0]-- - bInt-- - if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" - - aLong[0]++ - bLong++ - if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" - - aLong[0]-- - bLong-- - if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" - - aFloat[0]++ - bFloat++ - if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" - - aFloat[0]-- - bFloat-- - if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" - - aDouble[0]++ - bDouble++ - if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" - - aDouble[0]-- - bDouble-- - if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/extOnLong.kt b/backend.native/tests/external/codegen/box/increment/extOnLong.kt deleted file mode 100644 index 9dce4e9da95..00000000000 --- a/backend.native/tests/external/codegen/box/increment/extOnLong.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Long.get(i: Int) = this -operator fun Long.set(i: Int, newValue: Long) {} - -fun box(): String { - var x = 0L - val y = x[0]++ - return if (y == 0L) "OK" else "Failed, y=$y" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/genericClassWithGetSet.kt b/backend.native/tests/external/codegen/box/increment/genericClassWithGetSet.kt deleted file mode 100644 index 04825a34f6c..00000000000 --- a/backend.native/tests/external/codegen/box/increment/genericClassWithGetSet.kt +++ /dev/null @@ -1,77 +0,0 @@ -class A(var value: T) { - operator fun get(i: Int) = value - - operator fun set(i: Int, newValue: T) { - value = newValue - } -} - -fun box(): String { - val aByte = A(1) - var bByte: Byte = 1 - - val aShort = A(1) - var bShort: Short = 1 - - val aInt = A(1) - var bInt: Int = 1 - - val aLong = A(1) - var bLong: Long = 1 - - val aFloat = A(1.0f) - var bFloat: Float = 1.0f - - val aDouble = A(1.0) - var bDouble: Double = 1.0 - - aByte[0]++ - bByte++ - if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" - - aByte[0]-- - bByte-- - if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" - - aShort[0]++ - bShort++ - if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" - - aShort[0]-- - bShort-- - if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" - - aInt[0]++ - bInt++ - if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" - - aInt[0]-- - bInt-- - if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" - - aLong[0]++ - bLong++ - if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" - - aLong[0]-- - bLong-- - if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" - - aFloat[0]++ - bFloat++ - if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" - - aFloat[0]-- - bFloat-- - if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" - - aDouble[0]++ - bDouble++ - if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" - - aDouble[0]-- - bDouble-- - if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/memberExtOnLong.kt b/backend.native/tests/external/codegen/box/increment/memberExtOnLong.kt deleted file mode 100644 index c51bf9b901d..00000000000 --- a/backend.native/tests/external/codegen/box/increment/memberExtOnLong.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -object ExtProvider { - operator fun Long.get(i: Int) = this - operator fun Long.set(i: Int, newValue: Long) {} -} - -fun box(): String { - with (ExtProvider) { - var x = 0L - val y = x[0]++ - return if (y == 0L) "OK" else "Failed, y=$y" - } -} diff --git a/backend.native/tests/external/codegen/box/increment/mutableListElement.kt b/backend.native/tests/external/codegen/box/increment/mutableListElement.kt deleted file mode 100644 index b861d31e15d..00000000000 --- a/backend.native/tests/external/codegen/box/increment/mutableListElement.kt +++ /dev/null @@ -1,83 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val aByte = arrayListOf(1) - var bByte: Byte = 1 - - val aShort = arrayListOf(1) - var bShort: Short = 1 - - val aInt = arrayListOf(1) - var bInt: Int = 1 - - val aLong = arrayListOf(1) - var bLong: Long = 1 - - val aFloat = arrayListOf(1.0f) - var bFloat: Float = 1.0f - - val aDouble = arrayListOf(1.0) - var bDouble: Double = 1.0 - - aByte[0]-- - bByte-- - - if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" - - aByte[0]++ - bByte++ - - if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" - - aShort[0]-- - bShort-- - - if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" - - aShort[0]++ - bShort++ - - if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" - - aInt[0]-- - bInt-- - - if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" - - aInt[0]++ - bInt++ - - if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" - - aLong[0]-- - bLong-- - - if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" - - aLong[0]++ - bLong++ - - if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" - - aFloat[0]-- - bFloat-- - - if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" - - aFloat[0]++ - bFloat++ - - if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" - - aDouble[0]-- - bDouble-- - - if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" - - aDouble[0]++ - bDouble++ - - if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/increment/nullable.kt b/backend.native/tests/external/codegen/box/increment/nullable.kt deleted file mode 100644 index 4802b8a7fbc..00000000000 --- a/backend.native/tests/external/codegen/box/increment/nullable.kt +++ /dev/null @@ -1,69 +0,0 @@ -fun box(): String { - var aByte: Byte? = 0 - var bByte: Byte = 0 - - var aShort: Short? = 0 - var bShort: Short = 0 - - var aInt: Int? = 0 - var bInt: Int = 0 - - var aLong: Long? = 0 - var bLong: Long = 0 - - var aFloat: Float? = 0.0f - var bFloat: Float = 0.0f - - var aDouble: Double? = 0.0 - var bDouble: Double = 0.0 - - if (aByte != null) aByte-- - bByte-- - if (aByte != bByte) return "Failed post-decrement Byte: $aByte != $bByte" - - if (aByte != null) aByte++ - bByte++ - if (aByte != bByte) return "Failed post-increment Byte: $aByte != $bByte" - - if (aShort != null) aShort-- - bShort-- - if (aShort != bShort) return "Failed post-decrement Short: $aShort != $bShort" - - if (aShort != null) aShort++ - bShort++ - if (aShort != bShort) return "Failed post-increment Short: $aShort != $bShort" - - if (aInt != null) aInt-- - bInt-- - if (aInt != bInt) return "Failed post-decrement Int: $aInt != $bInt" - - if (aInt != null) aInt++ - bInt++ - if (aInt != bInt) return "Failed post-increment Int: $aInt != $bInt" - - if (aLong != null) aLong-- - bLong-- - if (aLong != bLong) return "Failed post-decrement Long: $aLong != $bLong" - - if (aLong != null) aLong++ - bLong++ - if (aLong != bLong) return "Failed post-increment Long: $aLong != $bLong" - - if (aFloat != null) aFloat-- - bFloat-- - if (aFloat != bFloat) return "Failed post-decrement Float: $aFloat != $bFloat" - - if (aFloat != null) aFloat++ - bFloat++ - if (aFloat != bFloat) return "Failed post-increment Float: $aFloat != $bFloat" - - if (aDouble != null) aDouble-- - bDouble-- - if (aDouble != bDouble) return "Failed post-decrement Double: $aDouble != $bDouble" - - if (aDouble != null) aDouble++ - bDouble++ - if (aDouble != bDouble) return "Failed post-increment Double: $aDouble != $bDouble" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/increment/postfixIncrementDoubleSmartCast.kt b/backend.native/tests/external/codegen/box/increment/postfixIncrementDoubleSmartCast.kt deleted file mode 100644 index 738a31c9697..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixIncrementDoubleSmartCast.kt +++ /dev/null @@ -1,10 +0,0 @@ -public fun box() : String { - var i : Int? - i = 10 - // We have "double" smart cast here: - // first on i and second on i++ - // Back-end should NOT think that both i and j are Int - val j: Int = i++ - - return if (j == 10 && 11 == i) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClass.kt b/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClass.kt deleted file mode 100644 index deb8df65d80..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface Base -class Derived: Base -class Another: Base -operator fun Base.inc(): Derived { return Derived() } - -public fun box() : String { - var i : Base - i = Another() - val j = i++ - - return if (j is Another && i is Derived) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClassSmartCast.kt b/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClassSmartCast.kt deleted file mode 100644 index 3bc2442a3be..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnClassSmartCast.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class Base -class Derived: Base() -operator fun Derived.inc(): Derived { return Derived() } - -public fun box() : String { - var i : Base - i = Derived() - val j = i++ - - return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnShortSmartCast.kt b/backend.native/tests/external/codegen/box/increment/postfixIncrementOnShortSmartCast.kt deleted file mode 100644 index 0dec61d0503..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnShortSmartCast.kt +++ /dev/null @@ -1,8 +0,0 @@ -public fun box() : String { - var i : Short? - i = 10 - // Postfix increment on a smart casted short should work - val j = i++ - - return if (j!!.toInt() == 10 && i!!.toInt() == 11) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnSmartCast.kt b/backend.native/tests/external/codegen/box/increment/postfixIncrementOnSmartCast.kt deleted file mode 100644 index 3da28a2d6e6..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixIncrementOnSmartCast.kt +++ /dev/null @@ -1,9 +0,0 @@ -public fun box() : String { - var i : Int? - i = 10 - // Postfix increment on a smart cast should work - // Specific: i.inc() type is Int but i and j types are both Int? - val j = i++ - - return if (j == 10 && 11 == i) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixNullableClassIncrement.kt b/backend.native/tests/external/codegen/box/increment/postfixNullableClassIncrement.kt deleted file mode 100644 index b6d22b07a1b..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixNullableClassIncrement.kt +++ /dev/null @@ -1,11 +0,0 @@ -class MyClass - -operator fun MyClass?.inc(): MyClass? = null - -public fun box() : String { - var i : MyClass? - i = MyClass() - val j = i++ - - return if (j is MyClass && null == i) "OK" else "fail i = $i j = $j" -} diff --git a/backend.native/tests/external/codegen/box/increment/postfixNullableIncrement.kt b/backend.native/tests/external/codegen/box/increment/postfixNullableIncrement.kt deleted file mode 100644 index 2564e3ed898..00000000000 --- a/backend.native/tests/external/codegen/box/increment/postfixNullableIncrement.kt +++ /dev/null @@ -1,10 +0,0 @@ -operator fun Int?.inc(): Int? = this - -fun init(): Int? { return 10 } - -public fun box() : String { - var i : Int? = init() - val j = i++ - - return if (j == 10 && 10 == i) "OK" else "fail i = $i j = $j" -} diff --git a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClass.kt b/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClass.kt deleted file mode 100644 index 6bc75ad060e..00000000000 --- a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface Base -class Derived: Base -class Another: Base -operator fun Base.inc(): Derived { return Derived() } - -public fun box() : String { - var i : Base - i = Another() - val j = ++i - - return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClassSmartCast.kt b/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClassSmartCast.kt deleted file mode 100644 index c51f6d1d816..00000000000 --- a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnClassSmartCast.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class Base -class Derived: Base() -operator fun Derived.inc(): Derived { return Derived() } - -public fun box() : String { - var i : Base - i = Derived() - val j = ++i - - return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnSmartCast.kt b/backend.native/tests/external/codegen/box/increment/prefixIncrementOnSmartCast.kt deleted file mode 100644 index 80e48f4f78b..00000000000 --- a/backend.native/tests/external/codegen/box/increment/prefixIncrementOnSmartCast.kt +++ /dev/null @@ -1,8 +0,0 @@ -public fun box() : String { - var i : Int? - i = 10 - // Prefix increment on a smart cast should work - val j = ++i - - return if (j == 11 && 11 == i) "OK" else "fail j = $j i = $i" -} diff --git a/backend.native/tests/external/codegen/box/increment/prefixNullableClassIncrement.kt b/backend.native/tests/external/codegen/box/increment/prefixNullableClassIncrement.kt deleted file mode 100644 index e8c98d7bce6..00000000000 --- a/backend.native/tests/external/codegen/box/increment/prefixNullableClassIncrement.kt +++ /dev/null @@ -1,11 +0,0 @@ -class MyClass - -operator fun MyClass?.inc(): MyClass? = null - -public fun box() : String { - var i : MyClass? - i = MyClass() - val j = ++i - - return if (j == null && null == i) "OK" else "fail i = $i j = $j" -} diff --git a/backend.native/tests/external/codegen/box/increment/prefixNullableIncrement.kt b/backend.native/tests/external/codegen/box/increment/prefixNullableIncrement.kt deleted file mode 100644 index 2c28b62ff11..00000000000 --- a/backend.native/tests/external/codegen/box/increment/prefixNullableIncrement.kt +++ /dev/null @@ -1,10 +0,0 @@ -operator fun Int?.inc(): Int? = this - -fun init(): Int? { return 10 } - -public fun box() : String { - var i : Int? = init() - val j = ++i - - return if (j == 10 && 10 == i) "OK" else "fail i = $i j = $j" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/createNestedClass.kt b/backend.native/tests/external/codegen/box/innerNested/createNestedClass.kt deleted file mode 100644 index b5cd0e787ec..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/createNestedClass.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - class B1 - class B2(val x: Int) - class B3(val x: Long, val y: Int) - class B4(val str: String) -} - - -fun box(): String { - A.B1() - val b2 = A.B2(A.B3(42, 42).y) - return A.B4("OK").str -} diff --git a/backend.native/tests/external/codegen/box/innerNested/createdNestedInOuterMember.kt b/backend.native/tests/external/codegen/box/innerNested/createdNestedInOuterMember.kt deleted file mode 100644 index f4c0640c7ab..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/createdNestedInOuterMember.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun foo(f: (Int) -> Int) = f(0) - -class Outer { - class Nested { - val y = foo { a -> a } - } - - fun bar(): String { - val a = Nested() - return "OK" - } -} - -fun box() = Outer().bar() diff --git a/backend.native/tests/external/codegen/box/innerNested/extensionFun.kt b/backend.native/tests/external/codegen/box/innerNested/extensionFun.kt deleted file mode 100644 index 44ed11116dc..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/extensionFun.kt +++ /dev/null @@ -1,31 +0,0 @@ -class Outer { - class Nested - inner class Inner - - fun Inner.foo() { - Outer() - Nested() - Inner() - } - - fun Nested.bar() { - Outer() - Nested() - Inner() - } - - fun Outer.baz() { - Outer() - Nested() - Inner() - } - - fun box(): String { - Inner().foo() - Nested().bar() - baz() - return "OK" - } -} - -fun box() = Outer().box() diff --git a/backend.native/tests/external/codegen/box/innerNested/extensionToNested.kt b/backend.native/tests/external/codegen/box/innerNested/extensionToNested.kt deleted file mode 100644 index 553ff99ae00..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/extensionToNested.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Test { - class Nested { - val value = "OK" - } -} - -fun Test.Nested.foo() = value - -fun box() = Test.Nested().foo() diff --git a/backend.native/tests/external/codegen/box/innerNested/importNestedClass.kt b/backend.native/tests/external/codegen/box/innerNested/importNestedClass.kt deleted file mode 100644 index 8bb9fdc5376..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/importNestedClass.kt +++ /dev/null @@ -1,18 +0,0 @@ -import A.B -import A.B.C - -class A { - class B { - class C - } -} - -fun box(): String { - val a = A() - val b = B() - val ab = A.B() - val c = C() - val bc = B.C() - val abc = A.B.C() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/innerGeneric.kt b/backend.native/tests/external/codegen/box/innerNested/innerGeneric.kt deleted file mode 100644 index 36a6bda1e99..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/innerGeneric.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Outer { - inner class Inner(val t: T) { - fun box() = t - } -} - -fun box(): String { - if (Outer().Inner("OK").box() != "OK") return "Fail" - val x: Outer.Inner = Outer().Inner("OK") - return x.box() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/innerGenericClassFromJava.kt b/backend.native/tests/external/codegen/box/innerNested/innerGenericClassFromJava.kt deleted file mode 100644 index 3490ee65894..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/innerGenericClassFromJava.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: JavaClass.java - -public abstract class JavaClass { - public static String test() { - return Test.INSTANCE.foo(new Outer("OK").new Inner(1)); - } -} - -// FILE: Kotlin.kt - -class Outer(val x: E) { - inner class Inner(val y: F) { - fun foo() = x.toString() + y.toString() - } -} - -object Test { - fun foo(x: Outer.Inner) = x.foo() -} - -fun box(): String { - val result = JavaClass.test() - if (result != "OK1") return "Fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/innerJavaClass.kt b/backend.native/tests/external/codegen/box/innerNested/innerJavaClass.kt deleted file mode 100644 index da291521d05..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/innerJavaClass.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: JavaClass.java - -public abstract class JavaClass { - public abstract InnerClass onCreateInner(); - - public class InnerClass { - - } -} - -// FILE: Kotlin.kt - -public class MyWallpaperService : JavaClass() { - override fun onCreateInner(): JavaClass.InnerClass = MyEngine() - - private inner class MyEngine : JavaClass.InnerClass() -} - -fun box(): String { - return if (MyWallpaperService().onCreateInner() != null) return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/innerLabeledThis.kt b/backend.native/tests/external/codegen/box/innerNested/innerLabeledThis.kt deleted file mode 100644 index 34a50d00af6..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/innerLabeledThis.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Outer { - inner class Inner { - fun O() = this@Outer.O - val K = this@Outer.K() - } - - val O = "O" - fun K() = "K" -} - -fun box() = Outer().Inner().O() + Outer().Inner().K diff --git a/backend.native/tests/external/codegen/box/innerNested/innerSimple.kt b/backend.native/tests/external/codegen/box/innerNested/innerSimple.kt deleted file mode 100644 index 9159e24d84c..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/innerSimple.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Outer { - inner class Inner { - fun box() = "OK" - } -} - -fun box() = Outer().Inner().box() diff --git a/backend.native/tests/external/codegen/box/innerNested/kt3132.kt b/backend.native/tests/external/codegen/box/innerNested/kt3132.kt deleted file mode 100644 index afcee1c6ca1..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/kt3132.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Test { - interface Foo { } - - class FooImplNested: Foo { } - - inner class FooImplInner: Foo { } -} - -fun box(): String { - Test().FooImplInner() - Test.FooImplNested() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/kt3927.kt b/backend.native/tests/external/codegen/box/innerNested/kt3927.kt deleted file mode 100644 index 1e1efce9624..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/kt3927.kt +++ /dev/null @@ -1,23 +0,0 @@ -//KT-3927 Inner class cannot be instantiated with child instance of outer class - -abstract class Base { - inner class Inner { - fun o() = "O" - fun k() = "K" - } -} - -class Child : Base() - -fun box(): String { - var result = "" - result += Child().Inner().o() - - fun Child.f() { - result += Inner().k() - } - Child().f() - - return result -} - diff --git a/backend.native/tests/external/codegen/box/innerNested/kt5363.kt b/backend.native/tests/external/codegen/box/innerNested/kt5363.kt deleted file mode 100644 index 1f696893d3d..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/kt5363.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Outer { - class Nested{ - fun foo(s: String) = s.extension() - } - - companion object { - private fun String.extension(): String = this - } -} - -fun box(): String { - return Outer.Nested().foo("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/kt6804.kt b/backend.native/tests/external/codegen/box/innerNested/kt6804.kt deleted file mode 100644 index edb201a622e..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/kt6804.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Outer { - class Nested { - fun fn() = s - } - - companion object { - private val s = "OK" - } -} - -fun box(): String { - return Outer.Nested().fn() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedClassInObject.kt b/backend.native/tests/external/codegen/box/innerNested/nestedClassInObject.kt deleted file mode 100644 index ec3f72d4b20..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedClassInObject.kt +++ /dev/null @@ -1,10 +0,0 @@ -object A { - class B - class C -} - -fun box(): String { - val b = A.B() - val c = A.C() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedClassObject.kt b/backend.native/tests/external/codegen/box/innerNested/nestedClassObject.kt deleted file mode 100644 index 8e470a4e58e..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedClassObject.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Outer { - class Nested { - companion object { - val O = "O" - val K = "K" - } - } - - fun O() = Nested.O -} - -fun box() = Outer().O() + Outer.Nested.K diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedEnumConstant.kt b/backend.native/tests/external/codegen/box/innerNested/nestedEnumConstant.kt deleted file mode 100644 index d8ae583f3d5..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedEnumConstant.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Outer { - enum class Nested { - O, - K - } -} - -fun box() = "${Outer.Nested.O}${Outer.Nested.K}" diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedGeneric.kt b/backend.native/tests/external/codegen/box/innerNested/nestedGeneric.kt deleted file mode 100644 index 9cdea6814f5..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedGeneric.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Outer { - class Nested(val t: T) { - fun box() = t - } -} - -fun box(): String { - if (Outer.Nested("OK").box() != "OK") return "Fail" - - val x: Outer.Nested = Outer.Nested("OK") - return x.box() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedInPackage.kt b/backend.native/tests/external/codegen/box/innerNested/nestedInPackage.kt deleted file mode 100644 index a08a2098110..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedInPackage.kt +++ /dev/null @@ -1,10 +0,0 @@ -package Package - -class Outer { - class Nested { - val O = "O" - val K = "K" - } -} - -fun box() = Package.Outer.Nested().O + Outer.Nested().K diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedObjects.kt b/backend.native/tests/external/codegen/box/innerNested/nestedObjects.kt deleted file mode 100644 index 185af172991..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedObjects.kt +++ /dev/null @@ -1,9 +0,0 @@ -object A { - object B { - object C { - val ok = "OK" - } - } -} - -fun box() = A.B.C.ok diff --git a/backend.native/tests/external/codegen/box/innerNested/nestedSimple.kt b/backend.native/tests/external/codegen/box/innerNested/nestedSimple.kt deleted file mode 100644 index a9180148616..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/nestedSimple.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Outer { - class Nested { - fun box() = "OK" - } -} - -fun box() = Outer.Nested().box() diff --git a/backend.native/tests/external/codegen/box/innerNested/protectedNestedClass.kt b/backend.native/tests/external/codegen/box/innerNested/protectedNestedClass.kt deleted file mode 100644 index 7de7c5cf0a6..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/protectedNestedClass.kt +++ /dev/null @@ -1,25 +0,0 @@ -// See KT-9246 IllegalAccessError when trying to access protected nested class from parent class -// FILE: a.kt - -package a - -abstract class A { - protected class C { - fun result() = "OK" - } -} - -// FILE: b.kt - -package b - -import a.A - -class B : A() { - protected val c = A.C() - val result: String get() = c.result() -} - -fun box(): String { - return B().result -} diff --git a/backend.native/tests/external/codegen/box/innerNested/protectedNestedClassFromJava.kt b/backend.native/tests/external/codegen/box/innerNested/protectedNestedClassFromJava.kt deleted file mode 100644 index 1dbc087f9c9..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/protectedNestedClassFromJava.kt +++ /dev/null @@ -1,34 +0,0 @@ -// See KT-8269 java.lang.IllegalAccessError on accessing protected inner class declared in Kotlin super class -// TARGET_BACKEND: JVM -// FILE: Test.kt - -package com.company - -import other.JavaClass - -open class Test { - protected class ProtectedClass -} - -fun box(): String { - JavaClass.test() - return "OK" -} - -// FILE: other/JavaClass.java - -package other; - -import com.company.Test; - -public class JavaClass { - static class JavaTest extends Test { - public static boolean foo(Object obj) { - return obj instanceof ProtectedClass; - } - } - - public static void test() { - JavaTest.foo(new Object()); - } -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepInnerHierarchy.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepInnerHierarchy.kt deleted file mode 100644 index 08efa14a7ff..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepInnerHierarchy.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class A(val s: String) { - open inner class B(s: String): A(s) - - open inner class C(s: String, additional: Double): B(s) - - open inner class D(other: Int, another: Long, s: String) : C(s, another.toDouble()) - - open inner class E : D(0, 42L, "OK") - - inner class F : E() -} - -fun box(): String = A("Fail").F().s diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepLocalHierarchy.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepLocalHierarchy.kt deleted file mode 100644 index 760f7b0deae..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/deepLocalHierarchy.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - abstract class L1 { - abstract fun foo(): String - } - - open class L2(val s: String) : L1() { - override fun foo() = s - } - - open class L3(unused: Double, value: String = "OK") : L2(value) - - open class L4(i: Int, j: Long, z: Boolean, l: L3) : L3(3.14) - - class L5 : L4(0, 0L, false, L3(2.71, "Fail")) - - return L5().foo() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt deleted file mode 100644 index c218f292c1f..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Father(val param: String) { - abstract inner class InClass { - fun work(): String { - return param - } - } - - inner class Child(p: String) : Father(p) { - inner class Child2 : Father.InClass { - constructor(): super() - } - } -} - -fun box(): String { - return Father("fail").Child("OK").Child2().work() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt deleted file mode 100644 index 3dd19c2f3d5..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Father(val param: String) { - abstract inner class InClass { - fun work(): String { - return param - } - } - - inner class Child(p: String) : Father(p) { - inner class Child2 : Father.InClass() { - - } - } -} - -fun box(): String { - return Father("fail").Child("OK").Child2().work() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsOuter.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsOuter.kt deleted file mode 100644 index 8db3bfa10ca..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/innerExtendsOuter.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM - -// When inner class extends its outer, there are two instances of the outer present in the inner: -// the enclosing one and the one in the super call. -// Here we test that symbols are resolved to the instance created via the super call. - -open class Outer(vararg val chars: Char) { - open inner class Inner(val s: String): Outer(s[0], s[1]) { - fun concat() = java.lang.String.valueOf(chars) - } - - fun value() = Inner("OK").concat() -} - -fun box() = Outer('F', 'a', 'i', 'l').value() diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_1.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_1.kt deleted file mode 100644 index fe17fb4d085..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_1.kt +++ /dev/null @@ -1,17 +0,0 @@ -abstract class Father { - abstract inner class InClass { - abstract fun work(): String - } -} - -class Child : Father() { - val ChildInClass = object : Father.InClass() { - override fun work(): String { - return "OK" - } - } -} - -fun box(): String { - return Child().ChildInClass.work() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_2.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_2.kt deleted file mode 100644 index 4753541d860..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/kt11833_2.kt +++ /dev/null @@ -1,19 +0,0 @@ -abstract class Father { - abstract inner class InClass { - abstract fun work(): String - } -} - -class Child : Father() { - fun test(): InClass { - return object : Father.InClass() { - override fun work(): String { - return "OK" - } - } - } -} - -fun box(): String { - return Child().test().work() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt deleted file mode 100644 index cf1db10e27c..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - fun bar(): Any { - return { - { - class Local : Inner() { - override fun toString() = foo() - } - Local() - }() - }() - } - - open inner class Inner - fun foo() = "OK" -} - -fun box(): String = A().bar().toString() diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsInner.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsInner.kt deleted file mode 100644 index bd2fe48d847..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsInner.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class Father(val param: String) { - abstract inner class InClass { - fun work(): String { - return param - } - } - - inner class Child(p: String) : Father(p) { - fun test(): InClass { - class Local : Father.InClass() { - - } - return Local() - } - - } -} - -fun box(): String { - return Father("fail").Child("OK").test().work() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt deleted file mode 100644 index f24ed933d5c..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val result = "OK" - - open class Local(val ok: Boolean) { - fun result() = if (ok) result else "Fail" - } - - class Derived : Local(true) - - return Derived().result() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt deleted file mode 100644 index b2bb6dbd67a..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun box(): String { - val three = 3 - - open class Local(val one: Int) { - open fun value() = "$three$one" - } - - val four = 4 - - class Derived(val two: Int) : Local(1) { - override fun value() = super.value() + "$four$two" - } - - val result = Derived(2).value() - return if (result == "3142") "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt deleted file mode 100644 index 298b0ec9162..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt +++ /dev/null @@ -1,9 +0,0 @@ -// KT-3581 - -open class A(val result: String = "OK") { -} - -fun box(): String { - val a = object : A() {} - return a.result -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassVararg.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassVararg.kt deleted file mode 100644 index b0bb4aed5d1..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsClassVararg.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class SomeClass(val some: Double, val other: Int, vararg val args: String) { - fun result() = args[1] -} - -fun box(): String { - return object : SomeClass(3.14, 42, "No", "OK", "Yes") { - }.result() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInner.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInner.kt deleted file mode 100644 index f02f1d4edc1..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInner.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - open inner class Inner(val result: String) - - fun box(): String { - val o = object : Inner("OK") { - fun ok() = result - } - return o.ok() - } -} - -fun box() = A().box() diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt deleted file mode 100644 index c94d6ab49ca..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - open inner class Inner(val result: String = "OK", val int: Int) - - fun box(): String { - val o = object : Inner(int = 0) { - fun ok() = result - } - return o.ok() - } -} - -fun box() = A().box() diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt deleted file mode 100644 index eef3131ae2b..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val capture = "oh" - - class Local { - val captured = capture - - open inner class Inner(val d: Double = -1.0, val s: String, vararg val y: Int) { - open fun result() = "Fail" - } - - val obj = object : Inner(s = "OK") { - override fun result() = s - } - } - - return Local().obj.result() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt deleted file mode 100644 index b4fb7a47cee..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - class Local { - open inner class Inner(val s: String) { - open fun result() = "Fail" - } - - val realResult = "OK" - - val obj = object : Inner(realResult) { - override fun result() = s - } - } - - return Local().obj.result() -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt deleted file mode 100644 index 35bb545eb82..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A(val s: String) - -fun box(): String { - class B { - val result = "OK" - - val f = object : A(result) {}.s - } - - return B().f -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt deleted file mode 100644 index 834b1e5d824..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box(): String { - val d = 42.0 - val c = 'C' - - open class Local(val l: Long) { - fun foo(): Boolean = d == 42.0 && c == 'C' && l == 239L - } - - if (object : Local(239L) { - fun bar(): Boolean = foo() - }.bar()) return "OK" - - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt b/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt deleted file mode 100644 index e6fe2b05cf9..00000000000 --- a/backend.native/tests/external/codegen/box/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A { - fun bar(): Any { - return { - { - object : Inner() { - override fun toString() = foo() - } - }() - }() - } - - open inner class Inner - fun foo() = "OK" -} - -fun box(): String = A().bar().toString() diff --git a/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarInt.kt b/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarInt.kt deleted file mode 100644 index 619bfd3a800..00000000000 --- a/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarInt.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - var a: Int - a = 12 - fun f() { - foo(a) - } - - return "OK" -} - -fun foo(l: Int) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarLong.kt b/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarLong.kt deleted file mode 100644 index 7340eb15d14..00000000000 --- a/backend.native/tests/external/codegen/box/instructions/swap/swapRefToSharedVarLong.kt +++ /dev/null @@ -1,13 +0,0 @@ -//KT-3042 Attempt to split long or double on the stack excepion - -fun box(): String { - var a: Long - a = 12.toLong() - fun f() { - foo(a) - } - - return "OK" -} - -fun foo(l: Long) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/charToInt.kt b/backend.native/tests/external/codegen/box/intrinsics/charToInt.kt deleted file mode 100644 index 371632e071c..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/charToInt.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val x: Any = 'A' - var y = 0 - if (x is Char) { - y = x.toInt() - } - return if (y == 65) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/defaultObjectMapping.kt b/backend.native/tests/external/codegen/box/intrinsics/defaultObjectMapping.kt deleted file mode 100644 index 93684dbed0d..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/defaultObjectMapping.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(java.lang.Integer.MIN_VALUE, Int.MIN_VALUE) - assertEquals(java.lang.Byte.MAX_VALUE, Byte.MAX_VALUE) - -/* -// TODO: uncomment when callable references to object members are supported - assertEquals("MIN_VALUE", (Int.Companion::MIN_VALUE).name) - assertEquals("MAX_VALUE", (Double.Companion::MAX_VALUE).name) - assertEquals("MIN_VALUE", (Float.Companion::MIN_VALUE).name) - assertEquals("MAX_VALUE", (Long.Companion::MAX_VALUE).name) - assertEquals("MIN_VALUE", (Short.Companion::MIN_VALUE).name) - assertEquals("MAX_VALUE", (Byte.Companion::MAX_VALUE).name) -*/ - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/ea35953.kt b/backend.native/tests/external/codegen/box/intrinsics/ea35953.kt deleted file mode 100644 index a1acb1d7481..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/ea35953.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - if (12.toString().equals("13")) { - return "Fail" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/incWithLabel.kt b/backend.native/tests/external/codegen/box/intrinsics/incWithLabel.kt deleted file mode 100644 index fff72ffb135..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/incWithLabel.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - var x = 1 - (foo@ x)++ - ++(foo@ x) - - if (x != 3) return "Fail: $x" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt10131.kt b/backend.native/tests/external/codegen/box/intrinsics/kt10131.kt deleted file mode 100644 index b388bc4fb62..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt10131.kt +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME - -fun box(): String = - listOf('O', 'K').fold("", String::plus) diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt10131a.kt b/backend.native/tests/external/codegen/box/intrinsics/kt10131a.kt deleted file mode 100644 index db05fd54b18..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt10131a.kt +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME - -fun box(): String = - charArrayOf('O', 'K').fold("", String::plus) diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt12125.kt b/backend.native/tests/external/codegen/box/intrinsics/kt12125.kt deleted file mode 100644 index c45ffb3f57c..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt12125.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun test(i: Int): Int { - return i -} - -fun box(): String { - var b = Byte.MAX_VALUE - b++ - var result = test(b.toInt()) - if (result != Byte.MIN_VALUE.toInt()) return "fail 1: $result" - - var s = Short.MIN_VALUE - s-- - result = test(s.toInt()) - if (result != Short.MAX_VALUE.toInt()) return "fail 2: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt12125_2.kt b/backend.native/tests/external/codegen/box/intrinsics/kt12125_2.kt deleted file mode 100644 index c9890efe644..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt12125_2.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun box(): String { - var aByte: Byte? = 0 - var bByte: Byte = 0 - - if (aByte != null) aByte-- - bByte-- - if (aByte != bByte) return "Failed post-decrement Byte: $aByte != $bByte" - - if (aByte != null) aByte++ - bByte++ - if (aByte != bByte) return "Failed post-increment Byte: $aByte != $bByte" - - aByte = null - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc.kt b/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc.kt deleted file mode 100644 index f531e713ef5..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun test(i: Int): Int { - return i -} - -fun box(): String { - var b = Byte.MAX_VALUE - var result = test(b.inc().toInt()) - if (result != Byte.MIN_VALUE.toInt()) return "fail 1: $result" - - var s = Short.MAX_VALUE - result = test(s.inc().toInt()) - if (result != Short.MIN_VALUE.toInt()) return "fail 2: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc_2.kt b/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc_2.kt deleted file mode 100644 index 953ccf8dc76..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt12125_inc_2.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun test(i: Int): Int { - return i -} - -fun box(): String { - var aByte: Byte? = 0 - var bByte: Byte = 0 - - if (aByte != null) { - if (aByte.dec() != bByte.dec()) return "Failed post-decrement Byte: ${aByte.dec()} != ${bByte.dec()}" - } - - if (aByte != null) { - if (aByte.inc() != bByte.inc()) return "Failed post-increment Byte: ${aByte.inc()} != ${bByte.inc()}" - } - - aByte = null - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt5937.kt b/backend.native/tests/external/codegen/box/intrinsics/kt5937.kt deleted file mode 100644 index e83cc48c5c3..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt5937.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var result = "Fail" - -var l = 10L -var d = 10.0 -var i = 10 - -fun foo(): Int { - result = "OK" - return 1 -} - -fun box(): String { - val javaClass = foo().javaClass - if (javaClass != 1.javaClass) return "fail 1" - - val lv = 3L - if (2L.javaClass != lv.javaClass) return "fail 2" - if (2L.javaClass != l.javaClass) return "fail 3" - - val dv = 3.0 - if (2.0.javaClass != dv.javaClass) return "fail 4" - if (2.0.javaClass != d.javaClass) return "fail 5" - - val iv = 3 - if (2.javaClass != iv.javaClass) return "fail 6" - if (2.javaClass != i.javaClass) return "fail 7" - - return result -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/kt8666.kt b/backend.native/tests/external/codegen/box/intrinsics/kt8666.kt deleted file mode 100644 index 835340e3afe..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/kt8666.kt +++ /dev/null @@ -1,18 +0,0 @@ -val MAX_LONG = "9223372036854775807" -val PREFIX = "max = " - -fun box(): String { - if (MAX_LONG != "${Long.MAX_VALUE}") return "fail template" - if (MAX_LONG != "" + Long.MAX_VALUE) return "fail \"\" +" - if (MAX_LONG != "".plus(Long.MAX_VALUE)) return "fail \"\".plus" - if (MAX_LONG != (String::plus)("", Long.MAX_VALUE)) return "fail String::plus" - if (MAX_LONG != (""::plus)(Long.MAX_VALUE)) return "fail \"\"::plus" - - if (PREFIX + MAX_LONG != "max = ${Long.MAX_VALUE}") return "fail template with prefix" - if (PREFIX + MAX_LONG != PREFIX + Long.MAX_VALUE) return "fail \"$PREFIX\" +" - if (PREFIX + MAX_LONG != PREFIX.plus(Long.MAX_VALUE)) return "fail \"$PREFIX\".plus" - if (PREFIX + MAX_LONG != (String::plus)(PREFIX, Long.MAX_VALUE)) return "fail String::plus($PREFIX, ...)" - if (PREFIX + MAX_LONG != (PREFIX::plus)(Long.MAX_VALUE)) return "fail \"$PREFIX\"::plus" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/longRangeWithExplicitDot.kt b/backend.native/tests/external/codegen/box/intrinsics/longRangeWithExplicitDot.kt deleted file mode 100644 index 1ecc929824d..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/longRangeWithExplicitDot.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val l: Long = 1 - val l2: Long = 2 - val r = l.rangeTo(l2) - return if (r.start == l && r.endInclusive == l2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/prefixIncDec.kt b/backend.native/tests/external/codegen/box/intrinsics/prefixIncDec.kt deleted file mode 100644 index 00321feb2f9..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/prefixIncDec.kt +++ /dev/null @@ -1,29 +0,0 @@ -public var inc: Int = 0 - -public var propInc: Int = 0 - get() {++inc; return field} - set(a: Int) { - ++inc - field = a - } - -public var dec: Int = 0 - -public var propDec: Int = 0 - get() { --dec; return field} - set(a: Int) { - --dec - field = a - } - -fun box(): String { - ++propInc - if (inc != 3) return "fail in prefix increment: ${inc} != 3" - if (propInc != 1) return "fail in prefix increment: ${propInc} != 1" - - --propDec - if (dec != -3) return "fail in prefix decrement: ${dec} != -3" - if (propDec != -1) return "fail in prefix decrement: ${propDec} != -1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/rangeFromCollection.kt b/backend.native/tests/external/codegen/box/intrinsics/rangeFromCollection.kt deleted file mode 100644 index 93d22ce72d0..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/rangeFromCollection.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val list = ArrayList() - list.add(1..3) - list[0].start - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/stringFromCollection.kt b/backend.native/tests/external/codegen/box/intrinsics/stringFromCollection.kt deleted file mode 100644 index bd15b7bf3f3..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/stringFromCollection.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val list = ArrayList() - list.add("0") - list[0][0] - list[0].length - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/throwable.kt b/backend.native/tests/external/codegen/box/intrinsics/throwable.kt deleted file mode 100644 index 35f310a3fe8..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/throwable.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - val s: String? = "OK" - val t: Throwable? = Throwable("test", null) - - val z = Throwable(s, t) - if (z.message !== s) return "fail 1: ${z.message}" - if (z.cause !== t) return "fail 2: ${z.cause}" - - val z2 = Throwable(s) - if (z2.message !== s) return "fail 3: ${z2.message}" - if (z2.cause !== null) return "fail 4: ${z2.cause}" - - val z3 = Throwable(t) - if (z3.message != "java.lang.Throwable: test") return "fail 5: ${z3.message}" - if (z3.cause !== t) return "fail 6: ${z2.cause}" - - val z4 = Throwable() - if (z4.message !== null) return "fail 7: ${z4.message}" - if (z4.cause !== null) return "fail 8: ${z4.cause}" - - return z.message!! -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/throwableCallableReference.kt b/backend.native/tests/external/codegen/box/intrinsics/throwableCallableReference.kt deleted file mode 100644 index c21fde159e5..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/throwableCallableReference.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import kotlin.reflect.KFunction2 -import kotlin.reflect.KFunction1 -import kotlin.reflect.KFunction0 - -fun box(): String { - val s: String? = "OK" - val t: Throwable? = Throwable("test", null) - var thr1: KFunction2 = ::Throwable - val z = thr1(s, t) - if (z.message !== s) return "fail 1: ${z.message}" - if (z.cause !== t) return "fail 2: ${z.cause}" - - var thr2: KFunction1 = ::Throwable - - val z2 = thr2(s) - if (z2.message !== s) return "fail 3: ${z2.message}" - if (z2.cause !== null) return "fail 4: ${z2.cause}" - - var thr3: KFunction1 = ::Throwable - val z3 = thr3(t) - if (z3.message != "java.lang.Throwable: test") return "fail 5: ${z3.message}" - if (z3.cause !== t) return "fail 6: ${z2.cause}" - - var thr4: KFunction0 = ::Throwable - val z4 = thr4() - if (z4.message !== null) return "fail 7: ${z4.message}" - if (z4.cause !== null) return "fail 8: ${z4.cause}" - - return z.message!! -} diff --git a/backend.native/tests/external/codegen/box/intrinsics/throwableParamOrder.kt b/backend.native/tests/external/codegen/box/intrinsics/throwableParamOrder.kt deleted file mode 100644 index 7708a6de220..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/throwableParamOrder.kt +++ /dev/null @@ -1,17 +0,0 @@ -var res = "" - -fun getM(): String { - res += "M" - return "OK" -} - -fun getT(): Throwable { - res += "T" - return Throwable("test", null) -} - -fun box(): String { - val z = Throwable(cause = getT(), message = getM()) - if (res != "TM") return "Wrong argument calculation order: $res" - return z.message!! -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/intrinsics/tostring.kt b/backend.native/tests/external/codegen/box/intrinsics/tostring.kt deleted file mode 100644 index 27f9f1a11a0..00000000000 --- a/backend.native/tests/external/codegen/box/intrinsics/tostring.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun box(): String { - if (239.toByte().toString() != (239.toByte() as Byte?).toString()) return "byte failed" - if (239.toShort().toString() != (239.toShort() as Short?).toString()) return "short failed" - if (239.toInt().toString() != (239.toInt() as Int?).toString()) return "int failed" - if (239.toFloat().toString() != (239.toFloat() as Float?).toString()) return "float failed" - if (239.toLong().toString() != (239.toLong() as Long?).toString()) return "long failed" - if (239.toDouble().toString() != (239.toDouble() as Double?).toString()) return "double failed" - if (true.toString() != (true as Boolean?).toString()) return "boolean failed" - if ('a'.toChar().toString() != ('a'.toChar() as Char?).toString()) return "char failed" - - if ("${239.toByte()}" != (239.toByte() as Byte?).toString()) return "byte template failed" - if ("${239.toShort()}" != (239.toShort() as Short?).toString()) return "short template failed" - if ("${239.toInt()}" != (239.toInt() as Int?).toString()) return "int template failed" - if ("${239.toFloat()}" != (239.toFloat() as Float?).toString()) return "float template failed" - if ("${239.toLong()}" != (239.toLong() as Long?).toString()) return "long template failed" - if ("${239.toDouble()}" != (239.toDouble() as Double?).toString()) return "double template failed" - if ("${true}" != (true as Boolean?).toString()) return "boolean template failed" - if ("${'a'.toChar()}" != ('a'.toChar() as Char?).toString()) return "char template failed" - - for(b in 0..255) { - if("${b.toByte()}" != (b.toByte() as Byte?).toString()) return "byte conversion failed" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/generics/allWildcardsOnClass.kt b/backend.native/tests/external/codegen/box/javaInterop/generics/allWildcardsOnClass.kt deleted file mode 100644 index 5cba4e58400..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/generics/allWildcardsOnClass.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaClass.java - -public class JavaClass { - - public static class C extends B { - public OutPair foo() { - return super.foo(); - } - - public In bar() { - return super.bar(); - } - } - - public static String test() { - A a = new C(); - - if (!a.foo().getX().equals("OK")) return "fail 1"; - if (!a.foo().getY().equals(123)) return "fail 2"; - - if (!a.bar().make("123").equals("123")) return "fail 3"; - - return "OK"; - } -} - -// FILE: main.kt - -class OutPair(val x: X, val y: Y) -class In { - fun make(x: Z): String = x.toString() -} - -@JvmSuppressWildcards(suppress = false) -interface A { - fun foo(): OutPair - fun bar(): In -} - -abstract class B : A { - override fun foo(): OutPair = OutPair("OK", 123) - override fun bar(): In = In() -} - -fun box(): String { - return JavaClass.test(); -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt b/backend.native/tests/external/codegen/box/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt deleted file mode 100644 index fb068efe1dc..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaClass.java - -public class JavaClass { - - public static class C extends B { - public OutPair foo() { - return super.foo(); - } - - public In bar() { - return super.bar(); - } - } - - public static String test() { - A a = new C(); - - if (!a.foo().getX().equals("OK")) return "fail 1"; - if (!a.foo().getY().equals(123)) return "fail 2"; - - if (!a.bar().make("123").equals("123")) return "fail 3"; - - return "OK"; - } -} - -// FILE: main.kt - -class OutPair(val x: X, val y: Y) -class In { - fun make(x: Z): String = x.toString() -} - -interface A { - fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number> - fun bar(): In<@JvmWildcard String> -} - -abstract class B : A { - override fun foo(): OutPair = OutPair("OK", 123) - override fun bar(): In = In() -} - -fun box(): String { - return JavaClass.test(); -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/generics/invariantArgumentsNoWildcard.kt b/backend.native/tests/external/codegen/box/javaInterop/generics/invariantArgumentsNoWildcard.kt deleted file mode 100644 index 56b2c68c129..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/generics/invariantArgumentsNoWildcard.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - public static String test() { - return MainKt.bar(MainKt.foo()); - } -} - -// FILE: main.kt - -class Pair(val x: X, val y: Y) - -class Inv(val x: T) - -fun foo(): Inv> = Inv(Pair("O", "K")) - -fun bar(inv: Inv>) = inv.x.x.toString() + inv.x.y - -fun box(): String { - return JavaClass.test(); -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/lambdaInstanceOf.kt b/backend.native/tests/external/codegen/box/javaInterop/lambdaInstanceOf.kt deleted file mode 100644 index 8c3764889d3..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/lambdaInstanceOf.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: J.java - -import kotlin.Function; -import kotlin.jvm.functions.Function0; -import kotlin.jvm.functions.Function1; -import kotlin.jvm.functions.Function2; - -public class J { - public static String test(Function x) { - if (x instanceof Function1) return "Fail 1"; - if (x instanceof Function2) return "Fail 2"; - if (!(x instanceof Function0)) return "Fail 3"; - - return ((Function0) x).invoke(); - } -} - -// FILE: K.kt - -fun box(): String { - return J.test({ "OK" }) -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt deleted file mode 100644 index 52032e8f491..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -var component1Evaluated = false - -// NB extension receiver is nullable -operator fun J?.component1() = 1.also { component1Evaluated = true } - -private operator fun J.component2() = 2 - -fun use(x: Any) {} - -fun box(): String { - assertFailsWith { - val (a, b) = J.j() - } - if (!component1Evaluated) return "component1 should be evaluated" - return "OK" -} - - -// FILE: J.java -public class J { - public static J j() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBody.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBody.kt deleted file mode 100644 index f7b2c2654df..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBody.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -fun withAssertion(j: J) = j.nullString() - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } - - public void test() { - TestKt.withAssertion(this); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBodyWithJavaGeneric.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBodyWithJavaGeneric.kt deleted file mode 100644 index 74e2c3a70bf..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBodyWithJavaGeneric.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// See KT-8135 -// We could generate runtime assertion on call site for 'generic()' below. - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "OK" - } - catch (e: Throwable) { - return "Fail: SHOULD NOT throw" - } -} - -// FILE: test.kt -fun withAssertion(j: J) = generic(j) - -fun generic(j: J) = j.nullT() - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull T nullT() { - return null; - } - - public void test() { - TestKt.withAssertion(this); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalFunctionWithExpressionBody.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalFunctionWithExpressionBody.kt deleted file mode 100644 index 29dc4850156..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalFunctionWithExpressionBody.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - outer() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -fun outer() { - fun withAssertion() = J().nullString() - withAssertion() // NB not used itself -} - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalVariableInitializer.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalVariableInitializer.kt deleted file mode 100644 index 6c2df07de45..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalVariableInitializer.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -fun withAssertion(j: J) { - val x = j.nullString() -} - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } - - public void test() { - TestKt.withAssertion(this); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inMemberPropertyInitializer.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inMemberPropertyInitializer.kt deleted file mode 100644 index 38c8d587615..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inMemberPropertyInitializer.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -class C { - val withAssertion = J().nullString() -} - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } - - public Object test() { - return new C(); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inPropertyGetterWithExpressionBody.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inPropertyGetterWithExpressionBody.kt deleted file mode 100644 index 84f13f3a8c0..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inPropertyGetterWithExpressionBody.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -val withAssertion get() = J().nullString() - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } - - public void test() { - TestKt.getWithAssertion(); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inTopLevelPropertyInitializer.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inTopLevelPropertyInitializer.kt deleted file mode 100644 index 5d2e21b1d53..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inTopLevelPropertyInitializer.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM -// STRICT_JAVA_NULLABILITY_ASSERTIONS - -// FILE: box.kt -fun box(): String { - try { - J().test() - return "Fail: should throw" - } - catch (e: Throwable) { - return "OK" - } -} - -// FILE: test.kt -val withAssertion = J().nullString() - -fun clinitTrigger() {} - -// FILE: J.java -import org.jetbrains.annotations.NotNull; - -public class J { - public @NotNull String nullString() { - return null; - } - - public void test() { - TestKt.clinitTrigger(); - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt deleted file mode 100644 index 344982316f4..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -public class Test { - public static String invokeFoo() { - try { - ExtensionKt.foo(null); - } - catch (IllegalArgumentException e) { - try { - ExtensionKt.getBar(null); - } - catch (IllegalArgumentException f) { - return "OK"; - } - } - - return "Fail: assertion must have been fired"; - } -} - -// FILE: extension.kt - -fun Any.foo() { } - -val Any.bar: String get() = "" - -fun box(): String { - return Test.invokeFoo() -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt deleted file mode 100644 index e14e5e764e4..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: test.kt -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.1 -private operator fun A.inc() = A() - -fun box(): String { - var aNull = A.n() - aNull++ - // NB no exception is thrown in language version 1.1 - return "OK" -} - -// FILE: A.java -public class A { - public static A n() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt deleted file mode 100644 index 2e09a3d9192..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: test.kt -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -private operator fun A.inc() = A() - -fun box(): String { - assertFailsWith { - var aNull = A.n() - aNull++ - } - - return "OK" -} - -// FILE: A.java -public class A { - public static A n() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt deleted file mode 100644 index 8c1121f7777..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: test.kt -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.1 -import kotlin.test.* - -operator fun A.inc() = A() - -fun box(): String { - assertFailsWith { - var aNull = A.n() - aNull++ - } - - return "OK" -} - -// FILE: A.java -public class A { - public static A n() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv12.kt deleted file mode 100644 index 330281df860..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv12.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: test.kt -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -operator fun A.inc() = A() - -fun box(): String { - assertFailsWith { - var aNull = A.n() - aNull++ - } - - return "OK" -} - -// FILE: A.java -public class A { - public static A n() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/mapPut.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/mapPut.kt deleted file mode 100644 index c39287e7d2b..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/mapPut.kt +++ /dev/null @@ -1,10 +0,0 @@ - -fun foo(k: K, v: V) { - val map = HashMap() - val old = map.put(k, v) -} - -fun box(): String { - foo("", "") - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt deleted file mode 100644 index 70e926c8b18..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.1 -import kotlin.test.* - -fun String.extension() {} - -fun box(): String { - assertFailsWith { J.s().extension() } - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv12.kt deleted file mode 100644 index ece06c560ae..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv12.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -fun String.extension() {} - -fun box(): String { - assertFailsWith { J.s().extension() } - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt deleted file mode 100644 index 4547e585579..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.1 -import kotlin.test.* - -inline fun String.extension() {} - -fun box(): String { - J.s().extension() // NB no exception thrown - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt deleted file mode 100644 index 768e5c56e14..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -inline fun String.extension() {} - -fun box(): String { - assertFailsWith { - J.s().extension() - } - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver_lv12.kt deleted file mode 100644 index 816f669d74d..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver_lv12.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -class C { - fun test() { J.s().memberExtension() } - fun String.memberExtension() {} -} - -fun box(): String { - assertFailsWith { C().test() } - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt b/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt deleted file mode 100644 index 5be1b082389..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -// LANGUAGE_VERSION: 1.2 -import kotlin.test.* - -class C { - fun test() { J.s().memberExtension() } - private fun String.memberExtension() {} -} - -fun box(): String { - assertFailsWith { - C().test() - } - return "OK" -} - -// FILE: J.java -public class J { - public static String s() { return null; } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt deleted file mode 100644 index 6780c6842f8..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -data class A(var x: Int) : Cloneable { - public override fun clone(): A = A(x) -} - -fun box(): String { - val a = A(42) - val b = a.clone() - if (b != a) return "Fail equals" - if (b === a) return "Fail identity" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt deleted file mode 100644 index 1c2faac7156..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -data class A(var x: Int) : Cloneable { - public override fun clone(): A = super.clone() as A -} - -fun box(): String { - val a = A(42) - val b = a.clone() - if (a != b) return "Fail equals" - if (a === b) return "Fail identity" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt deleted file mode 100644 index 5671e47cb2b..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -data class A(var x: Int) : Cloneable { - public override fun clone(): A { - val result = super.clone() as A - result.x = 239 - return result - } -} - -fun box(): String { - val a = A(42) - val b = a.clone() - if (a == b) return "Fail: $a == $b" - if (a === b) return "Fail: $a === $b" - if (b.x != 239) return "Fail: b.x = ${b.x}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHashSet.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHashSet.kt deleted file mode 100644 index 2ec3c2d0538..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHashSet.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TARGET_BACKEND: JVM - -fun box(): String { - val a = HashSet() - a.add("live") - a.add("long") - a.add("prosper") - val b = a.clone() - if (a != b) return "Fail equals" - if (a === b) return "Fail identity" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHierarchy.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHierarchy.kt deleted file mode 100644 index 123e036c5cf..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneHierarchy.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TARGET_BACKEND: JVM - -open class A : Cloneable { - public override fun clone(): A = super.clone() as A -} - -open class B(var s: String) : A() { - override fun clone(): B = super.clone() as B -} - -open class C(s: String, var l: ArrayList): B(s) { - override fun clone(): C { - val result = super.clone() as C - result.l = l.clone() as ArrayList - return result - } -} - -fun box(): String { - val l = ArrayList() - l.add(true) - - val c = C("OK", l) - val d = c.clone() - - if (c.s != d.s) return "Fail s: ${d.s}" - if (c.l != d.l) return "Fail l: ${d.l}" - if (c.l === d.l) return "Fail list identity" - if (c === d) return "Fail identity" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt b/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt deleted file mode 100644 index f15c2078344..00000000000 --- a/backend.native/tests/external/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -data class A(val s: String) : Cloneable { - fun externalClone(): A = clone() as A -} - -fun box(): String { - val a = A("OK") - val b = a.externalClone() - if (a != b) return "Fail equals" - if (a === b) return "Fail identity" - return b.s -} diff --git a/backend.native/tests/external/codegen/box/jdk/arrayList.kt b/backend.native/tests/external/codegen/box/jdk/arrayList.kt deleted file mode 100644 index 54a5b35886e..00000000000 --- a/backend.native/tests/external/codegen/box/jdk/arrayList.kt +++ /dev/null @@ -1,12 +0,0 @@ - -fun box(): String { - val a = ArrayList() - a.add(74) - a.add(75) - val i: Int = a.get(0) - val j: Int = a.get(1) - if (i != 74) return "fail 1" - if (j != 75) return "fail 2" - if (a.size != 2) return "epic fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jdk/hashMap.kt b/backend.native/tests/external/codegen/box/jdk/hashMap.kt deleted file mode 100644 index 3574e445e4c..00000000000 --- a/backend.native/tests/external/codegen/box/jdk/hashMap.kt +++ /dev/null @@ -1,14 +0,0 @@ - -fun box(): String { - val map: MutableMap = HashMap() - map.put("a", 1) - map.put("bb", 2) - map.put("ccc", 3) - map.put("dddd", 4) - if (map.get("a") != 1) return "fail 1" - if (map.size != 4) return "fail 2" - if (map.get("eeeee") != null) return "fail 3" - if (!map.containsKey("bb")) return "fail 4" - if (map.keys.contains("ffffff")) return "fail 5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jdk/iteratingOverHashMap.kt b/backend.native/tests/external/codegen/box/jdk/iteratingOverHashMap.kt deleted file mode 100644 index c53bd2d9b6f..00000000000 --- a/backend.native/tests/external/codegen/box/jdk/iteratingOverHashMap.kt +++ /dev/null @@ -1,24 +0,0 @@ - -fun box() : String { - if (!testIteratingOverMap1()) return "fail 1" - if (!testIteratingOverMap2()) return "fail 2" - return "OK" -} - -fun testIteratingOverMap1() : Boolean { - val map = HashMap() - map.put("a", 1) - for (entry in map.entries) { - entry.setValue(2) - } - return map.get("a") == 2 -} - -fun testIteratingOverMap2() : Boolean { - val map : MutableMap = HashMap() - map.put("a", 1) - for (entry in map.entries) { - entry.setValue(2) - } - return map.get("a") == 2 -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/jdk/kt1397.kt b/backend.native/tests/external/codegen/box/jdk/kt1397.kt deleted file mode 100644 index a18209a99c3..00000000000 --- a/backend.native/tests/external/codegen/box/jdk/kt1397.kt +++ /dev/null @@ -1,12 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -class IntArrayList(): ArrayList() { - override fun get(index: Int): Int = super.get(index) -} - -fun box(): String { - val a = IntArrayList() - a.add(1) - a[0]++ - return if (a[0] == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmField/captureClassFields.kt b/backend.native/tests/external/codegen/box/jvmField/captureClassFields.kt deleted file mode 100644 index be741722d3c..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/captureClassFields.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -open class A { - @JvmField public val publicField = "1"; - @JvmField internal val internalField = "2"; - @JvmField protected val protectedField = "34"; - - fun test(): String { - return { - publicField + internalField + protectedField - }() - } -} - - -fun box(): String { - return if (A().test() == "1234") return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmField/capturePackageFields.kt b/backend.native/tests/external/codegen/box/jvmField/capturePackageFields.kt deleted file mode 100644 index 17d926d01f8..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/capturePackageFields.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@JvmField public val publicField = "1"; -@JvmField internal val internalField = "23"; - -fun test(): String { - return { - publicField + internalField - }() -} - - -fun box(): String { - return if (test() == "123") return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmField/checkNoAccessors.kt b/backend.native/tests/external/codegen/box/jvmField/checkNoAccessors.kt deleted file mode 100644 index c171a31d0b4..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/checkNoAccessors.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertFalse - -@JvmField public val field = "OK"; - -class A { - @JvmField public val field = "OK"; - - companion object { - @JvmField public val cfield = "OK"; - } -} - -object Object { - @JvmField public val field = "OK"; -} - - -fun box(): String { - var result = A().field - - checkNoAccessors(A::class.java) - checkNoAccessors(A.Companion::class.java) - checkNoAccessors(Object::class.java) - checkNoAccessors(Class.forName("CheckNoAccessorsKt")) - - return "OK" -} - -public fun checkNoAccessors(clazz: Class<*>) { - clazz.declaredMethods.forEach { - assertFalse(it.name.startsWith("get") || it.name.startsWith("set"), - "Class ${clazz.name} has accessor '${it.name}'" - ) - } -} diff --git a/backend.native/tests/external/codegen/box/jvmField/classFieldReference.kt b/backend.native/tests/external/codegen/box/jvmField/classFieldReference.kt deleted file mode 100644 index 9a988fb6917..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/classFieldReference.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package zzz -import java.lang.reflect.Field -import kotlin.reflect.KProperty1 -import kotlin.test.assertEquals - -class A(val s1: String, val s2: String) { - @JvmField public val publicField = s1; - @JvmField internal val internalField = s2; - - fun testAccessors() { - checkAccessor(A::publicField, s1, this) - checkAccessor(A::internalField, s2, this) - } -} - - -/* -// TODO: uncomment when callable references to object members are supported -class AWithCompanion { - companion object { - @JvmField public val publicField = "1"; - @JvmField internal val internalField = "2"; - - fun testAccessors() { - checkAccessor(AWithCompanion.Companion::publicField, "1", AWithCompanion.Companion) - checkAccessor(AWithCompanion.Companion::internalField, "2", AWithCompanion.Companion) - } - } -} -*/ - -fun box(): String { - A("1", "2").testAccessors() - // AWithCompanion.testAccessors() - return "OK" -} - -public fun checkAccessor(prop: KProperty1, value: R, receiver: T) { - assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") -} diff --git a/backend.native/tests/external/codegen/box/jvmField/classFieldReflection.kt b/backend.native/tests/external/codegen/box/jvmField/classFieldReflection.kt deleted file mode 100644 index 40afbaf376d..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/classFieldReflection.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package zzz -import java.lang.reflect.Field -import kotlin.reflect.KProperty1 -import kotlin.test.assertEquals - - -import kotlin.reflect.KMutableProperty1 -import kotlin.test.assertEquals - -class A(val s1: String, val s2: String) { - @JvmField public var publicField = s1; - @JvmField internal var internalField = s2; - - fun testAccessors() { - checkAccessor(A::class.members.firstOrNull { it.name == "publicField" } as KMutableProperty1, s1, "3", this) - checkAccessor(A::class.members.firstOrNull { it.name == "internalField" } as KMutableProperty1, s2, "4", this) - } -} - - -class AWithCompanion { - companion object { - @JvmField public var publicField = "1"; - @JvmField internal var internalField = "2"; - - fun testAccessors() { - checkAccessor(AWithCompanion.Companion::class.members.firstOrNull { it.name == "publicField" } as KMutableProperty1, "1", "3", AWithCompanion.Companion) - checkAccessor(AWithCompanion.Companion::class.members.firstOrNull { it.name == "internalField" } as KMutableProperty1, "2", "4", AWithCompanion.Companion) - } - } -} - -fun box(): String { - A("1", "2").testAccessors() - AWithCompanion.testAccessors() - return "OK" -} - -public fun checkAccessor(prop: KMutableProperty1, value: R, newValue: R, receiver: T) { - assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") - prop.set(receiver, newValue) - assertEquals(prop.get(receiver), newValue, "Property ${prop} has wrong value") -} diff --git a/backend.native/tests/external/codegen/box/jvmField/constructorProperty.kt b/backend.native/tests/external/codegen/box/jvmField/constructorProperty.kt deleted file mode 100644 index 66d5f918c98..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/constructorProperty.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -public class Test { - public static String invokeMethodWithPublicField() { - C c = new C("OK"); - return c.foo; - } -} - -// FILE: simple.kt - -class C(@JvmField val foo: String) { - -} - -fun box(): String { - return Test.invokeMethodWithPublicField() -} diff --git a/backend.native/tests/external/codegen/box/jvmField/publicField.kt b/backend.native/tests/external/codegen/box/jvmField/publicField.kt deleted file mode 100644 index ae82c73bf6c..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/publicField.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class A { - @JvmField public val field = "OK"; - - companion object { - @JvmField public val cfield = "OK"; - } -} - -object Object { - @JvmField public val field = "OK"; -} - - -fun box(): String { - var result = A().field - - if (result != "OK") return "fail 1: $result" - if (A.cfield != "OK") return "fail 2: ${A.cfield}" - if (Object.field != "OK") return "fail 3: ${Object.field}" - - return "OK" - -} diff --git a/backend.native/tests/external/codegen/box/jvmField/simpleMemberProperty.kt b/backend.native/tests/external/codegen/box/jvmField/simpleMemberProperty.kt deleted file mode 100644 index 1adf5cf3d1e..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/simpleMemberProperty.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -public class Test { - public static String invokeMethodWithPublicField() { - C c = new C(); - return c.foo; - } -} - -// FILE: simple.kt - -class C { - @JvmField public val foo: String = "OK" -} - -fun box(): String { - return Test.invokeMethodWithPublicField() -} diff --git a/backend.native/tests/external/codegen/box/jvmField/superCall.kt b/backend.native/tests/external/codegen/box/jvmField/superCall.kt deleted file mode 100644 index e40059bd228..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/superCall.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -open class A { - @JvmField public val publicField = "1"; - @JvmField internal val internalField = "2"; - @JvmField protected val protectedfield = "3"; -} - - -class B : A() { - fun test(): String { - return super.publicField + super.internalField + super.protectedfield - } -} - - -fun box(): String { - return if (B().test() == "123") return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmField/superCall2.kt b/backend.native/tests/external/codegen/box/jvmField/superCall2.kt deleted file mode 100644 index 184cd974061..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/superCall2.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -open class A { - @JvmField public val publicField = "1"; - @JvmField internal val internalField = "2"; - @JvmField protected val protectedfield = "3"; -} - -open class B : A() { - -} - -open class C : B() { - fun test(): String { - return super.publicField + super.internalField + super.protectedfield - } -} - - -fun box(): String { - return if (C().test() == "123") return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReference.kt b/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReference.kt deleted file mode 100644 index 2977f5ec59f..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReference.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package zzz -import java.lang.reflect.Field -import kotlin.test.assertEquals -import kotlin.reflect.KProperty0 - -@JvmField public val publicField = "1"; -@JvmField internal val internalField = "2"; - -fun testAccessors() { - val kProperty: KProperty0 = ::publicField - checkAccessor(kProperty, "1") - checkAccessor(::internalField, "2") -} - - -fun box(): String { - testAccessors() - return "OK" -} - -public fun checkAccessor(prop: KProperty0, value: R) { - assertEquals(prop.get(), value, "Property ${prop} has wrong value") -} diff --git a/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReflection.kt b/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReflection.kt deleted file mode 100644 index c6edb440ee0..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/topLevelFieldReflection.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -import kotlin.reflect.KMutableProperty0 -import kotlin.reflect.jvm.kotlinProperty -import kotlin.test.assertEquals - -public var publicField = "1" -internal var internalField = "2" - -fun testAccessors() { - val packageClass = Class.forName("test.TopLevelFieldReflectionKt") - packageClass.getDeclaredField("publicField").kotlinProperty - checkAccessor(packageClass.getDeclaredField("publicField").kotlinProperty as KMutableProperty0, "1", "3") - checkAccessor(packageClass.getDeclaredField("internalField").kotlinProperty as KMutableProperty0, "2", "4") -} - - -fun box(): String { - testAccessors() - return "OK" -} - -public fun < R> checkAccessor(prop: KMutableProperty0, value: R, newValue: R) { - assertEquals(prop.get(), value, "Property ${prop} has wrong value") - prop.set(newValue) - assertEquals(prop.get(), newValue, "Property ${prop} has wrong value") -} diff --git a/backend.native/tests/external/codegen/box/jvmField/visibility.kt b/backend.native/tests/external/codegen/box/jvmField/visibility.kt deleted file mode 100644 index 7313703b023..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/visibility.kt +++ /dev/null @@ -1,71 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.Field -import kotlin.reflect.jvm.javaField -import kotlin.reflect.KProperty -import kotlin.test.assertNotEquals -import java.lang.reflect.Modifier - -@JvmField public val publicField = "OK"; -@JvmField internal val internalField = "OK"; - -fun testVisibilities() { - checkVisibility(::publicField.javaField!!, Modifier.PUBLIC) - checkVisibility(::internalField.javaField!!, Modifier.PUBLIC) -} - -class A { - @JvmField public val publicField = "OK"; - @JvmField internal val internalField = "OK"; - @JvmField protected val protectedfield = "OK"; - - fun testVisibilities() { - checkVisibility(A::publicField.javaField!!, Modifier.PUBLIC) - checkVisibility(A::internalField.javaField!!, Modifier.PUBLIC) - checkVisibility(A::protectedfield.javaField!!, Modifier.PROTECTED) - } -} - - -class AWithCompanion { - companion object { - @JvmField public val publicField = "OK"; - @JvmField internal val internalField = "OK"; - @JvmField protected val protectedfield = "OK"; - - operator fun get(name: String) = AWithCompanion.Companion::class.members.single { it.name == name } as KProperty<*> - - fun testVisibilities() { - checkVisibility(this["publicField"].javaField!!, Modifier.PUBLIC) - checkVisibility(this["internalField"].javaField!!, Modifier.PUBLIC) - checkVisibility(this["protectedfield"].javaField!!, Modifier.PROTECTED) - } - } -} - -object Object { - @JvmField public val publicField = "OK"; - @JvmField internal val internalField = "OK"; - - operator fun get(name: String) = Object::class.members.single { it.name == name } as KProperty<*> - - fun testVisibilities() { - checkVisibility(this["publicField"].javaField!!, Modifier.PUBLIC) - checkVisibility(this["internalField"].javaField!!, Modifier.PUBLIC) - } -} - -fun box(): String { - A().testVisibilities() - AWithCompanion.testVisibilities() - Object.testVisibilities() - return "OK" -} - -public fun checkVisibility(field: Field, visibility: Int) { - assertNotEquals(field.modifiers and visibility, 0, "Field ${field} has wrong visibility") -} diff --git a/backend.native/tests/external/codegen/box/jvmField/writeFieldReference.kt b/backend.native/tests/external/codegen/box/jvmField/writeFieldReference.kt deleted file mode 100644 index 651cccee665..00000000000 --- a/backend.native/tests/external/codegen/box/jvmField/writeFieldReference.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package zzz -import kotlin.reflect.KMutableProperty1 -import kotlin.test.assertEquals - -class A(val s1: String, val s2: String) { - @JvmField public var publicField = s1; - @JvmField internal var internalField = s2; - - fun testAccessors() { - val kMutableProperty: KMutableProperty1 = A::publicField - checkAccessor(kMutableProperty, s1, "3", this) - checkAccessor(A::internalField, s2, "4", this) - } -} - -fun box(): String { - A("1", "2").testAccessors() - return "OK" -} - -public fun checkAccessor(prop: KMutableProperty1, value: R, newValue: R, receiver: T) { - assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") - prop.set(receiver, newValue) - assertEquals(prop.get(receiver), newValue, "Property ${prop} has wrong value") -} diff --git a/backend.native/tests/external/codegen/box/jvmName/callableReference.kt b/backend.native/tests/external/codegen/box/jvmName/callableReference.kt deleted file mode 100644 index c53653a6686..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/callableReference.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@JvmName("bar") -fun foo() = "foo" - -fun box(): String { - val f = (::foo)() - if (f != "foo") return "Fail: $f" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/clashingErasure.kt b/backend.native/tests/external/codegen/box/jvmName/clashingErasure.kt deleted file mode 100644 index 7605893e6b3..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/clashingErasure.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun List.foo() = "foo" - -@JvmName("fooInt") -fun List.foo() = "fooInt" - -fun box(): String { - val strings = listOf("", "").foo() - if (strings != "foo") return "Fail: $strings" - - val ints = listOf(1, 2).foo() - if (ints != "fooInt") return "Fail: $ints" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/classMembers.kt b/backend.native/tests/external/codegen/box/jvmName/classMembers.kt deleted file mode 100644 index 924e913db4b..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/classMembers.kt +++ /dev/null @@ -1,121 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// See: -// http://kotlinlang.org/docs/reference/java-interop.html#handling-signature-clashes-with-platformname -// https://youtrack.jetbrains.com/issue/KT-5524 - -val strs = listOf("abc", "def") -val ints = listOf(1, 2, 3) - -class C { - // Instance methods - - @JvmName("instMethodStr") - fun instMethod(list: List): String = "instMethodStr" - - @JvmName("instMethodInt") - fun instMethod(list: List): String = "instMethodInt" - - // Properties - - var rwProperty: Int - @JvmName("get_rwProperty") - get() = 123 - @JvmName("set_rwProperty") - set(v) {} - - var rwValue = 111 - - fun getRwProperty(): Int = rwValue - - fun setRwProperty(v: Int) { - rwValue = v - } - - // Extension methods - - class Inner - - @JvmName("extMethodWithGenericParamStr") - fun Inner.extMethodWithGenericParam(list: List): String = "extMethodWithGenericParamStr" - - @JvmName("extMethodWithGenericParamInt") - fun Inner.extMethodWithGenericParam(list: List): String = "extMethodWithGenericParamInt" - - // This is already covered by extMethodWithGenericParam(), but might be relevant for a platform - // with extension method code generation strategy different from Java 6. - - @JvmName("extMethodWithGenericReceiverStr") - fun List.extMethodWithGenericReceiver(): String = "extMethodWithGenericReceiverStr" - - @JvmName("extMethodWithGenericReceiverInt") - fun List.extMethodWithGenericReceiver(): String = "extMethodWithGenericReceiverInt" - - // Extension method vs instance method - - @JvmName("ambigMethod1") - fun ambigMethod(str: String): String = "ambigMethod1" - - @JvmName("ambigMethod2") - fun String.ambigMethod(): String = "ambigMethod2" - -} - -fun box(): String { - val c = C() - - // Instance methods: - // method signatures with erased types SHOULD NOT clash - - val test1 = c.instMethod(strs) - if (test1 != "instMethodStr") return "Fail: c.instMethod(strs)==$test1" - - val test2 = c.instMethod(ints) - if (test2 != "instMethodInt") return "Fail: c.instMethod(ints)==$test2" - - // Properties: - // property accessors SHOULD NOT clash with class methods - - val test3 = c.rwProperty - if (test3 != 123) return "Fail: c.rwProperty==$test3" - - val test3a = c.getRwProperty() - if (test3a != 111) return "Fail: c.getRwProperty()==$test3a" - - c.setRwProperty(444) - val test3b = c.rwProperty - if (test3b != 123) return "Fail: c.rwProperty==$test3b after c.setRwProperty(1234)" - val test3c = c.getRwProperty() - if (test3c != 444) return "Fail: c.getRwProperty()==$test3c after c.setRwProperty(1234)" - - // Extension methods: - // method signatures with erased types SHOULD NOT clash - - val test4 = with(c) { C.Inner().extMethodWithGenericParam(strs) } - if (test4 != "extMethodWithGenericParamStr") return "Fail: with(c) { C.Inner().extMethodWithGenericParam(strs) }==$test4" - - val test5 = with(c) { C.Inner().extMethodWithGenericParam(ints) } - if (test5 != "extMethodWithGenericParamInt") return "Fail: with(c) { C.Inner().extMethodWithGenericParam(ints) }==$test5" - - val test6 = with(c) { strs.extMethodWithGenericReceiver() } - if (test6 != "extMethodWithGenericReceiverStr") return "Fail: with(c) { strs.extMethodWithGenericReceiver() }==$test6" - - val test7 = with(c) { ints.extMethodWithGenericReceiver() } - if (test7 != "extMethodWithGenericReceiverInt") return "Fail: with(c) { ints.extMethodWithGenericReceiver() }==$test7" - - // Extension method SHOULD NOT clash with instance method with the same Java signature. - - val str = "abc" - - val test8 = with(c) { ambigMethod(str) } - if (test8 != "ambigMethod1") return "Fail: with(c) { ambigMethod(str) }==$test8" - - val test9 = with(c) { str.ambigMethod() } - if (test9 != "ambigMethod2") return "Fail: with(c) { str.ambigMethod() }==$test9" - - // Everything is fine. - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/fakeJvmNameInJava.kt b/backend.native/tests/external/codegen/box/jvmName/fakeJvmNameInJava.kt deleted file mode 100644 index cb01a158914..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/fakeJvmNameInJava.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: FakePlatformName.java - -import kotlin.jvm.JvmName; - -public class FakePlatformName { - @JvmName(name = "fake") - public String foo() { - return "foo"; - } - - public String fake() { - return "fake"; - } -} - -// FILE: FakePlatformName.kt - -fun box(): String { - val test1 = FakePlatformName().foo() - if (test1 != "foo") return "Failed: FakePlatformName().foo()==$test1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/fileFacades/differentFiles.kt b/backend.native/tests/external/codegen/box/jvmName/fileFacades/differentFiles.kt deleted file mode 100644 index 2c8052a7515..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/fileFacades/differentFiles.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Baz.java - -public class Baz { - public static String baz() { - return Foo.foo() + Bar.bar(); - } -} - -// FILE: bar.kt - -@file:JvmName("Bar") -public fun bar(): String = "K" - -// FILE: foo.kt - -@file:JvmName("Foo") -public fun foo(): String = "O" - -// FILE: test.kt - -fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt b/backend.native/tests/external/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt deleted file mode 100644 index 1129e381e0c..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: StringHolder.java - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface StringHolder { - public String value(); -} - -// FILE: fileFacade.kt - -@file:StringHolder("OK") - -fun box(): String = - Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null" diff --git a/backend.native/tests/external/codegen/box/jvmName/fileFacades/simple.kt b/backend.native/tests/external/codegen/box/jvmName/fileFacades/simple.kt deleted file mode 100644 index b13c563bb7e..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/fileFacades/simple.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Bar.java - -public class Bar { - public static String bar() { - return Foo.foo(); - } -} - -// FILE: foo.kt - -@file:JvmName("Foo") -public fun foo(): String = "OK" - -// FILE: simple.kt - -fun box(): String = Bar.bar() diff --git a/backend.native/tests/external/codegen/box/jvmName/functionName.kt b/backend.native/tests/external/codegen/box/jvmName/functionName.kt deleted file mode 100644 index 931c86664a2..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/functionName.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@JvmName("bar") -fun foo() = "foo" - -fun box(): String { - val f = foo() - if (f != "foo") return "Fail: $f" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/multifileClass.kt b/backend.native/tests/external/codegen/box/jvmName/multifileClass.kt deleted file mode 100644 index 166e221662c..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/multifileClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:JvmName("Test") -@file:JvmMultifileClass -package test - -fun foo(): String = bar() -fun bar(): String = qux() -fun qux(): String = "OK" - -fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalClass.kt b/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalClass.kt deleted file mode 100644 index bab369e1ca6..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalClass.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:JvmName("Test") -@file:JvmMultifileClass -package test - -fun foo(): String = bar() -fun bar(): String { - class Local(val x: String) - return Local("OK").x -} - -fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalGeneric.kt b/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalGeneric.kt deleted file mode 100644 index 1bed0ec5cc0..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/multifileClassWithLocalGeneric.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:JvmName("Test") -@file:JvmMultifileClass -package test - -fun foo(): String = bar() -fun bar(): String { - open class LocalGeneric(val x: T) - class Derived(x: String) : LocalGeneric(x) - fun LocalGeneric.extFun() = this - fun localFun(x: LocalGeneric) = x - class Local3 { - fun method(x: LocalGeneric) = x.x - } - return Local3().method(localFun(Derived("OK")).extFun()) -} - -fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/box/jvmName/propertyAccessorsUseSite.kt b/backend.native/tests/external/codegen/box/jvmName/propertyAccessorsUseSite.kt deleted file mode 100644 index 18f7752943b..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/propertyAccessorsUseSite.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -class TestIt { - @get:JvmName("getIsFries") - @set:JvmName("setIsFries") - var isFries: Boolean = true - - @get:JvmName("getIsUpdateable") - @set:JvmName("setIsUpdateable") - var isUpdateable: Boolean by Delegate -} - -object Delegate { - operator fun getValue(thiz: Any?, metadata: Any?) = true - operator fun setValue(thiz: Any?, metadata: Any?, value: Boolean) {} -} - -fun box(): String { - assertEquals( - listOf("getIsFries", "getIsUpdateable", "setIsFries", "setIsUpdateable"), - TestIt::class.java.declaredMethods.map { it.name }.sorted() - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/propertyName.kt b/backend.native/tests/external/codegen/box/jvmName/propertyName.kt deleted file mode 100644 index a0285a5ac09..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/propertyName.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var v: Int = 1 - @JvmName("vget") - get - @JvmName("vset") - set - -fun box(): String { - v += 1 - if (v != 2) return "Fail: $v" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmName/renamedFileClass.kt b/backend.native/tests/external/codegen/box/jvmName/renamedFileClass.kt deleted file mode 100644 index d40e19ee331..00000000000 --- a/backend.native/tests/external/codegen/box/jvmName/renamedFileClass.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:JvmName("Util") -package test - -fun foo(): String = bar() -fun bar(): String = qux() -fun qux(): String = "OK" - -fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/companionObject.kt b/backend.native/tests/external/codegen/box/jvmOverloads/companionObject.kt deleted file mode 100644 index 842a2deff08..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/companionObject.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - companion object { - @JvmStatic @kotlin.jvm.JvmOverloads public fun foo(o: String, k: String = "K"): String { - return o + k - } - } -} - -fun box(): String { - val m = C::class.java.getMethod("foo", String::class.java) - return m.invoke(null, "O") as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/defaultsNotAtEnd.kt b/backend.native/tests/external/codegen/box/jvmOverloads/defaultsNotAtEnd.kt deleted file mode 100644 index b5643b1daab..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/defaultsNotAtEnd.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", i1: Int, k: String = "K", i2: Int): String { - return o + k - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo", Int::class.java, Int::class.java) - return m.invoke(c, 1, 2) as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/doubleParameters.kt b/backend.native/tests/external/codegen/box/jvmOverloads/doubleParameters.kt deleted file mode 100644 index 7544f76c9f1..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/doubleParameters.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @kotlin.jvm.JvmOverloads public fun foo(d1: Double, d2: Double, status: String = "OK"): String { - return if (d1 + d2 == 3.0) status else "fail" - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo", Double::class.java, Double::class.java) - return m.invoke(c, 1.0, 2.0) as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/extensionMethod.kt b/backend.native/tests/external/codegen/box/jvmOverloads/extensionMethod.kt deleted file mode 100644 index 14c8658c299..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/extensionMethod.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { -} - -@kotlin.jvm.JvmOverloads fun C.foo(o: String, k: String = "K"): String { - return o + k -} - -fun box(): String { - val m = C::class.java.getClassLoader().loadClass("ExtensionMethodKt").getMethod("foo", C::class.java, String::class.java) - return m.invoke(null, C(), "O") as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/generics.kt b/backend.native/tests/external/codegen/box/jvmOverloads/generics.kt deleted file mode 100644 index 88f6cc90649..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/generics.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -public class Test { - public static String invokeMethodWithOverloads() { - C c = new C(); - return c.foo("O"); - } -} - -// FILE: generics.kt - -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: T, k: String = "K"): String = o.toString() + k -} - -fun box(): String { - return Test.invokeMethodWithOverloads() -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/innerClass.kt b/backend.native/tests/external/codegen/box/jvmOverloads/innerClass.kt deleted file mode 100644 index 22e736d4d58..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/innerClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class Outer { - inner class Inner @JvmOverloads constructor(val s1: String, val s2: String = "OK") { - - } -} - -fun box(): String { - val outer = Outer() - val c = (Outer.Inner::class.java.getConstructor(Outer::class.java, String::class.java).newInstance(outer, "shazam")) - return c.s2 -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/multipleDefaultParameters.kt b/backend.native/tests/external/codegen/box/jvmOverloads/multipleDefaultParameters.kt deleted file mode 100644 index 6d3c1f720e6..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/multipleDefaultParameters.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", k: String = "K"): String { - return o + k - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo") - return m.invoke(c) as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/noRedundantVarargs.kt b/backend.native/tests/external/codegen/box/jvmOverloads/noRedundantVarargs.kt deleted file mode 100644 index 2dbae6a3258..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/noRedundantVarargs.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -// FILE: test.kt - -@JvmOverloads -fun foo(id: Int, vararg pairs: String = emptyArray()): String { - return "$id: ${java.util.Arrays.toString(pairs)}" -} - -@JvmOverloads -fun foo2(id: Int, s: Int = 56, vararg pairs: String): String { - return "$id, $s: ${java.util.Arrays.toString(pairs)}" -} - -fun box(): String { - if (A.bar1() != "1: []") return "fail 1" - if (A.bar2() != "2: [OK]") return "fail 2" - if (A.bar3() != "3, 56: []") return "fail 3" - if (A.bar4() != "4, 56: [OK]") return "fail 4" - if (A.bar5() != "5, 1491: [OK]") return "fail 5" - - return "OK" -} - -// FILE: A.java - -public class A { - public static String bar1() { - return TestKt.foo(1); - } - - public static String bar2() { - return TestKt.foo(2, "OK"); - } - - public static String bar3() { - return TestKt.foo2(3); - } - - public static String bar4() { - return TestKt.foo2(4, "OK"); - } - - public static String bar5() { - return TestKt.foo2(5, 1491, "OK"); - } -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/nonDefaultParameter.kt b/backend.native/tests/external/codegen/box/jvmOverloads/nonDefaultParameter.kt deleted file mode 100644 index 11f3d564674..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/nonDefaultParameter.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: String, k: String = "K"): String { - return o + k - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo", String::class.java) - return m.invoke(c, "O") as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/primaryConstructor.kt b/backend.native/tests/external/codegen/box/jvmOverloads/primaryConstructor.kt deleted file mode 100644 index cc74a22f3bd..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/primaryConstructor.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C @kotlin.jvm.JvmOverloads constructor(s1: String, s2: String = "K") { - public val status: String = s1 + s2 -} - -fun box(): String { - val c = (C::class.java.getConstructor(String::class.java).newInstance("O")) - return c.status -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/privateClass.kt b/backend.native/tests/external/codegen/box/jvmOverloads/privateClass.kt deleted file mode 100644 index 2c473204597..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/privateClass.kt +++ /dev/null @@ -1,10 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -private data class C(val status: String = "OK") - -fun box(): String { - val c = (C::class.java.getConstructor().newInstance()) - return c.status -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/secondaryConstructor.kt b/backend.native/tests/external/codegen/box/jvmOverloads/secondaryConstructor.kt deleted file mode 100644 index 28461330abb..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/secondaryConstructor.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C(val i: Int) { - var status = "fail" - - @kotlin.jvm.JvmOverloads constructor(o: String, k: String = "K"): this(-1) { - status = o + k - } -} - -fun box(): String { - val c = (C::class.java.getConstructor(String::class.java).newInstance("O")) - return c.status -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/simple.kt b/backend.native/tests/external/codegen/box/jvmOverloads/simple.kt deleted file mode 100644 index b11dc787dd7..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/simple.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @kotlin.jvm.JvmOverloads public fun foo(s: String = "OK"): String { - return s - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo") - return m.invoke(c) as String -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/simpleJavaCall.kt b/backend.native/tests/external/codegen/box/jvmOverloads/simpleJavaCall.kt deleted file mode 100644 index cf7edad65ac..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/simpleJavaCall.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -public class Test { - public static String invokeMethodWithOverloads() { - C c = new C(); - return c.foo(); - } -} - -// FILE: simple.kt - -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", k: String = "K"): String = o + k -} - -fun box(): String { - return Test.invokeMethodWithOverloads() -} diff --git a/backend.native/tests/external/codegen/box/jvmOverloads/varargs.kt b/backend.native/tests/external/codegen/box/jvmOverloads/varargs.kt deleted file mode 100644 index 1ca99e71284..00000000000 --- a/backend.native/tests/external/codegen/box/jvmOverloads/varargs.kt +++ /dev/null @@ -1,16 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - @JvmOverloads - fun foo(bar: Int = 0, vararg status: String) { - - } -} - -fun box(): String { - val c = C() - val m = c.javaClass.getMethod("foo", Array::class.java) - return if (m.isVarArgs) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/jvmPackageName/metadataField.kt b/backend.native/tests/external/codegen/box/jvmPackageName/metadataField.kt deleted file mode 100644 index 3636bc85fc0..00000000000 --- a/backend.native/tests/external/codegen/box/jvmPackageName/metadataField.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 - -// FILE: foo.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -@file:JvmPackageName("baz.foo.quux.bar") -package foo.bar - -fun f() {} - -// FILE: bar.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") - -fun getPackageName(classFqName: String): String = - Class.forName(classFqName).getAnnotation(Metadata::class.java).pn - -fun box(): String { - val bar = getPackageName("BarKt") - if (bar != "") return "Fail 1: $bar" - - val foo = getPackageName("baz.foo.quux.bar.FooKt") - if (foo != "foo.bar") return "Fail 2: $foo" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmPackageName/rootPackage.kt b/backend.native/tests/external/codegen/box/jvmPackageName/rootPackage.kt deleted file mode 100644 index 475834f0ee7..00000000000 --- a/backend.native/tests/external/codegen/box/jvmPackageName/rootPackage.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 - -// FILE: foo.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -@file:JvmPackageName("jjj") - -fun f(): String = "O" - -val g: String? get() = "K" - -inline fun i(block: () -> String) = block() - -// FILE: bar.kt - -fun box(): String = i { f() + g } diff --git a/backend.native/tests/external/codegen/box/jvmPackageName/simple.kt b/backend.native/tests/external/codegen/box/jvmPackageName/simple.kt deleted file mode 100644 index 01d9fac7917..00000000000 --- a/backend.native/tests/external/codegen/box/jvmPackageName/simple.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 - -// FILE: foo.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -@file:JvmPackageName("baz.foo.quux.bar") -package foo.bar - -fun f(): String = "O" - -val g: String? get() = "K" - -inline fun i(block: () -> T): T = block() - -// FILE: bar.kt - -import foo.bar.* - -fun box(): String = i { f() + g } diff --git a/backend.native/tests/external/codegen/box/jvmPackageName/withJvmName.kt b/backend.native/tests/external/codegen/box/jvmPackageName/withJvmName.kt deleted file mode 100644 index df2917bef0e..00000000000 --- a/backend.native/tests/external/codegen/box/jvmPackageName/withJvmName.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 - -// FILE: foo.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -@file:JvmPackageName("jjj") -@file:JvmName("Foooo") - -fun f(): String = "O" - -val g: String? get() = "K" - -inline fun i(block: () -> String) = block() - -// FILE: bar.kt - -fun box(): String = i { f() + g } diff --git a/backend.native/tests/external/codegen/box/jvmStatic/annotations.kt b/backend.native/tests/external/codegen/box/jvmStatic/annotations.kt deleted file mode 100644 index 3fe90d7a0e2..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/annotations.kt +++ /dev/null @@ -1,61 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -import java.lang.annotation.Annotation; - -class Test { - - public static String test1() throws NoSuchMethodException { - Annotation[] test1s = A.class.getMethod("test1").getAnnotations(); - for (Annotation test : test1s) { - String name = test.toString(); - if (name.contains("testAnnotation")) { - return "OK"; - } - } - return "fail"; - } - - public static String test2() throws NoSuchMethodException { - Annotation[] test2s = B.class.getMethod("test1").getAnnotations(); - for (Annotation test : test2s) { - String name = test.toString(); - if (name.contains("testAnnotation")) { - return "OK"; - } - } - return "fail"; - } - -} - -// FILE: test.kt - -@Retention(AnnotationRetention.RUNTIME) -annotation class testAnnotation - -class A { - - companion object { - val b: String = "OK" - - @JvmStatic @testAnnotation fun test1() = b - } -} - -object B { - val b: String = "OK" - - @JvmStatic @testAnnotation fun test1() = b -} - -fun box(): String { - if (Test.test1() != "OK") return "fail 1" - - if (Test.test2() != "OK") return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/closure.kt b/backend.native/tests/external/codegen/box/jvmStatic/closure.kt deleted file mode 100644 index 05998f701a7..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/closure.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - val b: String = "OK" - - @JvmStatic val c: String = "OK" - - @JvmStatic fun test1() : String { - return {b}() - } - - @JvmStatic fun test2() : String { - return {test1()}() - } - - fun test3(): String { - return {"1".test5()}() - } - - @JvmStatic fun test4(): String { - return {"1".test5()}() - } - - @JvmStatic fun String.test5() : String { - return {this + b}() - } - - fun test6(): String { - return {c}() - } -} - -fun box(): String { - if (A.test1() != "OK") return "fail 1" - - if (A.test2() != "OK") return "fail 2" - - if (A.test3() != "1OK") return "fail 3" - - if (A.test4() != "1OK") return "fail 4" - - if (with(A) {"1".test5()} != "1OK") return "fail 5" - - if (A.test6() != "OK") return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/companionObject.kt b/backend.native/tests/external/codegen/box/jvmStatic/companionObject.kt deleted file mode 100644 index d5bd0c41445..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/companionObject.kt +++ /dev/null @@ -1,54 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - - public static String test1() { - return A.test1(); - } - - public static String test2() { - return A.test2(); - } - - public static String test3() { - return A.test3("JAVA"); - } - - public static String test4() { - return A.getC(); - } - -} - -// FILE: simpleCompanionObject.kt - -class A { - - companion object { - val b: String = "OK" - - @JvmStatic val c: String = "OK" - - @JvmStatic fun test1() = b - - @JvmStatic fun test2() = b - - @JvmStatic fun String.test3() = this + b - } -} - -fun box(): String { - if (Test.test1() != "OK") return "fail 1" - - if (Test.test2() != "OK") return "fail 2" - - if (Test.test3() != "JAVAOK") return "fail 3" - - if (Test.test4() != "OK") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/convention.kt b/backend.native/tests/external/codegen/box/jvmStatic/convention.kt deleted file mode 100644 index f586013cf39..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/convention.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class B(var s: Int = 0) { - -} - -object A { - - fun test1(v: B) { - v += B(1000) - } - - @JvmStatic operator fun B.plusAssign(b: B) { - this.s += b.s - } -} - -fun box(): String { - - val b1 = B(11) - - with(A) { - b1 += B(1000) - } - - if (b1.s != 1011) return "fail 1" - - val b = B(11) - A.test1(b) - if (b.s != 1011) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/default.kt b/backend.native/tests/external/codegen/box/jvmStatic/default.kt deleted file mode 100644 index 3e2b82f62a7..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/default.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - @JvmStatic fun test(b: String = "OK") : String { - return b - } -} - -fun box(): String { - - if (A.test() != "OK") return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/enumCompanion.kt b/backend.native/tests/external/codegen/box/jvmStatic/enumCompanion.kt deleted file mode 100644 index 9c635ea32f8..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/enumCompanion.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - public static String foo() { - return A.foo; - } - - public static String constBar() { - return A.constBar; - } - - public static String getBar() { - return A.getBar(); - } - - public static String baz() { - return A.baz(); - } -} - -// FILE: enumCompanionObject.kt - -enum class A { - ; - companion object { - @JvmField val foo: String = "OK" - - const val constBar: String = "OK" - - @JvmStatic val bar: String = "OK" - - @JvmStatic fun baz() = foo - } -} - -fun box(): String { - if (Test.foo() != "OK") return "Fail foo" - if (Test.constBar() != "OK") return "Fail bar" - if (Test.getBar() != "OK") return "Fail getBar" - if (Test.baz() != "OK") return "Fail baz" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/explicitObject.kt b/backend.native/tests/external/codegen/box/jvmStatic/explicitObject.kt deleted file mode 100644 index 641dfc80e98..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/explicitObject.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object AX { - - @JvmStatic val c: String = "OK" - - @JvmStatic fun aStatic(): String { - return AX.b() - } - - fun aNonStatic(): String { - return AX.b() - } - - @JvmStatic fun b(): String { - return "OK" - } - - fun getProperty(): String { - return AX.c - } - -} - -fun box() : String { - - if (AX.aStatic() != "OK") return "fail 1" - - if (AX.aNonStatic() != "OK") return "fail 2" - - if (AX.getProperty() != "OK") return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/funAccess.kt b/backend.native/tests/external/codegen/box/jvmStatic/funAccess.kt deleted file mode 100644 index 7601d2da506..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/funAccess.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var holder = "" - -fun getA(): A { - holder += "OK" - return A -} - -object A { - @JvmStatic fun a(): String { - return holder - } -} - -fun box(): String { - return getA().a() -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/importStaticMemberFromObject.kt b/backend.native/tests/external/codegen/box/jvmStatic/importStaticMemberFromObject.kt deleted file mode 100644 index 7311331ef0f..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/importStaticMemberFromObject.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import O.p -import O.f -import C.Companion.p1 -import C.Companion.f1 - -object O { - @JvmStatic - fun f(): Int = 3 - - @JvmStatic - val p: Int = 6 -} - -class C { - companion object { - @JvmStatic - fun f1(): Int = 3 - - @JvmStatic - val p1: Int = 6 - } - -} - -fun box(): String { - if (p + f() != 9) return "fail" - if (p1 + f1() != 9) return "fail2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/inline.kt b/backend.native/tests/external/codegen/box/jvmStatic/inline.kt deleted file mode 100644 index 4977ac1fdca..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/inline.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - @JvmStatic inline fun test(b: String = "OK") : String { - return b - } -} - -fun box(): String { - - if (A.test() != "OK") return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/inlinePropertyAccessors.kt b/backend.native/tests/external/codegen/box/jvmStatic/inlinePropertyAccessors.kt deleted file mode 100644 index b4c219999f6..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/inlinePropertyAccessors.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var result = "fail 1" -object Foo { - @JvmStatic - private val a = "OK" - - fun foo() = run { result = a } -} - -fun box(): String { - Foo.foo() - - return result -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/kt9897_static.kt b/backend.native/tests/external/codegen/box/jvmStatic/kt9897_static.kt deleted file mode 100644 index a3ca2723748..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/kt9897_static.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object Test { - var z = "0" - var l = 0L - - fun changeObject(): String { - "1".someProperty += 1 - return z - } - - fun changeLong(): Long { - 2L.someProperty -= 1 - return l - } - - @JvmStatic var String.someProperty: Int - get() { - return this.length - } - set(left) { - z += this + left - } - - @JvmStatic var Long.someProperty: Long - get() { - return l - } - set(left) { - l += this + left - } - -} - -fun box(): String { - val changeObject = Test.changeObject() - if (changeObject != "012") return "fail 1: $changeObject" - - val changeLong = Test.changeLong() - if (changeLong != 1L) return "fail 1: $changeLong" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/object.kt b/backend.native/tests/external/codegen/box/jvmStatic/object.kt deleted file mode 100644 index 98ce03c845a..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/object.kt +++ /dev/null @@ -1,52 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - - public static String test1() { - return A.test1(); - } - - public static String test2() { - return A.test2(); - } - - public static String test3() { - return A.test3("JAVA"); - } - - public static String test4() { - return A.getC(); - } - -} - -// FILE: simpleObject.kt - -object A { - - val b: String = "OK" - - @JvmStatic val c: String = "OK" - - @JvmStatic fun test1() = b - - @JvmStatic fun test2() = b - - @JvmStatic fun String.test3() = this + b -} - -fun box(): String { - if (Test.test1() != "OK") return "fail 1" - - if (Test.test2() != "OK") return "fail 2" - - if (Test.test3() != "JAVAOK") return "fail 3" - - if (Test.test4() != "OK") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/postfixInc.kt b/backend.native/tests/external/codegen/box/jvmStatic/postfixInc.kt deleted file mode 100644 index 202cd0b0d06..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/postfixInc.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - @JvmStatic var a: Int = 1 - - var b: Int = 1 - @JvmStatic get - - var c: Int = 1 - @JvmStatic set - -} - -var holder = "" -fun getA(): A { - holder += "getA()" - return A -} - - -fun box(): String { - - var p = A.a++ - if (p != 1 || A.a != 2) return "fail 1" - - p = A.b++ - if (p != 1 || A.b != 2) return "fail 2" - - p = A.c++ - if (p != 1 || A.c != 2) return "fail 3" - - - p = getA().a++ - if (p != 2 || A.a != 3 || holder != "getA()") return "fail 4: $holder" - holder = "" - - p = getA().b++ - if (p != 2 || A.b != 3 || holder != "getA()") return "fail 5: $holder" - holder = "" - - p = getA().c++ - if (p != 2 || A.c != 3 || holder != "getA()") return "fail 6: $holder" - holder = "" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/prefixInc.kt b/backend.native/tests/external/codegen/box/jvmStatic/prefixInc.kt deleted file mode 100644 index f81a1467b48..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/prefixInc.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - @JvmStatic var a: Int = 1 - - var b: Int = 1 - @JvmStatic get - - var c: Int = 1 - @JvmStatic set - -} - -var holder = "" -fun getA(): A { - holder += "getA()" - return A -} - - -fun box(): String { - - var p = ++A.a - if (p != 2 || A.a != 2) return "fail 1" - - p = ++A.b - if (p != 2 || A.b != 2) return "fail 2" - - p = ++A.c - if (p != 2 || A.c != 2) return "fail 3" - - - p = ++getA().a - if (p != 3 || A.a != 3 || holder != "getA()") return "fail 4: $holder" - holder = "" - - p = ++getA().b - if (p != 3 || A.b != 3 || holder != "getA()") return "fail 5: $holder" - holder = "" - - p = ++getA().c - if (p != 3 || A.c != 3 || holder != "getA()") return "fail 6: $holder" - holder = "" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/privateMethod.kt b/backend.native/tests/external/codegen/box/jvmStatic/privateMethod.kt deleted file mode 100644 index a993a425f4a..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/privateMethod.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - private @JvmStatic fun a(): String { - return "OK" - } - - object Z { - val p = a() - } -} - -fun box(): String { - return A.Z.p -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/privateSetter.kt b/backend.native/tests/external/codegen/box/jvmStatic/privateSetter.kt deleted file mode 100644 index a931a41c8eb..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/privateSetter.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaClass.java -class JavaClass { - - - public static String test() - { - return TestApp.getValue(); - } -} - -// FILE: Kotlin.kt -open class TestApp { - companion object { - @JvmStatic - var value: String = "OK" - private set - } -} - - -fun box(): String { - return JavaClass.test() -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccess.kt b/backend.native/tests/external/codegen/box/jvmStatic/propertyAccess.kt deleted file mode 100644 index 3ccb556b423..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccess.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var holder = "" - -fun getA(): A { - holder += "getA()" - return A -} - -object A { - - @JvmStatic var a: Int = 1 - - var b: Int = 1 - @JvmStatic get - - var c: Int = 1 - @JvmStatic set - -} - - -fun box(): String { - - if (getA().a != 1 || holder != "getA()") return "fail 1: $holder" - holder = "" - - if (getA().b != 1 || holder != "getA()") return "fail 2: $holder" - holder = "" - - if (getA().c != 1 || holder != "getA()") return "fail 3: $holder" - holder = "" - - getA().a = 2 - if (getA().a != 2 || holder != "getA()getA()") return "fail 1: $holder" - holder = "" - - getA().b = 2 - if (getA().b != 2 || holder != "getA()getA()") return "fail 2: $holder" - holder = "" - - getA().c = 2 - if (getA().c != 2 || holder != "getA()getA()") return "fail 3: $holder" - holder = "" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsCompanion.kt b/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsCompanion.kt deleted file mode 100644 index 9ce9cd9e1fb..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsCompanion.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var result = "fail 2" -class Foo { - val b = { a } - val c = Runnable { result = a } - - companion object { - @JvmStatic - private val a = "OK" - } -} - -fun box(): String { - if (Foo().b() != "OK") return "fail 1" - - Foo().c.run() - - return result -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsObject.kt b/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsObject.kt deleted file mode 100644 index 6e3df7272ed..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/propertyAccessorsObject.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -var result = "fail 2" -object Foo { - @JvmStatic - private val a = "OK" - - val b = { a } - val c = Runnable { result = a } -} - -fun box(): String { - if (Foo.b() != "OK") return "fail 1" - - Foo.c.run() - - return result -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/propertyAsDefault.kt b/backend.native/tests/external/codegen/box/jvmStatic/propertyAsDefault.kt deleted file mode 100644 index 123d32ff19d..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/propertyAsDefault.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object X { - @JvmStatic val x = "OK" - - fun fn(value : String = x): String = value -} - -fun box(): String { - return X.fn() -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt b/backend.native/tests/external/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt deleted file mode 100644 index 767a0b188ae..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -// TARGET_BACKEND: JVM -object ObjectThisTest { - - val testValue: String - @JvmStatic get() = this.testValue2 - - val testValue2: String - get() = "OK" -} - -fun box() = ObjectThisTest.testValue diff --git a/backend.native/tests/external/codegen/box/jvmStatic/simple.kt b/backend.native/tests/external/codegen/box/jvmStatic/simple.kt deleted file mode 100644 index 535955271a5..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/simple.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -object A { - - val b: String = "OK" - - @JvmStatic val c: String = "OK" - - @JvmStatic fun test1() : String { - return b - } - - @JvmStatic fun test2() : String { - return test1() - } - - fun test3(): String { - return "1".test5() - } - - @JvmStatic fun test4(): String { - return "1".test5() - } - - @JvmStatic fun String.test5() : String { - return this + b - } -} - -fun box(): String { - if (A.test1() != "OK") return "fail 1" - - if (A.test2() != "OK") return "fail 2" - - if (A.test3() != "1OK") return "fail 3" - - if (A.test4() != "1OK") return "fail 4" - - if (with(A) {"1".test5()} != "1OK") return "fail 5" - - if (A.c != "OK") return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/jvmStatic/syntheticAccessor.kt b/backend.native/tests/external/codegen/box/jvmStatic/syntheticAccessor.kt deleted file mode 100644 index 76e27b7f63f..00000000000 --- a/backend.native/tests/external/codegen/box/jvmStatic/syntheticAccessor.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class C { - companion object { - private @JvmStatic fun foo(): String { - return "OK" - } - } - - fun bar(): String { - return foo() - } -} - -fun box(): String { - return C().bar() -} diff --git a/backend.native/tests/external/codegen/box/labels/controlLabelClashesWithFuncitonName.kt b/backend.native/tests/external/codegen/box/labels/controlLabelClashesWithFuncitonName.kt deleted file mode 100644 index ae2f251cc2c..00000000000 --- a/backend.native/tests/external/codegen/box/labels/controlLabelClashesWithFuncitonName.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun test1(): Boolean { - test1@ for(i in 1..2) { - continue@test1 - return false - } - - return true -} - -fun test2(): Boolean { - test2@ while (true) { - break@test2 - } - - return true -} - -fun box(): String { - if (!test1()) return "fail test1" - if (!test2()) return "fail test2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/labels/infixCallLabelling.kt b/backend.native/tests/external/codegen/box/labels/infixCallLabelling.kt deleted file mode 100644 index 720f0cf5f70..00000000000 --- a/backend.native/tests/external/codegen/box/labels/infixCallLabelling.kt +++ /dev/null @@ -1,24 +0,0 @@ -fun test(x: Int): Int { - x myMap { - return@myMap - } - - return 0 -} - -fun myMap(x: Int): Int { - x myMap { - return@myMap - } - - return 0 -} - -infix fun Int.myMap(x: () -> Unit) {} - -fun box(): String { - test(0) - myMap(0) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/labels/labeledDeclarations.kt b/backend.native/tests/external/codegen/box/labels/labeledDeclarations.kt deleted file mode 100644 index 5b407c979fb..00000000000 --- a/backend.native/tests/external/codegen/box/labels/labeledDeclarations.kt +++ /dev/null @@ -1,16 +0,0 @@ -data class A(val a: Int, val b: Int) - -fun box() : String -{ - a@ val x = 1 - b@ fun a() = 2 - c@ val (z, z2) = A(1, 2) - - if (x != 1) return "fail 1" - - if (a() != 2) return "fail 2" - - if (z != 1 || z2 != 2) return "fail 3" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/labels/propertyAccessor.kt b/backend.native/tests/external/codegen/box/labels/propertyAccessor.kt deleted file mode 100644 index b9973e82ddc..00000000000 --- a/backend.native/tests/external/codegen/box/labels/propertyAccessor.kt +++ /dev/null @@ -1,11 +0,0 @@ -val Int.getter: Int - get() { - return this@getter - } - -fun box(): String { - val i = 1 - if (i.getter != 1) return "getter failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/labels/propertyAccessorFunctionLiteral.kt b/backend.native/tests/external/codegen/box/labels/propertyAccessorFunctionLiteral.kt deleted file mode 100644 index 6d26e930ed2..00000000000 --- a/backend.native/tests/external/codegen/box/labels/propertyAccessorFunctionLiteral.kt +++ /dev/null @@ -1,13 +0,0 @@ -val Int.getter: Int - get() { - return { - this@getter - }.invoke() - } - -fun box(): String { - val i = 1 - if (i.getter != 1) return "getter failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/labels/propertyAccessorInnerExtensionFun.kt b/backend.native/tests/external/codegen/box/labels/propertyAccessorInnerExtensionFun.kt deleted file mode 100644 index 1a57fc6e039..00000000000 --- a/backend.native/tests/external/codegen/box/labels/propertyAccessorInnerExtensionFun.kt +++ /dev/null @@ -1,28 +0,0 @@ -val Int.getter: Int - get() { - val extFun: Int.() -> Int = { - this@getter - } - return this@getter.extFun() - } - - -var Int.setter: Int - get() = 1 - set(i: Int) { - val extFun: Int.() -> Int = { - this@setter - } - this@setter.extFun() - } - - -fun box(): String { - val i = 1 - if (i.getter != 1) return "getter failed" - - i.setter = 1 - if (i.setter != 1) return "setter failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/labels/propertyAccessorObject.kt b/backend.native/tests/external/codegen/box/labels/propertyAccessorObject.kt deleted file mode 100644 index 1fc9f25aa82..00000000000 --- a/backend.native/tests/external/codegen/box/labels/propertyAccessorObject.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface Base { - fun foo(): Int -} - -val Int.getter: Int - get() { - return object : Base { - override fun foo(): Int { - return this@getter - } - }.foo() - } - -fun box(): String { - val i = 1 - if (i.getter != 1) return "getter failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/labels/propertyInClassAccessor.kt b/backend.native/tests/external/codegen/box/labels/propertyInClassAccessor.kt deleted file mode 100644 index 21cfd6428d9..00000000000 --- a/backend.native/tests/external/codegen/box/labels/propertyInClassAccessor.kt +++ /dev/null @@ -1,17 +0,0 @@ -class Test { - val Int.innerGetter: Int - get() { - return this@innerGetter - } - - fun test(): Int { - val i = 1 - if (i.innerGetter != 1) return 0 - return 1 - } -} - -fun box(): String { - if (Test().test() != 1) return "inner getter or setter failed" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/exceptionInFieldInitializer.kt b/backend.native/tests/external/codegen/box/lazyCodegen/exceptionInFieldInitializer.kt deleted file mode 100644 index f086e0ca2ff..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/exceptionInFieldInitializer.kt +++ /dev/null @@ -1,32 +0,0 @@ -class A(val p: String) { - val prop: String = throw RuntimeException() -} - -class B(val p: String) { - val prop: String = if (p == "test") "OK" else throw RuntimeException() -} - -fun box(): String { - var result = "fail" - try { - if (A("test").prop != "OK") return "fail 1" - } - catch (e: RuntimeException) { - result = "OK" - } - if (result != "OK") return "fail 1: $result" - - - if (B("test").prop != "OK") return "fail 2" - - - result = "fail" - try { - if (B("fail").prop != "OK") return "fail 3" - } - catch (e: RuntimeException) { - return "OK" - } - - return "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/ifElse.kt b/backend.native/tests/external/codegen/box/lazyCodegen/ifElse.kt deleted file mode 100644 index 0f683860b24..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/ifElse.kt +++ /dev/null @@ -1,34 +0,0 @@ -class A (val p: String, p1: String, p2: String) { - - var cond1 :String = "" - - var cond2 :String = "" - - val prop: String = if (p == "test") p1 else p2 - - val prop1 = if (cond1(p)) p1 else false - - val prop2 = if (cond2(p)) true else false - - fun cond1(p: String): Boolean { - cond1 = "cond1" - return p == "test" - } - - fun cond2(p: String): Boolean { - cond2 = "cond2" - return p == "test" - } -} - -fun box(): String { - val a = A("test", "OK", "fail") - - if (a.prop != "OK") return "fail 1" - - if (a.cond1 != "cond1") return "fail 2" - - if (a.cond2 != "cond2") return "fail 3" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/increment.kt b/backend.native/tests/external/codegen/box/lazyCodegen/increment.kt deleted file mode 100644 index 40369fff4af..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/increment.kt +++ /dev/null @@ -1,31 +0,0 @@ -var holder = "" -var globalA: A = A(-1) - get(): A { - holder += "getA" - return field - } - - -class A(val p: Int) { - - var prop = this - - operator fun inc(): A { - return A(p+1) - } - - -} - -fun box(): String { - var a = A(1) - ++a - if (a.p != 2) return "fail 1: ${a.p} $holder" - - globalA = A(1) - ++(globalA.prop) - val holderValue = holder; - if (globalA.p != 1 || globalA.prop.p != 2 || holderValue != "getA") return "fail 2: ${a.p} ${a.prop.p} ${holderValue}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateConstantCompare.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateConstantCompare.kt deleted file mode 100644 index f68757d7588..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateConstantCompare.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - if (!(1 < 2)) { - return "fail" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalse.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalse.kt deleted file mode 100644 index fd5ef04626e..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalse.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - if (!false) { - return "OK" - } else { - return "fail" - } -} diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVar.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVar.kt deleted file mode 100644 index c4ad074824a..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVar.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - var p = 2 < 1; - if (!p) { - return "OK" - } else { - return "fail" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVarChain.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVarChain.kt deleted file mode 100644 index 8f89b14fe90..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateFalseVarChain.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val p = 2 < 1; - if (!!!!!p) { - return "OK" - } else { - return "fail" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp.kt deleted file mode 100644 index 58e15f4de93..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp.kt +++ /dev/null @@ -1,9 +0,0 @@ -val p: Int? = 1; -val z: Int? = 2; - -fun box(): String { - if (!(p!! == z!!)) { - return "OK" - } - return "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp2.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp2.kt deleted file mode 100644 index e1a13f17cc9..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateObjectComp2.kt +++ /dev/null @@ -1,9 +0,0 @@ -val p: Int? = 1; -val z: Int? = 2; - -fun box(): String { - if (!(p!! < z!!)) { - return "fail" - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrue.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrue.kt deleted file mode 100644 index 487ec8c27a8..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrue.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - if (!true) { - return "fail" - } else { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrueVar.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrueVar.kt deleted file mode 100644 index 2c651614453..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/negateTrueVar.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - var p = 1 < 2; - if (!p) { - return "fail" - } else { - return "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/noOptimization.kt b/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/noOptimization.kt deleted file mode 100644 index 1437d56484b..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/optimizations/noOptimization.kt +++ /dev/null @@ -1,28 +0,0 @@ -class A -class B - -var holder = 0 - -operator fun A.not(): A { - holder++ - return this; -} - -operator fun B.not(): Boolean { - holder++ - return false; -} - -fun box(): String { - !!!!!A() - if (holder != 5) return "fail 1" - - holder = 0; - if (!!!B() || holder != 1) return "fail 2" - - if (!B() != false) return "fail 3" - - if (!!B() != true) return "fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/safeAssign.kt b/backend.native/tests/external/codegen/box/lazyCodegen/safeAssign.kt deleted file mode 100644 index 8019455b3da..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/safeAssign.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Shape(var result: String) { - -} - -fun box(): String { - var a : Shape? = Shape("fail"); - a?.result = "OK"; - - return a!!.result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/safeAssignComplex.kt b/backend.native/tests/external/codegen/box/lazyCodegen/safeAssignComplex.kt deleted file mode 100644 index 6dd9cac91de..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/safeAssignComplex.kt +++ /dev/null @@ -1,34 +0,0 @@ -var holder = "" - -var mainShape: Shape? = null - -fun getShape(): Shape? { - holder += "getShape1()" - mainShape = Shape("fail") - return mainShape -} - -fun getOK(): String { - holder += "->OK" - return "OK" -} - - -class Shape(var result: String) { - - var innerShape: Shape? = null - - fun getShape2(): Shape? { - holder += "->getShape2()" - innerShape = Shape(result) - return innerShape - } -} - -fun box(): String { - getShape()?.getShape2()?.result = getOK(); - - if (holder != "getShape1()->getShape2()->OK") return "fail $holder" - - return mainShape!!.innerShape!!.result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/safeCallAndArray.kt b/backend.native/tests/external/codegen/box/lazyCodegen/safeCallAndArray.kt deleted file mode 100644 index 90b61d66b5f..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/safeCallAndArray.kt +++ /dev/null @@ -1,11 +0,0 @@ -class C { - fun calc() : String { - return "OK" - } -} - -fun box(): String? { - val c: C? = C() - val arrayList = arrayOf(c?.calc(), "") - return arrayList[0] -} diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/toString.kt b/backend.native/tests/external/codegen/box/lazyCodegen/toString.kt deleted file mode 100644 index a71276879e8..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/toString.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A (val p: String) { - - val _kind: String = "$p" - -} - -fun box(): String { - - if (A("OK")._kind != "OK") return "fail" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/tryCatchExpression.kt b/backend.native/tests/external/codegen/box/lazyCodegen/tryCatchExpression.kt deleted file mode 100644 index 8617a79e1cf..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/tryCatchExpression.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - val p : Int = try{ - 1 - } catch(e: Exception) { - throw RuntimeException() - } -} - -fun box() : String { - if (A().p != 1) return "fail 1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/lazyCodegen/when.kt b/backend.native/tests/external/codegen/box/lazyCodegen/when.kt deleted file mode 100644 index 3953b4f0b2c..00000000000 --- a/backend.native/tests/external/codegen/box/lazyCodegen/when.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A (val p: String) { - - val _kind: String = when { - p == "test" -> "OK" - else -> "fail" - } - -} - -fun box(): String { - - if (A("test")._kind != "OK") return "fail" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInInitializer.kt b/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInInitializer.kt deleted file mode 100644 index ef9b826ff07..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInInitializer.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - var a: String = "Fail" - - init { - a = object { - override fun toString(): String = "OK" - }.toString() - } -} - -fun box() : String { - return A().a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInParameterInitializer.kt b/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInParameterInitializer.kt deleted file mode 100644 index e5a27ccdbc4..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/anonymousObjectInParameterInitializer.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A( - val a: String = object { - override fun toString(): String = "OK" - }.toString() -) - -fun box() : String { - return A().a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/closureOfInnerLocalClass.kt b/backend.native/tests/external/codegen/box/localClasses/closureOfInnerLocalClass.kt deleted file mode 100644 index 629b491a31d..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/closureOfInnerLocalClass.kt +++ /dev/null @@ -1,28 +0,0 @@ -// Enable for JVM backend when KT-8120 gets fixed -// IGNORE_BACKEND: JVM - -fun box(): String { - var log = "" - - var s: Any? = null - for (t in arrayOf("1", "2", "3")) { - class C() { - val y = t - - inner class D() { - fun copyOuter() = C() - } - } - - if (s == null) { - s = C() - } - - val c = (s as C).D().copyOuter() - log += c.y - } - - if (log != "111") return "fail: ${log}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/closureOfLambdaInLocalClass.kt b/backend.native/tests/external/codegen/box/localClasses/closureOfLambdaInLocalClass.kt deleted file mode 100644 index 3cae7289280..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/closureOfLambdaInLocalClass.kt +++ /dev/null @@ -1,38 +0,0 @@ -fun box(): String { - var log = "" - - var s: Any? = null - for (t in arrayOf("1", "2", "3")) { - class A() { - fun foo() = { t } - } - - if (s == null) { - s = A() - } - - log += (s as A).foo()() - } - - if (log != "111") return "fail1: ${log}" - - s = null - log = "" - for (t in arrayOf("1", "2", "3")) { - class B() { - val y = t - - fun foo() = { y } - } - - if (s == null) { - s = B() - } - - log += (s as B).foo()() - } - - if (log != "111") return "fail2: ${log}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/closureWithSelfInstantiation.kt b/backend.native/tests/external/codegen/box/localClasses/closureWithSelfInstantiation.kt deleted file mode 100644 index 20727829c28..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/closureWithSelfInstantiation.kt +++ /dev/null @@ -1,78 +0,0 @@ -// Enable for JVM backend when KT-8120 gets fixed -// IGNORE_BACKEND: JVM - -fun box(): String { - val capturedInConstructor = 1 - val capturedInBody = 10 - var log = "" - - class A(var x: Int) { - var y = 0 - - fun copy(): A { - log += "A.copy;" - val result = A(x) - result.y += capturedInBody - return result - } - - init { - log += "A.;" - y += x + capturedInConstructor - } - } - - val a = A(100).copy() - if (a.y != 111) return "fail1a: ${a.y}" - if (a.x != 100) return "fail1b: ${a.x}" - - - class B(var x: Int) { - var y = 0 - - fun copier(): () -> B { - log += "B.copier;" - return { - log += "B.copy;" - val result = B(x) - result.y += capturedInBody - result - } - } - - init { - y += x + capturedInConstructor - log += "B.;" - } - } - - val b = B(100).copier()() - if (b.y != 111) return "fail2a: ${b.y}" - if (b.x != 100) return "fail2b: ${b.x}" - - class C(var x: Int) { - var y = 0 - - inner class D() { - fun copyOuter(): C { - log += "D.copyOuter;" - val result = C(x) - result.y += capturedInBody - return result - } - } - - init { - log += "C.;" - y += x + capturedInConstructor - } - } - - val c = C(100).D().copyOuter() - if (c.y != 111) return "fail3a: ${c.y}" - if (c.x != 100) return "fail3b: ${c.x}" - - if (log != "A.;A.copy;A.;B.;B.copier;B.copy;B.;C.;D.copyOuter;C.;") return "fail_log: $log" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/inExtensionFunction.kt b/backend.native/tests/external/codegen/box/localClasses/inExtensionFunction.kt deleted file mode 100644 index 0a4fbfbbbf0..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/inExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -package test - -fun A.a(): String { - class B { - val b : String - get() = this@a.s - } - return B().b -} - -class A { - val s : String = "OK" -} - -fun box() : String { - return A().a() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/inExtensionProperty.kt b/backend.native/tests/external/codegen/box/localClasses/inExtensionProperty.kt deleted file mode 100644 index 6b0ed7cb97d..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/inExtensionProperty.kt +++ /dev/null @@ -1,18 +0,0 @@ -package test - -val A.a: String - get() { - class B { - val b : String - get() = this@a.s - } - return B().b - } - -class A { - val s : String = "OK" -} - -fun box() : String { - return A().a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionFunction.kt b/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionFunction.kt deleted file mode 100644 index d7231d40d3d..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionFunction.kt +++ /dev/null @@ -1,24 +0,0 @@ -package test - -class C(val s : String) { - fun A.a(): String { - class B { - val b : String - get() = this@a.s + this@C.s - } - return B().b - } - - fun test(a : A) : String { - return a.a() - } -} - -class A(val s: String) { - - -} - -fun box() : String { - return C("K").test(A("O")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionProperty.kt b/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionProperty.kt deleted file mode 100644 index 6a628f41320..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/inLocalExtensionProperty.kt +++ /dev/null @@ -1,23 +0,0 @@ -package test - -class C(val s : String) { - val A.a: String - get() { - class B { - val b : String - get() = this@a.s + this@C.s - } - return B().b - } - - fun test(a : A) : String { - return a.a - } -} - -class A(val s: String) { -} - -fun box() : String { - return C("K").test(A("O")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/innerClassInLocalClass.kt b/backend.native/tests/external/codegen/box/localClasses/innerClassInLocalClass.kt deleted file mode 100644 index 72d84e5ddac..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/innerClassInLocalClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - val a = 1 - fun calc () : Int { - class B() { - val b = 2 - inner class C { - val c = 3 - fun calc() = this@A.a + this@B.b + this.c - } - } - return B().C().calc() - } -} - -fun box() : String { - return if (A().calc() == 6) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/innerOfLocalCaptureExtensionReceiver.kt b/backend.native/tests/external/codegen/box/localClasses/innerOfLocalCaptureExtensionReceiver.kt deleted file mode 100644 index ba3a0df632a..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/innerOfLocalCaptureExtensionReceiver.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun String.bar(): String { - open class Local { - fun result() = this@bar - } - - class Outer { - inner class Inner : Local() { - fun outer() = this@Outer - } - } - - return Outer().Inner().result() -} - -fun box() = "OK".bar() diff --git a/backend.native/tests/external/codegen/box/localClasses/kt2700.kt b/backend.native/tests/external/codegen/box/localClasses/kt2700.kt deleted file mode 100644 index 3baacf0b21f..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt2700.kt +++ /dev/null @@ -1,17 +0,0 @@ -package a.b - -interface Test { - fun invoke(): String { - return "OK" - } -} - -private val a : Test = { - object : Test { - - } -}() - -fun box(): String { - return a.invoke(); -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/kt2873.kt b/backend.native/tests/external/codegen/box/localClasses/kt2873.kt deleted file mode 100644 index be5008511ac..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt2873.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo() : String { - val u = { - class B(val data : String) - B("OK").data - } - return u() -} - -fun box(): String { - return foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/kt3210.kt b/backend.native/tests/external/codegen/box/localClasses/kt3210.kt deleted file mode 100644 index 12c9b1cba6e..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt3210.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.example - -interface SomeTrait {} - -interface KotlinProcessor { - fun execute(callback: KotlinCallback?); -} - -interface KotlinCallback { - fun on(t : T); -} - -public class Test(name : String) : KotlinProcessor { - public override fun execute(callback: KotlinCallback?) { - if(callback != null) { - class InlineTrait : SomeTrait {} - - var inlineTrait = InlineTrait() - callback.on(inlineTrait) - } - } -} - -fun box() : String { - var f = "fail" - Test("OK").execute(object : KotlinCallback { - override fun on(t: SomeTrait) { - f = "OK" - } - }) - return f -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/kt3389.kt b/backend.native/tests/external/codegen/box/localClasses/kt3389.kt deleted file mode 100644 index abb515b1688..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt3389.kt +++ /dev/null @@ -1,14 +0,0 @@ -package t - -class Reproduce { - - fun test(): String { - data class Foo(val bar: String, val baz: Int) - val foo = Foo("OK", 5) - return foo.bar - } -} - -fun box() : String { - return Reproduce().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/kt3584.kt b/backend.native/tests/external/codegen/box/localClasses/kt3584.kt deleted file mode 100644 index 21cdb764faa..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt3584.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - val s = "captured"; - - class A(val param: String = "OK") { - val s2 = s + param - } - - if (A().s2 != "capturedOK") return "fail 1: ${A().s2}" - - if (A("Test").s2 != "capturedTest") return "fail 2: ${A("Test").s2}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/kt4174.kt b/backend.native/tests/external/codegen/box/localClasses/kt4174.kt deleted file mode 100644 index 56a73053979..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/kt4174.kt +++ /dev/null @@ -1,25 +0,0 @@ -open class C(val s: String) { - fun test(): String { - return s - } -} - -class B(var x: String) { - fun foo(): String { - var s = "OK" - class Z : C(s) {} - return Z().test() - } - - fun foo2(): String { - class Y : C(x) {} - return Y().test() - } -} - - -fun box(): String { - val b = B("OK") - if (b.foo() != "OK") return "fail: ${b.foo()}" - return b.foo2() -} diff --git a/backend.native/tests/external/codegen/box/localClasses/localClass.kt b/backend.native/tests/external/codegen/box/localClasses/localClass.kt deleted file mode 100644 index d8cdb7552fd..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - fun a () : String { - class B() { - fun s() : String = "OK" - } - return B().s() - } -} - -fun box() : String { - return A().a() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/localClassCaptureExtensionReceiver.kt b/backend.native/tests/external/codegen/box/localClasses/localClassCaptureExtensionReceiver.kt deleted file mode 100644 index 89ee7e3754f..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localClassCaptureExtensionReceiver.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Outer { - fun String.id(): String { - class Local(unused: Long) { - fun result() = this@id - fun outer() = this@Outer - } - - return Local(42L).result() - } - - fun result(): String = "OK".id() -} - -fun box() = Outer().result() diff --git a/backend.native/tests/external/codegen/box/localClasses/localClassInInitializer.kt b/backend.native/tests/external/codegen/box/localClasses/localClassInInitializer.kt deleted file mode 100644 index 0dafae38048..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localClassInInitializer.kt +++ /dev/null @@ -1,19 +0,0 @@ -class A { - var a: String = "Fail" - - init { - open class B() { - open fun s() : String = "O" - } - - val o = object : B() { - override fun s(): String = "K" - } - - a = B().s() + o.s() - } -} - -fun box() : String { - return A().a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/localClassInParameterInitializer.kt b/backend.native/tests/external/codegen/box/localClasses/localClassInParameterInitializer.kt deleted file mode 100644 index 2b5c62666e6..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localClassInParameterInitializer.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A( - val a: String = { - open class B() { - open fun s() : String = "O" - } - - val o = object : B() { - override fun s(): String = "K" - } - - B().s() + o.s() - }() -) - -fun box() : String { - return A().a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/localDataClass.kt b/backend.native/tests/external/codegen/box/localClasses/localDataClass.kt deleted file mode 100644 index 33cf16258d2..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localDataClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val capturedInConstructor = 1 - - data class A(var x: Int) { - var y = 0 - - init { - y += x + capturedInConstructor - } - } - - val a = A(100).copy() - if (a.y != 101) return "fail1a: ${a.y}" - if (a.x != 100) return "fail1b: ${a.x}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/localExtendsInnerAndReferencesOuterMember.kt b/backend.native/tests/external/codegen/box/localClasses/localExtendsInnerAndReferencesOuterMember.kt deleted file mode 100644 index f5520406363..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/localExtendsInnerAndReferencesOuterMember.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - fun box(): String { - class Local : Inner() { - val u = foo() - } - val u = Local().u - return if (u == 42) "OK" else "Fail $u" - } - - open inner class Inner - fun foo() = 42 -} - -fun box() = A().box() diff --git a/backend.native/tests/external/codegen/box/localClasses/noclosure.kt b/backend.native/tests/external/codegen/box/localClasses/noclosure.kt deleted file mode 100644 index 8f9417505e7..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/noclosure.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - open class K { - val o = "O" - } - - class Bar : K() { - val k = "K" - } - - return K().o + Bar().k -} diff --git a/backend.native/tests/external/codegen/box/localClasses/object.kt b/backend.native/tests/external/codegen/box/localClasses/object.kt deleted file mode 100644 index a96a9237f68..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/object.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val k = object { - val ok = "OK" - } - - return k.ok -} diff --git a/backend.native/tests/external/codegen/box/localClasses/ownClosureOfInnerLocalClass.kt b/backend.native/tests/external/codegen/box/localClasses/ownClosureOfInnerLocalClass.kt deleted file mode 100644 index c978f8b9c62..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/ownClosureOfInnerLocalClass.kt +++ /dev/null @@ -1,24 +0,0 @@ -fun box(): String { - var log = "" - - var s: Any? = null - for (t in arrayOf("1", "2", "3")) { - class C() { - val y = t - - inner class D() { - fun foo() = "($y;$t)" - } - } - - if (s == null) { - s = C() - } - - log += (s as C).D().foo() - } - - if (log != "(1;1)(1;1)(1;1)") return "fail: ${log}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/localClasses/withclosure.kt b/backend.native/tests/external/codegen/box/localClasses/withclosure.kt deleted file mode 100644 index b9dc2f5bee3..00000000000 --- a/backend.native/tests/external/codegen/box/localClasses/withclosure.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val x = "OK" - class Aaa { - val y = x - } - - return Aaa().y -} diff --git a/backend.native/tests/external/codegen/box/localFunctions/parameterAsDefaultValue.kt b/backend.native/tests/external/codegen/box/localFunctions/parameterAsDefaultValue.kt deleted file mode 100644 index e90fe97fede..00000000000 --- a/backend.native/tests/external/codegen/box/localFunctions/parameterAsDefaultValue.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo(): String { - fun bar(x: String, y: String = x): String { - return y - } - - return bar("OK") -} - -fun box(): String { - return foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/mangling/field.kt b/backend.native/tests/external/codegen/box/mangling/field.kt deleted file mode 100644 index d4805116073..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/field.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package test - -internal val noMangling = 1; - -class Z { - internal var noMangling = 1; -} - -fun box(): String { - val clazz = Z::class.java - val classField = clazz.getDeclaredField("noMangling") - if (classField == null) return "Class internal backing field should exist" - - val topLevel = Class.forName("test.FieldKt").getDeclaredField("noMangling") - if (topLevel == null) return "Top level internal backing field should exist" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/mangling/fun.kt b/backend.native/tests/external/codegen/box/mangling/fun.kt deleted file mode 100644 index 648f8620f80..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/fun.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package test - -internal fun noMangling() = 1; - -class Z { - internal fun mangled() = 1; -} - -fun box(): String { - val clazz = Z::class.java - val declaredMethods = clazz.declaredMethods - - val mangled = declaredMethods.firstOrNull { - it.name.startsWith("mangled$") - } - if (mangled == null) return "Class internal function should exist" - - val topLevel = Class.forName("test.FunKt").getMethod("noMangling") - if (topLevel == null) return "Top level internal function should exist" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/mangling/internal.kt b/backend.native/tests/external/codegen/box/mangling/internal.kt deleted file mode 100644 index 1d7db0dd977..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/internal.kt +++ /dev/null @@ -1,37 +0,0 @@ -// MODULE: lib -// FILE: lib.kt - -package lib - -internal fun foo() = 1 - -internal val bar = 2 - -internal class A { - internal fun baz(a: Int): Int { - return a * 10 - } - - internal val foo = 3 - - internal inner class B { - internal fun foo() = 4 - } -} - -// MODULE: main(lib)(lib) -// FILE: main.kt - -package main - -import lib.* - -fun box(): String { - if (foo() != 1) return "fail 1: ${foo()}" - if (bar != 2) return "fail 2: ${bar}" - val a = A() - if (a.baz(10) != 100) return "fail 3: ${a.baz(10)}" - if (a.foo != 3) return "fail 4: ${a.foo}" - if (a.B().foo() != 4) return "fail 5: ${a.B().foo()}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/mangling/internalOverride.kt b/backend.native/tests/external/codegen/box/mangling/internalOverride.kt deleted file mode 100644 index b8ac1e207a1..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/internalOverride.kt +++ /dev/null @@ -1,29 +0,0 @@ -open class A { - internal open val field = "AF" - - internal open fun test(): String = "AM" -} - -fun invokeOnA(a: A) = a.test() + a.field - -class Z : A() { - override val field: String = "ZF" - - override fun test(): String = "ZM" -} - -fun box() : String { - var invokeOnA = invokeOnA(A()) - if (invokeOnA != "AMAF") return "fail 1: $invokeOnA" - - invokeOnA = invokeOnA(Z()) - if (invokeOnA != "ZMZF") return "fail 2: $invokeOnA" - - val z = Z().test() - if (z != "ZM") return "fail 3: $z" - - val f = Z().field - if (f != "ZF") return "fail 4: $f" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/mangling/internalOverrideSuperCall.kt b/backend.native/tests/external/codegen/box/mangling/internalOverrideSuperCall.kt deleted file mode 100644 index 64424c1dd80..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/internalOverrideSuperCall.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class A { - internal open val field = "F" - - internal open fun test(): String = "A" -} - -class Z : A() { - override fun test(): String = super.test() - - override val field = super.field -} - -fun box() : String { - val z = Z().test() - if (z != "A") return "fail 1: $z" - - val f = Z().field - if (f != "F") return "fail 2: $f" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/mangling/noOverrideWithJava.kt b/backend.native/tests/external/codegen/box/mangling/noOverrideWithJava.kt deleted file mode 100644 index 0e5a23013c9..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/noOverrideWithJava.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass extends A { - public String test() { - return "Java"; - } -} - -// FILE: test.kt - -open class A { - internal open fun test(): String = "Kotlin" -} - -fun box(): String { - if (A().test() != "Kotlin") return "fail 1: ${A().test()}" - - if (JavaClass().test() != "Java") return "fail 2: ${JavaClass().test()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/mangling/publicOverride.kt b/backend.native/tests/external/codegen/box/mangling/publicOverride.kt deleted file mode 100644 index 0087a1fbc66..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/publicOverride.kt +++ /dev/null @@ -1,29 +0,0 @@ -open class A { - internal open val field = "AF" - - internal open fun test(): String = "AM" -} - -fun invokeOnA(a: A) = a.test() + a.field - -class Z : A() { - public override val field: String = "ZF" - - public override fun test(): String = "ZM" -} - -fun box() : String { - var invokeOnA = invokeOnA(A()) - if (invokeOnA != "AMAF") return "fail 1: $invokeOnA" - - invokeOnA = invokeOnA(Z()) - if (invokeOnA != "ZMZF") return "fail 2: $invokeOnA" - - val z = Z().test() - if (z != "ZM") return "fail 3: $z" - - val f = Z().field - if (f != "ZF") return "fail 4: $f" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/mangling/publicOverrideSuperCall.kt b/backend.native/tests/external/codegen/box/mangling/publicOverrideSuperCall.kt deleted file mode 100644 index 422f510101e..00000000000 --- a/backend.native/tests/external/codegen/box/mangling/publicOverrideSuperCall.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class A { - internal open val field = "F" - - internal open fun test(): String = "A" -} - -class Z : A() { - public override fun test(): String = super.test() - - public override val field = super.field -} - -fun box() : String { - val z = Z().test() - if (z != "A") return "fail 1: $z" - - val f = Z().field - if (f != "F") return "fail 2: $f" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/ComplexInitializer.kt b/backend.native/tests/external/codegen/box/multiDecl/ComplexInitializer.kt deleted file mode 100644 index 14e38239d17..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/ComplexInitializer.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun A.getA() = this - -fun box() : String { - val (a, b) = A().getA().getA() - - return if (a == 1 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/SimpleVals.kt b/backend.native/tests/external/codegen/box/multiDecl/SimpleVals.kt deleted file mode 100644 index 9f438f3fe71..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/SimpleVals.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun box() : String { - val (a, b) = A() - return if (a == 1 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/SimpleValsExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/SimpleValsExtensions.kt deleted file mode 100644 index cab08120cb0..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/SimpleValsExtensions.kt +++ /dev/null @@ -1,10 +0,0 @@ -class A { -} - -operator fun A.component1() = 1 -operator fun A.component2() = 2 - -fun box() : String { - val (a, b) = A() - return if (a == 1 && b == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/SimpleVarsExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/SimpleVarsExtensions.kt deleted file mode 100644 index 525d1234901..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/SimpleVarsExtensions.kt +++ /dev/null @@ -1,10 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun box() : String { - var (a, b) = A() - a = b - return if (a == 2 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/UnderscoreNames.kt b/backend.native/tests/external/codegen/box/multiDecl/UnderscoreNames.kt deleted file mode 100644 index 3d38c505f6a..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/UnderscoreNames.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun box() : String { - val (_, b) = A() - - val (a, _) = A() - - val (`_`, c) = A() - - return if (a == 1 && b == 2 && `_` == 1 && c == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInFunctionLiteral.kt b/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInFunctionLiteral.kt deleted file mode 100644 index 4bf9bdcd08c..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInFunctionLiteral.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun box() : String { - val (a, b) = A() - - val run = { - a - } - return if (run() == 1 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInLocalFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInLocalFunction.kt deleted file mode 100644 index 91dfb1d7eb5..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInLocalFunction.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - -fun box() : String { - val (a, b) = A() - - fun run(): Int { - return a - } - return if (run() == 1 && b == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInObjectLiteral.kt b/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInObjectLiteral.kt deleted file mode 100644 index 9e194386e6a..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/ValCapturedInObjectLiteral.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - - -fun box() : String { - val (a, b) = A() - - val local = object { - public fun run() : Int { - return a - } - } - return if (local.run() == 1 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInFunctionLiteral.kt b/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInFunctionLiteral.kt deleted file mode 100644 index e0eb2cb5edd..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInFunctionLiteral.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - - -fun box() : String { - var (a, b) = A() - - val local = { - a = 3 - } - local() - return if (a == 3 && b == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInLocalFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInLocalFunction.kt deleted file mode 100644 index 5c2a87c9d65..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInLocalFunction.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { -} - -operator fun A.component1() = 1 -operator fun A.component2() = 2 - -fun box() : String { - var (a, b) = A() - - fun local() { - a = 3 - } - local() - return if (a == 3 && b == 2) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInObjectLiteral.kt b/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInObjectLiteral.kt deleted file mode 100644 index 48534b362c6..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/VarCapturedInObjectLiteral.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 2 -} - - -fun box() : String { - var (a, b) = A() - - val local = object { - public fun run() { - a = 3 - } - } - local.run() - return if (a == 3 && b == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/component.kt b/backend.native/tests/external/codegen/box/multiDecl/component.kt deleted file mode 100644 index efd446f8df6..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/component.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -class S(val a: String, val b: String) { - operator fun component1() : String = a - operator fun component2() : String = b -} - -operator fun S.component3() = ((a + b) as String).substring(2) - -class Tester() { - fun box() : String { - val (o,k,ok,ok2) = S("O","K") - return o + k + ok + ok2 - } - - operator fun S.component4() = ((a + b) as String).substring(2) -} - -fun box() = Tester().box() diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclFor.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclFor.kt deleted file mode 100644 index d3fce253d5a..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclFor.kt +++ /dev/null @@ -1,21 +0,0 @@ -class C(val i: Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 -} - -fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(C(0)) - l.add(C(1)) - l.add(C(2)) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentExtensions.kt deleted file mode 100644 index fb470307de3..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,22 +0,0 @@ -class C(val i: Int) { -} - -operator fun C.component1() = i + 1 -operator fun C.component2() = i + 2 - -fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(C(0)) - l.add(C(1)) - l.add(C(2)) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 344e2051fc9..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -class C(val i: Int) { -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 - - fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val l = ArrayList() - l.add(C(0)) - l.add(C(1)) - l.add(C(2)) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 2b223cd505e..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,24 +0,0 @@ -class C(val i: Int) { -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 -} - -fun M.doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(C(0)) - l.add(C(1)) - l.add(C(2)) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForValCaptured.kt deleted file mode 100644 index a744e0370ee..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/MultiDeclForValCaptured.kt +++ /dev/null @@ -1,21 +0,0 @@ -class C(val i: Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 -} - -fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(C(0)) - l.add(C(1)) - l.add(C(2)) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt deleted file mode 100644 index e9facb62192..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,19 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(0) - l.add(1) - l.add(2) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index 7afc1023d61..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,19 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(0) - l.add(1) - l.add(2) - val s = doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 499b2e18356..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,21 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 - - fun doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val l = ArrayList() - l.add(0) - l.add(1) - l.add(2) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index b20eb9d7453..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,21 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 -} - -fun M.doTest(l : ArrayList): String { - var s = "" - for ((a, b) in l) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val l = ArrayList() - l.add(0) - l.add(1) - l.add(2) - val s = M().doTest(l) - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclFor.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclFor.kt deleted file mode 100644 index ceabb3396b0..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclFor.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - operator fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0)..C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentExtensions.kt deleted file mode 100644 index edcd9c1188e..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun rangeTo(c: C) = Range(this, c) -} -operator fun C.component1() = i + 1 -operator fun C.component2() = i + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in C(0)..C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 3692148f5b5..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,38 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in C(0)..C(2)) { - s += "$a:$b;" - } - return s - } -} - - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 80258eee8e6..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,37 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in C(0)..C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForValCaptured.kt deleted file mode 100644 index 4687822bb09..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/MultiDeclForValCaptured.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - operator fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0)..C(2)) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNames.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNames.kt deleted file mode 100644 index 9139c8cd549..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNames.kt +++ /dev/null @@ -1,43 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - operator fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, _) in C(0)..C(2)) { - s += "$a;" - } - - for ((_, b) in C(1)..C(3)) { - s += "$b;" - } - - for ((_, `_`) in C(2)..C(4)) { - s += "$`_`;" - } - - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1;2;3;3;4;5;4;5;6;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt deleted file mode 100644 index 644125c9809..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - operator fun component1() = "O" - operator fun component2(): String = throw RuntimeException("fail 0") - operator fun component3() = "K" -} - -fun box(): String { - val aA = Array(1) { A() } - - for ((x, _, z) in aA) { - return x + z - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt deleted file mode 100644 index 1c746927ffc..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - infix fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0) rangeTo C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 2a3ce2cf5b7..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - infix fun rangeTo(c: C) = Range(this, c) -} -operator fun C.component1() = i + 1 -operator fun C.component2() = i + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in C(0) rangeTo C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 86973dd8f4f..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,38 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += "$a:$b;" - } - return s - } -} - - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 43c353d5735..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,37 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - infix fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in C(0) rangeTo C(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt deleted file mode 100644 index b09acb4b8aa..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - infix fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0) rangeTo C(2)) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 68454565301..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index f1d711a42e2..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index b5cade5f662..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 22ed58c8d10..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 132c532501f..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index fcb229e7f75..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 664233c2d14..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 99e71d259f3..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt deleted file mode 100644 index be1dacd3f39..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 08eb7d8914d..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - fun rangeTo(c: C) = Range(this, c) -} -operator fun C.component1() = i + 1 -operator fun C.component2() = i + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 1efc37832ab..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,38 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += "$a:$b;" - } - return s - } -} - - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 7daff02f89c..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,37 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - fun rangeTo(c: C) = Range(this, c) -} - -class M { - operator fun C.component1() = i + 1 - operator fun C.component2() = i + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt deleted file mode 100644 index 8df7e251bf5..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt +++ /dev/null @@ -1,34 +0,0 @@ -class Range(val from : C, val to: C) { - operator fun iterator() = It(from, to) -} - -class It(val from: C, val to: C) { - var c = from.i - - operator fun next(): C { - val next = C(c) - c++ - return next - } - - operator fun hasNext(): Boolean = c <= to.i -} - -class C(val i : Int) { - operator fun component1() = i + 1 - operator fun component2() = i + 2 - fun rangeTo(c: C) = Range(this, c) -} - -fun doTest(): String { - var s = "" - for ((a, b) in C(0).rangeTo(C(2))) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 68454565301..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index f1d711a42e2..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index b5cade5f662..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 22ed58c8d10..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0.rangeTo(2)) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt deleted file mode 100644 index c8bc4ce6e61..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun f(l : Long) { - l.rangeTo(l) -} -fun box(): String { - return "OK" -} - - -//operator fun Long.component1() = this + 1 -//operator fun Long.component2() = this + 2 -// -//fun doTest(): String { -// var s = "" -// for ((a, b) in 0.toLong().rangeTo(2.toLong())) { -// s += "$a:$b;" -// } -// return s -//} -// -//fun box(): String { -// val s = doTest() -// return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -//} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index fcb229e7f75..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index 664233c2d14..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 99e71d259f3..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0.toLong().rangeTo(2.toLong())) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 5f60ba33287..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0..2) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index fd0f6dac885..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Int.component1() = this + 1 -operator fun Int.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0..2) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index e1a6673c11a..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0..2) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 1a20e756f0f..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Int.component1() = this + 1 - operator fun Int.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0..2) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt deleted file mode 100644 index 85f78eabcdc..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong()..2.toLong()) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt deleted file mode 100644 index 8bf72ec08d7..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt +++ /dev/null @@ -1,15 +0,0 @@ -operator fun Long.component1() = this + 1 -operator fun Long.component2() = this + 2 - -fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong()..2.toLong()) { - s += {"$a:$b;"}() - } - return s -} - -fun box(): String { - val s = doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt deleted file mode 100644 index a11156329f4..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 - - fun doTest(): String { - var s = "" - for ((a, b) in 0.toLong()..2.toLong()) { - s += "$a:$b;" - } - return s - } -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt deleted file mode 100644 index 3ee641f67f7..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt +++ /dev/null @@ -1,17 +0,0 @@ -class M { - operator fun Long.component1() = this + 1 - operator fun Long.component2() = this + 2 -} - -fun M.doTest(): String { - var s = "" - for ((a, b) in 0.toLong()..2.toLong()) { - s += "$a:$b;" - } - return s -} - -fun box(): String { - val s = M().doTest() - return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multiDecl/kt9828_hashMap.kt b/backend.native/tests/external/codegen/box/multiDecl/kt9828_hashMap.kt deleted file mode 100644 index 8793aef1b14..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/kt9828_hashMap.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val hashMap = HashMap() - hashMap.put("one", 1) - hashMap.put("two", 2) - for ((key, value) in hashMap) { - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/multiDecl/returnInElvis.kt b/backend.native/tests/external/codegen/box/multiDecl/returnInElvis.kt deleted file mode 100644 index 9f381d75225..00000000000 --- a/backend.native/tests/external/codegen/box/multiDecl/returnInElvis.kt +++ /dev/null @@ -1,22 +0,0 @@ -data class Z(val p: String, val k: String) - - -fun create(p: Boolean): Z? { - return if (p) { - Z("O", "K") - } - else { - null; - } -} - -fun test(p: Boolean): String { - val (a, b) = create(p) ?: return "null" - return a + b -} - -fun box(): String { - if (test(false) != "null") return "fail 1: ${test(false)}" - - return test(true) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multifileClasses/callMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/box/multifileClasses/callMultifileClassMemberFromOtherPackage.kt deleted file mode 100644 index 7d110366025..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/callMultifileClassMemberFromOtherPackage.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME -// FILE: box.kt - -package test - -import b.bar - -fun box(): String = bar() - -// FILE: caller.kt - -package b - -import a.foo - -fun bar(): String = foo() - -// FILE: multifileClass.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun foo(): String = "OK" diff --git a/backend.native/tests/external/codegen/box/multifileClasses/callsToMultifileClassFromOtherPackage.kt b/backend.native/tests/external/codegen/box/multifileClasses/callsToMultifileClassFromOtherPackage.kt deleted file mode 100644 index 0dec11f9a46..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/callsToMultifileClassFromOtherPackage.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: 1.kt - -import a.* - -fun box(): String { - if (foo() != "OK") return "Fail function" - if (constOK != "OK") return "Fail const" - if (valOK != "OK") return "Fail val" - varOK = "OK" - if (varOK != "OK") return "Fail var" - - return "OK" -} - -// FILE: 2.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun foo(): String = "OK" -const val constOK: String = "OK" -val valOK: String = "OK" -var varOK: String = "Hmmm?" diff --git a/backend.native/tests/external/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt b/backend.native/tests/external/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt deleted file mode 100644 index 95b5b84301c..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT -// FILE: 1.kt - -import a.OK - -fun box(): String { - val okRef = ::OK - - val annotations = okRef.annotations - if (annotations.size != 1) { - return "Failed, annotations: $annotations" - } - - return okRef.get() -} - -// FILE: 2.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -annotation class A - -@A -const val OK: String = "OK" diff --git a/backend.native/tests/external/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt deleted file mode 100644 index 8631b9ac874..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: box.kt - -package test - -import a.foo - -fun box(): String = foo { "OK" } - -// FILE: foo.kt - -@file:[JvmName("A") JvmMultifileClass] -package a - -inline fun foo(body: () -> String): String = zee(body()) - -// FILE: zee.kt - -@file:[JvmName("A") JvmMultifileClass] -package a - -public fun zee(x: String): String = x diff --git a/backend.native/tests/external/codegen/box/multifileClasses/kt16077.kt b/backend.native/tests/external/codegen/box/multifileClasses/kt16077.kt deleted file mode 100644 index 3639809c63d..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/kt16077.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME - -@file:JvmMultifileClass - -class A { - private var r: String = "fail" - public fun getR(): String = "OK" -} - -fun box() = A().getR() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassPartsInitialization.kt b/backend.native/tests/external/codegen/box/multifileClasses/multifileClassPartsInitialization.kt deleted file mode 100644 index e13c83cb457..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassPartsInitialization.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: box.kt - -import a.* - -fun box(): String = OK - -// FILE: part1.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val O: String = "O" - -// FILE: part2.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val K: String = "K" - -// FILE: part3.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK: String = O + K - -// FILE: irrelevant.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val X: Nothing = throw AssertionError("X should not be initialized") - diff --git a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWith2Files.kt b/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWith2Files.kt deleted file mode 100644 index 5d69607f932..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWith2Files.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: Baz.java - -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} - -// FILE: bar.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = "K" - -// FILE: foo.kt - -@file:[JvmName("Util") JvmMultifileClass] -public fun foo(): String = "O" - -// FILE: test.kt - -fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithCrossCall.kt b/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithCrossCall.kt deleted file mode 100644 index 6c33e3a4c96..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithCrossCall.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: Baz.java - -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} - -// FILE: bar.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = barx() - -public fun foox(): String = "O" - -// FILE: foo.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun foo(): String = foox() - -public fun barx(): String = "K" - -// FILE: test.kt - -fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithPrivate.kt b/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithPrivate.kt deleted file mode 100644 index 76826d27c68..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/multifileClassWithPrivate.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: Baz.java - -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} - -// FILE: bar.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = barx() - -private fun barx(): String = "K" - -// FILE: foo.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun foo(): String = foox() - -private fun foox(): String = "O" - -// FILE: test.kt - -fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToFun.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToFun.kt deleted file mode 100644 index d145418ecd8..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToFun.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = (::ok)() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun ok() = "OK" diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToInternalValInline.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToInternalValInline.kt deleted file mode 100644 index 336a84e7a87..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToInternalValInline.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = okInline() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -internal val ok = run { "OK" } - -internal inline fun okInline() = - ::ok.get() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToPrivateVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToPrivateVal.kt deleted file mode 100644 index a9784f16796..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToPrivateVal.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = OK.okRef.get() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val ok = run { "OK" } - -object OK { - val okRef = ::ok -} diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToVal.kt deleted file mode 100644 index bd037033d92..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/callableRefToVal.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = ::OK.get() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK = run { "OK" } diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/calls.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/calls.kt deleted file mode 100644 index a142522a53d..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/calls.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: Baz.java - -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} - -// FILE: bar.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = barx() - -public fun foox(): String = "O" - -// FILE: foo.kt - -@file:JvmName("Util") -@file:JvmMultifileClass -public fun foo(): String = foox() - -public fun barx(): String = "K" - -// FILE: test.kt - -fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/deferredStaticInitialization.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/deferredStaticInitialization.kt deleted file mode 100644 index 8316d0390f6..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/deferredStaticInitialization.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = OK - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val O = run { "O" } - -// FILE: part2.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -const val K = "K" - -// FILE: part3.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK: String = run { O + K } - -// FILE: irrelevantPart.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val X1: Nothing = - throw AssertionError("X1 should not be initialized") - -// FILE: reallyIrrelevantPart.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val X2: Nothing = - throw AssertionError("X2 should not be initialized") diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/delegatedVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/delegatedVal.kt deleted file mode 100644 index 21b17c432ba..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/delegatedVal.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = OK - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK: String by lazy { "OK" } diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePrivateVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePrivateVal.kt deleted file mode 100644 index 601c1929f2c..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePrivateVal.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = ok() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val OK = run { "OK" } - -fun ok() = OK diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePublicVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePublicVal.kt deleted file mode 100644 index 94d55afdad7..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/initializePublicVal.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = OK - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -public val OK = run { "OK" } diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingFuns.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingFuns.kt deleted file mode 100644 index e2c9f9d6770..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingFuns.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = ok() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private fun overlapping() = "oops #1" - -// FILE: part2.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private fun overlapping() = "OK" - -fun ok() = overlapping() - -// FILE: part3.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private fun overlapping() = "oops #2" diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingVals.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingVals.kt deleted file mode 100644 index 3c94dafbbf4..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/overlappingVals.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = ok() - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val overlapping = run { "oops #1" } - -// FILE: part2.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val overlapping = run { "OK" } - -fun ok() = overlapping - -// FILE: part3.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val overlapping = run { "oops #2" } diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt deleted file mode 100644 index 86c3c944093..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = J.ok() - -// FILE: part1.kt -@file:[JvmName("MC") JvmMultifileClass] -package a - -val O = run { "O" } -const val K = "K" - -inline fun ok(): String { - return O + K -} - -// FILE: J.java -import a.MC; - -public class J { - public static String ok() { - return MC.ok(); - } -} diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt deleted file mode 100644 index 49194fc6205..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = ok {} - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val O = run { "O" } -const val K = "K" - -inline fun ok(block: () -> Unit): String { - block() - return O + K -} diff --git a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valWithAccessor.kt b/backend.native/tests/external/codegen/box/multifileClasses/optimized/valWithAccessor.kt deleted file mode 100644 index e47c2a619c8..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/optimized/valWithAccessor.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TARGET_BACKEND: JVM -// IGNORE_LIGHT_ANALYSIS -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: box.kt - -import a.* - -fun box(): String = OK().ok - -// FILE: part1.kt -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -private val reallyOk = run { "OK" } - -class OK() { - val ok = reallyOk -} diff --git a/backend.native/tests/external/codegen/box/multifileClasses/privateConstVal.kt b/backend.native/tests/external/codegen/box/multifileClasses/privateConstVal.kt deleted file mode 100644 index 1e6eb93207f..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/privateConstVal.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: foo.kt -@file:JvmName("Util") -@file:JvmMultifileClass -package test - -private const val x = "O" - -fun foo() = x - -// FILE: bar.kt -@file:JvmName("Util") -@file:JvmMultifileClass -package test - -private const val x = "K" - -fun bar() = x - -// FILE: test.kt -package test - -fun box(): String = foo() + bar() diff --git a/backend.native/tests/external/codegen/box/multifileClasses/samePartNameDifferentFacades.kt b/backend.native/tests/external/codegen/box/multifileClasses/samePartNameDifferentFacades.kt deleted file mode 100644 index eeb69d5d451..00000000000 --- a/backend.native/tests/external/codegen/box/multifileClasses/samePartNameDifferentFacades.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: 1/part.kt - -@file:JvmName("Foo") -@file:JvmMultifileClass -package test - -fun foo(): String = "O" - -// FILE: 2/part.kt - -@file:JvmName("Bar") -@file:JvmMultifileClass -package test - -fun bar(): String = "K" - -// FILE: box.kt - -package test - -fun box(): String = foo() + bar() diff --git a/backend.native/tests/external/codegen/box/nonLocalReturns/kt6895.kt b/backend.native/tests/external/codegen/box/nonLocalReturns/kt6895.kt deleted file mode 100644 index 4e6fb1160a6..00000000000 --- a/backend.native/tests/external/codegen/box/nonLocalReturns/kt6895.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME - -import java.util.concurrent.locks.ReentrantReadWriteLock -import kotlin.concurrent.write - -class UpdateableThing { - private val lock = ReentrantReadWriteLock() - private var updateCount = 0 - - fun performUpdates(block: () -> T): T { - lock.write { - ++updateCount - val result = block() - --updateCount - - return result - } - } -} - - -fun box(): String { - return UpdateableThing().performUpdates { "OK" } -} diff --git a/backend.native/tests/external/codegen/box/nonLocalReturns/kt9644let.kt b/backend.native/tests/external/codegen/box/nonLocalReturns/kt9644let.kt deleted file mode 100644 index 2972f593a56..00000000000 --- a/backend.native/tests/external/codegen/box/nonLocalReturns/kt9644let.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME - -fun foo() { - with(1) { - return (1..2).forEach { it } - } -} - -fun box(): String { - foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/nonLocalReturns/localReturnInsideProperty.kt b/backend.native/tests/external/codegen/box/nonLocalReturns/localReturnInsideProperty.kt deleted file mode 100644 index 7808b367f3e..00000000000 --- a/backend.native/tests/external/codegen/box/nonLocalReturns/localReturnInsideProperty.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface ClassData - -fun f() = object : ClassData { - val someInt: Int - get() { - return 5 - } -} - -fun box(): String{ - f() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/nonLocalReturns/use.kt b/backend.native/tests/external/codegen/box/nonLocalReturns/use.kt deleted file mode 100644 index 4c6934a5ebf..00000000000 --- a/backend.native/tests/external/codegen/box/nonLocalReturns/use.kt +++ /dev/null @@ -1,177 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.io.Closeable - -class MyException(message: String) : Exception(message) - -class Holder(var value: String) { - operator fun plusAssign(s: String?) { - value += s - if (s != "closed") { - value += "->" - } - } -} - -class TestLocal() : Closeable { - - var status = Holder("") - - private fun underMutexFun() { - status += "called" - } - - fun local(): Holder { - use { - underMutexFun() - } - return status - } - - - fun nonLocalSimple(): Holder { - use { - underMutexFun() - return status - } - return Holder("fail") - } - - fun nonLocalWithException(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message!! - return status - } - } - return Holder("fail") - } - - fun nonLocalWithFinally(): Holder { - use { - try { - underMutexFun() - return Holder("fail") - } finally { - status += "finally" - return status - } - } - return Holder("fail") - } - - fun nonLocalWithExceptionAndFinally(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message - return status - } finally { - status += "finally" - } - } - return Holder("fail") - } - - fun nonLocalWithExceptionAndFinallyWithReturn(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message - return Holder("fail") - } finally { - status += "finally" - return status - } - } - return Holder("fail") - } - - fun nonLocalNestedWithException(): Holder { - use { - try { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += "exception" - return Holder("fail") - } finally { - status += "finally1" - return status - } - } finally { - status += "finally2" - } - } - return Holder("fail") - } - - fun nonLocalNestedFinally(): Holder { - use { - try { - try { - underMutexFun() - return status - } finally { - status += "finally1" - status - } - } finally { - status += "finally2" - } - } - return Holder("fail") - } - - override fun close() { - status += "closed" - } -} - -fun box(): String { - var callable = TestLocal() - var result = callable.local() - if (result.value != "called->closed") return "fail local: " + result.value - - callable = TestLocal() - result = callable.nonLocalSimple() - if (result.value != "called->closed") return "fail nonLocalSimple: " + result.value - - callable = TestLocal() - result = callable.nonLocalWithException() - if (result.value != "called->exception->closed") return "fail nonLocalWithException: " + result.value - - callable = TestLocal() - result = callable.nonLocalWithFinally() - if (result.value != "called->finally->closed") return "fail nonLocalWithFinally: " + result.value - - callable = TestLocal() - result = callable.nonLocalWithExceptionAndFinally() - if (result.value != "called->exception->finally->closed") return "fail nonLocalWithExceptionAndFinally: " + result.value - - callable = TestLocal() - result = callable.nonLocalWithExceptionAndFinallyWithReturn() - if (result.value != "called->exception->finally->closed") return "fail nonLocalWithExceptionAndFinallyWithReturn: " + result.value - - callable = TestLocal() - result = callable.nonLocalNestedWithException() - if (result.value != "called->exception->finally1->finally2->closed") return "fail nonLocalNestedWithException: " + result.value - - callable = TestLocal() - result = callable.nonLocalNestedFinally() - if (result.value != "called->finally1->finally2->closed") return "fail nonLocalNestedFinally: " + result.value - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/nonLocalReturns/useWithException.kt b/backend.native/tests/external/codegen/box/nonLocalReturns/useWithException.kt deleted file mode 100644 index f3bb63dc008..00000000000 --- a/backend.native/tests/external/codegen/box/nonLocalReturns/useWithException.kt +++ /dev/null @@ -1,190 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.io.Closeable -import kotlin.test.assertTrue -import kotlin.test.fail -import kotlin.test.assertEquals - -class MyException(message: String) : Exception(message) - -class Holder(var value: String) { - operator fun plusAssign(s: String?) { - value += s - if (s != "closed") { - value += "->" - } - } -} - -class TestLocal() : Closeable { - - var status = Holder("") - - private fun underMutexFun() { - status += "called" - } - - fun local(): Holder { - use { - underMutexFun() - } - return status - } - - - fun nonLocalSimple(): Holder { - use { - underMutexFun() - return status - } - return Holder("fail") - } - - fun nonLocalWithException(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message!! - return status - } - } - return Holder("fail") - } - - fun nonLocalWithFinally(): Holder { - use { - try { - underMutexFun() - return Holder("fail") - } finally { - status += "finally" - return status - } - } - return Holder("fail") - } - - fun nonLocalWithExceptionAndFinally(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message - return status - } finally { - status += "finally" - } - } - return Holder("fail") - } - - fun nonLocalWithExceptionAndFinallyWithReturn(): Holder { - use { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += e.message - return Holder("fail") - } finally { - status += "finally" - return status - } - } - return Holder("fail") - } - - fun nonLocalNestedWithException(): Holder { - use { - try { - try { - underMutexFun() - throw MyException("exception") - } catch (e: MyException) { - status += "exception" - return Holder("fail") - } finally { - status += "finally1" - return status - } - } finally { - status += "finally2" - } - } - return Holder("fail") - } - - fun nonLocalNestedFinally(): Holder { - use { - try { - try { - underMutexFun() - return status - } finally { - status += "finally1" - status - } - } finally { - status += "finally2" - } - } - return Holder("fail") - } - - override fun close() { - status += "closed" - throw MyException("error") - } -} - -fun box(): String { - assertError(1,"called->closed") { - local() - } - - assertError(2, "called->closed") { - nonLocalSimple() - } - - assertError(3, "called->exception->closed") { - nonLocalWithException() - } - - assertError(4, "called->finally->closed") { - nonLocalWithFinally() - } - - assertError(5, "called->exception->finally->closed") { - nonLocalWithExceptionAndFinally() - } - - assertError(6, "called->exception->finally->closed") { - nonLocalWithExceptionAndFinallyWithReturn() - } - - assertError(7, "called->exception->finally1->finally2->closed") { - nonLocalNestedWithException() - } - - assertError(8, "called->finally1->finally2->closed") { - nonLocalNestedFinally() - } - - return "OK" -} - -public fun assertError(index: Int, expected: String, l: TestLocal.()->Unit) { - val testLocal = TestLocal() - try { - testLocal.l() - fail("fail $index: no error") - } catch (e: Exception) { - assertEquals(expected, testLocal.status.value, "failed on $index") - } -} diff --git a/backend.native/tests/external/codegen/box/nullCheckOptimization/isNullable.kt b/backend.native/tests/external/codegen/box/nullCheckOptimization/isNullable.kt deleted file mode 100644 index 750f01972a0..00000000000 --- a/backend.native/tests/external/codegen/box/nullCheckOptimization/isNullable.kt +++ /dev/null @@ -1,4 +0,0 @@ -inline fun isNullable() = null is T - -fun box(): String = - if (isNullable()) "OK" else "Fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/nullCheckOptimization/kt7774.kt b/backend.native/tests/external/codegen/box/nullCheckOptimization/kt7774.kt deleted file mode 100644 index ce35467e7d7..00000000000 --- a/backend.native/tests/external/codegen/box/nullCheckOptimization/kt7774.kt +++ /dev/null @@ -1,12 +0,0 @@ -var flag = false - -inline fun foo(c: String? = null) { - if (c != null) { - flag = true - } -} - -fun box(): String { - foo() - return if (flag) "fail" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/nullCheckOptimization/trivialInstanceOf.kt b/backend.native/tests/external/codegen/box/nullCheckOptimization/trivialInstanceOf.kt deleted file mode 100644 index 89a0f2d67ad..00000000000 --- a/backend.native/tests/external/codegen/box/nullCheckOptimization/trivialInstanceOf.kt +++ /dev/null @@ -1,17 +0,0 @@ -sealed class A { - class B : A() - - class C : A() -} - -inline fun foo(): A = A.B() - -fun box(): String { - val a: A = foo() - val b: Boolean - when (a) { - is A.B -> b = true - is A.C -> b = false - } - return if (b) "OK" else "FAIL" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objectIntrinsics/objects.kt b/backend.native/tests/external/codegen/box/objectIntrinsics/objects.kt deleted file mode 100644 index 3eddefd5794..00000000000 --- a/backend.native/tests/external/codegen/box/objectIntrinsics/objects.kt +++ /dev/null @@ -1,94 +0,0 @@ -package foo - -fun box(): String { - try { - testCompanionObjectAccess() - testInCall() - testDoubleConstants() - testFloatConstants() - testLocalFun() - testTopLevelFun() - testVarTopField() - } - catch (e: Throwable) { - return "Error: \n" + e - } - - return "OK" -} - -fun testCompanionObjectAccess() { - val i = Int - val d = Double - val f = Float - val l = Long - val sh = Short - val b = Byte - val ch = Char - val st = String - val en = Enum -} - -fun testInCall() { - test(Int) - test(Double) - test(Float) - test(Long) - test(Short) - test(Byte) - test(Char) - test(String) - test(Enum) -} - -fun testDoubleConstants() { - val pi = Double.POSITIVE_INFINITY - val ni = Double.NEGATIVE_INFINITY - val nan = Double.NaN - - myAssertEquals(pi, Double.POSITIVE_INFINITY) - myAssertEquals(ni, Double.NEGATIVE_INFINITY) -} - -fun testFloatConstants() { - val pi = Float.POSITIVE_INFINITY - val ni = Float.NEGATIVE_INFINITY - val nan = Float.NaN - - myAssertEquals(pi, Float.POSITIVE_INFINITY) - myAssertEquals(ni, Float.NEGATIVE_INFINITY) -} - -fun testLocalFun() { - fun Int.Companion.LocalFun() : String = "LocalFun" - myAssertEquals("LocalFun", Int.LocalFun()) -} - -fun testTopLevelFun() { - myAssertEquals("TopFun", Int.TopFun()) -} - -fun testVarTopField() { - myAssertEquals(0, Int.TopField) - - Int.TopField++ - myAssertEquals(1, Int.TopField) - - Int.TopField += 5 - myAssertEquals(6, Int.TopField) -} - -fun test(a: Any) {} - -var _field: Int = 0 -var Int.Companion.TopField : Int - get() = _field - set(value) { _field = value }; - -fun Int.Companion.TopFun() : String = "TopFun" - -fun myAssertEquals(a: T, b: T) { - if (a != b) throw Exception("$a != $b") -} - - diff --git a/backend.native/tests/external/codegen/box/objects/anonymousObjectPropertyInitialization.kt b/backend.native/tests/external/codegen/box/objects/anonymousObjectPropertyInitialization.kt deleted file mode 100644 index 4765e8858ba..00000000000 --- a/backend.native/tests/external/codegen/box/objects/anonymousObjectPropertyInitialization.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface T { - fun foo(): String -} - -val o = object : T { - val a = "OK" - val f = { - a - }() - - override fun foo() = f -} - -fun box() = o.foo() diff --git a/backend.native/tests/external/codegen/box/objects/anonymousObjectReturnsFromTopLevelFun.kt b/backend.native/tests/external/codegen/box/objects/anonymousObjectReturnsFromTopLevelFun.kt deleted file mode 100644 index c2f14068bfe..00000000000 --- a/backend.native/tests/external/codegen/box/objects/anonymousObjectReturnsFromTopLevelFun.kt +++ /dev/null @@ -1,22 +0,0 @@ -interface IFoo { - fun foo(): String -} - -interface IBar - -private fun createAnonObject() = - object : IFoo, IBar { - override fun foo() = "foo" - fun qux(): String = "qux" - } - -fun useAnonObject() { - createAnonObject().foo() - createAnonObject().qux() -} - -fun box(): String { - if (createAnonObject().foo() != "foo") return "fail 1" - if (createAnonObject().qux() != "qux") return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/classCallsProtectedInheritedByCompanion.kt b/backend.native/tests/external/codegen/box/objects/classCallsProtectedInheritedByCompanion.kt deleted file mode 100644 index 454a3815e24..00000000000 --- a/backend.native/tests/external/codegen/box/objects/classCallsProtectedInheritedByCompanion.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A { - protected fun foo() = "OK" -} - -class B { - companion object : A() - - fun bar() = foo() -} - -fun box() = B().bar() diff --git a/backend.native/tests/external/codegen/box/objects/classCompanion.kt b/backend.native/tests/external/codegen/box/objects/classCompanion.kt deleted file mode 100644 index 66d6d588238..00000000000 --- a/backend.native/tests/external/codegen/box/objects/classCompanion.kt +++ /dev/null @@ -1,19 +0,0 @@ -var result = "" - -class A { - - companion object { - - val prop = test() - - fun test(): String { - result += "OK" - return result - } - } -} - -fun box(): String { - if (A.prop != "OK") return "fail ${A.prop}" - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/flist.kt b/backend.native/tests/external/codegen/box/objects/flist.kt deleted file mode 100644 index 9da8a335ad7..00000000000 --- a/backend.native/tests/external/codegen/box/objects/flist.kt +++ /dev/null @@ -1,53 +0,0 @@ -public abstract class FList() { - public abstract val head: T - public abstract val tail: FList - public abstract val empty: Boolean - - companion object { - val emptyFList = object: FList() { - public override val head: Any - get() = throw UnsupportedOperationException(); - - public override val tail: FList - get() = this - - public override val empty: Boolean - get() = true - } - } - - operator fun plus(head: T): FList = object : FList() { - override public val head: T - get() = head - - override public val empty: Boolean - get() = false - - override public val tail: FList - get() = this@FList - } -} - -public fun emptyFList(): FList = FList.emptyFList as FList - -public fun FList.reverse(where: FList = emptyFList()) : FList = - if(empty) where else tail.reverse(where + head) - -operator fun FList.iterator(): Iterator = object: Iterator { - private var cur: FList = this@iterator - - override public fun next(): T { - val res = cur.head - cur = cur.tail - return res - } - override public fun hasNext(): Boolean = !cur.empty -} - -fun box() : String { - var r = "" - for(s in (emptyFList() + "O" + "K").reverse()) { - r += s - } - return r -} diff --git a/backend.native/tests/external/codegen/box/objects/initializationOrder.kt b/backend.native/tests/external/codegen/box/objects/initializationOrder.kt deleted file mode 100644 index 2281132636b..00000000000 --- a/backend.native/tests/external/codegen/box/objects/initializationOrder.kt +++ /dev/null @@ -1,16 +0,0 @@ -var result = "OK" - -class A { - companion object { - var z = result - - fun patchResult() { - result = "fail" - } - } -} - -fun box(): String { - A.patchResult() - return A.z -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/interfaceCompanion.kt b/backend.native/tests/external/codegen/box/objects/interfaceCompanion.kt deleted file mode 100644 index 924329d3b37..00000000000 --- a/backend.native/tests/external/codegen/box/objects/interfaceCompanion.kt +++ /dev/null @@ -1,19 +0,0 @@ -var result = "" - -interface A { - - companion object { - - val prop = test() - - fun test(): String { - result += "OK" - return result - } - } -} - -fun box(): String { - if (A.prop != "OK") return "fail ${A.prop}" - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/interfaceCompanionObjectReference.kt b/backend.native/tests/external/codegen/box/objects/interfaceCompanionObjectReference.kt deleted file mode 100644 index 6624b0a2bc9..00000000000 --- a/backend.native/tests/external/codegen/box/objects/interfaceCompanionObjectReference.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -interface Test { - companion object { - val x = "OK" - - val y1 = Test.x - - val y2 = 42.let { x } - - val y3: String - init { - fun localFun() = x - y3 = localFun() - } - - fun method() = x - val y4 = method() - - val anonObject = object { - override fun toString() = x - } - val y5 = anonObject.toString() - - init { - assertEquals(x, y1) - assertEquals(x, y2) - assertEquals(x, y3) - assertEquals(x, y4) - assertEquals(x, y5) - } - } -} - -fun box() = Test.x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/kt1047.kt b/backend.native/tests/external/codegen/box/objects/kt1047.kt deleted file mode 100644 index cc10922307f..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt1047.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -public open class Test() { - open public fun test() : Unit { - System.out?.println(hello) - } - companion object { - private val hello : String? = "Hello" - } -} - -fun box() : String { - Test().test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt11117.kt b/backend.native/tests/external/codegen/box/objects/kt11117.kt deleted file mode 100644 index 439f80a6723..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt11117.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A(val value: String) - -fun A.test(): String { - val o = object { - val z: String - init { - val x = value + "K" - z = x - } - } - return o.z -} - -fun box(): String { - return A("O").test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/kt1136.kt b/backend.native/tests/external/codegen/box/objects/kt1136.kt deleted file mode 100644 index 9caf5855971..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt1136.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TARGET_BACKEND: JVM - -public object SomeObject { - private val workerThread = object : Thread() { - override fun run() { - foo() - } - } - - init { - workerThread.start() - } - - private fun foo() : Unit { - } -} - -public class SomeClass() { - inner class Inner { - val copy = list - } - - private val list = ArrayList() - var status : Throwable? = null - private val workerThread = object : Thread() { - public override fun run() { - try { - list.add("123") - list.add("33") - Inner().copy.add("444") - } - catch(t: Throwable) { - status = t - } - } - } - - init { - workerThread.start() - workerThread.join() - } -} - -public fun box(): String { - var obj = SomeClass() - return if (obj.status == null) "OK" else { - (obj.status as java.lang.Throwable).printStackTrace() - "failed" - } -} diff --git a/backend.native/tests/external/codegen/box/objects/kt1186.kt b/backend.native/tests/external/codegen/box/objects/kt1186.kt deleted file mode 100644 index 6100f7092fa..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt1186.kt +++ /dev/null @@ -1,28 +0,0 @@ -enum class Color(val rgb : Int) { - RED(0xFF0000), - GREEN(0x00FF00), - BLUE(0x0000FF) -} - -enum class Direction { - NORTH, - SOUTH, - WEST, - EAST -} - -fun bar(c: Color) = when (c) { - Color.RED -> 1 - Color.GREEN -> 2 - Color.BLUE -> 3 -} - -fun foo(d: Direction) = when(d) { - Direction.NORTH -> 1 - Direction.SOUTH -> 2 - Direction.WEST -> 3 - Direction.EAST -> 4 -} - -fun box() : String = - if (foo(Direction.EAST) == 4 && bar(Color.GREEN) == 2) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/objects/kt1600.kt b/backend.native/tests/external/codegen/box/objects/kt1600.kt deleted file mode 100644 index e9f111a98b3..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt1600.kt +++ /dev/null @@ -1,8 +0,0 @@ -abstract class Foo { - fun hello(id: T) = "O$id" -} - -class Bar: Foo() { -} - -fun box() = Bar().hello("K") diff --git a/backend.native/tests/external/codegen/box/objects/kt1737.kt b/backend.native/tests/external/codegen/box/objects/kt1737.kt deleted file mode 100644 index 583cac8e39d..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt1737.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - return object { - fun foo(): String { - val f = {} - object : Runnable { - public override fun run() { - f() - } - } - return "OK" - } - }.foo() -} diff --git a/backend.native/tests/external/codegen/box/objects/kt18982.kt b/backend.native/tests/external/codegen/box/objects/kt18982.kt deleted file mode 100644 index daf03fb9bf6..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt18982.kt +++ /dev/null @@ -1,9 +0,0 @@ -import Foo.bar0 as bar - -object Foo { - val bar0 = "OK" - - fun test() = bar0 -} - -fun box() = Foo.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/kt2398.kt b/backend.native/tests/external/codegen/box/objects/kt2398.kt deleted file mode 100644 index a8b11518d1a..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2398.kt +++ /dev/null @@ -1,18 +0,0 @@ -class C { - public object Obj { - val o = "O" - - object InnerObj { - fun k() = "K" - } - - class D { - val ko = "KO" - } - } -} - -fun box(): String { - val res = C.Obj.o + C.Obj.InnerObj.k() + C.Obj.D().ko - return if (res == "OKKO") "OK" else "Fail: $res" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt2663.kt b/backend.native/tests/external/codegen/box/objects/kt2663.kt deleted file mode 100644 index b7dad56133f..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2663.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box() : String { - var a = 1 - - object { - init { - a = 2 - } - } - return if (a == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt2663_2.kt b/backend.native/tests/external/codegen/box/objects/kt2663_2.kt deleted file mode 100644 index 01007832059..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2663_2.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box() : String { - var a = 1 - - (object: Runnable { - override public fun run() { - a = 2 - } - }).run() - return if (a == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt2675.kt b/backend.native/tests/external/codegen/box/objects/kt2675.kt deleted file mode 100644 index 3cd63cc3262..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2675.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A() { - - fun ok() = Foo.Bar.bar() + Foo.Bar.barv - - private object Foo { - fun foo() = "O" - val foov = "K" - - public object Bar { - fun bar() = foo() - val barv = foov - } - } -} - -fun box() = A().ok() diff --git a/backend.native/tests/external/codegen/box/objects/kt2719.kt b/backend.native/tests/external/codegen/box/objects/kt2719.kt deleted file mode 100644 index 908dbb3a1be..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2719.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Clazz { - companion object { - val a = object { - fun run(x: String) = x - } - } -} - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/objects/kt2822.kt b/backend.native/tests/external/codegen/box/objects/kt2822.kt deleted file mode 100644 index 740aaf1698c..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt2822.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class A { - fun foo() = "OK" -} - -fun box() = object : A() { - fun bar() = super.foo() -}.bar() diff --git a/backend.native/tests/external/codegen/box/objects/kt3238.kt b/backend.native/tests/external/codegen/box/objects/kt3238.kt deleted file mode 100644 index b1adf30137b..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt3238.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -object Obj { - class Inner() { - fun ok() = "OK" - } -} - -fun box() : String { - val klass = Class.forName("Obj\$Inner")!! - val cons = klass.getConstructors()!![0] - val inner = cons.newInstance(*(arrayOfNulls(0) as Array)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt3684.kt b/backend.native/tests/external/codegen/box/objects/kt3684.kt deleted file mode 100644 index 53e742f1764..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt3684.kt +++ /dev/null @@ -1,16 +0,0 @@ -open class X(private val n: String) { - - fun foo(): String { - return object : X("inner") { - fun print(): String { - return n; - } - }.print() - } -} - - -fun box() : String { - return X("OK").foo() -} - diff --git a/backend.native/tests/external/codegen/box/objects/kt4086.kt b/backend.native/tests/external/codegen/box/objects/kt4086.kt deleted file mode 100644 index 2aa1ca343d8..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt4086.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface N - -open class Base(n: N) - -class Derived : Base(object: N{}) { - -} - -fun box() : String { - Derived() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/kt535.kt b/backend.native/tests/external/codegen/box/objects/kt535.kt deleted file mode 100644 index 3821753c731..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt535.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class Identifier(t : T?, myHasDollar : Boolean) { - private val myT : T? - - public fun getName() : T? { return myT } - - companion object { - open public fun init(name : T?) : Identifier { - val id = Identifier(name, false) - return id - } - } - init { - myT = t - } -} - -fun box() : String { - var i3 : Identifier? = Identifier.init("name") - System.out?.println(i3?.getName()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt560.kt b/backend.native/tests/external/codegen/box/objects/kt560.kt deleted file mode 100644 index a641c825feb..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt560.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package while_bug_1 - -import java.io.* - -open class AllEvenNum() { - - companion object { - open public fun main(args : Array?) : Unit { - var i : Int = 1 - while ((i <= 100)) { - { - if (((i % 2) == 0)) - { - System.out?.print((i.toString() + ",")) - } - - } - i = i + 1 - } - } - - } -} - -fun box() : String { - AllEvenNum.main(arrayOfNulls(0)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/kt694.kt b/backend.native/tests/external/codegen/box/objects/kt694.kt deleted file mode 100644 index 945e1298489..00000000000 --- a/backend.native/tests/external/codegen/box/objects/kt694.kt +++ /dev/null @@ -1,18 +0,0 @@ -enum class Test { - A, - B, - C -} - -fun checkA(a: Test) = when(a) { - Test.B -> false - Test.A -> true - else -> false -} - -fun box() : String { - if(!checkA(Test.A)) return "fail" - if( checkA(Test.C)) return "fail" - if( checkA(Test.B)) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/localFunctionInObjectInitializer_kt4516.kt b/backend.native/tests/external/codegen/box/objects/localFunctionInObjectInitializer_kt4516.kt deleted file mode 100644 index c59e782da64..00000000000 --- a/backend.native/tests/external/codegen/box/objects/localFunctionInObjectInitializer_kt4516.kt +++ /dev/null @@ -1,17 +0,0 @@ - -object O { - val mmmap = HashMap(); - - init { - fun doStuff() { - mmmap.put("two", 2) - } - doStuff() - } -} - -fun box(): String { - val r = O.mmmap["two"] - if (r != 2) return "Fail: $r" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/methodOnObject.kt b/backend.native/tests/external/codegen/box/objects/methodOnObject.kt deleted file mode 100644 index bdff2a1fec1..00000000000 --- a/backend.native/tests/external/codegen/box/objects/methodOnObject.kt +++ /dev/null @@ -1,5 +0,0 @@ -object A { - fun result() = "OK" -} - -fun box(): String = A.result() diff --git a/backend.native/tests/external/codegen/box/objects/nestedDerivedClassCallsProtectedFromCompanion.kt b/backend.native/tests/external/codegen/box/objects/nestedDerivedClassCallsProtectedFromCompanion.kt deleted file mode 100644 index a9a05baa90e..00000000000 --- a/backend.native/tests/external/codegen/box/objects/nestedDerivedClassCallsProtectedFromCompanion.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class A { - companion object { - protected fun foo() = "OK" - } - class B : A() { - fun bar() = foo() - } -} - -fun box() = A.B().bar() diff --git a/backend.native/tests/external/codegen/box/objects/nestedObjectWithSuperclass.kt b/backend.native/tests/external/codegen/box/objects/nestedObjectWithSuperclass.kt deleted file mode 100644 index 596801c7050..00000000000 --- a/backend.native/tests/external/codegen/box/objects/nestedObjectWithSuperclass.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A (val s: Int) { - open fun foo(): Int { - return s - } -} - -object Outer: A(1) { - object O: A(2) { - override fun foo(): Int { - val s = super.foo() - return s + 3 - } - } -} - -fun box() : String { - return if (Outer.O.foo() == 5) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/object.kt b/backend.native/tests/external/codegen/box/objects/object.kt deleted file mode 100644 index 8ce9ee1c9ba..00000000000 --- a/backend.native/tests/external/codegen/box/objects/object.kt +++ /dev/null @@ -1,15 +0,0 @@ -var result = "" - -object A { - val prop = test() - - fun test(): String { - result += "OK" - return result - } -} - -fun box(): String { - if (A.prop != "OK") return "fail ${A.prop}" - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/objectExtendsInnerAndReferencesOuterMember.kt b/backend.native/tests/external/codegen/box/objects/objectExtendsInnerAndReferencesOuterMember.kt deleted file mode 100644 index def3f9f7616..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectExtendsInnerAndReferencesOuterMember.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - val x: Any get() { - return object : Inner() { - override fun toString() = foo() - } - } - - open inner class Inner - fun foo() = "OK" -} - -fun box(): String = A().x.toString() diff --git a/backend.native/tests/external/codegen/box/objects/objectInLocalAnonymousObject.kt b/backend.native/tests/external/codegen/box/objects/objectInLocalAnonymousObject.kt deleted file mode 100644 index f21c93edf75..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectInLocalAnonymousObject.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - var boo = "OK" - var foo = object { - val bar = object { - val baz = boo - } - } - - return foo.bar.baz -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/objectInitialization_kt5523.kt b/backend.native/tests/external/codegen/box/objects/objectInitialization_kt5523.kt deleted file mode 100644 index 3238fe1f9ce..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectInitialization_kt5523.kt +++ /dev/null @@ -1,6 +0,0 @@ -object A { - val a = "OK" - val b = A.a -} - -fun box() = A.b diff --git a/backend.native/tests/external/codegen/box/objects/objectLiteral.kt b/backend.native/tests/external/codegen/box/objects/objectLiteral.kt deleted file mode 100644 index e6030a1ccd9..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectLiteral.kt +++ /dev/null @@ -1,18 +0,0 @@ -class C(x: Int, val y: Int) { - fun initChild(x0: Int): Any { - var x = x0 - return object { - override fun toString(): String { - x = x + y - return "child" + x - } - } - } - - val child = initChild(x) -} - -fun box(): String { - val c = C(10, 3) - return if (c.child.toString() == "child13" && c.child.toString() == "child16" && c.child.toString() == "child19") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/objects/objectLiteralInClosure.kt b/backend.native/tests/external/codegen/box/objects/objectLiteralInClosure.kt deleted file mode 100644 index 49e19260616..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectLiteralInClosure.kt +++ /dev/null @@ -1,17 +0,0 @@ -package p - -private class C(val y: Int) { - val initChild = { -> - object { - override fun toString(): String { - return "child" + y - } - } - } -} - -fun box(): String { - val c = C(3).initChild - val x = c().toString() - return if (x == "child3") "OK" else x -} diff --git a/backend.native/tests/external/codegen/box/objects/objectVsClassInitialization_kt5291.kt b/backend.native/tests/external/codegen/box/objects/objectVsClassInitialization_kt5291.kt deleted file mode 100644 index 88ec3c5bb6e..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectVsClassInitialization_kt5291.kt +++ /dev/null @@ -1,24 +0,0 @@ -public inline fun T.with(f: T.() -> Unit): T { - this.f() - return this -} - -public class Cls { - val string = "Cls" - val buffer = StringBuilder().with { - append(string) - } -} - -public object Obj { - val string = "Obj" - val buffer = StringBuilder().with { - append(string) - } -} - -fun box(): String { - if (Cls().buffer.toString() != "Cls") return "Fail class" - if (Obj.buffer.toString() != "Obj") return "Fail object" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/objectWithSuperclass.kt b/backend.native/tests/external/codegen/box/objects/objectWithSuperclass.kt deleted file mode 100644 index 31c004a45fb..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectWithSuperclass.kt +++ /dev/null @@ -1,16 +0,0 @@ -open class A { - open fun foo(): Int { - return 2 - } -} - -object O: A() { - override fun foo(): Int { - val s = super.foo() - return s + 3 - } -} - -fun box() : String { - return if (O.foo() == 5) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/objects/objectWithSuperclassAndTrait.kt b/backend.native/tests/external/codegen/box/objects/objectWithSuperclassAndTrait.kt deleted file mode 100644 index c239a3eff27..00000000000 --- a/backend.native/tests/external/codegen/box/objects/objectWithSuperclassAndTrait.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class A { - open fun foo(): Int { - return 2 - } -} - -interface T { - open fun foo(): Int { - return 3 - } -} - -object O: A(), T { - override fun foo(): Int { - return super.foo() + super.foo() - } -} - -fun box() : String { - return if (O.foo() == 5) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/objects/privateExtensionFromInitializer_kt4543.kt b/backend.native/tests/external/codegen/box/objects/privateExtensionFromInitializer_kt4543.kt deleted file mode 100644 index ffcb2ada647..00000000000 --- a/backend.native/tests/external/codegen/box/objects/privateExtensionFromInitializer_kt4543.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A(val result: String) - -fun a(body: A.() -> String): String { - val r = A("OK") - return r.body() -} - -object C { - private fun A.f() = result - - val g = a { - f() - } -} - -fun box() = C.g diff --git a/backend.native/tests/external/codegen/box/objects/privateFunctionFromClosureInInitializer_kt5582.kt b/backend.native/tests/external/codegen/box/objects/privateFunctionFromClosureInInitializer_kt5582.kt deleted file mode 100644 index 5b71ab435fe..00000000000 --- a/backend.native/tests/external/codegen/box/objects/privateFunctionFromClosureInInitializer_kt5582.kt +++ /dev/null @@ -1,20 +0,0 @@ -interface T - -object Foo { - private fun foo(p: T) = p - - private val v: Int = { - val x = foo(O) - 42 - }() - - private object O : T - - val result = v -} - -fun box(): String { - val foo = Foo - if (foo.result != 42) return "Fail: ${foo.result}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/receiverInConstructor.kt b/backend.native/tests/external/codegen/box/objects/receiverInConstructor.kt deleted file mode 100644 index b3b7a3dcb57..00000000000 --- a/backend.native/tests/external/codegen/box/objects/receiverInConstructor.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class A(open val v: String) - -fun A.a(newv: String) = object: A("fail") { - override val v = this@a.v + newv -} - -fun box() = A("O").a("K").v diff --git a/backend.native/tests/external/codegen/box/objects/safeAccess.kt b/backend.native/tests/external/codegen/box/objects/safeAccess.kt deleted file mode 100644 index bbb2c6db410..00000000000 --- a/backend.native/tests/external/codegen/box/objects/safeAccess.kt +++ /dev/null @@ -1,7 +0,0 @@ -// KT-5159 - -object Test { - val a = "OK" -} - -fun box(): String = Test?.a diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInAnonymousObjectInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInAnonymousObjectInSuperConstructorCall.kt deleted file mode 100644 index 099a68bfe1f..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInAnonymousObjectInSuperConstructorCall.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface IFn { - operator fun invoke(): String -} - -abstract class Base(val fn: IFn) - -class Host { - companion object : Base( - object : IFn { - override fun invoke(): String = Host.ok() - } - ) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInConstructorBody.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInConstructorBody.kt deleted file mode 100644 index 892e82811a1..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInConstructorBody.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Test { - companion object { - fun ok() = "OK" - val x = run { Test.ok() } - fun test() = x - } -} - -fun box() = Test.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInSuperConstructorCall.kt deleted file mode 100644 index fc2a08dd42e..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInInlineLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class Base(val fn: () -> String) - -class Host { - companion object : Base(run { { Host.ok() } }) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInLambdaInSuperConstructorCall.kt deleted file mode 100644 index ff1e7b7f631..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToCompanionObjectInLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class Base(val fn: () -> String) - -class Host { - companion object : Base({ Host.ok() }) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInAnonymousObjectInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInAnonymousObjectInSuperConstructorCall.kt deleted file mode 100644 index f1b33e5ba20..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInAnonymousObjectInSuperConstructorCall.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface IFn { - operator fun invoke(): String -} - -abstract class Base(val fn: IFn) - -interface Host { - companion object : Base( - object : IFn { - override fun invoke(): String = Host.ok() - } - ) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInConstructorBody.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInConstructorBody.kt deleted file mode 100644 index faccd52f1a4..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInConstructorBody.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface Test { - companion object { - fun ok() = "OK" - val x = run { Test.ok() } - fun test() = x - } -} - -fun box() = Test.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInSuperConstructorCall.kt deleted file mode 100644 index 226506094b2..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInInlineLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class Base(val fn: () -> String) - -interface Host { - companion object : Base(run { { Host.ok() } }) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInLambdaInSuperConstructorCall.kt deleted file mode 100644 index a6e6f034c26..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToInterfaceCompanionObjectInLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class Base(val fn: () -> String) - -interface Host { - companion object : Base({ Host.ok() }) { - fun ok() = "OK" - } -} - -fun box() = Host.Companion.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInAnonymousObjectInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInAnonymousObjectInSuperConstructorCall.kt deleted file mode 100644 index 2239c1b09e9..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInAnonymousObjectInSuperConstructorCall.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface IFn { - operator fun invoke(): String -} - -abstract class Base(val fn: IFn) - -object Test : Base( - object : IFn { - override fun invoke(): String = Test.ok() - } -) { - fun ok() = "OK" -} - -fun box() = Test.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInConstructorBody.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInConstructorBody.kt deleted file mode 100644 index 88cfbb44f32..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInConstructorBody.kt +++ /dev/null @@ -1,7 +0,0 @@ -object Test { - fun ok() = "OK" - val x = run { Test.ok() } - fun test() = x -} - -fun box() = Test.test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInSuperConstructorCall.kt deleted file mode 100644 index 045499084e6..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInInlineLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,7 +0,0 @@ -abstract class Base(val fn: () -> String) - -object Test : Base(run { { Test.ok() } }) { - fun ok() = "OK" -} - -fun box() = Test.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInLambdaInSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInLambdaInSuperConstructorCall.kt deleted file mode 100644 index e12b6882c7d..00000000000 --- a/backend.native/tests/external/codegen/box/objects/selfReferenceToObjectInLambdaInSuperConstructorCall.kt +++ /dev/null @@ -1,7 +0,0 @@ -abstract class Base(val fn: () -> String) - -object Test : Base({ Test.ok() }) { - fun ok() = "OK" -} - -fun box() = Test.fn() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/simpleObject.kt b/backend.native/tests/external/codegen/box/objects/simpleObject.kt deleted file mode 100644 index 5b78c077a6e..00000000000 --- a/backend.native/tests/external/codegen/box/objects/simpleObject.kt +++ /dev/null @@ -1,7 +0,0 @@ -object A { - val x: Int = 610 -} - -fun box() : String { - return if (A.x != 610) "fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/objects/thisInConstructor.kt b/backend.native/tests/external/codegen/box/objects/thisInConstructor.kt deleted file mode 100644 index 02f4ce346c9..00000000000 --- a/backend.native/tests/external/codegen/box/objects/thisInConstructor.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class A(open val v: String) { -} - -open class B(open val v: String) { - fun a(newv: String) = object: A("fail") { - override val v = this@B.v + newv - } -} - -fun box() = B("O").a("K").v diff --git a/backend.native/tests/external/codegen/box/objects/useAnonymousObjectAsIterator.kt b/backend.native/tests/external/codegen/box/objects/useAnonymousObjectAsIterator.kt deleted file mode 100644 index 4b492007eb1..00000000000 --- a/backend.native/tests/external/codegen/box/objects/useAnonymousObjectAsIterator.kt +++ /dev/null @@ -1,18 +0,0 @@ -// KT-5869 - -operator fun Iterator.iterator(): Iterator = this - -fun box(): String { - val iterator = object : Iterator { - var i = 0 - override fun next() = i++ - override fun hasNext() = i < 5 - } - - var result = "" - for (i in iterator) { - result += i - } - - return if (result == "01234") "OK" else "Fail $result" -} diff --git a/backend.native/tests/external/codegen/box/objects/useImportedMember.kt b/backend.native/tests/external/codegen/box/objects/useImportedMember.kt deleted file mode 100644 index 670d03ae1df..00000000000 --- a/backend.native/tests/external/codegen/box/objects/useImportedMember.kt +++ /dev/null @@ -1,51 +0,0 @@ -import C.f -import C.p -import C.ext -import C.g1 -import C.g2 -import C.fromClass -import C.fromInterface -import C.genericFromSuper - -interface I { - fun T.fromInterface(): T = this - - fun genericFromSuper(g: G) = g -} - -open class BaseClass { - val T.fromClass: T - get() = this -} - -@kotlin.native.ThreadLocal -object C: BaseClass(), I { - fun f(s: Int) = 1 - fun f(s: String) = 2 - fun Boolean.f() = 3 - - var p: Int = 4 - val Int.ext: Int - get() = 6 - - fun g1(t: T): T = t - val T.g2: T - get() = this -} - -fun box(): String { - if (f(1) != 1) return "1" - if (f("s") != 2) return "2" - if (true.f() != 3) return "3" - if (p != 4) return "4" - p = 5 - if (p != 5) return "5" - if (5.ext != 6) return "6" - if (g1("7") != "7") return "7" - if ("8".g2 != "8") return "8" - if (9.fromInterface() != 9) return "9" - if ("10".fromClass != "10") return "10" - if (genericFromSuper("11") != "11") return "11" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/objects/useImportedMemberFromCompanion.kt b/backend.native/tests/external/codegen/box/objects/useImportedMemberFromCompanion.kt deleted file mode 100644 index 58c46ecc0f3..00000000000 --- a/backend.native/tests/external/codegen/box/objects/useImportedMemberFromCompanion.kt +++ /dev/null @@ -1,53 +0,0 @@ -import Class.C.f -import Class.C.p -import Class.C.ext -import Class.C.g1 -import Class.C.g2 -import Class.C.fromClass -import Class.C.fromInterface -import Class.C.genericFromSuper - -interface I { - fun T.fromInterface(): T = this - - fun genericFromSuper(g: G) = g -} - -open class BaseClass { - val T.fromClass: T - get() = this -} - -class Class { - @kotlin.native.ThreadLocal - companion object C: BaseClass(), I { - fun f(s: Int) = 1 - fun f(s: String) = 2 - fun Boolean.f() = 3 - - var p: Int = 4 - val Int.ext: Int - get() = 6 - - fun g1(t: T): T = t - val T.g2: T - get() = this - } -} - -fun box(): String { - if (f(1) != 1) return "1" - if (f("s") != 2) return "2" - if (true.f() != 3) return "3" - if (p != 4) return "4" - p = 5 - if (p != 5) return "5" - if (5.ext != 6) return "6" - if (g1("7") != "7") return "7" - if ("8".g2 != "8") return "8" - if (9.fromInterface() != 9) return "9" - if ("10".fromClass != "10") return "10" - if (genericFromSuper("11") != "11") return "11" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/annotatedAssignment.kt b/backend.native/tests/external/codegen/box/operatorConventions/annotatedAssignment.kt deleted file mode 100644 index ef6ec161a84..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/annotatedAssignment.kt +++ /dev/null @@ -1,13 +0,0 @@ -@Target(AnnotationTarget.EXPRESSION) -annotation class Annotation - -fun box(): String { - var v = 0 - @Annotation v += 1 + 2 - if (v != 3) return "fail1" - - @Annotation v = 4 - if (v != 4) return "fail2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/assignmentOperations.kt b/backend.native/tests/external/codegen/box/operatorConventions/assignmentOperations.kt deleted file mode 100644 index edbd763154e..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/assignmentOperations.kt +++ /dev/null @@ -1,36 +0,0 @@ -class A() { - var x = 0 -} - -operator fun A.plusAssign(y: Int) { x += y } -operator fun A.minusAssign(y: Int) { x -= y } -operator fun A.timesAssign(y: Int) { x *= y } -operator fun A.divAssign(y: Int) { x /= y } -operator fun A.modAssign(y: Int) { x %= y } - -fun box(): String { - val original = A() - val a = original - - a += 1 - if (a !== original) return "Fail 1: $a !== $original" - if (a.x != 1) return "Fail 2: ${a.x} != 1" - - a -= 2 - if (a !== original) return "Fail 3: $a !== $original" - if (a.x != -1) return "Fail 4: ${a.x} != -1" - - a *= -10 - if (a !== original) return "Fail 5: $a !== $original" - if (a.x != 10) return "Fail 6: ${a.x} != 10" - - a /= 3 - if (a !== original) return "Fail 7: $a !== $original" - if (a.x != 3) return "Fail 8: ${a.x} != 3" - - a %= 2 - if (a !== original) return "Fail 9: $a !== $original" - if (a.x != 1) return "Fail 10: ${a.x} != 1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentInInitializer.kt b/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentInInitializer.kt deleted file mode 100644 index 4592c96c7ae..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentInInitializer.kt +++ /dev/null @@ -1,45 +0,0 @@ -abstract class A { - val b = B("O") - - open val c: B - - val d: B - get() = field - - var e: String - get() = field - - init { - c = B("O") - d = B("O") - e = "O" - - b += "," - c += "." - d += ";" - e += "|" - } -} - -class B(var value: String) { - operator fun plusAssign(o: String) { - value += o - } -} - -class C : A() { - init { - b += "K" - c += "K" - d += "K" - e += "K" - } -} - -fun box(): String { - val c = C() - val result = "${c.b.value} ${c.c.value} ${c.d.value} ${c.e}" - if (result != "O,K O.K O;K O|K") return "fail: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt b/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt deleted file mode 100644 index 0c80cc8edb7..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt +++ /dev/null @@ -1,33 +0,0 @@ -var log = "" - -fun foo(): Int { - log += "foo;" - return 1 -} -fun bar(): Int { - log += "bar;" - return 42 -} - -data class A(val x: Int) { - operator fun plus(other: A) = A(x + other.x) -} - -fun box(): String { - val array = arrayOf(0, 1) - array[foo()] += bar() - - if (array[0] != 0) return "fail1a: ${array[0]}" - if (array[1] != 43) return "fail1b: ${array[0]}" - - log += "!;" - - val objArray = arrayOf(A(0), A(1)) - objArray[foo()] += A(bar()) - if (objArray[0] != A(0)) return "fail2a: ${array[0]}" - if (objArray[1] != A(43)) return "fail2b: ${array[0]}" - - if (log != "foo;bar;!;foo;bar;") return "fail3: $log" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/boolean.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/boolean.kt deleted file mode 100644 index 833e11a733a..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/boolean.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Boolean, y: Boolean) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(false, true) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/comparable.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/comparable.kt deleted file mode 100644 index 957816c8974..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/comparable.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface A : Comparable - -class B(val x: Int) : A { - override fun compareTo(other: A) = x.compareTo((other as B).x) -} - -fun checkLess(x: A, y: A) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(B(0), B(1)) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleInt.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleInt.kt deleted file mode 100644 index 9818affbfba..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleInt.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Double, y: Int) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(0.5, 1) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleLong.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleLong.kt deleted file mode 100644 index 294560659ec..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/doubleLong.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Double, y: Long) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(0.5, 1.toLong()) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionArray.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionArray.kt deleted file mode 100644 index 7ca0f34b787..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionArray.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun checkLess(x: Array, y: Array) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -operator fun Array.compareTo(other: Array) = size - other.size - -fun box(): String { - val a = arrayOfNulls(0) as Array - val b = arrayOfNulls(1) as Array - return checkLess(a, b) -} diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionObject.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionObject.kt deleted file mode 100644 index 1f355ed16e6..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/extensionObject.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A(val x: Int) - -operator fun A.compareTo(other: A) = x.compareTo(other.x) - -fun checkLess(x: A, y: A) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(A(0), A(1)) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intDouble.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intDouble.kt deleted file mode 100644 index a76709fe2db..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intDouble.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Int, y: Double) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(0, 0.5) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intLong.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intLong.kt deleted file mode 100644 index dc91a1d0d51..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/intLong.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Int, y: Long) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(0, 123456789123.toLong()) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longDouble.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longDouble.kt deleted file mode 100644 index 90e43d49215..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longDouble.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Long, y: Double) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(0.toLong(), 0.5) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longInt.kt b/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longInt.kt deleted file mode 100644 index 623a3a46e01..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/compareTo/longInt.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun checkLess(x: Long, y: Int) = when { - x >= y -> "Fail $x >= $y" - !(x < y) -> "Fail !($x < $y)" - !(x <= y) -> "Fail !($x <= $y)" - x > y -> "Fail $x > $y" - x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" - else -> "OK" -} - -fun box() = checkLess(-123456789123.toLong(), 0) diff --git a/backend.native/tests/external/codegen/box/operatorConventions/incDecOnObject.kt b/backend.native/tests/external/codegen/box/operatorConventions/incDecOnObject.kt deleted file mode 100644 index 0717061a9b4..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/incDecOnObject.kt +++ /dev/null @@ -1,41 +0,0 @@ -class X(var value: Long) - -operator fun X.inc(): X { - this.value++ - return this -} - -operator fun X.dec(): X { - this.value-- - return this -} - -class Z { - - public var counter: Int = 0; - - public var prop: X = X(0) - get() { - counter++; return field - } - set(a: X) { - counter++ - field = a; - } -} - -fun box(): String { - var z = Z() - z.prop++ - - if (z.counter != 2) return "fail in postfix increment: ${z.counter} != 2" - if (z.prop.value != 1.toLong()) return "fail in postfix increment: ${z.prop.value} != 1" - - z = Z() - z.prop-- - - if (z.counter != 2) return "fail in postfix decrement: ${z.counter} != 2" - if (z.prop.value != -1.toLong()) return "fail in postfix decrement: ${z.prop.value} != -1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/infixFunctionOverBuiltinMember.kt b/backend.native/tests/external/codegen/box/operatorConventions/infixFunctionOverBuiltinMember.kt deleted file mode 100644 index d4ec1d41d6a..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/infixFunctionOverBuiltinMember.kt +++ /dev/null @@ -1,18 +0,0 @@ -infix fun Int.rem(other: Int) = 10 -infix operator fun Int.minus(other: Int): Int = 20 - -fun box(): String { - val a = 5 rem 2 - if (a != 10) return "fail 1" - - val b = 5 minus 3 - if (b != 20) return "fail 2" - - val a1 = 5.rem(2) - if (a1 != 1) return "fail 3" - - val b2 = 5.minus(3) - if (b2 != 2) return "fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/kt14201.kt b/backend.native/tests/external/codegen/box/operatorConventions/kt14201.kt deleted file mode 100644 index 3ee91af468f..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/kt14201.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface Intf { - val aValue: String -} - -class ClassB { - val x = { "OK" } - - val value: Intf = object : Intf { - override val aValue = x() - } -} - -fun box() : String { - return ClassB().value.aValue -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/kt14201_2.kt b/backend.native/tests/external/codegen/box/operatorConventions/kt14201_2.kt deleted file mode 100644 index b95b82d9172..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/kt14201_2.kt +++ /dev/null @@ -1,27 +0,0 @@ -class A { - val z: String = "OK" -} - -class B { - operator fun A.invoke(): String = z -} - -class ClassB { - val x = A() - - fun B.test(): String { - val value = object { - val z = x() - } - return value.z - } - - fun call(): String { - return B().test() - } - -} - -fun box(): String { - return ClassB().call() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/kt20387.kt b/backend.native/tests/external/codegen/box/operatorConventions/kt20387.kt deleted file mode 100644 index 95fcaa70ec6..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/kt20387.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: test.kt -import base.* - -class Derived : Base() { - inner class Inner { - fun foo() = this@Derived[0L] - } -} - -fun box() = Derived().Inner().foo() - -// FILE: Base.kt -package base - -open class Base { - protected operator fun get(key: K) = "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/kt4152.kt b/backend.native/tests/external/codegen/box/operatorConventions/kt4152.kt deleted file mode 100644 index 7e494f7f032..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/kt4152.kt +++ /dev/null @@ -1,29 +0,0 @@ -public var inc: Int = 0; - -public var propInc: Int = 0 - get() {inc++; return field} - set(a: Int) { - inc++ - field = a - } - -public var dec: Int = 0; - -public var propDec: Int = 0 - get() { dec--; return field} - set(a: Int) { - dec-- - field = a - } - -fun box(): String { - propInc++ - if (inc != 2) return "fail in postfix increment: ${inc} != 2" - if (propInc != 1) return "fail in postfix increment: ${propInc} != 1" - - propDec-- - if (dec != -2) return "fail in postfix decrement: ${dec} != -2" - if (propDec != -1) return "fail in postfix decrement: ${propDec} != -1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/kt4987.kt b/backend.native/tests/external/codegen/box/operatorConventions/kt4987.kt deleted file mode 100644 index ed28874dbbc..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/kt4987.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - operator fun Int?.inc() = (this ?: 0) + 1 - var counter: Int? = null - counter++ - return if (counter == 1) "OK" else "fail: $counter" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/nestedMaps.kt b/backend.native/tests/external/codegen/box/operatorConventions/nestedMaps.kt deleted file mode 100644 index b459a515d6a..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/nestedMaps.kt +++ /dev/null @@ -1,13 +0,0 @@ -object Map1 { - operator fun get(i: Int, j: Int) = Map2 -} - -object Map2 { - operator fun get(i: Int, j: Int) = 0 - operator fun set(i: Int, j: Int, newValue: Int) {} -} - -fun box(): String { - Map1[0, 0][0, 0]++ - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/operatorSetLambda.kt b/backend.native/tests/external/codegen/box/operatorConventions/operatorSetLambda.kt deleted file mode 100644 index cef08624bdd..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/operatorSetLambda.kt +++ /dev/null @@ -1,17 +0,0 @@ -// See KT-14999 - -@kotlin.native.ThreadLocal -object Obj { - var key = "" - var value = "" - - operator fun set(k: String, v: ((String) -> Unit) -> Unit) { - key += k - v { value += it } - } -} - -fun box(): String { - Obj["O"] = label@{ it("K") } - return Obj.key + Obj.value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/overloadedSet.kt b/backend.native/tests/external/codegen/box/operatorConventions/overloadedSet.kt deleted file mode 100644 index 839722da16a..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/overloadedSet.kt +++ /dev/null @@ -1,11 +0,0 @@ -object A { - operator fun get(i: Int) = 1 - operator fun set(i: Int, j: Int) {} - operator fun set(i: Int, x: Any) { throw Exception() } -} - -fun box(): String { - A[0]++ - A[0] += 1 - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt b/backend.native/tests/external/codegen/box/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt deleted file mode 100644 index 0d1cdd857dc..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TARGET_BACKEND: JVM - -// LANGUAGE_VERSION: 1.0 -// FULL_JDK - -import java.math.BigInteger - -fun box(): String { - val m = BigInteger.valueOf(-2) % BigInteger.valueOf(3) - return if (m != BigInteger.valueOf(1)) "Fail: BigInteger(-2) mod BigInteger(3) == $m" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/plusExplicit.kt b/backend.native/tests/external/codegen/box/operatorConventions/plusExplicit.kt deleted file mode 100644 index 8d45ed1b931..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/plusExplicit.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -fun bar1(): String { - val l: List = listOf("O") - val s = l[0].plus("K") - return s -} - -fun bar2(): String { - val l: List = listOf("O") - val s = l[0]?.plus("K") - return s!! -} - -fun bar3(): String { - val l: List = listOf("O") - with(l[0]) { - return plus("K") - } - return "fail" -} - -fun box(): String { - if (bar1() != "OK") return "fail 1" - if (bar2() != "OK") return "fail 2" - if (bar3() != "OK") return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/operatorConventions/remAssignmentOperation.kt b/backend.native/tests/external/codegen/box/operatorConventions/remAssignmentOperation.kt deleted file mode 100644 index b0c2bf060c3..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/remAssignmentOperation.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A() { - var x = 5 -} - -operator fun A.modAssign(y: Int) { throw RuntimeException("mod has been called instead of rem") } -operator fun A.remAssign(y: Int) { x %= y + 1 } - -fun box(): String { - val original = A() - val a = original - - a %= 2 - if (a !== original) return "Fail 1: $a !== $original" - if (a.x != 2) return "Fail 2: ${a.x} != 2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/operatorConventions/remOverModOperation.kt b/backend.native/tests/external/codegen/box/operatorConventions/remOverModOperation.kt deleted file mode 100644 index f10fe021e65..00000000000 --- a/backend.native/tests/external/codegen/box/operatorConventions/remOverModOperation.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A() { - var x = 5 - - operator fun mod(y: Int) { throw RuntimeException("mod has been called instead of rem") } - operator fun rem(y: Int) { x -= y } -} - -fun box(): String { - val a = A() - - a % 5 - - if (a.x != 0) { - return "Fail: a.x(${a.x}) != 0" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/optimizations/kt20844.kt b/backend.native/tests/external/codegen/box/optimizations/kt20844.kt deleted file mode 100644 index 6c359e3c88b..00000000000 --- a/backend.native/tests/external/codegen/box/optimizations/kt20844.kt +++ /dev/null @@ -1,9 +0,0 @@ -//WITH_RUNTIME - -fun foo(x: String, ys: List) = - x + ys.fold("", { a, b -> a + b }) - -var flag = true - -fun box(): String = - foo("O", if (flag) listOf("k").map { it.toUpperCase() } else listOf()) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/package/boxPrimitiveTypeInClinit.kt b/backend.native/tests/external/codegen/box/package/boxPrimitiveTypeInClinit.kt deleted file mode 100644 index 8b8377d314b..00000000000 --- a/backend.native/tests/external/codegen/box/package/boxPrimitiveTypeInClinit.kt +++ /dev/null @@ -1,27 +0,0 @@ -var xi = 0 -var xin : Int? = 0 -var xinn : Int? = null - -var xl = 0.toLong() -var xln : Long? = 0.toLong() -var xlnn : Long? = null - -var xb = 0.toByte() -var xbn : Byte? = 0.toByte() -var xbnn : Byte? = null - -var xf = 0.toFloat() -var xfn : Float? = 0.toFloat() -var xfnn : Float? = null - -var xd = 0.toDouble() -var xdn : Double? = 0.toDouble() -var xdnn : Double? = null - -var xs = 0.toShort() -var xsn : Short? = 0.toShort() -var xsnn : Short? = null - -fun box() : String { - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/package/checkCast.kt b/backend.native/tests/external/codegen/box/package/checkCast.kt deleted file mode 100644 index ffdfa30042b..00000000000 --- a/backend.native/tests/external/codegen/box/package/checkCast.kt +++ /dev/null @@ -1,15 +0,0 @@ -class C(val x: Int) { - override fun equals(rhs: Any?): Boolean { - if (rhs is C) { - val rhsC = rhs as C - return rhsC.x == x - } - return false - } -} - -fun box(): String { - val c1 = C(10) - val c2 = C(10) - return if (c1 == c2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/package/incrementProperty.kt b/backend.native/tests/external/codegen/box/package/incrementProperty.kt deleted file mode 100644 index 07f0a112195..00000000000 --- a/backend.native/tests/external/codegen/box/package/incrementProperty.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Slot() { - var vitality: Int = 10000 - - fun increaseVitality(delta: Int) { - vitality += delta - if (vitality > 65535) vitality = 65535; - } -} - -fun box(): String { - val s = Slot() - s.increaseVitality(1000) - return if (s.vitality == 11000) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/package/initializationOrder.kt b/backend.native/tests/external/codegen/box/package/initializationOrder.kt deleted file mode 100644 index 99dc990860d..00000000000 --- a/backend.native/tests/external/codegen/box/package/initializationOrder.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String? { - val log = System.getProperty("boxtest.log") - System.clearProperty("boxtest.log") // test can be run twice - return if (log == "bca") "OK" else log -} - -val b = log("b") -val c = log("c") -val a = log("a") - -fun log(message: String) { - val value = (System.getProperty("boxtest.log") ?: "") + message - System.setProperty("boxtest.log", value) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/package/invokespecial.kt b/backend.native/tests/external/codegen/box/package/invokespecial.kt deleted file mode 100644 index b0dfae5ae86..00000000000 --- a/backend.native/tests/external/codegen/box/package/invokespecial.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// KT-2202 Wrong instruction for invoke private setter - -class A { - private fun f1() { } - fun foo() { - f1() - } -} - -class B { - private val foo = 1 - get - - fun foo() { - foo - } -} - -class C { - private var foo = 1 - get - set - - fun foo() { - foo = 2 - foo - } -} - -class D { - var foo = 1 - private set - - fun foo() { - foo = 2 - } -} - -fun box(): String { - A().foo() - B().foo() - C().foo() - D().foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/package/mainInFiles.kt b/backend.native/tests/external/codegen/box/package/mainInFiles.kt deleted file mode 100644 index b4cf8c0b19b..00000000000 --- a/backend.native/tests/external/codegen/box/package/mainInFiles.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: 1.kt - -package test - -class A {} - -fun getMain(className: String): java.lang.reflect.Method { - val classLoader = A().javaClass.classLoader - return classLoader.loadClass(className).getDeclaredMethod("main", Array::class.java) -} - -fun box(): String { - val bMain = getMain("pkg.AKt") - val cMain = getMain("pkg.BKt") - - val args = Array(1, { "" }) - - bMain.invoke(null, args) - cMain.invoke(null, args) - - return args[0] -} - - - -// FILE: a.kt - -package pkg - -fun main(args: Array) { - args[0] += "O" -} - -// FILE: b.kt - -package pkg - -fun main(args: Array) { - args[0] += "K" -} diff --git a/backend.native/tests/external/codegen/box/package/nullablePrimitiveNoFieldInitializer.kt b/backend.native/tests/external/codegen/box/package/nullablePrimitiveNoFieldInitializer.kt deleted file mode 100644 index c0f72702d06..00000000000 --- a/backend.native/tests/external/codegen/box/package/nullablePrimitiveNoFieldInitializer.kt +++ /dev/null @@ -1,11 +0,0 @@ -val zint : Int? = 1 -val zlong : Long? = 2 -val zbyte : Byte? = 3 -val zshort : Short? = 4 -val zchar : Char? = 'c' -val zdouble : Double? = 1.0 -val zfloat : Float? = 2.0.toFloat() - -fun box(): String { - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/package/packageLocalClassNotImportedWithDefaultImport.kt b/backend.native/tests/external/codegen/box/package/packageLocalClassNotImportedWithDefaultImport.kt deleted file mode 100644 index 7d185e9ee00..00000000000 --- a/backend.native/tests/external/codegen/box/package/packageLocalClassNotImportedWithDefaultImport.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: box.kt - -package a - -import pack.* - -class X : SomeClass() - -fun box(): String { - X() - return "OK" -} - -// FILE: file1.kt - -package kotlin.jvm - -private class SomeClass - -// FILE: file2.kt - -package pack - -public open class SomeClass diff --git a/backend.native/tests/external/codegen/box/package/packageQualifiedMethod.kt b/backend.native/tests/external/codegen/box/package/packageQualifiedMethod.kt deleted file mode 100644 index 92aaf32b62e..00000000000 --- a/backend.native/tests/external/codegen/box/package/packageQualifiedMethod.kt +++ /dev/null @@ -1,6 +0,0 @@ -package Foo - fun bar() = 610 - -fun box(): String { - return if (Foo.bar() == 610) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/package/privateMembersInImportList.kt b/backend.native/tests/external/codegen/box/package/privateMembersInImportList.kt deleted file mode 100644 index e7009753efa..00000000000 --- a/backend.native/tests/external/codegen/box/package/privateMembersInImportList.kt +++ /dev/null @@ -1,40 +0,0 @@ -package test - -import test.C.E1 -import test.A.B.* -import test.Obj.CInObj.Tt -import test.Obj.foo - -private enum class C { - E1 -} - -class A { - private class B { - object C - class D - } - - fun test() { - C - D() - } -} - -private object Obj { - private class CInObj { - class Tt - } - - fun foo() { - Tt() - } -} - -fun box(): String { - E1 - A().test() - foo() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/package/privateTopLevelPropAndVarInInner.kt b/backend.native/tests/external/codegen/box/package/privateTopLevelPropAndVarInInner.kt deleted file mode 100644 index b61fd243ab9..00000000000 --- a/backend.native/tests/external/codegen/box/package/privateTopLevelPropAndVarInInner.kt +++ /dev/null @@ -1,4 +0,0 @@ -private var x = "O" -private fun f() = "K" - -fun box() = { x + f() }() diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/assign.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/assign.kt deleted file mode 100644 index 97730470dfc..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/assign.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - var x = l[0] - x = 2 - if (x != 2) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/compareTo.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/compareTo.kt deleted file mode 100644 index 288a8111d76..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/compareTo.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] < 2 - if (x != true) return "Fail: $x}" - val y = l[0].compareTo(2) - if (y != -1) return "Fail (y): $y}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/dec.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/dec.kt deleted file mode 100644 index 04574676e01..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/dec.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - var x = l[0] - var y = l[0] - l[0]-- - --l[0] - x-- - --y - if (l[0] != -1) return "Fail: ${l[0]}" - if (x != 0) return "Fail x: $x" - if (y != 0) return "Fail y: $y" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/div.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/div.kt deleted file mode 100644 index 1d19aa08bde..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/div.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(2) - val x = l[0] / 2 - if (x != 1) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/equals.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/equals.kt deleted file mode 100644 index f11e683d8cf..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/equals.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] == 2 - if (x != false) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv11.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv11.kt deleted file mode 100644 index 981310ecabe..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv11.kt +++ /dev/null @@ -1,39 +0,0 @@ -// LANGUAGE_VERSION: 1.1 -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -import kotlin.test.* - -fun box(): String { - assertEquals(J.BOOL_NULL.equals(null), true) - assertEquals(J.CHAR_NULL.equals(null), true) - assertEquals(J.BYTE_NULL.equals(null), true) - assertEquals(J.SHORT_NULL.equals(null), true) - assertEquals(J.INT_NULL.equals(null), true) - assertEquals(J.LONG_NULL.equals(null), true) - assertEquals(J.FLOAT_NULL.equals(null), true) - assertEquals(J.DOUBLE_NULL.equals(null), true) - - assertEquals(J.BOOL_NULL == null, true) - assertEquals(J.CHAR_NULL == null, true) - assertEquals(J.BYTE_NULL == null, true) - assertEquals(J.SHORT_NULL == null, true) - assertEquals(J.INT_NULL == null, true) - assertEquals(J.LONG_NULL == null, true) - assertEquals(J.FLOAT_NULL == null, true) - assertEquals(J.DOUBLE_NULL == null, true) - - return "OK" -} - -// FILE: J.java -public class J { - public static Boolean BOOL_NULL = null; - public static Character CHAR_NULL = null; - public static Byte BYTE_NULL = null; - public static Short SHORT_NULL = null; - public static Integer INT_NULL = null; - public static Long LONG_NULL = null; - public static Float FLOAT_NULL = null; - public static Double DOUBLE_NULL = null; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv12.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv12.kt deleted file mode 100644 index 1a4f0c850c4..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_lv12.kt +++ /dev/null @@ -1,39 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -import kotlin.test.* - -fun box(): String { - assertFailsWith { J.BOOL_NULL.equals(null) } - assertFailsWith { J.CHAR_NULL.equals(null) } - assertFailsWith { J.BYTE_NULL.equals(null) } - assertFailsWith { J.SHORT_NULL.equals(null) } - assertFailsWith { J.INT_NULL.equals(null) } - assertFailsWith { J.LONG_NULL.equals(null) } - assertFailsWith { J.FLOAT_NULL.equals(null) } - assertFailsWith { J.DOUBLE_NULL.equals(null) } - - assertEquals(J.BOOL_NULL == null, true) - assertEquals(J.CHAR_NULL == null, true) - assertEquals(J.BYTE_NULL == null, true) - assertEquals(J.SHORT_NULL == null, true) - assertEquals(J.INT_NULL == null, true) - assertEquals(J.LONG_NULL == null, true) - assertEquals(J.FLOAT_NULL == null, true) - assertEquals(J.DOUBLE_NULL == null, true) - - return "OK" -} - -// FILE: J.java -public class J { - public static Boolean BOOL_NULL = null; - public static Character CHAR_NULL = null; - public static Byte BYTE_NULL = null; - public static Short SHORT_NULL = null; - public static Integer INT_NULL = null; - public static Long LONG_NULL = null; - public static Float FLOAT_NULL = null; - public static Double DOUBLE_NULL = null; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_withExplicitFlag.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_withExplicitFlag.kt deleted file mode 100644 index 4d7aba6b1a9..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/equalsNull_withExplicitFlag.kt +++ /dev/null @@ -1,40 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// KOTLIN_CONFIGURATION_FLAGS: +JVM.NO_EXCEPTION_ON_EXPLICIT_EQUALS_FOR_BOXED_NULL -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -import kotlin.test.* - -fun box(): String { - assertEquals(J.BOOL_NULL.equals(null), true) - assertEquals(J.CHAR_NULL.equals(null), true) - assertEquals(J.BYTE_NULL.equals(null), true) - assertEquals(J.SHORT_NULL.equals(null), true) - assertEquals(J.INT_NULL.equals(null), true) - assertEquals(J.LONG_NULL.equals(null), true) - assertEquals(J.FLOAT_NULL.equals(null), true) - assertEquals(J.DOUBLE_NULL.equals(null), true) - - assertEquals(J.BOOL_NULL == null, true) - assertEquals(J.CHAR_NULL == null, true) - assertEquals(J.BYTE_NULL == null, true) - assertEquals(J.SHORT_NULL == null, true) - assertEquals(J.INT_NULL == null, true) - assertEquals(J.LONG_NULL == null, true) - assertEquals(J.FLOAT_NULL == null, true) - assertEquals(J.DOUBLE_NULL == null, true) - - return "OK" -} - -// FILE: J.java -public class J { - public static Boolean BOOL_NULL = null; - public static Character CHAR_NULL = null; - public static Byte BYTE_NULL = null; - public static Short SHORT_NULL = null; - public static Integer INT_NULL = null; - public static Long LONG_NULL = null; - public static Float FLOAT_NULL = null; - public static Double DOUBLE_NULL = null; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/hashCode.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/hashCode.kt deleted file mode 100644 index 884ce0f7752..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/hashCode.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0].hashCode() - if (x != 1) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/identityEquals.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/identityEquals.kt deleted file mode 100644 index 495dace669b..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/identityEquals.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - val l = java.util.ArrayList() - l.add(1000) - - val x = l[0] === 1000 - if (x) return "Fail: $x" - val x1 = l[0] === 1 - if (x1) return "Fail 1: $x" - val x2 = l[0] === l[0] - if (!x2) return "Fail 2: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/inc.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/inc.kt deleted file mode 100644 index 25de0090050..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/inc.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - var x = l[0] - var y = l[0] - l[0]++ - ++l[0] - x++ - ++y - if (l[0] != 3) return "Fail: ${l[0]}" - if (x != 2) return "Fail x: $x" - if (y != 2) return "Fail y: $y" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/minus.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/minus.kt deleted file mode 100644 index cf14e881a9a..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/minus.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] - 1 - if (x != 0) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/mod.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/mod.kt deleted file mode 100644 index f72a03f668d..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/mod.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(2) - val x = l[0] % 2 - if (x != 0) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/not.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/not.kt deleted file mode 100644 index 0c280a8febc..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/not.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(true) - val x = !l[0] - if (x) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/notEquals.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/notEquals.kt deleted file mode 100644 index 0f57a857b28..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/notEquals.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] != 1 - if (x != false) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/plus.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/plus.kt deleted file mode 100644 index 97b8744ab0d..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/plus.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] + 1 - if (x != 2) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/plusAssign.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/plusAssign.kt deleted file mode 100644 index cc3512f76a0..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/plusAssign.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - var x = l[0] - x += 1 - l[0] += 1 - if (l[0] != 2) return "Fail: ${l[0]}" - if (x != 2) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/rangeTo.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/rangeTo.kt deleted file mode 100644 index ceb1961f5df..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/rangeTo.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(2) - val sb = StringBuilder() - for (i in l[0]..3) { - sb.append(i) - } - if (sb.toString() != "23") return "Fail: $sb}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/times.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/times.kt deleted file mode 100644 index 939bc056018..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/times.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0] * 2 - if (x != 2) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/toShort.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/toShort.kt deleted file mode 100644 index 429eaf77336..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/toShort.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = l[0].toShort() - if (x != 1.toShort()) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/toString.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/toString.kt deleted file mode 100644 index 3ad15f84649..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/toString.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = "${l[0]}" - if (x != "1") return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryMinus.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryMinus.kt deleted file mode 100644 index 30ed37ccf3b..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryMinus.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = -l[0] - if (x != -1) return "Fail: $x" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryPlus.kt b/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryPlus.kt deleted file mode 100644 index c987878a3a1..00000000000 --- a/backend.native/tests/external/codegen/box/platformTypes/primitives/unaryPlus.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val l = ArrayList() - l.add(1) - val x = +l[0] - if (x != 1) return "Fail: $x}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNaN.kt b/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNaN.kt deleted file mode 100644 index 77bf84e3558..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNaN.kt +++ /dev/null @@ -1,61 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// This test checks that our bytecode is consistent with javac bytecode - -fun _assert(condition: Boolean) { - if (!condition) throw AssertionError("Fail") -} - -fun _assertFalse(condition: Boolean) = _assert(!condition) - -fun box(): String { - var dnan = Double.NaN -// if (System.nanoTime() < 0) dnan = 3.14 // To avoid possible compile-time const propagation - - _assertFalse(0.0 < dnan) - _assertFalse(0.0 > dnan) - _assertFalse(0.0 <= dnan) - _assertFalse(0.0 >= dnan) - _assertFalse(0.0 == dnan) - _assertFalse(dnan < 0.0) - _assertFalse(dnan > 0.0) - _assertFalse(dnan <= 0.0) - _assertFalse(dnan >= 0.0) - _assertFalse(dnan == 0.0) - _assertFalse(dnan < dnan) - _assertFalse(dnan > dnan) - _assertFalse(dnan <= dnan) - _assertFalse(dnan >= dnan) - _assertFalse(dnan == dnan) - - // Double.compareTo: "NaN is considered by this method to be equal to itself and greater than all other values" - _assert(0.0.compareTo(dnan) == -1) - _assert(dnan.compareTo(0.0) == 1) - _assert(dnan.compareTo(dnan) == 0) - - var fnan = Float.NaN -// if (System.nanoTime() < 0) fnan = 3.14f - - _assertFalse(0.0f < fnan) - _assertFalse(0.0f > fnan) - _assertFalse(0.0f <= fnan) - _assertFalse(0.0f >= fnan) - _assertFalse(0.0f == fnan) - _assertFalse(fnan < 0.0f) - _assertFalse(fnan > 0.0f) - _assertFalse(fnan <= 0.0f) - _assertFalse(fnan >= 0.0f) - _assertFalse(fnan == 0.0f) - _assertFalse(fnan < fnan) - _assertFalse(fnan > fnan) - _assertFalse(fnan <= fnan) - _assertFalse(fnan >= fnan) - _assertFalse(fnan == fnan) - - _assert(0.0.compareTo(fnan) == -1) - _assert(fnan.compareTo(0.0) == 1) - _assert(fnan.compareTo(fnan) == 0) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt b/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt deleted file mode 100644 index 0948f0eb0b9..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt +++ /dev/null @@ -1,13 +0,0 @@ -var entered = 0 - -fun foo(t: T): T { - entered++ - return t -} - -fun box(): String { - if (foo(null) == null) {} - if (null == foo(null)) {} - if (foo(null) == foo(null)) {} - return if (entered == 4) "OK" else "Fail $entered" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/conversions.kt b/backend.native/tests/external/codegen/box/primitiveTypes/conversions.kt deleted file mode 100644 index a8521d51a0a..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/conversions.kt +++ /dev/null @@ -1,56 +0,0 @@ -// WITH_RUNTIME -import kotlin.test.assertEquals - -fun box(): String { - - assertEquals(-2147483648, Float.NEGATIVE_INFINITY.toInt()) - assertEquals(-2147483648, (-Float.MAX_VALUE).toInt()) - assertEquals(-1, (-1.9f).toInt()) - assertEquals(0, (-0.0f).toInt()) - assertEquals(0, (-Float.MIN_VALUE).toInt()) - assertEquals(0, 0.0f.toInt()) - assertEquals(0, Float.NaN.toInt()) - assertEquals(0, Float.MIN_VALUE.toInt()) - assertEquals(0, 0.9f.toInt()) - assertEquals(2147483647, Float.MAX_VALUE.toInt()) - assertEquals(2147483647, Float.POSITIVE_INFINITY.toInt()) - - assertEquals(-2147483648, Double.NEGATIVE_INFINITY.toInt()) - assertEquals(-2147483648, (-Double.MAX_VALUE).toInt()) - assertEquals(-2147483648, (-2147483649.0).toInt()) - assertEquals(-2147483648, (-2147483648.0).toInt()) - assertEquals(-2147483647, (-2147483647.9).toInt()) - assertEquals(-1, (-1.9).toInt()) - assertEquals(0, (-0.0).toInt()) - assertEquals(0, (-Double.MIN_VALUE).toInt()) - assertEquals(0, 0.0.toInt()) - assertEquals(0, Double.NaN.toInt()) - assertEquals(0, Double.MIN_VALUE.toInt()) - assertEquals(0, 0.9.toInt()) - assertEquals(2147483646, 2147483646.9.toInt()) - assertEquals(2147483647, 2147483647.0.toInt()) - assertEquals(2147483647, 2147483648.0.toInt()) - assertEquals(2147483647, Double.MAX_VALUE.toInt()) - assertEquals(2147483647, Double.POSITIVE_INFINITY.toInt()) - - for (d in doubleArrayOf(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE, - -2147483649.0, -2147483648.0, -2147483647.0, - -65536.0, -65535.0, -65534.0, - -1.5, -Double.MIN_VALUE, - -0.0, 0.0, - Double.MIN_VALUE, 1.5, - 65534.0, 65535.0, 65536.0, - 2147483647.0, 2147483648.0, 2147483649.0, - Double.MAX_VALUE, Double.POSITIVE_INFINITY)) { - assertEquals(d.toInt().toByte(), d.toByte()) - assertEquals(d.toInt().toShort(), d.toShort()) - assertEquals(d.toInt().toChar(), d.toChar()) - - val f = d.toFloat() - assertEquals(f.toInt().toByte(), f.toByte()) - assertEquals(f.toInt().toShort(), f.toShort()) - assertEquals(f.toInt().toChar(), f.toChar()) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/ea35963.kt b/backend.native/tests/external/codegen/box/primitiveTypes/ea35963.kt deleted file mode 100644 index 6d58f3f2de4..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/ea35963.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - if (1 != 0) { - 1 - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedEqPrimitiveEvaluationOrder.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedEqPrimitiveEvaluationOrder.kt deleted file mode 100644 index 5fd58629899..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedEqPrimitiveEvaluationOrder.kt +++ /dev/null @@ -1,39 +0,0 @@ -var order: String = "" - -fun a(i: Int): Int? { - order += "a" - return i -} - -fun b(i: Int): Int { - order += "b" - return i -} - -inline fun evaluateAndCheckOrder(marker: String, expectedValue: Boolean, expectedOrder: String, expr: () -> Boolean) { - order = "" - val actualValue = expr() - if (actualValue != expectedValue) throw AssertionError("$marker: Expected: $expectedValue, actual: $actualValue") - if (order != expectedOrder) throw AssertionError("$marker, order: Expected: '$expectedOrder', actual: '$order'") -} - -val nn: Int? = null - -fun box(): String { - evaluateAndCheckOrder("1 == 1", true, "ab") { a(1) == b(1) } - evaluateAndCheckOrder("1 == 2", false, "ab") { a(1) == b(2) } - evaluateAndCheckOrder("1 != 1", false, "ab") { a(1) != b(1) } - evaluateAndCheckOrder("1 != 2", true, "ab") { a(1) != b(2) } - - evaluateAndCheckOrder("!(1 == 2)", true, "ab") { !(a(1) == b(2)) } - evaluateAndCheckOrder("!(1 == 1)", false, "ab") { !(a(1) == b(1)) } - evaluateAndCheckOrder("!(1 != 2)", false, "ab") { !(a(1) != b(2)) } - evaluateAndCheckOrder("!(1 != 1)", true, "ab") { !(a(1) != b(1)) } - - evaluateAndCheckOrder("null == 1", false, "a") { nn == a(1) } - evaluateAndCheckOrder("null != 1", true, "a") { nn != a(1) } - evaluateAndCheckOrder("!(null == 1)", true, "a") { !(nn == a(1)) } - evaluateAndCheckOrder("!(null != 1)", false, "a") { !(nn != a(1)) } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedLongEqualsLong.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedLongEqualsLong.kt deleted file mode 100644 index 9f589c7d3aa..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/boxedLongEqualsLong.kt +++ /dev/null @@ -1,6 +0,0 @@ -val x: Long = 0L - -fun box(): String { - val ax: Long? = 0L - return if (ax != x) "Fail" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveBoolean.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveBoolean.kt deleted file mode 100644 index a4c037d5d19..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveBoolean.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Boolean? = true -val nn: Boolean? = null -val x: Boolean = true -val y: Boolean = false - -fun box(): String { - val ax: Boolean? = true - val an: Boolean? = null - val bx: Boolean = true - val by: Boolean = false - - return when { - nx != true -> "Fail 0" - nx == false -> "Fail 1" - !(nx == true) -> "Fail 2" - !(nx != false) -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == true -> "Fail 8" - !(nn != true) -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != true -> "Fail 12" - ax == false -> "Fail 13" - !(ax == true) -> "Fail 14" - !(ax != false) -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == true -> "Fail 24" - !(an != true) -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveByte.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveByte.kt deleted file mode 100644 index 327054de5dd..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveByte.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Byte? = 0.toByte() -val nn: Byte? = null -val x: Byte = 0.toByte() -val y: Byte = 1.toByte() - -fun box(): String { - val ax: Byte? = 0.toByte() - val an: Byte? = null - val bx: Byte = 0.toByte() - val by: Byte = 1.toByte() - - return when { - nx != 0.toByte() -> "Fail 0" - nx == 1.toByte() -> "Fail 1" - !(nx == 0.toByte()) -> "Fail 2" - !(nx != 1.toByte()) -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == 0.toByte() -> "Fail 8" - !(nn != 0.toByte()) -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != 0.toByte() -> "Fail 12" - ax == 1.toByte() -> "Fail 13" - !(ax == 0.toByte()) -> "Fail 14" - !(ax != 1.toByte()) -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == 0.toByte() -> "Fail 24" - !(an != 0.toByte()) -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveChar.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveChar.kt deleted file mode 100644 index 589fe0b563f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveChar.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Char? = '0' -val nn: Char? = null -val x: Char = '0' -val y: Char = '1' - -fun box(): String { - val ax: Char? = '0' - val an: Char? = null - val bx: Char = '0' - val by: Char = '1' - - return when { - nx != '0' -> "Fail 0" - nx == '1' -> "Fail 1" - !(nx == '0') -> "Fail 2" - !(nx != '1') -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == '0' -> "Fail 8" - !(nn != '0') -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != '0' -> "Fail 12" - ax == '1' -> "Fail 13" - !(ax == '0') -> "Fail 14" - !(ax != '1') -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == '0' -> "Fail 24" - !(an != '0') -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveInt.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveInt.kt deleted file mode 100644 index 8b816d0b70b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveInt.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Int? = 0 -val nn: Int? = null -val x: Int = 0 -val y: Int = 1 - -fun box(): String { - val ax: Int? = 0 - val an: Int? = null - val bx: Int = 0 - val by: Int = 1 - - return when { - nx != 0 -> "Fail 0" - nx == 1 -> "Fail 1" - !(nx == 0) -> "Fail 2" - !(nx != 1) -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == 0 -> "Fail 8" - !(nn != 0) -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != 0 -> "Fail 12" - ax == 1 -> "Fail 13" - !(ax == 0) -> "Fail 14" - !(ax != 1) -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == 0 -> "Fail 24" - !(an != 0) -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveLong.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveLong.kt deleted file mode 100644 index 57253df6725..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveLong.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Long? = 0L -val nn: Long? = null -val x: Long = 0L -val y: Long = 1L - -fun box(): String { - val ax: Long? = 0L - val an: Long? = null - val bx: Long = 0L - val by: Long = 1L - - return when { - nx != 0L -> "Fail 0" - nx == 1L -> "Fail 1" - !(nx == 0L) -> "Fail 2" - !(nx != 1L) -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == 0L -> "Fail 8" - !(nn != 0L) -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != 0L -> "Fail 12" - ax == 1L -> "Fail 13" - !(ax == 0L) -> "Fail 14" - !(ax != 1L) -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == 0L -> "Fail 24" - !(an != 0L) -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveShort.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveShort.kt deleted file mode 100644 index e93839a29c1..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/boxedEqPrimitiveShort.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Short? = 0.toShort() -val nn: Short? = null -val x: Short = 0.toShort() -val y: Short = 1.toShort() - -fun box(): String { - val ax: Short? = 0.toShort() - val an: Short? = null - val bx: Short = 0.toShort() - val by: Short = 1.toShort() - - return when { - nx != 0.toShort() -> "Fail 0" - nx == 1.toShort() -> "Fail 1" - !(nx == 0.toShort()) -> "Fail 2" - !(nx != 1.toShort()) -> "Fail 3" - nx != x -> "Fail 4" - nx == y -> "Fail 5" - !(nx == x) -> "Fail 6" - !(nx != y) -> "Fail 7" - nn == 0.toShort() -> "Fail 8" - !(nn != 0.toShort()) -> "Fail 9" - nn == x -> "Fail 10" - !(nn != x) -> "Fail 11" - ax != 0.toShort() -> "Fail 12" - ax == 1.toShort() -> "Fail 13" - !(ax == 0.toShort()) -> "Fail 14" - !(ax != 1.toShort()) -> "Fail 15" - ax != x -> "Fail 16" - ax == y -> "Fail 17" - !(ax == x) -> "Fail 18" - !(ax != y) -> "Fail 19" - ax != bx -> "Fail 20" - ax == by -> "Fail 21" - !(ax == bx) -> "Fail 22" - !(ax != by) -> "Fail 23" - an == 0.toShort() -> "Fail 24" - !(an != 0.toShort()) -> "Fail 25" - an == x -> "Fail 26" - !(an != x) -> "Fail 27" - an == bx -> "Fail 28" - !(an != bx) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedBoolean.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedBoolean.kt deleted file mode 100644 index a80c77136ad..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedBoolean.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Boolean? = true -val nn: Boolean? = null -val x: Boolean = true -val y: Boolean = false - -fun box(): String { - val ax: Boolean? = true - val an: Boolean? = null - val bx: Boolean = true - val by: Boolean = false - - return when { - true != nx -> "Fail 0" - false == nx -> "Fail 1" - !(true == nx) -> "Fail 2" - !(false != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - true == nn -> "Fail 8" - !(true != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - true != ax -> "Fail 12" - false == ax -> "Fail 13" - !(true == ax) -> "Fail 14" - !(false != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - true == an -> "Fail 24" - !(true != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedByte.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedByte.kt deleted file mode 100644 index 937d82722fa..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedByte.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Byte? = 0.toByte() -val nn: Byte? = null -val x: Byte = 0.toByte() -val y: Byte = 1.toByte() - -fun box(): String { - val ax: Byte? = 0.toByte() - val an: Byte? = null - val bx: Byte = 0.toByte() - val by: Byte = 1.toByte() - - return when { - 0.toByte() != nx -> "Fail 0" - 1.toByte() == nx -> "Fail 1" - !(0.toByte() == nx) -> "Fail 2" - !(1.toByte() != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0.toByte() == nn -> "Fail 8" - !(0.toByte() != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0.toByte() != ax -> "Fail 12" - 1.toByte() == ax -> "Fail 13" - !(0.toByte() == ax) -> "Fail 14" - !(1.toByte() != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0.toByte() == an -> "Fail 24" - !(0.toByte() != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedChar.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedChar.kt deleted file mode 100644 index 331ab442988..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedChar.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Char? = '0' -val nn: Char? = null -val x: Char = '0' -val y: Char = '1' - -fun box(): String { - val ax: Char? = '0' - val an: Char? = null - val bx: Char = '0' - val by: Char = '1' - - return when { - '0' != nx -> "Fail 0" - '1' == nx -> "Fail 1" - !('0' == nx) -> "Fail 2" - !('1' != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - '0' == nn -> "Fail 8" - !('0' != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - '0' != ax -> "Fail 12" - '1' == ax -> "Fail 13" - !('0' == ax) -> "Fail 14" - !('1' != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - '0' == an -> "Fail 24" - !('0' != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedInt.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedInt.kt deleted file mode 100644 index a9e3946fa90..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedInt.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Int? = 0 -val nn: Int? = null -val x: Int = 0 -val y: Int = 1 - -fun box(): String { - val ax: Int? = 0 - val an: Int? = null - val bx: Int = 0 - val by: Int = 1 - - return when { - 0 != nx -> "Fail 0" - 1 == nx -> "Fail 1" - !(0 == nx) -> "Fail 2" - !(1 != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0 == nn -> "Fail 8" - !(0 != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0 != ax -> "Fail 12" - 1 == ax -> "Fail 13" - !(0 == ax) -> "Fail 14" - !(1 != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0 == an -> "Fail 24" - !(0 != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedLong.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedLong.kt deleted file mode 100644 index e2eccb0ddf5..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedLong.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Long? = 0L -val nn: Long? = null -val x: Long = 0L -val y: Long = 1L - -fun box(): String { - val ax: Long? = 0L - val an: Long? = null - val bx: Long = 0L - val by: Long = 1L - - return when { - 0L != nx -> "Fail 0" - 1L == nx -> "Fail 1" - !(0L == nx) -> "Fail 2" - !(1L != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0L == nn -> "Fail 8" - !(0L != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0L != ax -> "Fail 12" - 1L == ax -> "Fail 13" - !(0L == ax) -> "Fail 14" - !(1L != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0L == an -> "Fail 24" - !(0L != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedShort.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedShort.kt deleted file mode 100644 index 29bf73f855a..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqBoxedShort.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Short? = 0.toShort() -val nn: Short? = null -val x: Short = 0.toShort() -val y: Short = 1.toShort() - -fun box(): String { - val ax: Short? = 0.toShort() - val an: Short? = null - val bx: Short = 0.toShort() - val by: Short = 1.toShort() - - return when { - 0.toShort() != nx -> "Fail 0" - 1.toShort() == nx -> "Fail 1" - !(0.toShort() == nx) -> "Fail 2" - !(1.toShort() != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0.toShort() == nn -> "Fail 8" - !(0.toShort() != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0.toShort() != ax -> "Fail 12" - 1.toShort() == ax -> "Fail 13" - !(0.toShort() == ax) -> "Fail 14" - !(1.toShort() != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0.toShort() == an -> "Fail 24" - !(0.toShort() != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectBoolean.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectBoolean.kt deleted file mode 100644 index 3086b937bb9..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectBoolean.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = true -val nn: Any? = null -val x: Boolean = true -val y: Boolean = false - -fun box(): String { - val ax: Any? = true - val an: Any? = null - val bx: Boolean = true - val by: Boolean = false - - return when { - true != nx -> "Fail 0" - false == nx -> "Fail 1" - !(true == nx) -> "Fail 2" - !(false != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - true == nn -> "Fail 8" - !(true != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - true != ax -> "Fail 12" - false == ax -> "Fail 13" - !(true == ax) -> "Fail 14" - !(false != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - true == an -> "Fail 24" - !(true != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectByte.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectByte.kt deleted file mode 100644 index b0b853c6edc..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectByte.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = 0.toByte() -val nn: Any? = null -val x: Byte = 0.toByte() -val y: Byte = 1.toByte() - -fun box(): String { - val ax: Any? = 0.toByte() - val an: Any? = null - val bx: Byte = 0.toByte() - val by: Byte = 1.toByte() - - return when { - 0.toByte() != nx -> "Fail 0" - 1.toByte() == nx -> "Fail 1" - !(0.toByte() == nx) -> "Fail 2" - !(1.toByte() != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0.toByte() == nn -> "Fail 8" - !(0.toByte() != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0.toByte() != ax -> "Fail 12" - 1.toByte() == ax -> "Fail 13" - !(0.toByte() == ax) -> "Fail 14" - !(1.toByte() != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0.toByte() == an -> "Fail 24" - !(0.toByte() != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectChar.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectChar.kt deleted file mode 100644 index 6122439bcb6..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectChar.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = '0' -val nn: Any? = null -val x: Char = '0' -val y: Char = '1' - -fun box(): String { - val ax: Any? = '0' - val an: Any? = null - val bx: Char = '0' - val by: Char = '1' - - return when { - '0' != nx -> "Fail 0" - '1' == nx -> "Fail 1" - !('0' == nx) -> "Fail 2" - !('1' != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - '0' == nn -> "Fail 8" - !('0' != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - '0' != ax -> "Fail 12" - '1' == ax -> "Fail 13" - !('0' == ax) -> "Fail 14" - !('1' != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - '0' == an -> "Fail 24" - !('0' != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectInt.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectInt.kt deleted file mode 100644 index a93afee14a2..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectInt.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = 0 -val nn: Any? = null -val x: Int = 0 -val y: Int = 1 - -fun box(): String { - val ax: Any? = 0 - val an: Any? = null - val bx: Int = 0 - val by: Int = 1 - - return when { - 0 != nx -> "Fail 0" - 1 == nx -> "Fail 1" - !(0 == nx) -> "Fail 2" - !(1 != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0 == nn -> "Fail 8" - !(0 != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0 != ax -> "Fail 12" - 1 == ax -> "Fail 13" - !(0 == ax) -> "Fail 14" - !(1 != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0 == an -> "Fail 24" - !(0 != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectLong.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectLong.kt deleted file mode 100644 index ddfdcad82e8..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectLong.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = 0L -val nn: Any? = null -val x: Long = 0L -val y: Long = 1L - -fun box(): String { - val ax: Any? = 0L - val an: Any? = null - val bx: Long = 0L - val by: Long = 1L - - return when { - 0L != nx -> "Fail 0" - 1L == nx -> "Fail 1" - !(0L == nx) -> "Fail 2" - !(1L != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0L == nn -> "Fail 8" - !(0L != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0L != ax -> "Fail 12" - 1L == ax -> "Fail 13" - !(0L == ax) -> "Fail 14" - !(1L != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0L == an -> "Fail 24" - !(0L != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectShort.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectShort.kt deleted file mode 100644 index 61c27d231c0..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectShort.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit! - -val nx: Any? = 0.toShort() -val nn: Any? = null -val x: Short = 0.toShort() -val y: Short = 1.toShort() - -fun box(): String { - val ax: Any? = 0.toShort() - val an: Any? = null - val bx: Short = 0.toShort() - val by: Short = 1.toShort() - - return when { - 0.toShort() != nx -> "Fail 0" - 1.toShort() == nx -> "Fail 1" - !(0.toShort() == nx) -> "Fail 2" - !(1.toShort() != nx) -> "Fail 3" - x != nx -> "Fail 4" - y == nx -> "Fail 5" - !(x == nx) -> "Fail 6" - !(y != nx) -> "Fail 7" - 0.toShort() == nn -> "Fail 8" - !(0.toShort() != nn) -> "Fail 9" - x == nn -> "Fail 10" - !(x != nn) -> "Fail 11" - 0.toShort() != ax -> "Fail 12" - 1.toShort() == ax -> "Fail 13" - !(0.toShort() == ax) -> "Fail 14" - !(1.toShort() != ax) -> "Fail 15" - x != ax -> "Fail 16" - y == ax -> "Fail 17" - !(x == ax) -> "Fail 18" - !(y != ax) -> "Fail 19" - bx != ax -> "Fail 20" - by == ax -> "Fail 21" - !(bx == ax) -> "Fail 22" - !(by != ax) -> "Fail 23" - 0.toShort() == an -> "Fail 24" - !(0.toShort() != an) -> "Fail 25" - x == an -> "Fail 26" - !(x != an) -> "Fail 27" - bx == an -> "Fail 28" - !(bx != an) -> "Fail 29" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt deleted file mode 100644 index c0426625b8b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt +++ /dev/null @@ -1,20 +0,0 @@ -// Strictly speaking, asymmetric equals violates contract for 'Object#equals'. -// However, we don't rely on this contract so far. -class FakeInt(val value: Int) { - override fun equals(other: Any?): Boolean = - other is Int && other == value -} - -fun box(): String { - val fake: Any = FakeInt(42) - - val int1 = 1 - val int42 = 42 - - if (fake == int1) return "FakeInt(42) == 1" - if (fake != int42) return "FakeInt(42) != 42" - if (int1 == fake) return "1 == FakeInt(42)" - if (int42 == fake) return "42 == FakeInt(42)" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/whenNullableBoxed.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/whenNullableBoxed.kt deleted file mode 100644 index ff03f15417c..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalityWithObject/whenNullableBoxed.kt +++ /dev/null @@ -1,62 +0,0 @@ -class CInt(val value: Int) -val nCInt3: CInt? = CInt(3) - -class CLong(val value: Long) -val nCLong3: CLong? = CLong(3) - -var subjectEvaluated: Int = 0 - -fun subject(x: T): T { - subjectEvaluated++ - return x -} - -fun doTestInt(i: Int?) = - when (subject(i)) { - null -> "null" - 0 -> "zero" - nCInt3?.value -> "three" - 42 -> "magic" - else -> "other" - } - -fun doTestLong(i: Long?) = - when (subject(i)) { - null -> "null" - 0L -> "zero" - nCLong3?.value -> "three" - 42L -> "magic" - else -> "other" - } - -fun testInt(i: Int?): String { - subjectEvaluated = 0 - val result = doTestInt(i) - if (subjectEvaluated != 1) throw AssertionError("Subject evaluated $subjectEvaluated") - return result -} - -fun testLong(i: Long?): String { - subjectEvaluated = 0 - val result = doTestLong(i) - if (subjectEvaluated != 1) throw AssertionError("Subject evaluated $subjectEvaluated") - return result -} - -fun box(): String { - return when { - testInt(null) != "null" -> "Fail testInt null" - testInt(0) != "zero" -> "Fail testInt 0" - testInt(1) != "other" -> "Fail testInt 1" - testInt(3) != "three" -> "Fail testInt 3" - testInt(42) != "magic" -> "Fail testInt 42" - - testLong(null) != "null" -> "Fail testLong null" - testLong(0L) != "zero" -> "Fail testLong 0" - testLong(1L) != "other" -> "Fail testLong 1" - testLong(3L) != "three" -> "Fail testLong 3" - testLong(42L) != "magic" -> "Fail testLong 42" - - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/box/primitiveTypes/equalsHashCodeToString.kt deleted file mode 100644 index 7d4684e70bd..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/equalsHashCodeToString.kt +++ /dev/null @@ -1,60 +0,0 @@ -fun box(): String { - val b: Byte = 42 - val c: Char = 'z' - val s: Short = 239 - val i: Int = -1 - val j: Long = -42L - val f: Float = 3.14f - val d: Double = -2.72 - val z: Boolean = true - - b.equals(b) - b == b - b.hashCode() - b.toString() - "$b" - - c.equals(c) - c == c - c.hashCode() - c.toString() - "$c" - - s.equals(s) - s == s - s.hashCode() - s.toString() - "$s" - - i.equals(i) - i == i - i.hashCode() - i.toString() - "$i" - - j.equals(j) - j == j - j.hashCode() - j.toString() - "$j" - - f.equals(f) - f == f - f.hashCode() - f.toString() - "$f" - - d.equals(d) - d == d - d.hashCode() - d.toString() - "$d" - - z.equals(z) - z == z - z.hashCode() - z.toString() - "$z" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/incrementByteCharShort.kt b/backend.native/tests/external/codegen/box/primitiveTypes/incrementByteCharShort.kt deleted file mode 100644 index 59b3f12b2ef..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/incrementByteCharShort.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun byteArg(b: Byte) {} -fun charArg(c: Char) {} -fun shortArg(s: Short) {} - -fun box(): String { - var b = 42.toByte() - b++ - ++b - byteArg(b) - - var c = 'x' - c++ - ++c - charArg(c) - - var s = 239.toShort() - s++ - ++s - shortArg(s) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/intLiteralIsNotNull.kt b/backend.native/tests/external/codegen/box/primitiveTypes/intLiteralIsNotNull.kt deleted file mode 100644 index d9f9d0420f1..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/intLiteralIsNotNull.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = if (10!! == 10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt1054.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt1054.kt deleted file mode 100644 index 6393e3a0ec0..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt1054.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box() : String { - return if(true.and(true)) "OK" else "fail" -} - -fun Boolean.and(other : Boolean) : Boolean{ - if(other == true) { - if(this == true){ - return true ; - } - else{ - return false; - } - } - else { - return false; - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt1055.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt1055.kt deleted file mode 100644 index 1a03f1e3b6b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt1055.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box() : String { - val a = "lala" - if(a !== a) return "fail 1" - if(a === a) return "OK" - return "fail 2" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt1093.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt1093.kt deleted file mode 100644 index f1b56508700..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt1093.kt +++ /dev/null @@ -1,8 +0,0 @@ -val f : (Any) -> String = { it.toString() } - -fun box() : String { - if(!(f === f)) return "fail 1" - if(!(f == f)) return "fail 2" - if(!(f.equals(f))) return "fail 3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt13023.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt13023.kt deleted file mode 100644 index 602654d9563..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt13023.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - val b = 'b' - val c = 'c' - assertEquals('c', b + 1) - assertEquals('a', b - 1) - assertEquals(1, c - b) - - val list = listOf('b', 'a') - assertEquals('c', list[0] + 1) - assertEquals('a', list[0] - 1) - assertEquals(1, list[0] - list[1]) - assertEquals(1, list[0] - 'a') - assertEquals(1, 'b' - list[1]) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt14868.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt14868.kt deleted file mode 100644 index 1416af7135b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt14868.kt +++ /dev/null @@ -1,6 +0,0 @@ - -fun box(): String { - val x: Number = 75 - - return "O" + x.toChar() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt1508.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt1508.kt deleted file mode 100644 index 28e534afe39..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt1508.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun test( n : Number ) = n.toInt().toLong() + n.toLong() - -fun box() : String { - val n : Number = 10 - return if(test(n) == 20.toLong()) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt1634.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt1634.kt deleted file mode 100644 index 8cdc1a36907..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt1634.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - !true - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt16732.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt16732.kt deleted file mode 100644 index 8b58c6f402b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt16732.kt +++ /dev/null @@ -1,15 +0,0 @@ -//WITH_RUNTIME - -fun valueFromDB(value: Any): Any { - return when (value) { - is Char -> value - is Number-> value.toChar() - is String -> value.single() - else -> error("Unexpected value of type Char: $value") - } -} - -fun box(): String { - valueFromDB(1) - return "" + valueFromDB("O") + valueFromDB("K") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt2251.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt2251.kt deleted file mode 100644 index d75041090e5..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt2251.kt +++ /dev/null @@ -1,39 +0,0 @@ -class A(var b: Byte) { - fun c(d: Short) = (b + d.toByte()).toChar() -} - -fun box() : String { - if(A(10.toByte()).c(20.toShort()) != 30.toByte().toChar()) return "plus failed" - - var x = 20.toByte() - var y = 20.toByte() - val foo = { - x++ - ++x - } - - if(++x != 21.toByte() || x++ != 21.toByte() || foo() != 24.toByte() || x != 24.toByte()) return "shared byte fail" - if(++y != 21.toByte() || y++ != 21.toByte() || y != 22.toByte()) return "byte fail" - - var xs = 20.toShort() - var ys = 20.toShort() - val foos = { - xs++ - ++xs - } - - if(++xs != 21.toShort() || xs++ != 21.toShort() || foos() != 24.toShort() || xs != 24.toShort()) return "shared short fail" - if(++ys != 21.toShort() || ys++ != 21.toShort() || ys != 22.toShort()) return "short fail" - - var xc = 20.toChar() - var yc = 20.toChar() - val fooc = { - xc++ - ++xc - } - - if(++xc != 21.toChar() || xc++ != 21.toChar() || fooc() != 24.toChar() || xc != 24.toChar()) return "shared char fail" - if(++yc != 21.toChar() || yc++ != 21.toChar() || yc != 22.toChar()) return "char fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt2269.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt2269.kt deleted file mode 100644 index e1896168c8f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt2269.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box() : String { - 230?.toByte()?.hashCode() - 9.hashCode() - - if(230.equals(9.toByte())) { - return "fail" - } - - if(230 == 9.toByte().toInt()) { - return "fail" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt2275.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt2275.kt deleted file mode 100644 index 4dc1296a0e5..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt2275.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - (0.toLong() as Number?)?.toByte() - (0 as Int?)?.toDouble() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt239.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt239.kt deleted file mode 100644 index f36b32743d8..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt239.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box() : String { - val i : Int? = 0 - val j = i?.plus(3) //verify error - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt242.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt242.kt deleted file mode 100644 index c1a99510817..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt242.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun box() : String { - val i: Int? = 7 - val j: Int? = null - val k = 7 - - //verify errors - if (i == 7) {} - if (7 == i) {} - - if (j == 7) {} - if (7 == j) {} - - if (i == k) {} - if (k == i) {} - - if (j == k) {} - if (k == j) {} - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt243.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt243.kt deleted file mode 100644 index 41c93f54971..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt243.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box() : String { - val t = java.lang.String.copyValueOf(java.lang.String("s").toCharArray()) - val i = java.lang.Integer.MAX_VALUE - val j = java.lang.Integer.valueOf(15) - val s = java.lang.String.valueOf(1) - val l = java.util.Collections.emptyList() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt248.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt248.kt deleted file mode 100644 index 0607b21341f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt248.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box() : String { - val b = true as? Boolean //exception - val i = 1 as Int //exception - val j = 1 as Int? //ok - val s = "s" as String //ok - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt2768.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt2768.kt deleted file mode 100644 index b2b0ec976ef..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt2768.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun assertEquals(a: T, b: T) { - if (a != b) throw AssertionError("$a != $b") -} - -fun box(): String { - val bytePos = 128.toByte() // Byte.MAX_VALUE + 1 - assertEquals(-128, bytePos.toInt()) // correct, wrapped to Byte.MIN_VALUE - - val shortPos = 32768.toShort() // Short.MAX_VALUE + 1 - assertEquals(-32768, shortPos.toInt()) // correct, wrapped to Short.MIN_VALUE - - assertEquals((-128).toByte().toString(), "-128") - // TODO: KT-2780 - // assertEquals((-128.toByte()).toString(), "-128") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt2794.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt2794.kt deleted file mode 100644 index bd6c80dced5..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt2794.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box () : String { - val b = 4.toByte() - val s = 5.toShort() - val c: Char = 'A' - return if( "$b" == "4" && " $b" == " 4" && "$s" == "5" && " $s" == " 5" && "$c" == "A" && " $c" == " A") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt3078.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt3078.kt deleted file mode 100644 index cd834c89b2f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt3078.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - if (1 >= 1.9) return "Fail #1" - if (1.compareTo(1.1) >= 0) return "Fail #2" - if (1.9 <= 1) return "Fail #3" - if (1.1.compareTo(1) <= 0) return "Fail #4" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt3517.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt3517.kt deleted file mode 100644 index 535f32308cd..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt3517.kt +++ /dev/null @@ -1,6 +0,0 @@ -// KT-3517 Can't call .equals() on a boolean - -fun box(): String { - val a = false - return if (true.equals(true) && a.equals(false)) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt3576.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt3576.kt deleted file mode 100644 index 955272f0faa..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt3576.kt +++ /dev/null @@ -1,9 +0,0 @@ -object TestObject { - val testFloat: Float = 0.9999.toFloat() - val otherFloat: Float = 1.01.toFloat() -} - -fun box(): String { - return if (TestObject.testFloat.equals(0.9999.toFloat()) - && TestObject.otherFloat.equals(1.01.toFloat())) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt3613.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt3613.kt deleted file mode 100644 index c578f93fb7e..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt3613.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun foo(): Int? = 42 - -fun box(): String { - if (foo()!! > 239) return "Fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt4097.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt4097.kt deleted file mode 100644 index 04cc01c3f3a..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt4097.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - val shouldBeTrue = 555555555555555555L in 123456789123456789L..987654321987654321L - if (!shouldBeTrue) return "Fail 1" - - val shouldBeFalse = 5000000000L in 6000000000L..9000000000L - if (shouldBeFalse) return "Fail 2" - - if (123123123123L !in 100100100100L..200200200200L) return "Fail 3" - - return when (9876543210) { - in 2000000000L..3333333333L -> "Fail 4" - !in 8888888888L..9999999999L -> "Fail 5" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt4098.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt4098.kt deleted file mode 100644 index a74f18feeac..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt4098.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val c: Char? = '0' - c!!.toInt() - - "123456"?.get(0)!!.toInt() - - "123456"!!.get(0).toInt() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt4210.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt4210.kt deleted file mode 100644 index 4f3b16d0e6e..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt4210.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun box(): String { - val s: String? = "abc" - val c = s?.get(0)!! - 'b' - if (c != -1) return "Fail c: $c" - - val d = 'b' - s?.get(2)!! - if (d != -1) return "Fail d: $d" - - val e = s?.get(2)!! - s?.get(0)!! - if (e != 2) return "Fail e: $e" - - val f = s?.get(2)!!.minus(s?.get(0)!!) - if (f != 2) return "Fail f: $f" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt4251.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt4251.kt deleted file mode 100644 index eda602589c0..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt4251.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - val a: Char? = 'a' - val result = a!! < 'b' - return if (result) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt446.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt446.kt deleted file mode 100644 index c148b490f81..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt446.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - var s = "s" - s += 1 - return if (s == "s1") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt518.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt518.kt deleted file mode 100644 index f1ec08f1c2f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt518.kt +++ /dev/null @@ -1,15 +0,0 @@ - -fun foo(i : Int?, a : Any?) { - i?.plus(1) - if (i != null) { - i + 1 - if (a is String) { - a[0] - } - } -} - -fun box () : String { - foo(2, "239") - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt6590_identityEquals.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt6590_identityEquals.kt deleted file mode 100644 index f21a8f1f6a7..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt6590_identityEquals.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - val i: Int = 10000 - if (!(i === i)) return "Fail int ===" - if (i !== i) return "Fail int !==" - - val j: Long = 123L - if (!(j === j)) return "Fail long ===" - if (j !== j) return "Fail long !==" - - val d: Double = 3.14 - if (!(d === d)) return "Fail double ===" - if (d !== d) return "Fail double !==" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt665.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt665.kt deleted file mode 100644 index b8bd69b6550..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt665.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun f(x: Long, zzz: Long = 1): Long -{ - return if (x <= 1) zzz - else f(x-1, x*zzz) -} - -fun box() : String -{ - val six: Long = 6; - if (f(six) != 720.toLong()) return "Fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt684.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt684.kt deleted file mode 100644 index 5441850af87..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt684.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun escapeChar(c : Char) : String? = when (c) { - '\\' -> "\\\\" - '\n' -> "\\n" - '"' -> "\\\"" - else -> "" + c -} - -fun String.escape(i : Int = 0, result : String = "") : String = - if (i == length) result - else escape(i + 1, result + escapeChar(get(i))) - -fun box() : String { - val s = " System.out?.println(\"fun escapeChar(c : Char) : String? = when (c) {\");\n System.out?.println(\" '\\\\\\\\' => \\\"\\\\\\\\\\\\\\\\\\\"\");\n System.out?.println(\" '\\\\n' => \\\"\\\\\\\\n\\\"\");\n System.out?.println(\" '\\\"' => \\\"\\\\\\\\\\\\\\\"\\\"\");\n System.out?.println(\" else => String.valueOf(c)\");\n System.out?.println(\"}\");\n System.out?.println();\n System.out?.println(\"fun String.escape(i : Int = 0, result : String = \\\"\\\") : String =\");\n System.out?.println(\" if (i == length) result\");\n System.out?.println(\" else escape(i + 1, result + escapeChar(this.get(i)))\");\n System.out?.println();\n System.out?.println(\"fun main(args : Array) {\");\n System.out?.println(\" val s = \\\"\" + s.escape() + \"\\\";\");\n System.out?.println(s);\n}\n"; - System.out?.println("fun escapeChar(c : Char) : String? = when (c) {"); - System.out?.println(" '\\\\' => \"\\\\\\\\\""); - System.out?.println(" '\\n' => \"\\\\n\""); - System.out?.println(" '\"' => \"\\\\\\\"\""); - System.out?.println(" else => String.valueOf(c)"); - System.out?.println("}"); - System.out?.println(); - System.out?.println("fun String.escape(i : Int = 0, result : String = \"\") : String ="); - System.out?.println(" if (i == length) result"); - System.out?.println(" else escape(i + 1, result + escapeChar(this.get(i)))"); - System.out?.println(); - System.out?.println("fun main(args : Array) {"); - System.out?.println(" val s = \"" + s.escape() + "\";"); - System.out?.println(s); - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt711.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt711.kt deleted file mode 100644 index ffe360595a5..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt711.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = if ((1 ?: 0) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt737.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt737.kt deleted file mode 100644 index bdf9a4f5af7..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt737.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - if (3.compareTo(2) != 1) return "Fail #1" - if (5.toByte().compareTo(10.toLong()) >= 0) return "Fail #2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt752.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt752.kt deleted file mode 100644 index a62581eefb7..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt752.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package demo_range - -operator fun Int?.rangeTo(other : Int?) : IntRange = this!!.rangeTo(other!!) - -fun box() : String { - val x : Int? = 10 - val y : Int? = 12 - - for (i in x..y) - System.out?.println(i.inv()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt753.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt753.kt deleted file mode 100644 index f66201f9927..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt753.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package bitwise_demo - -fun Long?.shl(bits : Int?) : Long = this!!.shl(bits!!) - -fun box() : String { - val x : Long? = 10 - val y : Int? = 12 - - System.out?.println(x.shl(y)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt756.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt756.kt deleted file mode 100644 index 6d65494990b..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt756.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package demo_range - -operator fun Int?.unaryPlus() : Int = this!!.unaryPlus() -operator fun Int?.dec() : Int = this!!.dec() -operator fun Int?.inc() : Int = this!!.inc() -operator fun Int?.unaryMinus() : Int = this!!.unaryMinus() - -fun box() : String { - val x : Int? = 10 - System.out?.println(x?.inv())// * x?.unaryPlus() * x?.dec() * x?.unaryMinus() as Number) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt757.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt757.kt deleted file mode 100644 index 39bc99d7d8f..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt757.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package demo_long - -fun Long?.inv() : Long = this!!.inv() - -fun box() : String { - val x : Long? = 10 - System.out?.println(x.inv()) - return if(x.inv() == -11.toLong()) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt828.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt828.kt deleted file mode 100644 index 06e63bec23c..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt828.kt +++ /dev/null @@ -1,15 +0,0 @@ -package demo - -fun box() : String { - var res : Boolean = true - res = (res and false) - res = (res or false) - res = (res xor false) - res = (true and false) - res = (true or false) - res = (true xor false) - res = (!true) - res = (true && false) - res = (true || false) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt877.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt877.kt deleted file mode 100644 index 094c5f88fae..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt877.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box() : String { - var a : Int = -1 - if((+a) != -1) return "fail 1" - a = 1 - if((+a) != 1) return "fail 2" - if((+-1) != -1) return "fail 3" - if((-+a) != -1) return "fail 4" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt882.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt882.kt deleted file mode 100644 index 15da30a150e..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt882.kt +++ /dev/null @@ -1,7 +0,0 @@ -val _0 : Double = 0.0 -val _0dbl : Double = 0.toDouble() - -fun box() : String { - if(_0 != _0dbl) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt887.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt887.kt deleted file mode 100644 index c03be7c8835..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt887.kt +++ /dev/null @@ -1,5 +0,0 @@ -class Book(val name: String) : Comparable { - override fun compareTo(other: Book) = name.compareTo(other.name) -} - -fun box() = if(Book("239").compareTo(Book("932")) != 0) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/kt935.kt b/backend.native/tests/external/codegen/box/primitiveTypes/kt935.kt deleted file mode 100644 index 92674333923..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/kt935.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package bottles - -fun box() : String { - var bottles = 10 - while (bottles > 0) { - print(bottlesOfBeer(bottles) + " on the wall, ") - println(bottlesOfBeer(bottles) + ".") - print("Take one down, pass it around, ") - if (--bottles == 0) { - println("no more bottles of beer on the wall.") - } - else { - println(bottlesOfBeer(bottles) + " on the wall.") - } - } - return "OK" -} - -fun bottlesOfBeer(count : Int) : String { - val result = StringBuilder() - result += count - result += if (count > 1) " bottles of beer" else " bottle of beer" - return result.toString() ?: "" -} - -// An excerpt from the standard library -fun print(message : String) { System.out?.print(message) } -fun println(message : String) { System.out?.println(message) } -operator fun StringBuilder.plusAssign(o : Any) { append(o) } -val Array.isEmpty : Boolean get() = size == 0 diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt b/backend.native/tests/external/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt deleted file mode 100644 index a9273088e10..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/nullAsNullableIntIsNull.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - try { - if ((null as Int?)!! == 10) return "Fail #1" - return "Fail #2" - } - catch (e: Exception) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/nullableCharBoolean.kt b/backend.native/tests/external/codegen/box/primitiveTypes/nullableCharBoolean.kt deleted file mode 100644 index ddc86b85777..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/nullableCharBoolean.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - val c: Char? = 'a' - if (c!! - 'a' != 0) return "Fail c" - - val b: Boolean? = false - if (b!!) return "Fail b" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/number.kt b/backend.native/tests/external/codegen/box/primitiveTypes/number.kt deleted file mode 100644 index faefeadd942..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/number.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: FortyTwoExtractor.java - -public class FortyTwoExtractor { - private Number fortyTwo = new FortyTwo(); - - public int intValue() { - return fortyTwo.intValue(); - } -} - -// FILE: FortyTwoExtractor.kt - -class FortyTwo : Number() { - override fun toByte() = 42.toByte() - - override fun toShort() = 42.toShort() - - override fun toInt() = 42 - - override fun toLong() = 42L - - override fun toFloat() = 42.0f - - override fun toDouble() = 42.0 - - override fun toChar() = 42.toChar() -} - -fun box(): String { - val extractor = FortyTwoExtractor() - if (extractor.intValue() != 42) return "FAIL" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/rangeTo.kt b/backend.native/tests/external/codegen/box/primitiveTypes/rangeTo.kt deleted file mode 100644 index 7d55b63daf9..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/rangeTo.kt +++ /dev/null @@ -1,62 +0,0 @@ -fun box(): String { - val b: Byte = 42 - val c: Char = 'z' - val s: Short = 239 - val i: Int = -1 - val j: Long = -42L - - b.rangeTo(b) - b..b - b.rangeTo(s) - b..s - b.rangeTo(i) - b..i - b.rangeTo(j) - b..j - - c.rangeTo(c) - c..c - - s.rangeTo(b) - s..b - s.rangeTo(s) - s..s - s.rangeTo(i) - s..i - s.rangeTo(j) - s..j - - i.rangeTo(b) - i..b - i.rangeTo(s) - i..s - i.rangeTo(i) - i..i - i.rangeTo(j) - i..j - - j.rangeTo(b) - j..b - j.rangeTo(s) - j..s - j.rangeTo(i) - j..i - j.rangeTo(j) - j..j - - return "OK" -} - -/* -fun main(args: Array) { - val s = "bcsij" - for (i in s) { - for (j in s) { - if ((i == 'c') != (j == 'c')) continue - println(" $i.rangeTo($j)") - println(" $i..$j") - } - println() - } -} -*/ diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/substituteIntForGeneric.kt b/backend.native/tests/external/codegen/box/primitiveTypes/substituteIntForGeneric.kt deleted file mode 100644 index 6b32d00e18e..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/substituteIntForGeneric.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class L(var a: T) {} - -fun foo() = L(5).a - -fun box(): String { - val x: Any = foo() - return if (x is Integer) "OK" else "Fail $x" -} diff --git a/backend.native/tests/external/codegen/box/primitiveTypes/unboxComparable.kt b/backend.native/tests/external/codegen/box/primitiveTypes/unboxComparable.kt deleted file mode 100644 index 870989087fd..00000000000 --- a/backend.native/tests/external/codegen/box/primitiveTypes/unboxComparable.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo(x: Int) = x - -fun bar(x: Comparable) = if (x is Int) foo(x) else 0 - -fun box() = if (bar(42) == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/private/arrayConvention.kt b/backend.native/tests/external/codegen/box/private/arrayConvention.kt deleted file mode 100644 index 5d778552e83..00000000000 --- a/backend.native/tests/external/codegen/box/private/arrayConvention.kt +++ /dev/null @@ -1,21 +0,0 @@ -var result = "fail" - -private operator fun X.get(name: String) = name + "K" -private operator fun X.set(name: String, v: String) { - result = v -} - -class X { - fun test() : String { - if (this["O"] != "OK") return "fail 1: ${this["O"]}" - - this["O"] += "K" - if (result != "OKK") return "fail 2: ${result}" - - return "OK" - } -} - -fun box(): String { - return X().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/private/kt9855.kt b/backend.native/tests/external/codegen/box/private/kt9855.kt deleted file mode 100644 index 03e1658e1a5..00000000000 --- a/backend.native/tests/external/codegen/box/private/kt9855.kt +++ /dev/null @@ -1,15 +0,0 @@ -class MyString(var content : String) - -object Greeter { - fun sayHello(name : String): String { - var result = MyString(name) - result += "K" - return result.content - } -} - -private operator fun MyString.plus(suffix: String) : MyString = MyString("${this.content}$suffix") - -fun box(): String { - return Greeter.sayHello("O") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/base.kt b/backend.native/tests/external/codegen/box/privateConstructors/base.kt deleted file mode 100644 index f856a95217b..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/base.kt +++ /dev/null @@ -1,9 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor() { - class Inner: Outer() -} - -fun box(): String { - val outer = Outer.Inner() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/captured.kt b/backend.native/tests/external/codegen/box/privateConstructors/captured.kt deleted file mode 100644 index 83b38054d77..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/captured.kt +++ /dev/null @@ -1,10 +0,0 @@ -public open class Outer private constructor(val s: String) { - - companion object { - fun test () = { Outer("OK") }() - } -} - -fun box(): String { - return Outer.test().s -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/companion.kt b/backend.native/tests/external/codegen/box/privateConstructors/companion.kt deleted file mode 100644 index 482c81233a4..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/companion.kt +++ /dev/null @@ -1,11 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor() { - companion object { - fun foo() = Outer() - } -} - -fun box(): String { - val outer = Outer.foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/inline.kt b/backend.native/tests/external/codegen/box/privateConstructors/inline.kt deleted file mode 100644 index 9b80c07d05a..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/inline.kt +++ /dev/null @@ -1,11 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor() { - companion object { - internal inline fun foo() = Outer() - } -} - -fun box(): String { - val outer = Outer.foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/inner.kt b/backend.native/tests/external/codegen/box/privateConstructors/inner.kt deleted file mode 100644 index 16c1734f08f..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/inner.kt +++ /dev/null @@ -1,15 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val s: String) { - inner class Inner: Outer("O") { - fun foo(): String { - return this.s + this@Outer.s - } - } - class Nested: Outer("K") - fun bar() = Inner() -} - -fun box(): String { - val inner = Outer.Nested().bar() - return inner.foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/kt4860.kt b/backend.native/tests/external/codegen/box/privateConstructors/kt4860.kt deleted file mode 100644 index 8b63d2b415f..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/kt4860.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class A private constructor() { - companion object : A() { - } - - class B: A() -} - -fun box(): String { - val a = A - val b = A.B() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/secondary.kt b/backend.native/tests/external/codegen/box/privateConstructors/secondary.kt deleted file mode 100644 index 6f59e0474b1..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/secondary.kt +++ /dev/null @@ -1,9 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val x: Int) { - constructor(): this(42) -} - -fun box(): String { - val outer = Outer() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/synthetic.kt b/backend.native/tests/external/codegen/box/privateConstructors/synthetic.kt deleted file mode 100644 index 5b00a7166da..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/synthetic.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -// private constructors are transformed into synthetic -class PrivateConstructor private constructor() { - class Nested { val a = PrivateConstructor() } -} - -fun check(klass: Class<*>) { - var hasSynthetic = false - var hasSimple = false - for (method in klass.getDeclaredConstructors()) { - if (method.isSynthetic()) { - hasSynthetic = true - } - else { - hasSimple = true - } - } - if (hasSynthetic && hasSimple) return - throw AssertionError("Class should have both synthetic and non-synthetic constructor: ($hasSynthetic, $hasSimple)") -} - -fun box(): String { - check(PrivateConstructor::class.java) - // Also check that synthetic accessors really work - PrivateConstructor.Nested() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/privateConstructors/withArguments.kt b/backend.native/tests/external/codegen/box/privateConstructors/withArguments.kt deleted file mode 100644 index a53517a81dd..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/withArguments.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val s: String, val f: Boolean = true) { - class Inner: Outer("xyz") - class Other: Outer("abc", true) - class Another: Outer("", false) -} - -fun box(): String { - val outer = Outer.Inner() - val other = Outer.Other() - val another = Outer.Another() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/withDefault.kt b/backend.native/tests/external/codegen/box/privateConstructors/withDefault.kt deleted file mode 100644 index cb96e8dcb4b..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/withDefault.kt +++ /dev/null @@ -1,11 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val x: Int = 0) { - class Inner: Outer() - class Other: Outer(42) -} - -fun box(): String { - val outer = Outer.Inner() - val other = Outer.Other() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/withLinkedClasses.kt b/backend.native/tests/external/codegen/box/privateConstructors/withLinkedClasses.kt deleted file mode 100644 index ff7f86f847a..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/withLinkedClasses.kt +++ /dev/null @@ -1,12 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val p: Outer?) { - object First: Outer(null) - class Other(p: Outer = First): Outer(p) -} - -fun box(): String { - val second = Outer.Other() - val third = Outer.Other(second) - val fourth = Outer.Other(third) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/withLinkedObjects.kt b/backend.native/tests/external/codegen/box/privateConstructors/withLinkedObjects.kt deleted file mode 100644 index 549e13912ef..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/withLinkedObjects.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val p: Outer?) { - object Inner: Outer(null) - object Other: Outer(Inner) - object Another: Outer(Other) -} - -fun box(): String { - val outer = Outer.Inner - val other = Outer.Other - val another = Outer.Another - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/privateConstructors/withVarargs.kt b/backend.native/tests/external/codegen/box/privateConstructors/withVarargs.kt deleted file mode 100644 index f7791f1968c..00000000000 --- a/backend.native/tests/external/codegen/box/privateConstructors/withVarargs.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See also KT-6299 -public open class Outer private constructor(val s: String, vararg i: Int) { - class Inner: Outer("xyz") - class Other: Outer("abc", 1, 2, 3) - class Another: Outer("", 42) -} - -fun box(): String { - val outer = Outer.Inner() - val other = Outer.Other() - val another = Outer.Another() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/accessToPrivateProperty.kt b/backend.native/tests/external/codegen/box/properties/accessToPrivateProperty.kt deleted file mode 100644 index b898fa5689e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/accessToPrivateProperty.kt +++ /dev/null @@ -1,52 +0,0 @@ -class A { - private var foo = 1 - get() { - return 1 - } - - fun foo() { - foo = 5 - foo - } -} - -class B { - private val foo = 1 - get - - fun foo() { - foo - } -} - -class C { - private var foo = 1 - get - set - - fun foo() { - foo = 2 - foo - } -} - -class D { - private var foo = 1 - set(i: Int) { - field = i + 1 - } - - fun foo() { - foo = 5 - foo - } -} - -fun box(): String { - A().foo() - B().foo() - C().foo() - D().foo() - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/properties/accessToPrivateSetter.kt b/backend.native/tests/external/codegen/box/properties/accessToPrivateSetter.kt deleted file mode 100644 index 881f5eae288..00000000000 --- a/backend.native/tests/external/codegen/box/properties/accessToPrivateSetter.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -class D { - var foo = 1 - private set - - fun foo() { - foo = 2 - } -} - -fun box(): String { - D().foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/augmentedAssignmentsAndIncrements.kt b/backend.native/tests/external/codegen/box/properties/augmentedAssignmentsAndIncrements.kt deleted file mode 100644 index bde3c09d5c4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/augmentedAssignmentsAndIncrements.kt +++ /dev/null @@ -1,147 +0,0 @@ -// Enable when KT-14833 is fixed. -// IGNORE_BACKEND: JVM -import kotlin.reflect.KProperty - -var a = 0 - -var b: Int - get() = a - set(v: Int) { - a = v - } - -class A { - var c: Int - get() = a - set(v: Int) { - a = v - } -} - -var A.d: Int - get() = a - set(v: Int) { - a = v - } - -var Int.e: Int - get() = a - set(v: Int) { - a = v - } - -object SimpleDelegate { - operator fun getValue(thisRef: Any?, desc: KProperty<*>): Int { - return a - } - - operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: Int) { - a = value - } -} - -var f by SimpleDelegate - -fun box(): String { - if (b++ != 0) return "fail b++: $b" - if (++b != 2) return "fail ++b: $b" - if (--b != 1) return "fail --b: $b" - if (b-- != 1) return "fail b--: $b" - b += 10 - if (b != 10) return "fail b +=: $b" - b *= 10 - if (b != 100) return "fail b *=: $b" - b /= 5 - if (b != 20) return "fail b /=: $b" - b -= 10 - if (b != 10) return "fail b -=: $b" - b %= 7 - if (b != 3) return "fail b %=: $b" - - var q = A() - - a = 0 - if (q.c++ != 0) return "fail q.c++: ${q.c}" - if (++q.c != 2) return "fail ++q.c: ${q.c}" - if (--q.c != 1) return "fail --q.c: ${q.c}" - if (q.c-- != 1) return "fail q.c--: ${q.c}" - q.c += 10 - if (q.c != 10) return "fail q.c +=: ${q.c}" - q.c *= 10 - if (q.c != 100) return "fail q.c *=: ${q.c}" - q.c /= 5 - if (q.c != 20) return "fail q.c /=: ${q.c}" - q.c -= 10 - if (q.c != 10) return "fail q.c -=: ${q.c}" - q.c %= 7 - if (q.c != 3) return "fail q.c %=: ${q.c}" - - a = 0 - if (q.d++ != 0) return "fail q.d++: ${q.d}" - if (++q.d != 2) return "fail ++q.d: ${q.d}" - if (--q.d != 1) return "fail --q.d: ${q.d}" - if (q.d-- != 1) return "fail q.d--: ${q.d}" - q.d += 10 - if (q.d != 10) return "fail q.d +=: ${q.d}" - q.d *= 10 - if (q.d != 100) return "fail q.d *=: ${q.d}" - q.d /= 5 - if (q.d != 20) return "fail q.d /=: ${q.d}" - q.d -= 10 - if (q.d != 10) return "fail q.d -=: ${q.d}" - q.d %= 7 - if (q.d != 3) return "fail q.d %=: ${q.d}" - - a = 0 - if (0.e++ != 0) return "fail 0.e++: ${0.e}" - if (++0.e != 2) return "fail ++0.e: ${0.e}" - if (--0.e != 1) return "fail --0.e: ${0.e}" - if (0.e-- != 1) return "fail 0.e--: ${0.e}" - 0.e += 10 - if (0.e != 10) return "fail 0.e +=: ${0.e}" - 0.e *= 10 - if (0.e != 100) return "fail 0.e *=: ${0.e}" - 0.e /= 5 - if (0.e != 20) return "fail 0.e /=: ${0.e}" - 0.e -= 10 - if (0.e != 10) return "fail 0.e -=: ${0.e}" - 0.e %= 7 - if (0.e != 3) return "fail 0.e %=: ${0.e}" - - a = 0 - if (f++ != 0) return "fail f++: $f" - if (++f != 2) return "fail ++f: $f" - if (--f != 1) return "fail --f: $f" - if (f-- != 1) return "fail f--: $f" - f += 10 - if (f != 10) return "fail f +=: $f" - f *= 10 - if (f != 100) return "fail f *=: $f" - f /= 5 - if (f != 20) return "fail f /=: $f" - f -= 10 - if (f != 10) return "fail f -=: $f" - f %= 7 - if (f != 3) return "fail f %=: $f" - - - var g by SimpleDelegate - - a = 0 - if (g++ != 0) return "fail g++: $g" - if (++g != 2) return "fail ++g: $g" - if (--g != 1) return "fail --g: $g" - if (g-- != 1) return "fail g--: $g" - g += 10 - if (g != 10) return "fail g +=: $g" - g *= 10 - if (g != 100) return "fail g *=: $g" - g /= 5 - if (g != 20) return "fail g /=: $g" - g -= 10 - if (g != 10) return "fail g -=: $g" - g %= 7 - if (g != 3) return "fail g %=: $g" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classArtificialFieldInsideNested.kt b/backend.native/tests/external/codegen/box/properties/classArtificialFieldInsideNested.kt deleted file mode 100644 index a33fcca3c74..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classArtificialFieldInsideNested.kt +++ /dev/null @@ -1,15 +0,0 @@ -abstract class Your { - abstract val your: String - - fun foo() = your -} - -class My { - val back = "O" - val my: String - get() = object : Your() { - override val your = back - }.foo() + "K" -} - -fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classFieldInsideLambda.kt b/backend.native/tests/external/codegen/box/properties/classFieldInsideLambda.kt deleted file mode 100644 index 121ac3426b4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classFieldInsideLambda.kt +++ /dev/null @@ -1,6 +0,0 @@ -class My { - val my: String = "O" - get() = { field }() + "K" -} - -fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classFieldInsideLocalInSetter.kt b/backend.native/tests/external/codegen/box/properties/classFieldInsideLocalInSetter.kt deleted file mode 100644 index e6e1c9f17f4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classFieldInsideLocalInSetter.kt +++ /dev/null @@ -1,18 +0,0 @@ -class My { - var my: String = "U" - get() = { field }() - set(arg) { - class Local { - fun foo() { - field = arg + "K" - } - } - Local().foo() - } -} - -fun box(): String { - val m = My() - m.my = "O" - return m.my -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classFieldInsideNested.kt b/backend.native/tests/external/codegen/box/properties/classFieldInsideNested.kt deleted file mode 100644 index 0ac00ddb630..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classFieldInsideNested.kt +++ /dev/null @@ -1,14 +0,0 @@ -abstract class Your { - abstract val your: String - - fun foo() = your -} - -class My { - val my: String = "O" - get() = object : Your() { - override val your = field - }.foo() + "K" -} - -fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classObjectProperties.kt b/backend.native/tests/external/codegen/box/properties/classObjectProperties.kt deleted file mode 100644 index 53c0c4f7b68..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classObjectProperties.kt +++ /dev/null @@ -1,59 +0,0 @@ -class Test { - - @kotlin.native.ThreadLocal - companion object { - - public val prop1 : Int = 10 - - public var prop2 : Int = 11 - private set - - public val prop3: Int = 12 - get() { - return field - } - - var prop4 : Int = 13 - - fun incProp4() { - prop4++ - } - - - public var prop5 : Int = 14 - - public var prop7 : Int = 20 - set(i: Int) { - field++ - } - } - -} - - -fun box(): String { - val t = Test; - - if (t.prop1 != 10) return "fail1"; - - if (t.prop2 != 11) return "fail2"; - - if (t.prop3 != 12) return "fail3"; - - if (t.prop4 != 13) return "fail4"; - - t.incProp4() - if (t.prop4 != 14) return "fail4.inc"; - - if (t.prop5 != 14) return "fail5"; - - t.prop5 = 1414 - if (t.prop5 != 1414) return "fail6"; - - if (t.prop7 != 20) return "fail7"; - - t.prop7 = 1000000 - if (t.prop7 != 21) return "fail8"; - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/classPrivateArtificialFieldInsideNested.kt b/backend.native/tests/external/codegen/box/properties/classPrivateArtificialFieldInsideNested.kt deleted file mode 100644 index af1660a58da..00000000000 --- a/backend.native/tests/external/codegen/box/properties/classPrivateArtificialFieldInsideNested.kt +++ /dev/null @@ -1,15 +0,0 @@ -abstract class Your { - abstract val your: String - - fun foo() = your -} - -class My { - private val back = "O" - val my: String - get() = object : Your() { - override val your = back - }.foo() + "K" -} - -fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/collectionSize.kt b/backend.native/tests/external/codegen/box/properties/collectionSize.kt deleted file mode 100644 index 6a296b7fd69..00000000000 --- a/backend.native/tests/external/codegen/box/properties/collectionSize.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -public class Test extends java.util.ArrayList { - public final int size() { - return 56; - } -} - -// FILE: test.kt - -class OurTest : Test() - -fun box(): String { - val t = OurTest() - val x: MutableCollection = t - - if (t.size != 56) return "fail 1: ${t.size}" - if (x.size != 56) return "fail 1: ${x.size}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/commonPropertiesKJK.kt b/backend.native/tests/external/codegen/box/properties/commonPropertiesKJK.kt deleted file mode 100644 index 264d2ffbdfc..00000000000 --- a/backend.native/tests/external/codegen/box/properties/commonPropertiesKJK.kt +++ /dev/null @@ -1,112 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J extends A { - - public boolean okField = false; - - public int getValProp() { - return 123; - } - - public int getVarProp() { - return 456; - } - - public void setVarProp(int x) { - okField = true; - } - - public int isProp() { - return 789; - } - - public void setProp(int x) { - okField = true; - } -} - -// FILE: test.kt - -open class A { - open val valProp: Int = -1 - open var varProp: Int = -1 - open var isProp: Int = -1 -} - -class B : J() { - override val valProp: Int = super.valProp + 1 - override var varProp: Int - set(value) { - super.varProp = value - } - get() = super.varProp + 1 - - override var isProp: Int - set(value) { - super.isProp = value - } - get() = super.isProp + 1 -} - -fun box(): String { - val j = J() - var a: A = j - - if (j.valProp != 123) return "fail 1" - if (a.valProp != 123) return "fail 2" - - j.varProp = -1 - if (!j.okField) return "fail 3" - j.okField = false - - a.varProp = -1 - if (!j.okField) return "fail 4" - j.okField = false - - if (j.varProp != 456) return "fail 5" - if (a.varProp != 456) return "fail 6" - - j.isProp = -1 - if (!j.okField) return "fail 7" - j.okField = false - - a.isProp = -1 - if (!j.okField) return "fail 8" - j.okField = false - - if (j.isProp != 789) return "fail 9" - if (a.isProp != 789) return "fail 10" - - val b = B() - a = b - - if (b.valProp != 124) return "fail 11" - if (a.valProp != 124) return "fail 12" - - b.varProp = -1 - if (!b.okField) return "fail 13" - b.okField = false - - a.varProp = -1 - if (!b.okField) return "fail 14" - b.okField = false - - if (b.varProp != 457) return "fail 15" - if (a.varProp != 457) return "fail 16" - - b.isProp = -1 - if (!b.okField) return "fail 17" - b.okField = false - - a.isProp = -1 - if (!b.okField) return "fail 18" - b.okField = false - - if (b.isProp != 790) return "fail 19" - if (a.isProp != 790) return "fail 20" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/companionFieldInsideLambda.kt b/backend.native/tests/external/codegen/box/properties/companionFieldInsideLambda.kt deleted file mode 100644 index 4e4f60b9df7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/companionFieldInsideLambda.kt +++ /dev/null @@ -1,8 +0,0 @@ -class My { - companion object { - val my: String = "O" - get() = { field }() + "K" - } -} - -fun box() = My.my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/companionObjectAccessor.kt b/backend.native/tests/external/codegen/box/properties/companionObjectAccessor.kt deleted file mode 100644 index 85f734aa294..00000000000 --- a/backend.native/tests/external/codegen/box/properties/companionObjectAccessor.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - public static int f() { - return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2(); - } -} - -// FILE: test.kt - -class A { - companion object { - val i1 = 1 - val i2 = 2 - } -} - -class B { - companion object Named { - val i1 = 3 - val i2 = 4 - } -} - -fun box(): String { - return if (J.f() == A.i1 + A.i2 + B.i1 + B.i2) "OK" else "Fail: ${J.f()}" -} diff --git a/backend.native/tests/external/codegen/box/properties/companionObjectPropertiesFromJava.kt b/backend.native/tests/external/codegen/box/properties/companionObjectPropertiesFromJava.kt deleted file mode 100644 index 6ae3b092564..00000000000 --- a/backend.native/tests/external/codegen/box/properties/companionObjectPropertiesFromJava.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class Test { - String test() { - String s; - - s = Klass.NAME; - if (!s.equals("Klass")) throw new AssertionError("Fail class: " + s); - - s = Klass.JVM_NAME; - if (!s.equals("JvmKlass")) throw new AssertionError("Fail jvm class: " + s); - - s = Trait.NAME; - if (!s.equals("Trait")) throw new AssertionError("Fail interface: " + s); - - s = Enoom.NAME; - if (!s.equals("Enum")) throw new AssertionError("Fail enum: " + s); - - s = Enoom.JVM_NAME; - if (!s.equals("JvmEnum")) throw new AssertionError("Fail jvm enum: " + s); - - return "OK"; - } -} - -// FILE: test.kt - -class Klass { - companion object { - const val NAME = "Klass" - @JvmField val JVM_NAME = "JvmKlass" - } -} - -interface Trait { - companion object { - const val NAME = "Trait" - } -} - -enum class Enoom { - ; - companion object { - const val NAME = "Enum" - @JvmField val JVM_NAME = "JvmEnum" - } -} - -fun box() = Test().test() diff --git a/backend.native/tests/external/codegen/box/properties/companionPrivateField.kt b/backend.native/tests/external/codegen/box/properties/companionPrivateField.kt deleted file mode 100644 index 7a4b94e7aaa..00000000000 --- a/backend.native/tests/external/codegen/box/properties/companionPrivateField.kt +++ /dev/null @@ -1,10 +0,0 @@ -class My { - companion object { - private val my: String = "O" - get() = field + "K" - - fun getValue() = my - } -} - -fun box() = My.getValue() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/companionPrivateFieldInsideLambda.kt b/backend.native/tests/external/codegen/box/properties/companionPrivateFieldInsideLambda.kt deleted file mode 100644 index 7219fcd4d3d..00000000000 --- a/backend.native/tests/external/codegen/box/properties/companionPrivateFieldInsideLambda.kt +++ /dev/null @@ -1,10 +0,0 @@ -class My { - companion object { - private val my: String = "O" - get() = { field }() + "K" - - fun getValue() = my - } -} - -fun box() = My.getValue() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/const/constFlags.kt b/backend.native/tests/external/codegen/box/properties/const/constFlags.kt deleted file mode 100644 index a031c4d0341..00000000000 --- a/backend.native/tests/external/codegen/box/properties/const/constFlags.kt +++ /dev/null @@ -1,52 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -@file:JvmName("XYZ") -import java.lang.reflect.Modifier - -private const val privateConst: Int = 1 -public const val publicConst: Int = 3 - -public object A { - private const val privateConst: Int = 1 - public const val publicConst: Int = 3 -} - -public class B { - companion object { - private const val privateConst: Int = 1 - protected const val protectedConst: Int = 2 - public const val publicConst: Int = 3 - } -} - -fun check(clazz: Class<*>, expectProtected: Boolean = true) { - val fields = clazz.declaredFields.filter { it.name.contains("Const") } - - assert(fields.all { Modifier.isStatic(it.modifiers) }) { "`$clazz` contains non-static fields" } - - assert(Modifier.isPrivate(fields.single { it.name.contains("private") }.modifiers)) { - "`$clazz`.privateConst is not private" - } - - assert(Modifier.isPublic(fields.single { it.name.contains("public") }.modifiers)) { - "`$clazz`.publicConst is not public" - } - - if (expectProtected) { - assert(Modifier.isProtected(fields.single { it.name.contains("protected") }.modifiers)) { - "`$clazz`.protectedConst is not protected" - } - } -} - -fun box(): String { - check(A::class.java, false) - check(B::class.java) - check(Class.forName("XYZ"), false) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/const/constValInAnnotationDefault.kt b/backend.native/tests/external/codegen/box/properties/const/constValInAnnotationDefault.kt deleted file mode 100644 index f02f2bd6ca7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/const/constValInAnnotationDefault.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -const val z = "OK" - -annotation class A(val value: String = z) - -@A -class Test - -fun box(): String { - return Test::class.java.getAnnotation(A::class.java).value -} diff --git a/backend.native/tests/external/codegen/box/properties/const/interfaceCompanion.kt b/backend.native/tests/external/codegen/box/properties/const/interfaceCompanion.kt deleted file mode 100644 index afa9670a227..00000000000 --- a/backend.native/tests/external/codegen/box/properties/const/interfaceCompanion.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -interface KInt { - - companion object { - const val a = "a" - const val b = "b$a" - } -} - -fun box(): String { - val a = KInt::class.java.getField("a").get(null) - val b = KInt::class.java.getField("b").get(null) - - if (a !== KInt.a) return "fail 1: KInt.a !== KInt.Companion.a" - if (b !== KInt.b) return "fail 2: KInt.b !== KInt.Companion.b" - if (b !== "ba") return "fail 2: 'ba' !== KInt.Companion.b" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/field.kt b/backend.native/tests/external/codegen/box/properties/field.kt deleted file mode 100644 index c03066671ad..00000000000 --- a/backend.native/tests/external/codegen/box/properties/field.kt +++ /dev/null @@ -1,10 +0,0 @@ -var my: String = "" - get() = field + "K" - set(arg) { - field = arg - } - -fun box(): String { - my = "O" - return my -} diff --git a/backend.native/tests/external/codegen/box/properties/fieldInClass.kt b/backend.native/tests/external/codegen/box/properties/fieldInClass.kt deleted file mode 100644 index 37ef0a06a9a..00000000000 --- a/backend.native/tests/external/codegen/box/properties/fieldInClass.kt +++ /dev/null @@ -1,6 +0,0 @@ -class My { - val my: String = "O" - get() = field + "K" -} - -fun box() = My().my diff --git a/backend.native/tests/external/codegen/box/properties/fieldInsideField.kt b/backend.native/tests/external/codegen/box/properties/fieldInsideField.kt deleted file mode 100644 index e86fe70da9e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/fieldInsideField.kt +++ /dev/null @@ -1,13 +0,0 @@ -abstract class Your { - abstract val your: String - - fun foo() = your -} - -val my: String = "O" - get() = field + object: Your() { - override val your = "K" - get() = field - }.foo() - -fun box() = my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/fieldInsideLambda.kt b/backend.native/tests/external/codegen/box/properties/fieldInsideLambda.kt deleted file mode 100644 index ebf3cb6cfb7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/fieldInsideLambda.kt +++ /dev/null @@ -1,4 +0,0 @@ -val my: String = "O" - get() = { field }() + "K" - -fun box() = my diff --git a/backend.native/tests/external/codegen/box/properties/fieldInsideNested.kt b/backend.native/tests/external/codegen/box/properties/fieldInsideNested.kt deleted file mode 100644 index cb49c6b46c7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/fieldInsideNested.kt +++ /dev/null @@ -1,12 +0,0 @@ -abstract class Your { - abstract val your: String - - fun foo() = your -} - -val my: String = "O" - get() = object: Your() { - override val your = field - }.foo() + "K" - -fun box() = my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/fieldSimple.kt b/backend.native/tests/external/codegen/box/properties/fieldSimple.kt deleted file mode 100644 index be19a1f8d45..00000000000 --- a/backend.native/tests/external/codegen/box/properties/fieldSimple.kt +++ /dev/null @@ -1,4 +0,0 @@ -val x: String = "OK" - get() = field - -fun box() = x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/generalAccess.kt b/backend.native/tests/external/codegen/box/properties/generalAccess.kt deleted file mode 100644 index 577d9ab7e13..00000000000 --- a/backend.native/tests/external/codegen/box/properties/generalAccess.kt +++ /dev/null @@ -1,54 +0,0 @@ -package As - -val staticProperty : String = "1" - -val String.staticExt: String get() = "1" - -open class A(val init: String) { - - open val property : String = init - - private val privateProperty : String = init - - val String.ext: String get() = "1" - - val Int.myInc : Int - get() = this + 1 - - open fun getPrivate() : String { - return privateProperty; - } - - open fun getExt() : String { - return "0".ext; - } - - public var backingField : Int = 0 - get() = field.myInc - set(s) { field = s } - -} - -open class B(init: String) : A("1") { - - override val property: String = init - - fun getOpenProperty(): String { - return super.property - } - - fun getWithBackingFieldProperty(): String { - return property - } -} - -fun box() : String { - val a = A("1"); - val b = B("0"); - a.backingField = 0 - val result = a.property + a.getPrivate() + staticProperty + "0".staticExt + a.getExt() + - a.backingField + a.backingField + - b.getOpenProperty() + b.property + b.getWithBackingFieldProperty() - - return if (result == "1111111100") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedGetter.kt b/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedGetter.kt deleted file mode 100644 index 88f00bb32e3..00000000000 --- a/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedGetter.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - private Boolean value; - - public Boolean isValue() { - return value; - } - - public void setValue(boolean value) { - this.value = value; - } -} - -// FILE: kotlin.kt - -fun box(): String { - val javaClass = JavaClass() - - if (javaClass.isValue != null) return "fail 1" - - javaClass.isValue = false - if (javaClass.isValue != false) return "fail 2" - - javaClass.isValue = true - if (javaClass.isValue != true) return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedSetter.kt b/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedSetter.kt deleted file mode 100644 index 35dca43aa8d..00000000000 --- a/backend.native/tests/external/codegen/box/properties/javaPropertyBoxedSetter.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - private boolean value; - - public boolean isValue() { - return value; - } - - public void setValue(Boolean value) { - this.value = value; - } -} - -// FILE: kotlin.kt - -fun box(): String { - val javaClass = JavaClass() - - if (javaClass.isValue != false) return "fail 1" - - javaClass.isValue = true - - if (javaClass.isValue != true) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt10715.kt b/backend.native/tests/external/codegen/box/properties/kt10715.kt deleted file mode 100644 index 7449c1b5bfa..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt10715.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - var a = Base() - - val count = a.count - if (count != 0) return "fail 1: $count" - - val count2 = a.count - if (count2 != 1) return "fail 2: $count2" - - return "OK" - -} - -class Base { - var count: Int = 0 - get() = field++ -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt10729.kt b/backend.native/tests/external/codegen/box/properties/kt10729.kt deleted file mode 100644 index 9b0db522f25..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt10729.kt +++ /dev/null @@ -1,20 +0,0 @@ -class IntentionsBundle { - companion object { - fun message(key: String): String { - return key + BUNDLE - } - - fun message2(key: String): String { - return { key + BUNDLE }() - } - - private const val BUNDLE = "K" - } -} - - -fun box(): String { - if (IntentionsBundle.message("O") != "OK") return "fail 1: ${IntentionsBundle.message("O")}" - - return IntentionsBundle.message2("O") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt1159.kt b/backend.native/tests/external/codegen/box/properties/kt1159.kt deleted file mode 100644 index 66b07250a72..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1159.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -public object RefreshQueue { - - private val any = Any() - - private val workerThread: Thread = Thread(object : Runnable { - override fun run() { - any.hashCode() - } - }); - - init { - workerThread.start() - } -} - -fun box() : String { - RefreshQueue - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1165.kt b/backend.native/tests/external/codegen/box/properties/kt1165.kt deleted file mode 100644 index 0a32a58b9e2..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1165.kt +++ /dev/null @@ -1,13 +0,0 @@ -public abstract class VirtualFile() { - public abstract val size : Long -} - -public class PhysicalVirtualFile : VirtualFile() { - public override val size: Long - get() = 11 -} - -fun box() : String { - PhysicalVirtualFile() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1168.kt b/backend.native/tests/external/codegen/box/properties/kt1168.kt deleted file mode 100644 index fc931784687..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1168.kt +++ /dev/null @@ -1,15 +0,0 @@ -public abstract class BaseClass() { - protected abstract val kind : String - - protected open val kind2 : String = " kind1" - - fun debug() = kind + kind2 -} - -public class Subclass : BaseClass() { - override val kind : String = "Physical" - - override val kind2 : String = " kind2" -} - -fun box():String = if(Subclass().debug() == "Physical kind2") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/properties/kt1170.kt b/backend.native/tests/external/codegen/box/properties/kt1170.kt deleted file mode 100644 index 3b33740d7c6..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1170.kt +++ /dev/null @@ -1,16 +0,0 @@ -public abstract class BaseClass() { - open val kind : String = "BaseClass " - - fun getKindValue() : String { - return kind - } -} - -public class Subclass : BaseClass() { - override val kind : String = "Subclass " -} - -fun box(): String { - val r = Subclass().getKindValue() + Subclass().kind - return if(r == "Subclass Subclass ") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt12200.kt b/backend.native/tests/external/codegen/box/properties/kt12200.kt deleted file mode 100644 index fab0ec15481..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt12200.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -//WITH_RUNTIME - -class ThingTemplate { - val prop = 0 -} - -class ThingVal(template: ThingTemplate) { - val prop = template.prop -} - -class ThingVar(template: ThingTemplate) { - var prop = template.prop -} - - -fun box() : String { - val template = ThingTemplate(); - val javaClass = ThingTemplate::class.java - val field = javaClass.getDeclaredField("prop")!! - field.isAccessible = true - field.set(template, 1) - - val thingVal = ThingVal(template) - if (thingVal.prop != 1) return "fail 1" - - val thingVar = ThingVar(template) - if (thingVar.prop != 1) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1398.kt b/backend.native/tests/external/codegen/box/properties/kt1398.kt deleted file mode 100644 index b3b3f69c1ca..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1398.kt +++ /dev/null @@ -1,10 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -open class Base(val bar: String) - -class Foo(bar: String) : Base(bar) { - fun something() = (bar as java.lang.String).toUpperCase() -} - -fun box() = Foo("ok").something() diff --git a/backend.native/tests/external/codegen/box/properties/kt1417.kt b/backend.native/tests/external/codegen/box/properties/kt1417.kt deleted file mode 100644 index 665f45d22cd..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1417.kt +++ /dev/null @@ -1,9 +0,0 @@ -package pack - -open class A(val value: String ) - -class B(value: String) : A(value) { - override fun toString() = "B($value)"; -} - -fun box() = if (B("4").toString() == "B(4)") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/properties/kt1482_2279.kt b/backend.native/tests/external/codegen/box/properties/kt1482_2279.kt deleted file mode 100644 index 5ea5c172005..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1482_2279.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -abstract class ClassValAbstract { - abstract var a: Int - - companion object { - val methods = (this as java.lang.Object).getClass()?.getClassLoader()?.loadClass("ClassValAbstract")?.getMethods()!! - } -} - -fun box() : String { - for(m in ClassValAbstract.methods) { - if (m!!.getName() == "getA") { - if(m!!.getModifiers() != 1025) - return "get failed" - } - if (m!!.getName() == "setA") { - if(m!!.getModifiers() != 1025) - return "set failed" - } - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1714.kt b/backend.native/tests/external/codegen/box/properties/kt1714.kt deleted file mode 100644 index 9425908610e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1714.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -interface A { - val method : (() -> Unit )? - val test : Integer -} - -class AImpl : A { - override val method : (() -> Unit )? = { - } - override val test : Integer = Integer(777) -} - -fun test(a : A) { - val method = a.method - if (method != null) { - method() - } -} - -public fun box() : String { - AImpl().test - test(AImpl()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1714_minimal.kt b/backend.native/tests/external/codegen/box/properties/kt1714_minimal.kt deleted file mode 100644 index faec0d99269..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1714_minimal.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface A { - val v: Int -} - -class AImpl : A { - override val v: Int = 5 -} - -public fun box() : String { - val a: A = AImpl() - a.v - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt1892.kt b/backend.native/tests/external/codegen/box/properties/kt1892.kt deleted file mode 100644 index ae564c7fc93..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt1892.kt +++ /dev/null @@ -1,5 +0,0 @@ -val Int.ext: () -> Int get() = { 5 } -val Long.ext: Long get() = 4.ext().toLong() //(c.kt:4) -val y: Long get() = 10L.ext - -fun box(): String = if (y == 5L) "OK" else "fail: $y" diff --git a/backend.native/tests/external/codegen/box/properties/kt2331.kt b/backend.native/tests/external/codegen/box/properties/kt2331.kt deleted file mode 100644 index a96dd67bf6d..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt2331.kt +++ /dev/null @@ -1,14 +0,0 @@ -class P { - var x : Int = 0 - private set - - fun foo() { - ({ x = 4 })() - } -} - -fun box() : String { - val p = P() - p.foo() - return if (p.x == 4) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt257.kt b/backend.native/tests/external/codegen/box/properties/kt257.kt deleted file mode 100644 index 299042d2f31..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt257.kt +++ /dev/null @@ -1,20 +0,0 @@ -class A(var t: T) {} -class B(val r: R) {} - -fun box() : String { - val ai = A(1) - val aai = A>(ai) - if(aai.t.t != 1) return "fail" -/* - aai.t.t = 2 - if(aai.t.t != 2) return "fail" - - if(ai.t != 2) return "fail" - if(aai.t != ai) return "fail" - if(aai.t !== ai) return "fail" - - val abi = A>(B(1)) - if(abi.t.r != 1) return "fail" -*/ - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt2655.kt b/backend.native/tests/external/codegen/box/properties/kt2655.kt deleted file mode 100644 index 3956fb3a17d..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt2655.kt +++ /dev/null @@ -1,20 +0,0 @@ -interface TextField { - fun getText(): String - fun setText(text: String) -} - -class SimpleTextField : TextField { - private var text2 = "" - override fun getText() = text2 - override fun setText(text: String) { - this.text2 = text - } -} - -class TextFieldWrapper(textField: TextField) : TextField by textField - -fun box() : String { - val textField = TextFieldWrapper(SimpleTextField()) - textField.setText("OK") - return textField.getText() -} diff --git a/backend.native/tests/external/codegen/box/properties/kt2786.kt b/backend.native/tests/external/codegen/box/properties/kt2786.kt deleted file mode 100644 index 003ca536275..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt2786.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface FooTrait { - val propertyTest: String -} - -class FooDelegate: FooTrait { - override val propertyTest: String = "OK" -} - -class DelegateTest(): FooTrait by FooDelegate() { - fun test() = propertyTest -} - -fun box() = DelegateTest().test() diff --git a/backend.native/tests/external/codegen/box/properties/kt2892.kt b/backend.native/tests/external/codegen/box/properties/kt2892.kt deleted file mode 100644 index 816b11009d7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt2892.kt +++ /dev/null @@ -1,16 +0,0 @@ -open class A -class B : A() { - fun foo() = 1 -} - -class Test { - val a : A = B() - private val b : B get() = a as B //'private' is important here - - fun outer() : Int { - fun inner() : Int = b.foo() //'no such field error' here - return inner() - } -} - -fun box() = if (Test().outer() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/properties/kt3118.kt b/backend.native/tests/external/codegen/box/properties/kt3118.kt deleted file mode 100644 index b95ea4ad3b4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt3118.kt +++ /dev/null @@ -1,12 +0,0 @@ -package testing - -class Test { - private val hello: String - get() { return "hello" } - - fun sayHello() : String = hello -} - -fun box(): String { - return if (Test().sayHello() == "hello") "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt3524.kt b/backend.native/tests/external/codegen/box/properties/kt3524.kt deleted file mode 100644 index 3fcdaaebcf1..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt3524.kt +++ /dev/null @@ -1,5 +0,0 @@ -val i: Any = 12 - -fun box(): String { - return if (i == 12) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt3551.kt b/backend.native/tests/external/codegen/box/properties/kt3551.kt deleted file mode 100644 index ba6696e1417..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt3551.kt +++ /dev/null @@ -1,23 +0,0 @@ -class Identifier() { - private var myNullable : Boolean = false - set(l : Boolean) { - //do nothing - } - - fun getValue() : Boolean { - return myNullable - } - - companion object { - fun init(isNullable : Boolean) : Identifier { - val id = Identifier() - id.myNullable = isNullable - return id - } - } -} - -fun box() : String { - val id = Identifier.init(true) - return if (id.getValue() == false) return "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt3556.kt b/backend.native/tests/external/codegen/box/properties/kt3556.kt deleted file mode 100644 index adce0368131..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt3556.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Test { - val a : String = "1" - private val b : String get() = a - - fun outer() : Int { - return b.length - } -} - -fun box() = if (Test().outer() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/properties/kt3930.kt b/backend.native/tests/external/codegen/box/properties/kt3930.kt deleted file mode 100644 index b03168b7f43..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt3930.kt +++ /dev/null @@ -1,16 +0,0 @@ -public abstract class Foo { - var isOpen = true - private set -} -public class Bar: Foo() { - inner class Baz { - fun call() { - val s = this@Bar - s.isOpen - } - } -} -fun box(): String { - Bar().Baz() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt4140.kt b/backend.native/tests/external/codegen/box/properties/kt4140.kt deleted file mode 100644 index 724ea4bf831..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4140.kt +++ /dev/null @@ -1,17 +0,0 @@ -class TestObject() -{ - @kotlin.native.ThreadLocal - companion object { - var prop: Int = 1 - get() = field++ - } -} - -fun box(): String { - - if (TestObject.prop != 1) return "fail 1" - - if (TestObject.prop != 2) return "fail 2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt4252.kt b/backend.native/tests/external/codegen/box/properties/kt4252.kt deleted file mode 100644 index 9e31831b347..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4252.kt +++ /dev/null @@ -1,24 +0,0 @@ -class CallbackBlock {} - -public class Foo -{ - @kotlin.native.ThreadLocal - companion object { - private var bar = 0 - } - - init { - ++bar - } - - fun getBar(): Int = bar -} - -fun box() : String { - - val foo = Foo() - - if (foo.getBar() != 1) return "Fail"; - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt4252_2.kt b/backend.native/tests/external/codegen/box/properties/kt4252_2.kt deleted file mode 100644 index 746bb06b680..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4252_2.kt +++ /dev/null @@ -1,31 +0,0 @@ -class Foo() { - @kotlin.native.ThreadLocal - companion object { - val bar = "OK"; - var boo = "FAIL"; - } - - val a = bar - var b = Foo.bar - val c: String - var d: String - - init { - c = bar - d = Foo.bar - boo = "O" - Foo.boo += "K" - } -} - -fun box(): String { - val foo = Foo() - - if (foo.a != "OK") return "foo.a != OK" - if (foo.b != "OK") return "foo.b != OK" - if (foo.c != "OK") return "foo.c != OK" - if (foo.d != "OK") return "foo.d != OK" - if (Foo.boo != "OK") return "Foo.boo != OK" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt4340.kt b/backend.native/tests/external/codegen/box/properties/kt4340.kt deleted file mode 100644 index 63a97eb0f44..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4340.kt +++ /dev/null @@ -1,36 +0,0 @@ -class A { - - var result: Int = 0; - - private val Int.times3: Int - get() = this * 3 - - private var Int.times: Int - get() = this * 4 - set(s: Int) { - result = this * s - } - - fun test(p: Int):Int { - return { - p.times3 - }() - } - - fun test2(p: Int, s: Int):Int { - { - p.times = s - }() - return result - } -} - -fun box() : String { - var result = A().test(3); - if (result != 9) return "fail1: $result" - - result = A().test2(2, 4); - if (result != 8) return "fail2: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt4373.kt b/backend.native/tests/external/codegen/box/properties/kt4373.kt deleted file mode 100644 index 41b781f2cfc..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4373.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface Tr { - val prop: T -} - -class A(a: Tr) : Tr by a - -fun eat(x: Int) {} - -fun box(): String { - eat(A(object : Tr { - override val prop = 42 - }).prop) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt4383.kt b/backend.native/tests/external/codegen/box/properties/kt4383.kt deleted file mode 100644 index 783d2c23e46..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt4383.kt +++ /dev/null @@ -1,19 +0,0 @@ -import kotlin.reflect.KProperty - -class D { - operator fun getValue(a: Any, p: KProperty<*>) { } -} - -@kotlin.native.ThreadLocal -object P { - val u = Unit - val v by D() - var w = Unit -} - -fun box(): String { - if (P.u != P.v) return "Fail uv" - P.w = Unit - if (P.w != P.u) return "Fail w" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt613.kt b/backend.native/tests/external/codegen/box/properties/kt613.kt deleted file mode 100644 index 4f55c044844..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt613.kt +++ /dev/null @@ -1,15 +0,0 @@ -package name - -class Test() { - var i = 5 - val ten = 10.toLong() - - fun Long.t() = this.toInt() + i++ + ++i - - fun tt() = ten.t() -} - -fun box() : String { - var m = Test() - return if((m.i)++ == 5 && ++(m.i) == 7 && m.tt() == 26) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/properties/kt8928.kt b/backend.native/tests/external/codegen/box/properties/kt8928.kt deleted file mode 100644 index 76da0b6e273..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt8928.kt +++ /dev/null @@ -1,17 +0,0 @@ -class App { - fun init() { - s = "OK" - } - @kotlin.native.ThreadLocal - companion object { - var s: String = "Fail" - private set - - } -} - -fun box(): String { - App().init() - - return App.s -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/kt9603.kt b/backend.native/tests/external/codegen/box/properties/kt9603.kt deleted file mode 100644 index ddbabfcc99b..00000000000 --- a/backend.native/tests/external/codegen/box/properties/kt9603.kt +++ /dev/null @@ -1,11 +0,0 @@ -class A { - public var prop = "OK" - private set - - - fun test(): String { - return { prop }() - } -} - -fun box(): String = A().test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/accessor.kt b/backend.native/tests/external/codegen/box/properties/lateinit/accessor.kt index 0ea93950456..e69de29bb2d 100644 --- a/backend.native/tests/external/codegen/box/properties/lateinit/accessor.kt +++ b/backend.native/tests/external/codegen/box/properties/lateinit/accessor.kt @@ -1,21 +0,0 @@ -public class A { - - fun setMyStr() { - str = "OK" - } - - fun getMyStr(): String { - return str - } - - @kotlin.native.ThreadLocal - private companion object { - private lateinit var str: String - } -} - -fun box(): String { - val a = A() - a.setMyStr() - return a.getMyStr() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/accessorException.kt b/backend.native/tests/external/codegen/box/properties/lateinit/accessorException.kt deleted file mode 100644 index 8650a0fad11..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/accessorException.kt +++ /dev/null @@ -1,21 +0,0 @@ -public class A { - - fun getMyStr(): String { - try { - val a = str - } catch (e: RuntimeException) { - return "OK" - } - - return "FAIL" - } - - private companion object { - private lateinit var str: String - } -} - -fun box(): String { - val a = A() - return a.getMyStr() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/exceptionField.kt b/backend.native/tests/external/codegen/box/properties/lateinit/exceptionField.kt deleted file mode 100644 index 76120e7eff5..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/exceptionField.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A { - private lateinit var str: String - - public fun getMyStr(): String { - try { - val a = str - } catch (e: RuntimeException) { - return "OK" - } - - return "FAIL" - } -} - -fun box(): String { - val a = A() - return a.getMyStr() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/exceptionGetter.kt b/backend.native/tests/external/codegen/box/properties/lateinit/exceptionGetter.kt deleted file mode 100644 index 35449a38fad..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/exceptionGetter.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - public lateinit var str: String -} - -fun box(): String { - val a = A() - try { - a.str - } catch (e: RuntimeException) { - return "OK" - } - return "FAIL" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt deleted file mode 100644 index e0191f26f44..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt +++ /dev/null @@ -1,40 +0,0 @@ -// WITH_RUNTIME - -package test - -class Foo { - lateinit var p: String - - fun test(): Boolean { - if (!::p.isInitialized) { - p = "OK" - return false - } - return true - } -} - -@kotlin.native.ThreadLocal -object Bar { - lateinit var p: String - - fun test(): Boolean { - if (!::p.isInitialized) { - p = "OK" - return false - } - return true - } -} - -fun box(): String { - val foo = Foo() - if (foo.test()) return "Fail 1" - if (!foo.test()) return "Fail 2" - - val bar = Bar - if (bar.test()) return "Fail 3" - if (!bar.test()) return "Fail 4" - - return bar.p -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt deleted file mode 100644 index ae96f730eab..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt +++ /dev/null @@ -1,34 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -open class Foo { - lateinit var bar: String - - private lateinit var baz: String - - fun test(): String { - val isBarInitialized: () -> Boolean = { this::bar.isInitialized } - if (isBarInitialized()) return "Fail 1" - bar = "bar" - if (!isBarInitialized()) return "Fail 2" - baz = "baz" - return InnerSubclass().testInner() - } - - inner class InnerSubclass : Foo() { - fun testInner(): String { - // This is access to InnerSubclass.bar which is inherited from Foo.bar - if (this::bar.isInitialized) return "Fail 3" - bar = "OK" - if (!this::bar.isInitialized) return "Fail 4" - - // This is access to Foo.bar declared lexically above - if (!this@Foo::bar.isInitialized) return "Fail 5" - return "OK" - } - } -} - -fun box(): String { - return Foo().test() -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/propertyImportedFromObject.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/propertyImportedFromObject.kt deleted file mode 100644 index a61d790b09a..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/propertyImportedFromObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME -// IGNORE_BACKEND: JS - -package test - -import test.Derived.p - -open class Base(val b: Boolean) - -object Derived : Base(::p.isInitialized) { - lateinit var p: String -} - -fun box(): String { - return if (Derived.b) "Fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/sideEffects.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/sideEffects.kt deleted file mode 100644 index af11f2c3bc6..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/sideEffects.kt +++ /dev/null @@ -1,20 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -class Foo { - lateinit var bar: String - - fun test(): String { - var state = 0 - if (run { state++; this }::bar.isInitialized) return "Fail 1" - - bar = "A" - if (!run { state++; this }::bar.isInitialized) return "Fail 3" - - return if (state == 2) "OK" else "Fail: state=$state" - } -} - -fun box(): String { - return Foo().test() -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/simpleIsInitialized.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/simpleIsInitialized.kt deleted file mode 100644 index a91306584e4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/simpleIsInitialized.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TARGET_BACKEND: JVM -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -// FILE: J.java - -public class J { - public static void deinitialize(Foo foo) { - foo.bar = null; - } -} - -// FILE: main.kt - -class Foo { - lateinit var bar: String - - fun test(): String { - if (this::bar.isInitialized) return "Fail 1" - J.deinitialize(this) - if (this::bar.isInitialized) return "Fail 2" - - bar = "A" - if (!this::bar.isInitialized) return "Fail 3" - J.deinitialize(this) - if (this::bar.isInitialized) return "Fail 4" - - bar = "OK" - if (!this::bar.isInitialized) return "Fail 5" - return bar - } -} - -fun box(): String { - return Foo().test() -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt b/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt deleted file mode 100644 index ef928e74a5b..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/isInitializedAndDeinitialize/topLevelProperty.kt +++ /dev/null @@ -1,11 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -lateinit var bar: String - -fun box(): String { - if (::bar.isInitialized) return "Fail 1" - bar = "OK" - if (!::bar.isInitialized) return "Fail 2" - return bar -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/capturedLocalLateinit.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/capturedLocalLateinit.kt deleted file mode 100644 index 03507ac8f5a..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/capturedLocalLateinit.kt +++ /dev/null @@ -1,11 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -fun runNoInline(f: () -> Unit) = f() - -fun box(): String { - lateinit var ok: String - runNoInline { - ok = "OK" - } - return ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/localLateinit.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/localLateinit.kt deleted file mode 100644 index bb68d6f3f3e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/localLateinit.kt +++ /dev/null @@ -1,9 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -fun box(): String { - lateinit var ok: String - run { - ok = "OK" - } - return ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedMemberAccess.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedMemberAccess.kt deleted file mode 100644 index 2ec43b51f18..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedMemberAccess.kt +++ /dev/null @@ -1,23 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -fun runNoInline(f: () -> Unit) = f() - -fun box(): String { - lateinit var str: String - var i: Int = 0 - try { - runNoInline { - i = str.length - } - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedRead.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedRead.kt deleted file mode 100644 index 1e66de74e9c..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedCapturedRead.kt +++ /dev/null @@ -1,23 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -fun runNoInline(f: () -> Unit) = f() - -fun box(): String { - lateinit var str: String - var str2: String = "" - try { - runNoInline { - str2 = str - } - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedMemberAccess.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedMemberAccess.kt deleted file mode 100644 index bb44b6b553e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedMemberAccess.kt +++ /dev/null @@ -1,19 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -fun box(): String { - lateinit var str: String - var i: Int = 0 - try { - i = str.length - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedRead.kt b/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedRead.kt deleted file mode 100644 index c27563bdf75..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/local/uninitializedRead.kt +++ /dev/null @@ -1,19 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -fun box(): String { - lateinit var str: String - var str2: String = "" - try { - str2 = str - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/override.kt b/backend.native/tests/external/codegen/box/properties/lateinit/override.kt deleted file mode 100644 index 02d05d723be..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/override.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface Intf { - val str: String -} - -class A : Intf { - override lateinit var str: String - - fun setMyStr() { - str = "OK" - } - - fun getMyStr(): String { - return str - } -} - -fun box(): String { - val a = A() - a.setMyStr() - return a.getMyStr() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/overrideException.kt b/backend.native/tests/external/codegen/box/properties/lateinit/overrideException.kt deleted file mode 100644 index ffc98f1f128..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/overrideException.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface Intf { - val str: String -} - -class A : Intf { - override lateinit var str: String - - fun getMyStr(): String { - try { - val a = str - } catch (e: RuntimeException) { - return "OK" - } - return "FAIL" - } -} - -fun box(): String { - val a = A() - return a.getMyStr() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetter.kt b/backend.native/tests/external/codegen/box/properties/lateinit/privateSetter.kt deleted file mode 100644 index 75bdc125e64..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetter.kt +++ /dev/null @@ -1,12 +0,0 @@ -class My { - lateinit var x: String - private set - - fun init() { x = "OK" } -} - -fun box(): String { - val my = My() - my.init() - return my.x -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterFromLambda.kt b/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterFromLambda.kt deleted file mode 100644 index 80baa4ec688..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterFromLambda.kt +++ /dev/null @@ -1,12 +0,0 @@ -class My { - lateinit var x: String - private set - - fun init(arg: String, f: (String) -> String) { x = f(arg) } -} - -fun box(): String { - val my = My() - my.init("O") { it + "K" } - return my.x -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterViaSubclass.kt b/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterViaSubclass.kt deleted file mode 100644 index be73743b028..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/privateSetterViaSubclass.kt +++ /dev/null @@ -1,16 +0,0 @@ -open class A { - lateinit var x: String - private set - - protected fun set(value: String) { x = value } -} - -class B : A() { - fun init() { set("OK") } -} - -fun box(): String { - val b = B() - b.init() - return b.x -} diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/simpleVar.kt b/backend.native/tests/external/codegen/box/properties/lateinit/simpleVar.kt deleted file mode 100644 index b5314ead1c8..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/simpleVar.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - public lateinit var str: String -} - -fun box(): String { - val a = A() - a.str = "OK" - return a.str -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorException.kt b/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorException.kt deleted file mode 100644 index a6ecf9ab272..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorException.kt +++ /dev/null @@ -1,27 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME -// FILE: lateinit.kt -private lateinit var s: String - -object C { - fun setS(value: String) { s = value } - fun getS() = s -} - -// FILE: test.kt -import kotlin.UninitializedPropertyAccessException - -fun box(): String { - var str2: String = "" - try { - str2 = C.getS() - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } - -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorForTopLevelLateinit.kt b/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorForTopLevelLateinit.kt deleted file mode 100644 index aca5474f004..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/accessorForTopLevelLateinit.kt +++ /dev/null @@ -1,15 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -// FILE: lateinit.kt -private lateinit var s: String - -object C { - fun setS(value: String) { s = value } - fun getS() = s -} - -// FILE: test.kt -fun box(): String { - C.setS("OK") - return C.getS() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/topLevelLateinit.kt b/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/topLevelLateinit.kt deleted file mode 100644 index 2eb9c779585..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/topLevelLateinit.kt +++ /dev/null @@ -1,10 +0,0 @@ -// LANGUAGE_VERSION: 1.2 - -lateinit var ok: String - -fun box(): String { - run { - ok = "OK" - } - return ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedMemberAccess.kt b/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedMemberAccess.kt deleted file mode 100644 index 0c496b9005b..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedMemberAccess.kt +++ /dev/null @@ -1,20 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -lateinit var str: String - -fun box(): String { - var i: Int = 0 - try { - i = str.length - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedRead.kt b/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedRead.kt deleted file mode 100644 index bc4af80a0c4..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/topLevel/uninitializedRead.kt +++ /dev/null @@ -1,20 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME - -import kotlin.UninitializedPropertyAccessException - -lateinit var str: String - -fun box(): String { - var str2: String = "" - try { - str2 = str - return "Should throw an exception" - } - catch (e: UninitializedPropertyAccessException) { - return "OK" - } - catch (e: Throwable) { - return "Unexpected exception: ${e::class}" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/lateinit/visibility.kt b/backend.native/tests/external/codegen/box/properties/lateinit/visibility.kt deleted file mode 100644 index 7773f38e555..00000000000 --- a/backend.native/tests/external/codegen/box/properties/lateinit/visibility.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK - -import java.lang.reflect.Modifier - -public class A { - private lateinit var privateField: String - protected lateinit var protectedField: String - public lateinit var publicField: String - - fun test(): String { - val clazz = A::class.java - val cond = arrayListOf() - - if (!Modifier.isPrivate(clazz.getDeclaredField("privateField").modifiers)) cond += "NOT_PRIVATE" - if (!Modifier.isProtected(clazz.getDeclaredField("protectedField").modifiers)) cond += "NOT_PROTECTED" - if (!Modifier.isPublic(clazz.getDeclaredField("publicField").modifiers)) cond += "NOT_PUBLIC" - - try { - val a = privateField - } catch (e: UninitializedPropertyAccessException) { - return if (cond.isEmpty()) "OK" else cond.joinToString() - } - - return "EXCEPTION WAS NOT CAUGHT" - } -} - -fun box(): String { - return A().test() -} diff --git a/backend.native/tests/external/codegen/box/properties/primitiveOverrideDefaultAccessor.kt b/backend.native/tests/external/codegen/box/properties/primitiveOverrideDefaultAccessor.kt deleted file mode 100644 index e8039fa4cc7..00000000000 --- a/backend.native/tests/external/codegen/box/properties/primitiveOverrideDefaultAccessor.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface R> { - var value: T -} - -class A(override var value: Int): R - -fun box(): String { - val a = A(239) - a.value = 42 - return if (a.value == 42) "OK" else "Fail 1" -} diff --git a/backend.native/tests/external/codegen/box/properties/primitiveOverrideDelegateAccessor.kt b/backend.native/tests/external/codegen/box/properties/primitiveOverrideDelegateAccessor.kt deleted file mode 100644 index 008ef946010..00000000000 --- a/backend.native/tests/external/codegen/box/properties/primitiveOverrideDelegateAccessor.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -class Holder(var value: Int) { - operator fun getValue(that: Any?, desc: KProperty<*>) = value - operator fun setValue(that: Any?, desc: KProperty<*>, newValue: Int) { value = newValue } -} - -interface R> { - var value: T -} - -class A(start: Int) : R { - override var value: Int by Holder(start) -} - -fun box(): String { - val a = A(239) - a.value = 42 - return if (a.value == 42) "OK" else "Fail 1" -} diff --git a/backend.native/tests/external/codegen/box/properties/privatePropertyInConstructor.kt b/backend.native/tests/external/codegen/box/properties/privatePropertyInConstructor.kt deleted file mode 100644 index 9a9e186c8de..00000000000 --- a/backend.native/tests/external/codegen/box/properties/privatePropertyInConstructor.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A( - private val x: String, - private var y: Double -) { - fun foo() { - val r = { - if (x != "abc") throw AssertionError("$x") - y = 0.0 - if (y != 0.0) throw AssertionError("$y") - } - r() - } -} - -fun box(): String { - A("abc", 3.14).foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/privatePropertyWithoutBackingField.kt b/backend.native/tests/external/codegen/box/properties/privatePropertyWithoutBackingField.kt deleted file mode 100644 index e03074deaa0..00000000000 --- a/backend.native/tests/external/codegen/box/properties/privatePropertyWithoutBackingField.kt +++ /dev/null @@ -1,17 +0,0 @@ -class Test { - private var i : Int - get() = 1 - set(i) {} - - fun foo() { - fun f() { - i = 2 - } - f() - } -} - -fun box(): String { - Test().foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/properties/protectedJavaFieldInInline.kt b/backend.native/tests/external/codegen/box/properties/protectedJavaFieldInInline.kt deleted file mode 100644 index deec2e94003..00000000000 --- a/backend.native/tests/external/codegen/box/properties/protectedJavaFieldInInline.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - protected String FIELD = "OK"; - -} - -// FILE: Kotlin.kt - -package test - -import JavaClass - -class B : JavaClass() { - inline fun bar() = FIELD -} - -fun box() = B().bar() diff --git a/backend.native/tests/external/codegen/box/properties/protectedJavaProperty.kt b/backend.native/tests/external/codegen/box/properties/protectedJavaProperty.kt deleted file mode 100644 index 356a55f75d0..00000000000 --- a/backend.native/tests/external/codegen/box/properties/protectedJavaProperty.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaBaseClass.java - -public class JavaBaseClass { - - private String field = "fail"; - - protected String getFoo() { - return field; - } - - protected void setFoo(String foo) { - field = foo; - } -} - -// FILE: kotlin.kt - -package z - -import JavaBaseClass - -object KotlinExtender : JavaBaseClass() { - @JvmStatic fun test(): String { - return runSlowly { - foo = "OK" - foo - } - } -} -fun runSlowly(f: () -> String): String { - return f() -} - -fun box(): String { - return KotlinExtender.test() -} diff --git a/backend.native/tests/external/codegen/box/properties/protectedJavaPropertyInCompanion.kt b/backend.native/tests/external/codegen/box/properties/protectedJavaPropertyInCompanion.kt deleted file mode 100644 index 242ce0f8006..00000000000 --- a/backend.native/tests/external/codegen/box/properties/protectedJavaPropertyInCompanion.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: JavaBaseClass.java - -public class JavaBaseClass { - - private String field = "fail"; - - protected String getFoo() { - return field; - } - - protected void setFoo(String foo) { - field = foo; - } -} - -// FILE: kotlin.kt - -package z - -import JavaBaseClass - -class A { - @JvmField var foo = "fail" - - companion object : JavaBaseClass() { - @JvmStatic fun test(): String { - return runSlowly { - foo = "OK" - foo - } - } - } -} -fun runSlowly(f: () -> String): String { - return f() -} - -fun box(): String { - val a = A() - a.foo = "Kotlin" - if (a.foo != "Kotlin") return "fail" - - return A.test() -} diff --git a/backend.native/tests/external/codegen/box/properties/substituteJavaSuperField.kt b/backend.native/tests/external/codegen/box/properties/substituteJavaSuperField.kt deleted file mode 100644 index 03c3ff2b6cf..00000000000 --- a/backend.native/tests/external/codegen/box/properties/substituteJavaSuperField.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -public abstract class Test { - protected final F value = null; -} - -// FILE: test.kt -// See KT-5445: Bad access to protected data in getfield - -class A : Test() { - fun foo(): String? = value - fun bar(): String? = this.value -} - -fun box(): String { - if (A().foo() != null) return "Fail 1" - if (A().bar() != null) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt b/backend.native/tests/external/codegen/box/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt deleted file mode 100644 index 678b82c784e..00000000000 --- a/backend.native/tests/external/codegen/box/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt +++ /dev/null @@ -1,9 +0,0 @@ -annotation class Anno - -@Anno val Int.foo: Int - get() = this - -@Anno val String.foo: Int - get() = 42 - -fun box() = if (42.foo == 42 && "OK".foo == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/properties/typeInferredFromGetter.kt b/backend.native/tests/external/codegen/box/properties/typeInferredFromGetter.kt deleted file mode 100644 index f4f042888b1..00000000000 --- a/backend.native/tests/external/codegen/box/properties/typeInferredFromGetter.kt +++ /dev/null @@ -1,7 +0,0 @@ -val x get() = "O" - -class A { - val y get() = "K" -} - -fun box() = x + A().y diff --git a/backend.native/tests/external/codegen/box/publishedApi/noMangling.kt b/backend.native/tests/external/codegen/box/publishedApi/noMangling.kt deleted file mode 100644 index 8ecfb8a8c04..00000000000 --- a/backend.native/tests/external/codegen/box/publishedApi/noMangling.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -//WITH_REFLECT -class A { - @PublishedApi - internal fun published() = "O" - - @PublishedApi - internal var publishedProp = "K" - - inline fun test() = published() + publishedProp -} - -fun box() : String { - val clazz = A::class.java - if (clazz.getDeclaredMethod("published") == null) return "fail 1" - if (clazz.getDeclaredMethod("getPublishedProp") == null) return "fail 2" - if (clazz.getDeclaredMethod("setPublishedProp", String::class.java) == null) return "fail 3" - return A().test() -} diff --git a/backend.native/tests/external/codegen/box/publishedApi/simple.kt b/backend.native/tests/external/codegen/box/publishedApi/simple.kt deleted file mode 100644 index 4ad78979fd4..00000000000 --- a/backend.native/tests/external/codegen/box/publishedApi/simple.kt +++ /dev/null @@ -1,16 +0,0 @@ -// MODULE: lib -// FILE: lib.kt -class A { - - @PublishedApi - internal fun published() = "OK" - - inline fun test() = published() - -} - -// MODULE: main(lib) -// FILE: main.kt -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/publishedApi/topLevel.kt b/backend.native/tests/external/codegen/box/publishedApi/topLevel.kt deleted file mode 100644 index e2a33400e7d..00000000000 --- a/backend.native/tests/external/codegen/box/publishedApi/topLevel.kt +++ /dev/null @@ -1,10 +0,0 @@ -// MODULE: lib -// FILE: lib.kt -@PublishedApi -internal fun published() = "OK" - -inline fun test() = published() - -// MODULE: main(lib) -// FILE: main.kt -fun box() = test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt b/backend.native/tests/external/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt deleted file mode 100644 index 949136655a1..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun abs(x: Int) = if (x < 0) -x else x -fun abs(x: Long) = if (x < 0) -x else x - -fun test1() = - 5 in abs(-1) .. 10 - -fun test2() = - 5 in 1 .. abs(-10) - -fun test3() = - 5L in abs(-1L) .. 10L - -fun test4() = - 5L in 1L .. abs(-10L) - -fun box(): String { - if (!test1()) return "Fail 1" - if (!test2()) return "Fail 2" - if (!test3()) return "Fail 3" - if (!test4()) return "Fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForCollection.kt b/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForCollection.kt deleted file mode 100644 index 64973d641bd..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForCollection.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME - -var order = StringBuilder() - -inline fun expectOrder(at: String, expected: String, body: () -> Unit) { - order = StringBuilder() // have to do that in order to run this test in JS - body() - if (order.toString() != expected) throw AssertionError("$at: expected: $expected, actual: $order") -} - -fun list(): List { - order.append("L") - return emptyList() -} - - -fun x(i: Int): Int { - order.append("X") - return i -} - -fun box(): String { - expectOrder("1 in []", "LX") { x(1) in list() } - expectOrder("1 !in []", "LX") { x(1) !in list() } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForComparableRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForComparableRange.kt deleted file mode 100644 index 6201cf0b728..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForComparableRange.kt +++ /dev/null @@ -1,47 +0,0 @@ -// WITH_RUNTIME - -var order = StringBuilder() - -inline fun expectOrder(at: String, expected: String, body: () -> Unit) { - order = StringBuilder() // have to do that in order to run this test in JS - body() - if (order.toString() != expected) { - throw AssertionError("$at: expected: '$expected', actual: '$order'") - } -} - -class Z(val x: Int) : Comparable { - override fun compareTo(other: Z): Int { - order.append("c:$x,${other.x} ") - return x.compareTo(other.x) - } -} - -fun z(i: Int): Z { - order.append("z:$i ") - return Z(i) -} - -fun zr(i: Int, j: Int) = z(i) .. z(j) - -fun box(): String { - expectOrder("#1", "z:1 z:3 z:0 c:0,1 ") { z(0) in z(1) .. z(3) } - expectOrder("#1a", "z:1 z:3 z:0 c:0,1 ") { z(0) in zr(1, 3) } - - expectOrder("#2", "z:1 z:3 z:2 c:2,1 c:2,3 ") { z(2) in z(1) .. z(3) } - expectOrder("#2a", "z:1 z:3 z:2 c:2,1 c:2,3 ") { z(2) in zr(1, 3) } - - expectOrder("#3", "z:1 z:3 z:4 c:4,1 c:4,3 ") { z(4) in z(1) .. z(3) } - expectOrder("#3a", "z:1 z:3 z:4 c:4,1 c:4,3 ") { z(4) in zr(1, 3) } - - expectOrder("#4", "z:1 z:3 z:0 c:0,1 ") { z(0) !in z(1) .. z(3) } - expectOrder("#4a", "z:1 z:3 z:0 c:0,1 ") { z(0) !in zr(1, 3) } - - expectOrder("#5", "z:1 z:3 z:2 c:2,1 c:2,3 ") { z(2) !in z(1) .. z(3) } - expectOrder("#5a", "z:1 z:3 z:2 c:2,1 c:2,3 ") { z(2) !in zr(1, 3) } - - expectOrder("#6", "z:1 z:3 z:4 c:4,1 c:4,3 ") { z(4) !in z(1) .. z(3) } - expectOrder("#6a", "z:1 z:3 z:4 c:4,1 c:4,3 ") { z(4) !in zr(1, 3) } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForDownTo.kt b/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForDownTo.kt deleted file mode 100644 index 433614b74aa..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForDownTo.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME - -var order = StringBuilder() - -inline fun expectOrder(at: String, expected: String, body: () -> Unit) { - order = StringBuilder() // have to do that in order to run this test in JS - body() - if (order.toString() != expected) throw AssertionError("$at: expected: $expected, actual: $order") -} - -fun low(i: Int): Int { - order.append("L") - return i -} - -fun high(i: Int): Int { - order.append("H") - return i -} - -fun x(i: Int): Int { - order.append("X") - return i -} - -fun box(): String { - expectOrder("0 in 1 .. 3", "HLX") { x(0) in high(3) downTo low(1) } - expectOrder("0 !in 1 .. 3", "HLX") { x(0) !in high(3) downTo low(1) } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForRangeLiteral.kt deleted file mode 100644 index 1128de60a56..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/evaluationOrderForRangeLiteral.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME - -var order = StringBuilder() - -inline fun expectOrder(at: String, expected: String, body: () -> Unit) { - order = StringBuilder() // have to do that in order to run this test in JS - body() - if (order.toString() != expected) throw AssertionError("$at: expected: $expected, actual: $order") -} - -fun low(i: Int): Int { - order.append("L") - return i -} - -fun high(i: Int): Int { - order.append("H") - return i -} - -fun x(i: Int): Int { - order.append("X") - return i -} - -fun box(): String { - expectOrder("0 in 1 .. 3", "LHX") { x(0) in low(1) .. high(3) } - expectOrder("0 !in 1 .. 3", "LHX") { x(0) !in low(1) .. high(3) } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/arrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/arrayIndices.kt deleted file mode 100644 index 73f9e466828..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/arrayIndices.kt +++ /dev/null @@ -1,2071 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - -val intArray = intArrayOf(1, 2, 3) -val objectArray = arrayOf(1, 2, 3) -val emptyIntArray = intArrayOf() -val emptyObjectArray = arrayOf() - -val range0 = intArray.indices -val range1 = objectArray.indices -val range2 = emptyIntArray.indices -val range3 = emptyObjectArray.indices - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - testR2xE0() - testR2xE1() - testR2xE2() - testR2xE3() - testR2xE4() - testR2xE5() - testR2xE6() - testR2xE7() - testR2xE8() - testR2xE9() - testR2xE10() - testR2xE11() - testR2xE12() - testR2xE13() - testR2xE14() - testR2xE15() - testR2xE16() - testR2xE17() - testR2xE18() - testR2xE19() - testR2xE20() - testR2xE21() - testR2xE22() - testR2xE23() - testR2xE24() - testR2xE25() - testR2xE26() - testR2xE27() - testR2xE28() - testR2xE29() - testR2xE30() - testR2xE31() - testR2xE32() - testR2xE33() - testR2xE34() - testR2xE35() - testR3xE0() - testR3xE1() - testR3xE2() - testR3xE3() - testR3xE4() - testR3xE5() - testR3xE6() - testR3xE7() - testR3xE8() - testR3xE9() - testR3xE10() - testR3xE11() - testR3xE12() - testR3xE13() - testR3xE14() - testR3xE15() - testR3xE16() - testR3xE17() - testR3xE18() - testR3xE19() - testR3xE20() - testR3xE21() - testR3xE22() - testR3xE23() - testR3xE24() - testR3xE25() - testR3xE26() - testR3xE27() - testR3xE28() - testR3xE29() - testR3xE30() - testR3xE31() - testR3xE32() - testR3xE33() - testR3xE34() - testR3xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in intArray.indices != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in intArray.indices != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in intArray.indices) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in intArray.indices) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in intArray.indices != range0.contains(element0)) throw AssertionError() - if (element0 !in intArray.indices != !range0.contains(element0)) throw AssertionError() - if (!(element0 in intArray.indices) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in intArray.indices) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in intArray.indices != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in intArray.indices != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in intArray.indices) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in intArray.indices) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in intArray.indices != range0.contains(element1)) throw AssertionError() - if (element1 !in intArray.indices != !range0.contains(element1)) throw AssertionError() - if (!(element1 in intArray.indices) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in intArray.indices) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in intArray.indices != range0.contains((-1))) throw AssertionError() - if ((-1) !in intArray.indices != !range0.contains((-1))) throw AssertionError() - if (!((-1) in intArray.indices) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in intArray.indices) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in intArray.indices != range0.contains(element2)) throw AssertionError() - if (element2 !in intArray.indices != !range0.contains(element2)) throw AssertionError() - if (!(element2 in intArray.indices) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in intArray.indices) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in intArray.indices != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in intArray.indices != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in intArray.indices) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in intArray.indices) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in intArray.indices != range0.contains(element3)) throw AssertionError() - if (element3 !in intArray.indices != !range0.contains(element3)) throw AssertionError() - if (!(element3 in intArray.indices) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in intArray.indices) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in intArray.indices != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in intArray.indices != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in intArray.indices) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in intArray.indices) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in intArray.indices != range0.contains(element4)) throw AssertionError() - if (element4 !in intArray.indices != !range0.contains(element4)) throw AssertionError() - if (!(element4 in intArray.indices) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in intArray.indices) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in intArray.indices != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in intArray.indices != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in intArray.indices) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in intArray.indices) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in intArray.indices != range0.contains(element5)) throw AssertionError() - if (element5 !in intArray.indices != !range0.contains(element5)) throw AssertionError() - if (!(element5 in intArray.indices) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in intArray.indices) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in intArray.indices != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in intArray.indices != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in intArray.indices) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in intArray.indices) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in intArray.indices != range0.contains(element6)) throw AssertionError() - if (element6 !in intArray.indices != !range0.contains(element6)) throw AssertionError() - if (!(element6 in intArray.indices) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in intArray.indices) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in intArray.indices != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in intArray.indices != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in intArray.indices) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in intArray.indices) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in intArray.indices != range0.contains(element7)) throw AssertionError() - if (element7 !in intArray.indices != !range0.contains(element7)) throw AssertionError() - if (!(element7 in intArray.indices) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in intArray.indices) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in intArray.indices != range0.contains(0)) throw AssertionError() - if (0 !in intArray.indices != !range0.contains(0)) throw AssertionError() - if (!(0 in intArray.indices) != !range0.contains(0)) throw AssertionError() - if (!(0 !in intArray.indices) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in intArray.indices != range0.contains(element8)) throw AssertionError() - if (element8 !in intArray.indices != !range0.contains(element8)) throw AssertionError() - if (!(element8 in intArray.indices) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in intArray.indices) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in intArray.indices != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in intArray.indices != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in intArray.indices) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in intArray.indices) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in intArray.indices != range0.contains(element9)) throw AssertionError() - if (element9 !in intArray.indices != !range0.contains(element9)) throw AssertionError() - if (!(element9 in intArray.indices) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in intArray.indices) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in intArray.indices != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in intArray.indices != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in intArray.indices) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in intArray.indices) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in intArray.indices != range0.contains(element10)) throw AssertionError() - if (element10 !in intArray.indices != !range0.contains(element10)) throw AssertionError() - if (!(element10 in intArray.indices) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in intArray.indices) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in intArray.indices != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in intArray.indices != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in intArray.indices) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in intArray.indices) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in intArray.indices != range0.contains(element11)) throw AssertionError() - if (element11 !in intArray.indices != !range0.contains(element11)) throw AssertionError() - if (!(element11 in intArray.indices) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in intArray.indices) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in intArray.indices != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in intArray.indices != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in intArray.indices) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in intArray.indices) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in intArray.indices != range0.contains(element12)) throw AssertionError() - if (element12 !in intArray.indices != !range0.contains(element12)) throw AssertionError() - if (!(element12 in intArray.indices) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in intArray.indices) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in intArray.indices != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in intArray.indices != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in intArray.indices) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in intArray.indices) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in intArray.indices != range0.contains(element13)) throw AssertionError() - if (element13 !in intArray.indices != !range0.contains(element13)) throw AssertionError() - if (!(element13 in intArray.indices) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in intArray.indices) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in intArray.indices != range0.contains(1)) throw AssertionError() - if (1 !in intArray.indices != !range0.contains(1)) throw AssertionError() - if (!(1 in intArray.indices) != !range0.contains(1)) throw AssertionError() - if (!(1 !in intArray.indices) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in intArray.indices != range0.contains(element14)) throw AssertionError() - if (element14 !in intArray.indices != !range0.contains(element14)) throw AssertionError() - if (!(element14 in intArray.indices) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in intArray.indices) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in intArray.indices != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in intArray.indices != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in intArray.indices) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in intArray.indices) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in intArray.indices != range0.contains(element15)) throw AssertionError() - if (element15 !in intArray.indices != !range0.contains(element15)) throw AssertionError() - if (!(element15 in intArray.indices) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in intArray.indices) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in intArray.indices != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in intArray.indices != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in intArray.indices) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in intArray.indices) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in intArray.indices != range0.contains(element16)) throw AssertionError() - if (element16 !in intArray.indices != !range0.contains(element16)) throw AssertionError() - if (!(element16 in intArray.indices) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in intArray.indices) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in intArray.indices != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in intArray.indices != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in intArray.indices) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in intArray.indices) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in intArray.indices != range0.contains(element17)) throw AssertionError() - if (element17 !in intArray.indices != !range0.contains(element17)) throw AssertionError() - if (!(element17 in intArray.indices) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in intArray.indices) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in intArray.indices != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in intArray.indices != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in intArray.indices) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in intArray.indices) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in intArray.indices != range0.contains(element18)) throw AssertionError() - if (element18 !in intArray.indices != !range0.contains(element18)) throw AssertionError() - if (!(element18 in intArray.indices) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in intArray.indices) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in intArray.indices != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in intArray.indices != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in intArray.indices) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in intArray.indices) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in intArray.indices != range0.contains(element19)) throw AssertionError() - if (element19 !in intArray.indices != !range0.contains(element19)) throw AssertionError() - if (!(element19 in intArray.indices) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in intArray.indices) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in intArray.indices != range0.contains(2)) throw AssertionError() - if (2 !in intArray.indices != !range0.contains(2)) throw AssertionError() - if (!(2 in intArray.indices) != !range0.contains(2)) throw AssertionError() - if (!(2 !in intArray.indices) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in intArray.indices != range0.contains(element20)) throw AssertionError() - if (element20 !in intArray.indices != !range0.contains(element20)) throw AssertionError() - if (!(element20 in intArray.indices) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in intArray.indices) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in intArray.indices != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in intArray.indices != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in intArray.indices) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in intArray.indices) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in intArray.indices != range0.contains(element21)) throw AssertionError() - if (element21 !in intArray.indices != !range0.contains(element21)) throw AssertionError() - if (!(element21 in intArray.indices) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in intArray.indices) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in intArray.indices != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in intArray.indices != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in intArray.indices) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in intArray.indices) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in intArray.indices != range0.contains(element22)) throw AssertionError() - if (element22 !in intArray.indices != !range0.contains(element22)) throw AssertionError() - if (!(element22 in intArray.indices) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in intArray.indices) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in intArray.indices != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in intArray.indices != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in intArray.indices) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in intArray.indices) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in intArray.indices != range0.contains(element23)) throw AssertionError() - if (element23 !in intArray.indices != !range0.contains(element23)) throw AssertionError() - if (!(element23 in intArray.indices) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in intArray.indices) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in intArray.indices != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in intArray.indices != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in intArray.indices) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in intArray.indices) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in intArray.indices != range0.contains(element24)) throw AssertionError() - if (element24 !in intArray.indices != !range0.contains(element24)) throw AssertionError() - if (!(element24 in intArray.indices) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in intArray.indices) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in intArray.indices != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in intArray.indices != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in intArray.indices) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in intArray.indices) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in intArray.indices != range0.contains(element25)) throw AssertionError() - if (element25 !in intArray.indices != !range0.contains(element25)) throw AssertionError() - if (!(element25 in intArray.indices) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in intArray.indices) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in intArray.indices != range0.contains(3)) throw AssertionError() - if (3 !in intArray.indices != !range0.contains(3)) throw AssertionError() - if (!(3 in intArray.indices) != !range0.contains(3)) throw AssertionError() - if (!(3 !in intArray.indices) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in intArray.indices != range0.contains(element26)) throw AssertionError() - if (element26 !in intArray.indices != !range0.contains(element26)) throw AssertionError() - if (!(element26 in intArray.indices) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in intArray.indices) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in intArray.indices != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in intArray.indices != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in intArray.indices) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in intArray.indices) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in intArray.indices != range0.contains(element27)) throw AssertionError() - if (element27 !in intArray.indices != !range0.contains(element27)) throw AssertionError() - if (!(element27 in intArray.indices) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in intArray.indices) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in intArray.indices != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in intArray.indices != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in intArray.indices) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in intArray.indices) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in intArray.indices != range0.contains(element28)) throw AssertionError() - if (element28 !in intArray.indices != !range0.contains(element28)) throw AssertionError() - if (!(element28 in intArray.indices) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in intArray.indices) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in intArray.indices != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in intArray.indices != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in intArray.indices) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in intArray.indices) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in intArray.indices != range0.contains(element29)) throw AssertionError() - if (element29 !in intArray.indices != !range0.contains(element29)) throw AssertionError() - if (!(element29 in intArray.indices) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in intArray.indices) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in intArray.indices != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in intArray.indices != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in intArray.indices) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in intArray.indices) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in intArray.indices != range0.contains(element30)) throw AssertionError() - if (element30 !in intArray.indices != !range0.contains(element30)) throw AssertionError() - if (!(element30 in intArray.indices) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in intArray.indices) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in intArray.indices != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in intArray.indices != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in intArray.indices) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in intArray.indices) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in intArray.indices != range0.contains(element31)) throw AssertionError() - if (element31 !in intArray.indices != !range0.contains(element31)) throw AssertionError() - if (!(element31 in intArray.indices) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in intArray.indices) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in intArray.indices != range0.contains(4)) throw AssertionError() - if (4 !in intArray.indices != !range0.contains(4)) throw AssertionError() - if (!(4 in intArray.indices) != !range0.contains(4)) throw AssertionError() - if (!(4 !in intArray.indices) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in intArray.indices != range0.contains(element32)) throw AssertionError() - if (element32 !in intArray.indices != !range0.contains(element32)) throw AssertionError() - if (!(element32 in intArray.indices) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in intArray.indices) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in intArray.indices != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in intArray.indices != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in intArray.indices) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in intArray.indices) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in intArray.indices != range0.contains(element33)) throw AssertionError() - if (element33 !in intArray.indices != !range0.contains(element33)) throw AssertionError() - if (!(element33 in intArray.indices) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in intArray.indices) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in intArray.indices != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in intArray.indices != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in intArray.indices) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in intArray.indices) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in intArray.indices != range0.contains(element34)) throw AssertionError() - if (element34 !in intArray.indices != !range0.contains(element34)) throw AssertionError() - if (!(element34 in intArray.indices) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in intArray.indices) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in intArray.indices != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in intArray.indices != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in intArray.indices) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in intArray.indices) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in intArray.indices != range0.contains(element35)) throw AssertionError() - if (element35 !in intArray.indices != !range0.contains(element35)) throw AssertionError() - if (!(element35 in intArray.indices) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in intArray.indices) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in objectArray.indices != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in objectArray.indices != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in objectArray.indices) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in objectArray.indices) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in objectArray.indices != range1.contains(element0)) throw AssertionError() - if (element0 !in objectArray.indices != !range1.contains(element0)) throw AssertionError() - if (!(element0 in objectArray.indices) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in objectArray.indices) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in objectArray.indices != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in objectArray.indices != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in objectArray.indices) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in objectArray.indices) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in objectArray.indices != range1.contains(element1)) throw AssertionError() - if (element1 !in objectArray.indices != !range1.contains(element1)) throw AssertionError() - if (!(element1 in objectArray.indices) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in objectArray.indices) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in objectArray.indices != range1.contains((-1))) throw AssertionError() - if ((-1) !in objectArray.indices != !range1.contains((-1))) throw AssertionError() - if (!((-1) in objectArray.indices) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in objectArray.indices) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in objectArray.indices != range1.contains(element2)) throw AssertionError() - if (element2 !in objectArray.indices != !range1.contains(element2)) throw AssertionError() - if (!(element2 in objectArray.indices) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in objectArray.indices) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in objectArray.indices != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in objectArray.indices != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in objectArray.indices) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in objectArray.indices) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in objectArray.indices != range1.contains(element3)) throw AssertionError() - if (element3 !in objectArray.indices != !range1.contains(element3)) throw AssertionError() - if (!(element3 in objectArray.indices) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in objectArray.indices) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in objectArray.indices != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in objectArray.indices != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in objectArray.indices) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in objectArray.indices) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in objectArray.indices != range1.contains(element4)) throw AssertionError() - if (element4 !in objectArray.indices != !range1.contains(element4)) throw AssertionError() - if (!(element4 in objectArray.indices) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in objectArray.indices) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in objectArray.indices != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in objectArray.indices != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in objectArray.indices) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in objectArray.indices) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in objectArray.indices != range1.contains(element5)) throw AssertionError() - if (element5 !in objectArray.indices != !range1.contains(element5)) throw AssertionError() - if (!(element5 in objectArray.indices) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in objectArray.indices) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in objectArray.indices != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in objectArray.indices != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in objectArray.indices) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in objectArray.indices) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in objectArray.indices != range1.contains(element6)) throw AssertionError() - if (element6 !in objectArray.indices != !range1.contains(element6)) throw AssertionError() - if (!(element6 in objectArray.indices) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in objectArray.indices) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in objectArray.indices != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in objectArray.indices != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in objectArray.indices) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in objectArray.indices) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in objectArray.indices != range1.contains(element7)) throw AssertionError() - if (element7 !in objectArray.indices != !range1.contains(element7)) throw AssertionError() - if (!(element7 in objectArray.indices) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in objectArray.indices) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in objectArray.indices != range1.contains(0)) throw AssertionError() - if (0 !in objectArray.indices != !range1.contains(0)) throw AssertionError() - if (!(0 in objectArray.indices) != !range1.contains(0)) throw AssertionError() - if (!(0 !in objectArray.indices) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in objectArray.indices != range1.contains(element8)) throw AssertionError() - if (element8 !in objectArray.indices != !range1.contains(element8)) throw AssertionError() - if (!(element8 in objectArray.indices) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in objectArray.indices) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in objectArray.indices != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in objectArray.indices != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in objectArray.indices) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in objectArray.indices) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in objectArray.indices != range1.contains(element9)) throw AssertionError() - if (element9 !in objectArray.indices != !range1.contains(element9)) throw AssertionError() - if (!(element9 in objectArray.indices) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in objectArray.indices) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in objectArray.indices != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in objectArray.indices != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in objectArray.indices) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in objectArray.indices) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in objectArray.indices != range1.contains(element10)) throw AssertionError() - if (element10 !in objectArray.indices != !range1.contains(element10)) throw AssertionError() - if (!(element10 in objectArray.indices) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in objectArray.indices) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in objectArray.indices != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in objectArray.indices != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in objectArray.indices) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in objectArray.indices) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in objectArray.indices != range1.contains(element11)) throw AssertionError() - if (element11 !in objectArray.indices != !range1.contains(element11)) throw AssertionError() - if (!(element11 in objectArray.indices) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in objectArray.indices) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in objectArray.indices != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in objectArray.indices != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in objectArray.indices) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in objectArray.indices) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in objectArray.indices != range1.contains(element12)) throw AssertionError() - if (element12 !in objectArray.indices != !range1.contains(element12)) throw AssertionError() - if (!(element12 in objectArray.indices) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in objectArray.indices) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in objectArray.indices != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in objectArray.indices != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in objectArray.indices) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in objectArray.indices) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in objectArray.indices != range1.contains(element13)) throw AssertionError() - if (element13 !in objectArray.indices != !range1.contains(element13)) throw AssertionError() - if (!(element13 in objectArray.indices) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in objectArray.indices) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in objectArray.indices != range1.contains(1)) throw AssertionError() - if (1 !in objectArray.indices != !range1.contains(1)) throw AssertionError() - if (!(1 in objectArray.indices) != !range1.contains(1)) throw AssertionError() - if (!(1 !in objectArray.indices) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in objectArray.indices != range1.contains(element14)) throw AssertionError() - if (element14 !in objectArray.indices != !range1.contains(element14)) throw AssertionError() - if (!(element14 in objectArray.indices) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in objectArray.indices) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in objectArray.indices != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in objectArray.indices != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in objectArray.indices) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in objectArray.indices) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in objectArray.indices != range1.contains(element15)) throw AssertionError() - if (element15 !in objectArray.indices != !range1.contains(element15)) throw AssertionError() - if (!(element15 in objectArray.indices) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in objectArray.indices) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in objectArray.indices != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in objectArray.indices != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in objectArray.indices) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in objectArray.indices) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in objectArray.indices != range1.contains(element16)) throw AssertionError() - if (element16 !in objectArray.indices != !range1.contains(element16)) throw AssertionError() - if (!(element16 in objectArray.indices) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in objectArray.indices) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in objectArray.indices != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in objectArray.indices != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in objectArray.indices) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in objectArray.indices) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in objectArray.indices != range1.contains(element17)) throw AssertionError() - if (element17 !in objectArray.indices != !range1.contains(element17)) throw AssertionError() - if (!(element17 in objectArray.indices) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in objectArray.indices) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in objectArray.indices != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in objectArray.indices != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in objectArray.indices) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in objectArray.indices) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in objectArray.indices != range1.contains(element18)) throw AssertionError() - if (element18 !in objectArray.indices != !range1.contains(element18)) throw AssertionError() - if (!(element18 in objectArray.indices) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in objectArray.indices) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in objectArray.indices != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in objectArray.indices != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in objectArray.indices) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in objectArray.indices) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in objectArray.indices != range1.contains(element19)) throw AssertionError() - if (element19 !in objectArray.indices != !range1.contains(element19)) throw AssertionError() - if (!(element19 in objectArray.indices) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in objectArray.indices) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in objectArray.indices != range1.contains(2)) throw AssertionError() - if (2 !in objectArray.indices != !range1.contains(2)) throw AssertionError() - if (!(2 in objectArray.indices) != !range1.contains(2)) throw AssertionError() - if (!(2 !in objectArray.indices) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in objectArray.indices != range1.contains(element20)) throw AssertionError() - if (element20 !in objectArray.indices != !range1.contains(element20)) throw AssertionError() - if (!(element20 in objectArray.indices) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in objectArray.indices) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in objectArray.indices != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in objectArray.indices != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in objectArray.indices) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in objectArray.indices) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in objectArray.indices != range1.contains(element21)) throw AssertionError() - if (element21 !in objectArray.indices != !range1.contains(element21)) throw AssertionError() - if (!(element21 in objectArray.indices) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in objectArray.indices) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in objectArray.indices != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in objectArray.indices != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in objectArray.indices) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in objectArray.indices) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in objectArray.indices != range1.contains(element22)) throw AssertionError() - if (element22 !in objectArray.indices != !range1.contains(element22)) throw AssertionError() - if (!(element22 in objectArray.indices) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in objectArray.indices) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in objectArray.indices != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in objectArray.indices != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in objectArray.indices) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in objectArray.indices) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in objectArray.indices != range1.contains(element23)) throw AssertionError() - if (element23 !in objectArray.indices != !range1.contains(element23)) throw AssertionError() - if (!(element23 in objectArray.indices) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in objectArray.indices) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in objectArray.indices != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in objectArray.indices != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in objectArray.indices) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in objectArray.indices) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in objectArray.indices != range1.contains(element24)) throw AssertionError() - if (element24 !in objectArray.indices != !range1.contains(element24)) throw AssertionError() - if (!(element24 in objectArray.indices) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in objectArray.indices) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in objectArray.indices != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in objectArray.indices != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in objectArray.indices) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in objectArray.indices) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in objectArray.indices != range1.contains(element25)) throw AssertionError() - if (element25 !in objectArray.indices != !range1.contains(element25)) throw AssertionError() - if (!(element25 in objectArray.indices) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in objectArray.indices) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in objectArray.indices != range1.contains(3)) throw AssertionError() - if (3 !in objectArray.indices != !range1.contains(3)) throw AssertionError() - if (!(3 in objectArray.indices) != !range1.contains(3)) throw AssertionError() - if (!(3 !in objectArray.indices) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in objectArray.indices != range1.contains(element26)) throw AssertionError() - if (element26 !in objectArray.indices != !range1.contains(element26)) throw AssertionError() - if (!(element26 in objectArray.indices) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in objectArray.indices) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in objectArray.indices != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in objectArray.indices != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in objectArray.indices) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in objectArray.indices) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in objectArray.indices != range1.contains(element27)) throw AssertionError() - if (element27 !in objectArray.indices != !range1.contains(element27)) throw AssertionError() - if (!(element27 in objectArray.indices) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in objectArray.indices) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in objectArray.indices != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in objectArray.indices != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in objectArray.indices) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in objectArray.indices) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in objectArray.indices != range1.contains(element28)) throw AssertionError() - if (element28 !in objectArray.indices != !range1.contains(element28)) throw AssertionError() - if (!(element28 in objectArray.indices) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in objectArray.indices) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in objectArray.indices != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in objectArray.indices != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in objectArray.indices) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in objectArray.indices) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in objectArray.indices != range1.contains(element29)) throw AssertionError() - if (element29 !in objectArray.indices != !range1.contains(element29)) throw AssertionError() - if (!(element29 in objectArray.indices) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in objectArray.indices) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in objectArray.indices != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in objectArray.indices != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in objectArray.indices) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in objectArray.indices) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in objectArray.indices != range1.contains(element30)) throw AssertionError() - if (element30 !in objectArray.indices != !range1.contains(element30)) throw AssertionError() - if (!(element30 in objectArray.indices) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in objectArray.indices) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in objectArray.indices != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in objectArray.indices != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in objectArray.indices) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in objectArray.indices) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in objectArray.indices != range1.contains(element31)) throw AssertionError() - if (element31 !in objectArray.indices != !range1.contains(element31)) throw AssertionError() - if (!(element31 in objectArray.indices) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in objectArray.indices) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in objectArray.indices != range1.contains(4)) throw AssertionError() - if (4 !in objectArray.indices != !range1.contains(4)) throw AssertionError() - if (!(4 in objectArray.indices) != !range1.contains(4)) throw AssertionError() - if (!(4 !in objectArray.indices) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in objectArray.indices != range1.contains(element32)) throw AssertionError() - if (element32 !in objectArray.indices != !range1.contains(element32)) throw AssertionError() - if (!(element32 in objectArray.indices) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in objectArray.indices) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in objectArray.indices != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in objectArray.indices != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in objectArray.indices) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in objectArray.indices) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in objectArray.indices != range1.contains(element33)) throw AssertionError() - if (element33 !in objectArray.indices != !range1.contains(element33)) throw AssertionError() - if (!(element33 in objectArray.indices) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in objectArray.indices) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in objectArray.indices != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in objectArray.indices != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in objectArray.indices) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in objectArray.indices) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in objectArray.indices != range1.contains(element34)) throw AssertionError() - if (element34 !in objectArray.indices != !range1.contains(element34)) throw AssertionError() - if (!(element34 in objectArray.indices) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in objectArray.indices) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in objectArray.indices != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in objectArray.indices != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in objectArray.indices) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in objectArray.indices) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in objectArray.indices != range1.contains(element35)) throw AssertionError() - if (element35 !in objectArray.indices != !range1.contains(element35)) throw AssertionError() - if (!(element35 in objectArray.indices) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in objectArray.indices) != range1.contains(element35)) throw AssertionError() -} - -fun testR2xE0() { - // with possible local optimizations - if ((-1).toByte() in emptyIntArray.indices != range2.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in emptyIntArray.indices != !range2.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in emptyIntArray.indices) != !range2.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in emptyIntArray.indices) != range2.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in emptyIntArray.indices != range2.contains(element0)) throw AssertionError() - if (element0 !in emptyIntArray.indices != !range2.contains(element0)) throw AssertionError() - if (!(element0 in emptyIntArray.indices) != !range2.contains(element0)) throw AssertionError() - if (!(element0 !in emptyIntArray.indices) != range2.contains(element0)) throw AssertionError() -} - -fun testR2xE1() { - // with possible local optimizations - if ((-1).toShort() in emptyIntArray.indices != range2.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in emptyIntArray.indices != !range2.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in emptyIntArray.indices) != !range2.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in emptyIntArray.indices) != range2.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in emptyIntArray.indices != range2.contains(element1)) throw AssertionError() - if (element1 !in emptyIntArray.indices != !range2.contains(element1)) throw AssertionError() - if (!(element1 in emptyIntArray.indices) != !range2.contains(element1)) throw AssertionError() - if (!(element1 !in emptyIntArray.indices) != range2.contains(element1)) throw AssertionError() -} - -fun testR2xE2() { - // with possible local optimizations - if ((-1) in emptyIntArray.indices != range2.contains((-1))) throw AssertionError() - if ((-1) !in emptyIntArray.indices != !range2.contains((-1))) throw AssertionError() - if (!((-1) in emptyIntArray.indices) != !range2.contains((-1))) throw AssertionError() - if (!((-1) !in emptyIntArray.indices) != range2.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in emptyIntArray.indices != range2.contains(element2)) throw AssertionError() - if (element2 !in emptyIntArray.indices != !range2.contains(element2)) throw AssertionError() - if (!(element2 in emptyIntArray.indices) != !range2.contains(element2)) throw AssertionError() - if (!(element2 !in emptyIntArray.indices) != range2.contains(element2)) throw AssertionError() -} - -fun testR2xE3() { - // with possible local optimizations - if ((-1).toLong() in emptyIntArray.indices != range2.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in emptyIntArray.indices != !range2.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in emptyIntArray.indices) != !range2.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in emptyIntArray.indices) != range2.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in emptyIntArray.indices != range2.contains(element3)) throw AssertionError() - if (element3 !in emptyIntArray.indices != !range2.contains(element3)) throw AssertionError() - if (!(element3 in emptyIntArray.indices) != !range2.contains(element3)) throw AssertionError() - if (!(element3 !in emptyIntArray.indices) != range2.contains(element3)) throw AssertionError() -} - -fun testR2xE4() { - // with possible local optimizations - if ((-1).toFloat() in emptyIntArray.indices != range2.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in emptyIntArray.indices != !range2.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in emptyIntArray.indices) != !range2.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in emptyIntArray.indices) != range2.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in emptyIntArray.indices != range2.contains(element4)) throw AssertionError() - if (element4 !in emptyIntArray.indices != !range2.contains(element4)) throw AssertionError() - if (!(element4 in emptyIntArray.indices) != !range2.contains(element4)) throw AssertionError() - if (!(element4 !in emptyIntArray.indices) != range2.contains(element4)) throw AssertionError() -} - -fun testR2xE5() { - // with possible local optimizations - if ((-1).toDouble() in emptyIntArray.indices != range2.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in emptyIntArray.indices != !range2.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in emptyIntArray.indices) != !range2.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in emptyIntArray.indices) != range2.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in emptyIntArray.indices != range2.contains(element5)) throw AssertionError() - if (element5 !in emptyIntArray.indices != !range2.contains(element5)) throw AssertionError() - if (!(element5 in emptyIntArray.indices) != !range2.contains(element5)) throw AssertionError() - if (!(element5 !in emptyIntArray.indices) != range2.contains(element5)) throw AssertionError() -} - -fun testR2xE6() { - // with possible local optimizations - if (0.toByte() in emptyIntArray.indices != range2.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in emptyIntArray.indices != !range2.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in emptyIntArray.indices) != !range2.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in emptyIntArray.indices) != range2.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in emptyIntArray.indices != range2.contains(element6)) throw AssertionError() - if (element6 !in emptyIntArray.indices != !range2.contains(element6)) throw AssertionError() - if (!(element6 in emptyIntArray.indices) != !range2.contains(element6)) throw AssertionError() - if (!(element6 !in emptyIntArray.indices) != range2.contains(element6)) throw AssertionError() -} - -fun testR2xE7() { - // with possible local optimizations - if (0.toShort() in emptyIntArray.indices != range2.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in emptyIntArray.indices != !range2.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in emptyIntArray.indices) != !range2.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in emptyIntArray.indices) != range2.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in emptyIntArray.indices != range2.contains(element7)) throw AssertionError() - if (element7 !in emptyIntArray.indices != !range2.contains(element7)) throw AssertionError() - if (!(element7 in emptyIntArray.indices) != !range2.contains(element7)) throw AssertionError() - if (!(element7 !in emptyIntArray.indices) != range2.contains(element7)) throw AssertionError() -} - -fun testR2xE8() { - // with possible local optimizations - if (0 in emptyIntArray.indices != range2.contains(0)) throw AssertionError() - if (0 !in emptyIntArray.indices != !range2.contains(0)) throw AssertionError() - if (!(0 in emptyIntArray.indices) != !range2.contains(0)) throw AssertionError() - if (!(0 !in emptyIntArray.indices) != range2.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in emptyIntArray.indices != range2.contains(element8)) throw AssertionError() - if (element8 !in emptyIntArray.indices != !range2.contains(element8)) throw AssertionError() - if (!(element8 in emptyIntArray.indices) != !range2.contains(element8)) throw AssertionError() - if (!(element8 !in emptyIntArray.indices) != range2.contains(element8)) throw AssertionError() -} - -fun testR2xE9() { - // with possible local optimizations - if (0.toLong() in emptyIntArray.indices != range2.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in emptyIntArray.indices != !range2.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in emptyIntArray.indices) != !range2.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in emptyIntArray.indices) != range2.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in emptyIntArray.indices != range2.contains(element9)) throw AssertionError() - if (element9 !in emptyIntArray.indices != !range2.contains(element9)) throw AssertionError() - if (!(element9 in emptyIntArray.indices) != !range2.contains(element9)) throw AssertionError() - if (!(element9 !in emptyIntArray.indices) != range2.contains(element9)) throw AssertionError() -} - -fun testR2xE10() { - // with possible local optimizations - if (0.toFloat() in emptyIntArray.indices != range2.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in emptyIntArray.indices != !range2.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in emptyIntArray.indices) != !range2.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in emptyIntArray.indices) != range2.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in emptyIntArray.indices != range2.contains(element10)) throw AssertionError() - if (element10 !in emptyIntArray.indices != !range2.contains(element10)) throw AssertionError() - if (!(element10 in emptyIntArray.indices) != !range2.contains(element10)) throw AssertionError() - if (!(element10 !in emptyIntArray.indices) != range2.contains(element10)) throw AssertionError() -} - -fun testR2xE11() { - // with possible local optimizations - if (0.toDouble() in emptyIntArray.indices != range2.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in emptyIntArray.indices != !range2.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in emptyIntArray.indices) != !range2.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in emptyIntArray.indices) != range2.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in emptyIntArray.indices != range2.contains(element11)) throw AssertionError() - if (element11 !in emptyIntArray.indices != !range2.contains(element11)) throw AssertionError() - if (!(element11 in emptyIntArray.indices) != !range2.contains(element11)) throw AssertionError() - if (!(element11 !in emptyIntArray.indices) != range2.contains(element11)) throw AssertionError() -} - -fun testR2xE12() { - // with possible local optimizations - if (1.toByte() in emptyIntArray.indices != range2.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in emptyIntArray.indices != !range2.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in emptyIntArray.indices) != !range2.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in emptyIntArray.indices) != range2.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in emptyIntArray.indices != range2.contains(element12)) throw AssertionError() - if (element12 !in emptyIntArray.indices != !range2.contains(element12)) throw AssertionError() - if (!(element12 in emptyIntArray.indices) != !range2.contains(element12)) throw AssertionError() - if (!(element12 !in emptyIntArray.indices) != range2.contains(element12)) throw AssertionError() -} - -fun testR2xE13() { - // with possible local optimizations - if (1.toShort() in emptyIntArray.indices != range2.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in emptyIntArray.indices != !range2.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in emptyIntArray.indices) != !range2.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in emptyIntArray.indices) != range2.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in emptyIntArray.indices != range2.contains(element13)) throw AssertionError() - if (element13 !in emptyIntArray.indices != !range2.contains(element13)) throw AssertionError() - if (!(element13 in emptyIntArray.indices) != !range2.contains(element13)) throw AssertionError() - if (!(element13 !in emptyIntArray.indices) != range2.contains(element13)) throw AssertionError() -} - -fun testR2xE14() { - // with possible local optimizations - if (1 in emptyIntArray.indices != range2.contains(1)) throw AssertionError() - if (1 !in emptyIntArray.indices != !range2.contains(1)) throw AssertionError() - if (!(1 in emptyIntArray.indices) != !range2.contains(1)) throw AssertionError() - if (!(1 !in emptyIntArray.indices) != range2.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in emptyIntArray.indices != range2.contains(element14)) throw AssertionError() - if (element14 !in emptyIntArray.indices != !range2.contains(element14)) throw AssertionError() - if (!(element14 in emptyIntArray.indices) != !range2.contains(element14)) throw AssertionError() - if (!(element14 !in emptyIntArray.indices) != range2.contains(element14)) throw AssertionError() -} - -fun testR2xE15() { - // with possible local optimizations - if (1.toLong() in emptyIntArray.indices != range2.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in emptyIntArray.indices != !range2.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in emptyIntArray.indices) != !range2.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in emptyIntArray.indices) != range2.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in emptyIntArray.indices != range2.contains(element15)) throw AssertionError() - if (element15 !in emptyIntArray.indices != !range2.contains(element15)) throw AssertionError() - if (!(element15 in emptyIntArray.indices) != !range2.contains(element15)) throw AssertionError() - if (!(element15 !in emptyIntArray.indices) != range2.contains(element15)) throw AssertionError() -} - -fun testR2xE16() { - // with possible local optimizations - if (1.toFloat() in emptyIntArray.indices != range2.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in emptyIntArray.indices != !range2.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in emptyIntArray.indices) != !range2.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in emptyIntArray.indices) != range2.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in emptyIntArray.indices != range2.contains(element16)) throw AssertionError() - if (element16 !in emptyIntArray.indices != !range2.contains(element16)) throw AssertionError() - if (!(element16 in emptyIntArray.indices) != !range2.contains(element16)) throw AssertionError() - if (!(element16 !in emptyIntArray.indices) != range2.contains(element16)) throw AssertionError() -} - -fun testR2xE17() { - // with possible local optimizations - if (1.toDouble() in emptyIntArray.indices != range2.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in emptyIntArray.indices != !range2.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in emptyIntArray.indices) != !range2.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in emptyIntArray.indices) != range2.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in emptyIntArray.indices != range2.contains(element17)) throw AssertionError() - if (element17 !in emptyIntArray.indices != !range2.contains(element17)) throw AssertionError() - if (!(element17 in emptyIntArray.indices) != !range2.contains(element17)) throw AssertionError() - if (!(element17 !in emptyIntArray.indices) != range2.contains(element17)) throw AssertionError() -} - -fun testR2xE18() { - // with possible local optimizations - if (2.toByte() in emptyIntArray.indices != range2.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in emptyIntArray.indices != !range2.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in emptyIntArray.indices) != !range2.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in emptyIntArray.indices) != range2.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in emptyIntArray.indices != range2.contains(element18)) throw AssertionError() - if (element18 !in emptyIntArray.indices != !range2.contains(element18)) throw AssertionError() - if (!(element18 in emptyIntArray.indices) != !range2.contains(element18)) throw AssertionError() - if (!(element18 !in emptyIntArray.indices) != range2.contains(element18)) throw AssertionError() -} - -fun testR2xE19() { - // with possible local optimizations - if (2.toShort() in emptyIntArray.indices != range2.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in emptyIntArray.indices != !range2.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in emptyIntArray.indices) != !range2.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in emptyIntArray.indices) != range2.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in emptyIntArray.indices != range2.contains(element19)) throw AssertionError() - if (element19 !in emptyIntArray.indices != !range2.contains(element19)) throw AssertionError() - if (!(element19 in emptyIntArray.indices) != !range2.contains(element19)) throw AssertionError() - if (!(element19 !in emptyIntArray.indices) != range2.contains(element19)) throw AssertionError() -} - -fun testR2xE20() { - // with possible local optimizations - if (2 in emptyIntArray.indices != range2.contains(2)) throw AssertionError() - if (2 !in emptyIntArray.indices != !range2.contains(2)) throw AssertionError() - if (!(2 in emptyIntArray.indices) != !range2.contains(2)) throw AssertionError() - if (!(2 !in emptyIntArray.indices) != range2.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in emptyIntArray.indices != range2.contains(element20)) throw AssertionError() - if (element20 !in emptyIntArray.indices != !range2.contains(element20)) throw AssertionError() - if (!(element20 in emptyIntArray.indices) != !range2.contains(element20)) throw AssertionError() - if (!(element20 !in emptyIntArray.indices) != range2.contains(element20)) throw AssertionError() -} - -fun testR2xE21() { - // with possible local optimizations - if (2.toLong() in emptyIntArray.indices != range2.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in emptyIntArray.indices != !range2.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in emptyIntArray.indices) != !range2.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in emptyIntArray.indices) != range2.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in emptyIntArray.indices != range2.contains(element21)) throw AssertionError() - if (element21 !in emptyIntArray.indices != !range2.contains(element21)) throw AssertionError() - if (!(element21 in emptyIntArray.indices) != !range2.contains(element21)) throw AssertionError() - if (!(element21 !in emptyIntArray.indices) != range2.contains(element21)) throw AssertionError() -} - -fun testR2xE22() { - // with possible local optimizations - if (2.toFloat() in emptyIntArray.indices != range2.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in emptyIntArray.indices != !range2.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in emptyIntArray.indices) != !range2.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in emptyIntArray.indices) != range2.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in emptyIntArray.indices != range2.contains(element22)) throw AssertionError() - if (element22 !in emptyIntArray.indices != !range2.contains(element22)) throw AssertionError() - if (!(element22 in emptyIntArray.indices) != !range2.contains(element22)) throw AssertionError() - if (!(element22 !in emptyIntArray.indices) != range2.contains(element22)) throw AssertionError() -} - -fun testR2xE23() { - // with possible local optimizations - if (2.toDouble() in emptyIntArray.indices != range2.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in emptyIntArray.indices != !range2.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in emptyIntArray.indices) != !range2.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in emptyIntArray.indices) != range2.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in emptyIntArray.indices != range2.contains(element23)) throw AssertionError() - if (element23 !in emptyIntArray.indices != !range2.contains(element23)) throw AssertionError() - if (!(element23 in emptyIntArray.indices) != !range2.contains(element23)) throw AssertionError() - if (!(element23 !in emptyIntArray.indices) != range2.contains(element23)) throw AssertionError() -} - -fun testR2xE24() { - // with possible local optimizations - if (3.toByte() in emptyIntArray.indices != range2.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in emptyIntArray.indices != !range2.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in emptyIntArray.indices) != !range2.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in emptyIntArray.indices) != range2.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in emptyIntArray.indices != range2.contains(element24)) throw AssertionError() - if (element24 !in emptyIntArray.indices != !range2.contains(element24)) throw AssertionError() - if (!(element24 in emptyIntArray.indices) != !range2.contains(element24)) throw AssertionError() - if (!(element24 !in emptyIntArray.indices) != range2.contains(element24)) throw AssertionError() -} - -fun testR2xE25() { - // with possible local optimizations - if (3.toShort() in emptyIntArray.indices != range2.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in emptyIntArray.indices != !range2.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in emptyIntArray.indices) != !range2.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in emptyIntArray.indices) != range2.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in emptyIntArray.indices != range2.contains(element25)) throw AssertionError() - if (element25 !in emptyIntArray.indices != !range2.contains(element25)) throw AssertionError() - if (!(element25 in emptyIntArray.indices) != !range2.contains(element25)) throw AssertionError() - if (!(element25 !in emptyIntArray.indices) != range2.contains(element25)) throw AssertionError() -} - -fun testR2xE26() { - // with possible local optimizations - if (3 in emptyIntArray.indices != range2.contains(3)) throw AssertionError() - if (3 !in emptyIntArray.indices != !range2.contains(3)) throw AssertionError() - if (!(3 in emptyIntArray.indices) != !range2.contains(3)) throw AssertionError() - if (!(3 !in emptyIntArray.indices) != range2.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in emptyIntArray.indices != range2.contains(element26)) throw AssertionError() - if (element26 !in emptyIntArray.indices != !range2.contains(element26)) throw AssertionError() - if (!(element26 in emptyIntArray.indices) != !range2.contains(element26)) throw AssertionError() - if (!(element26 !in emptyIntArray.indices) != range2.contains(element26)) throw AssertionError() -} - -fun testR2xE27() { - // with possible local optimizations - if (3.toLong() in emptyIntArray.indices != range2.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in emptyIntArray.indices != !range2.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in emptyIntArray.indices) != !range2.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in emptyIntArray.indices) != range2.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in emptyIntArray.indices != range2.contains(element27)) throw AssertionError() - if (element27 !in emptyIntArray.indices != !range2.contains(element27)) throw AssertionError() - if (!(element27 in emptyIntArray.indices) != !range2.contains(element27)) throw AssertionError() - if (!(element27 !in emptyIntArray.indices) != range2.contains(element27)) throw AssertionError() -} - -fun testR2xE28() { - // with possible local optimizations - if (3.toFloat() in emptyIntArray.indices != range2.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in emptyIntArray.indices != !range2.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in emptyIntArray.indices) != !range2.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in emptyIntArray.indices) != range2.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in emptyIntArray.indices != range2.contains(element28)) throw AssertionError() - if (element28 !in emptyIntArray.indices != !range2.contains(element28)) throw AssertionError() - if (!(element28 in emptyIntArray.indices) != !range2.contains(element28)) throw AssertionError() - if (!(element28 !in emptyIntArray.indices) != range2.contains(element28)) throw AssertionError() -} - -fun testR2xE29() { - // with possible local optimizations - if (3.toDouble() in emptyIntArray.indices != range2.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in emptyIntArray.indices != !range2.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in emptyIntArray.indices) != !range2.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in emptyIntArray.indices) != range2.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in emptyIntArray.indices != range2.contains(element29)) throw AssertionError() - if (element29 !in emptyIntArray.indices != !range2.contains(element29)) throw AssertionError() - if (!(element29 in emptyIntArray.indices) != !range2.contains(element29)) throw AssertionError() - if (!(element29 !in emptyIntArray.indices) != range2.contains(element29)) throw AssertionError() -} - -fun testR2xE30() { - // with possible local optimizations - if (4.toByte() in emptyIntArray.indices != range2.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in emptyIntArray.indices != !range2.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in emptyIntArray.indices) != !range2.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in emptyIntArray.indices) != range2.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in emptyIntArray.indices != range2.contains(element30)) throw AssertionError() - if (element30 !in emptyIntArray.indices != !range2.contains(element30)) throw AssertionError() - if (!(element30 in emptyIntArray.indices) != !range2.contains(element30)) throw AssertionError() - if (!(element30 !in emptyIntArray.indices) != range2.contains(element30)) throw AssertionError() -} - -fun testR2xE31() { - // with possible local optimizations - if (4.toShort() in emptyIntArray.indices != range2.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in emptyIntArray.indices != !range2.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in emptyIntArray.indices) != !range2.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in emptyIntArray.indices) != range2.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in emptyIntArray.indices != range2.contains(element31)) throw AssertionError() - if (element31 !in emptyIntArray.indices != !range2.contains(element31)) throw AssertionError() - if (!(element31 in emptyIntArray.indices) != !range2.contains(element31)) throw AssertionError() - if (!(element31 !in emptyIntArray.indices) != range2.contains(element31)) throw AssertionError() -} - -fun testR2xE32() { - // with possible local optimizations - if (4 in emptyIntArray.indices != range2.contains(4)) throw AssertionError() - if (4 !in emptyIntArray.indices != !range2.contains(4)) throw AssertionError() - if (!(4 in emptyIntArray.indices) != !range2.contains(4)) throw AssertionError() - if (!(4 !in emptyIntArray.indices) != range2.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in emptyIntArray.indices != range2.contains(element32)) throw AssertionError() - if (element32 !in emptyIntArray.indices != !range2.contains(element32)) throw AssertionError() - if (!(element32 in emptyIntArray.indices) != !range2.contains(element32)) throw AssertionError() - if (!(element32 !in emptyIntArray.indices) != range2.contains(element32)) throw AssertionError() -} - -fun testR2xE33() { - // with possible local optimizations - if (4.toLong() in emptyIntArray.indices != range2.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in emptyIntArray.indices != !range2.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in emptyIntArray.indices) != !range2.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in emptyIntArray.indices) != range2.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in emptyIntArray.indices != range2.contains(element33)) throw AssertionError() - if (element33 !in emptyIntArray.indices != !range2.contains(element33)) throw AssertionError() - if (!(element33 in emptyIntArray.indices) != !range2.contains(element33)) throw AssertionError() - if (!(element33 !in emptyIntArray.indices) != range2.contains(element33)) throw AssertionError() -} - -fun testR2xE34() { - // with possible local optimizations - if (4.toFloat() in emptyIntArray.indices != range2.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in emptyIntArray.indices != !range2.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in emptyIntArray.indices) != !range2.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in emptyIntArray.indices) != range2.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in emptyIntArray.indices != range2.contains(element34)) throw AssertionError() - if (element34 !in emptyIntArray.indices != !range2.contains(element34)) throw AssertionError() - if (!(element34 in emptyIntArray.indices) != !range2.contains(element34)) throw AssertionError() - if (!(element34 !in emptyIntArray.indices) != range2.contains(element34)) throw AssertionError() -} - -fun testR2xE35() { - // with possible local optimizations - if (4.toDouble() in emptyIntArray.indices != range2.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in emptyIntArray.indices != !range2.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in emptyIntArray.indices) != !range2.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in emptyIntArray.indices) != range2.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in emptyIntArray.indices != range2.contains(element35)) throw AssertionError() - if (element35 !in emptyIntArray.indices != !range2.contains(element35)) throw AssertionError() - if (!(element35 in emptyIntArray.indices) != !range2.contains(element35)) throw AssertionError() - if (!(element35 !in emptyIntArray.indices) != range2.contains(element35)) throw AssertionError() -} - -fun testR3xE0() { - // with possible local optimizations - if ((-1).toByte() in emptyObjectArray.indices != range3.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in emptyObjectArray.indices != !range3.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in emptyObjectArray.indices) != !range3.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in emptyObjectArray.indices) != range3.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in emptyObjectArray.indices != range3.contains(element0)) throw AssertionError() - if (element0 !in emptyObjectArray.indices != !range3.contains(element0)) throw AssertionError() - if (!(element0 in emptyObjectArray.indices) != !range3.contains(element0)) throw AssertionError() - if (!(element0 !in emptyObjectArray.indices) != range3.contains(element0)) throw AssertionError() -} - -fun testR3xE1() { - // with possible local optimizations - if ((-1).toShort() in emptyObjectArray.indices != range3.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in emptyObjectArray.indices != !range3.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in emptyObjectArray.indices) != !range3.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in emptyObjectArray.indices) != range3.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in emptyObjectArray.indices != range3.contains(element1)) throw AssertionError() - if (element1 !in emptyObjectArray.indices != !range3.contains(element1)) throw AssertionError() - if (!(element1 in emptyObjectArray.indices) != !range3.contains(element1)) throw AssertionError() - if (!(element1 !in emptyObjectArray.indices) != range3.contains(element1)) throw AssertionError() -} - -fun testR3xE2() { - // with possible local optimizations - if ((-1) in emptyObjectArray.indices != range3.contains((-1))) throw AssertionError() - if ((-1) !in emptyObjectArray.indices != !range3.contains((-1))) throw AssertionError() - if (!((-1) in emptyObjectArray.indices) != !range3.contains((-1))) throw AssertionError() - if (!((-1) !in emptyObjectArray.indices) != range3.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in emptyObjectArray.indices != range3.contains(element2)) throw AssertionError() - if (element2 !in emptyObjectArray.indices != !range3.contains(element2)) throw AssertionError() - if (!(element2 in emptyObjectArray.indices) != !range3.contains(element2)) throw AssertionError() - if (!(element2 !in emptyObjectArray.indices) != range3.contains(element2)) throw AssertionError() -} - -fun testR3xE3() { - // with possible local optimizations - if ((-1).toLong() in emptyObjectArray.indices != range3.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in emptyObjectArray.indices != !range3.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in emptyObjectArray.indices) != !range3.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in emptyObjectArray.indices) != range3.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in emptyObjectArray.indices != range3.contains(element3)) throw AssertionError() - if (element3 !in emptyObjectArray.indices != !range3.contains(element3)) throw AssertionError() - if (!(element3 in emptyObjectArray.indices) != !range3.contains(element3)) throw AssertionError() - if (!(element3 !in emptyObjectArray.indices) != range3.contains(element3)) throw AssertionError() -} - -fun testR3xE4() { - // with possible local optimizations - if ((-1).toFloat() in emptyObjectArray.indices != range3.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in emptyObjectArray.indices != !range3.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in emptyObjectArray.indices) != !range3.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in emptyObjectArray.indices) != range3.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in emptyObjectArray.indices != range3.contains(element4)) throw AssertionError() - if (element4 !in emptyObjectArray.indices != !range3.contains(element4)) throw AssertionError() - if (!(element4 in emptyObjectArray.indices) != !range3.contains(element4)) throw AssertionError() - if (!(element4 !in emptyObjectArray.indices) != range3.contains(element4)) throw AssertionError() -} - -fun testR3xE5() { - // with possible local optimizations - if ((-1).toDouble() in emptyObjectArray.indices != range3.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in emptyObjectArray.indices != !range3.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in emptyObjectArray.indices) != !range3.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in emptyObjectArray.indices) != range3.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in emptyObjectArray.indices != range3.contains(element5)) throw AssertionError() - if (element5 !in emptyObjectArray.indices != !range3.contains(element5)) throw AssertionError() - if (!(element5 in emptyObjectArray.indices) != !range3.contains(element5)) throw AssertionError() - if (!(element5 !in emptyObjectArray.indices) != range3.contains(element5)) throw AssertionError() -} - -fun testR3xE6() { - // with possible local optimizations - if (0.toByte() in emptyObjectArray.indices != range3.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in emptyObjectArray.indices != !range3.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in emptyObjectArray.indices) != !range3.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in emptyObjectArray.indices) != range3.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in emptyObjectArray.indices != range3.contains(element6)) throw AssertionError() - if (element6 !in emptyObjectArray.indices != !range3.contains(element6)) throw AssertionError() - if (!(element6 in emptyObjectArray.indices) != !range3.contains(element6)) throw AssertionError() - if (!(element6 !in emptyObjectArray.indices) != range3.contains(element6)) throw AssertionError() -} - -fun testR3xE7() { - // with possible local optimizations - if (0.toShort() in emptyObjectArray.indices != range3.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in emptyObjectArray.indices != !range3.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in emptyObjectArray.indices) != !range3.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in emptyObjectArray.indices) != range3.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in emptyObjectArray.indices != range3.contains(element7)) throw AssertionError() - if (element7 !in emptyObjectArray.indices != !range3.contains(element7)) throw AssertionError() - if (!(element7 in emptyObjectArray.indices) != !range3.contains(element7)) throw AssertionError() - if (!(element7 !in emptyObjectArray.indices) != range3.contains(element7)) throw AssertionError() -} - -fun testR3xE8() { - // with possible local optimizations - if (0 in emptyObjectArray.indices != range3.contains(0)) throw AssertionError() - if (0 !in emptyObjectArray.indices != !range3.contains(0)) throw AssertionError() - if (!(0 in emptyObjectArray.indices) != !range3.contains(0)) throw AssertionError() - if (!(0 !in emptyObjectArray.indices) != range3.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in emptyObjectArray.indices != range3.contains(element8)) throw AssertionError() - if (element8 !in emptyObjectArray.indices != !range3.contains(element8)) throw AssertionError() - if (!(element8 in emptyObjectArray.indices) != !range3.contains(element8)) throw AssertionError() - if (!(element8 !in emptyObjectArray.indices) != range3.contains(element8)) throw AssertionError() -} - -fun testR3xE9() { - // with possible local optimizations - if (0.toLong() in emptyObjectArray.indices != range3.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in emptyObjectArray.indices != !range3.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in emptyObjectArray.indices) != !range3.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in emptyObjectArray.indices) != range3.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in emptyObjectArray.indices != range3.contains(element9)) throw AssertionError() - if (element9 !in emptyObjectArray.indices != !range3.contains(element9)) throw AssertionError() - if (!(element9 in emptyObjectArray.indices) != !range3.contains(element9)) throw AssertionError() - if (!(element9 !in emptyObjectArray.indices) != range3.contains(element9)) throw AssertionError() -} - -fun testR3xE10() { - // with possible local optimizations - if (0.toFloat() in emptyObjectArray.indices != range3.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in emptyObjectArray.indices != !range3.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in emptyObjectArray.indices) != !range3.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in emptyObjectArray.indices) != range3.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in emptyObjectArray.indices != range3.contains(element10)) throw AssertionError() - if (element10 !in emptyObjectArray.indices != !range3.contains(element10)) throw AssertionError() - if (!(element10 in emptyObjectArray.indices) != !range3.contains(element10)) throw AssertionError() - if (!(element10 !in emptyObjectArray.indices) != range3.contains(element10)) throw AssertionError() -} - -fun testR3xE11() { - // with possible local optimizations - if (0.toDouble() in emptyObjectArray.indices != range3.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in emptyObjectArray.indices != !range3.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in emptyObjectArray.indices) != !range3.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in emptyObjectArray.indices) != range3.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in emptyObjectArray.indices != range3.contains(element11)) throw AssertionError() - if (element11 !in emptyObjectArray.indices != !range3.contains(element11)) throw AssertionError() - if (!(element11 in emptyObjectArray.indices) != !range3.contains(element11)) throw AssertionError() - if (!(element11 !in emptyObjectArray.indices) != range3.contains(element11)) throw AssertionError() -} - -fun testR3xE12() { - // with possible local optimizations - if (1.toByte() in emptyObjectArray.indices != range3.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in emptyObjectArray.indices != !range3.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in emptyObjectArray.indices) != !range3.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in emptyObjectArray.indices) != range3.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in emptyObjectArray.indices != range3.contains(element12)) throw AssertionError() - if (element12 !in emptyObjectArray.indices != !range3.contains(element12)) throw AssertionError() - if (!(element12 in emptyObjectArray.indices) != !range3.contains(element12)) throw AssertionError() - if (!(element12 !in emptyObjectArray.indices) != range3.contains(element12)) throw AssertionError() -} - -fun testR3xE13() { - // with possible local optimizations - if (1.toShort() in emptyObjectArray.indices != range3.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in emptyObjectArray.indices != !range3.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in emptyObjectArray.indices) != !range3.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in emptyObjectArray.indices) != range3.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in emptyObjectArray.indices != range3.contains(element13)) throw AssertionError() - if (element13 !in emptyObjectArray.indices != !range3.contains(element13)) throw AssertionError() - if (!(element13 in emptyObjectArray.indices) != !range3.contains(element13)) throw AssertionError() - if (!(element13 !in emptyObjectArray.indices) != range3.contains(element13)) throw AssertionError() -} - -fun testR3xE14() { - // with possible local optimizations - if (1 in emptyObjectArray.indices != range3.contains(1)) throw AssertionError() - if (1 !in emptyObjectArray.indices != !range3.contains(1)) throw AssertionError() - if (!(1 in emptyObjectArray.indices) != !range3.contains(1)) throw AssertionError() - if (!(1 !in emptyObjectArray.indices) != range3.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in emptyObjectArray.indices != range3.contains(element14)) throw AssertionError() - if (element14 !in emptyObjectArray.indices != !range3.contains(element14)) throw AssertionError() - if (!(element14 in emptyObjectArray.indices) != !range3.contains(element14)) throw AssertionError() - if (!(element14 !in emptyObjectArray.indices) != range3.contains(element14)) throw AssertionError() -} - -fun testR3xE15() { - // with possible local optimizations - if (1.toLong() in emptyObjectArray.indices != range3.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in emptyObjectArray.indices != !range3.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in emptyObjectArray.indices) != !range3.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in emptyObjectArray.indices) != range3.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in emptyObjectArray.indices != range3.contains(element15)) throw AssertionError() - if (element15 !in emptyObjectArray.indices != !range3.contains(element15)) throw AssertionError() - if (!(element15 in emptyObjectArray.indices) != !range3.contains(element15)) throw AssertionError() - if (!(element15 !in emptyObjectArray.indices) != range3.contains(element15)) throw AssertionError() -} - -fun testR3xE16() { - // with possible local optimizations - if (1.toFloat() in emptyObjectArray.indices != range3.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in emptyObjectArray.indices != !range3.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in emptyObjectArray.indices) != !range3.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in emptyObjectArray.indices) != range3.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in emptyObjectArray.indices != range3.contains(element16)) throw AssertionError() - if (element16 !in emptyObjectArray.indices != !range3.contains(element16)) throw AssertionError() - if (!(element16 in emptyObjectArray.indices) != !range3.contains(element16)) throw AssertionError() - if (!(element16 !in emptyObjectArray.indices) != range3.contains(element16)) throw AssertionError() -} - -fun testR3xE17() { - // with possible local optimizations - if (1.toDouble() in emptyObjectArray.indices != range3.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in emptyObjectArray.indices != !range3.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in emptyObjectArray.indices) != !range3.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in emptyObjectArray.indices) != range3.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in emptyObjectArray.indices != range3.contains(element17)) throw AssertionError() - if (element17 !in emptyObjectArray.indices != !range3.contains(element17)) throw AssertionError() - if (!(element17 in emptyObjectArray.indices) != !range3.contains(element17)) throw AssertionError() - if (!(element17 !in emptyObjectArray.indices) != range3.contains(element17)) throw AssertionError() -} - -fun testR3xE18() { - // with possible local optimizations - if (2.toByte() in emptyObjectArray.indices != range3.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in emptyObjectArray.indices != !range3.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in emptyObjectArray.indices) != !range3.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in emptyObjectArray.indices) != range3.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in emptyObjectArray.indices != range3.contains(element18)) throw AssertionError() - if (element18 !in emptyObjectArray.indices != !range3.contains(element18)) throw AssertionError() - if (!(element18 in emptyObjectArray.indices) != !range3.contains(element18)) throw AssertionError() - if (!(element18 !in emptyObjectArray.indices) != range3.contains(element18)) throw AssertionError() -} - -fun testR3xE19() { - // with possible local optimizations - if (2.toShort() in emptyObjectArray.indices != range3.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in emptyObjectArray.indices != !range3.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in emptyObjectArray.indices) != !range3.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in emptyObjectArray.indices) != range3.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in emptyObjectArray.indices != range3.contains(element19)) throw AssertionError() - if (element19 !in emptyObjectArray.indices != !range3.contains(element19)) throw AssertionError() - if (!(element19 in emptyObjectArray.indices) != !range3.contains(element19)) throw AssertionError() - if (!(element19 !in emptyObjectArray.indices) != range3.contains(element19)) throw AssertionError() -} - -fun testR3xE20() { - // with possible local optimizations - if (2 in emptyObjectArray.indices != range3.contains(2)) throw AssertionError() - if (2 !in emptyObjectArray.indices != !range3.contains(2)) throw AssertionError() - if (!(2 in emptyObjectArray.indices) != !range3.contains(2)) throw AssertionError() - if (!(2 !in emptyObjectArray.indices) != range3.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in emptyObjectArray.indices != range3.contains(element20)) throw AssertionError() - if (element20 !in emptyObjectArray.indices != !range3.contains(element20)) throw AssertionError() - if (!(element20 in emptyObjectArray.indices) != !range3.contains(element20)) throw AssertionError() - if (!(element20 !in emptyObjectArray.indices) != range3.contains(element20)) throw AssertionError() -} - -fun testR3xE21() { - // with possible local optimizations - if (2.toLong() in emptyObjectArray.indices != range3.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in emptyObjectArray.indices != !range3.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in emptyObjectArray.indices) != !range3.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in emptyObjectArray.indices) != range3.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in emptyObjectArray.indices != range3.contains(element21)) throw AssertionError() - if (element21 !in emptyObjectArray.indices != !range3.contains(element21)) throw AssertionError() - if (!(element21 in emptyObjectArray.indices) != !range3.contains(element21)) throw AssertionError() - if (!(element21 !in emptyObjectArray.indices) != range3.contains(element21)) throw AssertionError() -} - -fun testR3xE22() { - // with possible local optimizations - if (2.toFloat() in emptyObjectArray.indices != range3.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in emptyObjectArray.indices != !range3.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in emptyObjectArray.indices) != !range3.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in emptyObjectArray.indices) != range3.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in emptyObjectArray.indices != range3.contains(element22)) throw AssertionError() - if (element22 !in emptyObjectArray.indices != !range3.contains(element22)) throw AssertionError() - if (!(element22 in emptyObjectArray.indices) != !range3.contains(element22)) throw AssertionError() - if (!(element22 !in emptyObjectArray.indices) != range3.contains(element22)) throw AssertionError() -} - -fun testR3xE23() { - // with possible local optimizations - if (2.toDouble() in emptyObjectArray.indices != range3.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in emptyObjectArray.indices != !range3.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in emptyObjectArray.indices) != !range3.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in emptyObjectArray.indices) != range3.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in emptyObjectArray.indices != range3.contains(element23)) throw AssertionError() - if (element23 !in emptyObjectArray.indices != !range3.contains(element23)) throw AssertionError() - if (!(element23 in emptyObjectArray.indices) != !range3.contains(element23)) throw AssertionError() - if (!(element23 !in emptyObjectArray.indices) != range3.contains(element23)) throw AssertionError() -} - -fun testR3xE24() { - // with possible local optimizations - if (3.toByte() in emptyObjectArray.indices != range3.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in emptyObjectArray.indices != !range3.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in emptyObjectArray.indices) != !range3.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in emptyObjectArray.indices) != range3.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in emptyObjectArray.indices != range3.contains(element24)) throw AssertionError() - if (element24 !in emptyObjectArray.indices != !range3.contains(element24)) throw AssertionError() - if (!(element24 in emptyObjectArray.indices) != !range3.contains(element24)) throw AssertionError() - if (!(element24 !in emptyObjectArray.indices) != range3.contains(element24)) throw AssertionError() -} - -fun testR3xE25() { - // with possible local optimizations - if (3.toShort() in emptyObjectArray.indices != range3.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in emptyObjectArray.indices != !range3.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in emptyObjectArray.indices) != !range3.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in emptyObjectArray.indices) != range3.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in emptyObjectArray.indices != range3.contains(element25)) throw AssertionError() - if (element25 !in emptyObjectArray.indices != !range3.contains(element25)) throw AssertionError() - if (!(element25 in emptyObjectArray.indices) != !range3.contains(element25)) throw AssertionError() - if (!(element25 !in emptyObjectArray.indices) != range3.contains(element25)) throw AssertionError() -} - -fun testR3xE26() { - // with possible local optimizations - if (3 in emptyObjectArray.indices != range3.contains(3)) throw AssertionError() - if (3 !in emptyObjectArray.indices != !range3.contains(3)) throw AssertionError() - if (!(3 in emptyObjectArray.indices) != !range3.contains(3)) throw AssertionError() - if (!(3 !in emptyObjectArray.indices) != range3.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in emptyObjectArray.indices != range3.contains(element26)) throw AssertionError() - if (element26 !in emptyObjectArray.indices != !range3.contains(element26)) throw AssertionError() - if (!(element26 in emptyObjectArray.indices) != !range3.contains(element26)) throw AssertionError() - if (!(element26 !in emptyObjectArray.indices) != range3.contains(element26)) throw AssertionError() -} - -fun testR3xE27() { - // with possible local optimizations - if (3.toLong() in emptyObjectArray.indices != range3.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in emptyObjectArray.indices != !range3.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in emptyObjectArray.indices) != !range3.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in emptyObjectArray.indices) != range3.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in emptyObjectArray.indices != range3.contains(element27)) throw AssertionError() - if (element27 !in emptyObjectArray.indices != !range3.contains(element27)) throw AssertionError() - if (!(element27 in emptyObjectArray.indices) != !range3.contains(element27)) throw AssertionError() - if (!(element27 !in emptyObjectArray.indices) != range3.contains(element27)) throw AssertionError() -} - -fun testR3xE28() { - // with possible local optimizations - if (3.toFloat() in emptyObjectArray.indices != range3.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in emptyObjectArray.indices != !range3.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in emptyObjectArray.indices) != !range3.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in emptyObjectArray.indices) != range3.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in emptyObjectArray.indices != range3.contains(element28)) throw AssertionError() - if (element28 !in emptyObjectArray.indices != !range3.contains(element28)) throw AssertionError() - if (!(element28 in emptyObjectArray.indices) != !range3.contains(element28)) throw AssertionError() - if (!(element28 !in emptyObjectArray.indices) != range3.contains(element28)) throw AssertionError() -} - -fun testR3xE29() { - // with possible local optimizations - if (3.toDouble() in emptyObjectArray.indices != range3.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in emptyObjectArray.indices != !range3.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in emptyObjectArray.indices) != !range3.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in emptyObjectArray.indices) != range3.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in emptyObjectArray.indices != range3.contains(element29)) throw AssertionError() - if (element29 !in emptyObjectArray.indices != !range3.contains(element29)) throw AssertionError() - if (!(element29 in emptyObjectArray.indices) != !range3.contains(element29)) throw AssertionError() - if (!(element29 !in emptyObjectArray.indices) != range3.contains(element29)) throw AssertionError() -} - -fun testR3xE30() { - // with possible local optimizations - if (4.toByte() in emptyObjectArray.indices != range3.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in emptyObjectArray.indices != !range3.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in emptyObjectArray.indices) != !range3.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in emptyObjectArray.indices) != range3.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in emptyObjectArray.indices != range3.contains(element30)) throw AssertionError() - if (element30 !in emptyObjectArray.indices != !range3.contains(element30)) throw AssertionError() - if (!(element30 in emptyObjectArray.indices) != !range3.contains(element30)) throw AssertionError() - if (!(element30 !in emptyObjectArray.indices) != range3.contains(element30)) throw AssertionError() -} - -fun testR3xE31() { - // with possible local optimizations - if (4.toShort() in emptyObjectArray.indices != range3.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in emptyObjectArray.indices != !range3.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in emptyObjectArray.indices) != !range3.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in emptyObjectArray.indices) != range3.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in emptyObjectArray.indices != range3.contains(element31)) throw AssertionError() - if (element31 !in emptyObjectArray.indices != !range3.contains(element31)) throw AssertionError() - if (!(element31 in emptyObjectArray.indices) != !range3.contains(element31)) throw AssertionError() - if (!(element31 !in emptyObjectArray.indices) != range3.contains(element31)) throw AssertionError() -} - -fun testR3xE32() { - // with possible local optimizations - if (4 in emptyObjectArray.indices != range3.contains(4)) throw AssertionError() - if (4 !in emptyObjectArray.indices != !range3.contains(4)) throw AssertionError() - if (!(4 in emptyObjectArray.indices) != !range3.contains(4)) throw AssertionError() - if (!(4 !in emptyObjectArray.indices) != range3.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in emptyObjectArray.indices != range3.contains(element32)) throw AssertionError() - if (element32 !in emptyObjectArray.indices != !range3.contains(element32)) throw AssertionError() - if (!(element32 in emptyObjectArray.indices) != !range3.contains(element32)) throw AssertionError() - if (!(element32 !in emptyObjectArray.indices) != range3.contains(element32)) throw AssertionError() -} - -fun testR3xE33() { - // with possible local optimizations - if (4.toLong() in emptyObjectArray.indices != range3.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in emptyObjectArray.indices != !range3.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in emptyObjectArray.indices) != !range3.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in emptyObjectArray.indices) != range3.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in emptyObjectArray.indices != range3.contains(element33)) throw AssertionError() - if (element33 !in emptyObjectArray.indices != !range3.contains(element33)) throw AssertionError() - if (!(element33 in emptyObjectArray.indices) != !range3.contains(element33)) throw AssertionError() - if (!(element33 !in emptyObjectArray.indices) != range3.contains(element33)) throw AssertionError() -} - -fun testR3xE34() { - // with possible local optimizations - if (4.toFloat() in emptyObjectArray.indices != range3.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in emptyObjectArray.indices != !range3.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in emptyObjectArray.indices) != !range3.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in emptyObjectArray.indices) != range3.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in emptyObjectArray.indices != range3.contains(element34)) throw AssertionError() - if (element34 !in emptyObjectArray.indices != !range3.contains(element34)) throw AssertionError() - if (!(element34 in emptyObjectArray.indices) != !range3.contains(element34)) throw AssertionError() - if (!(element34 !in emptyObjectArray.indices) != range3.contains(element34)) throw AssertionError() -} - -fun testR3xE35() { - // with possible local optimizations - if (4.toDouble() in emptyObjectArray.indices != range3.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in emptyObjectArray.indices != !range3.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in emptyObjectArray.indices) != !range3.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in emptyObjectArray.indices) != range3.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in emptyObjectArray.indices != range3.contains(element35)) throw AssertionError() - if (element35 !in emptyObjectArray.indices != !range3.contains(element35)) throw AssertionError() - if (!(element35 in emptyObjectArray.indices) != !range3.contains(element35)) throw AssertionError() - if (!(element35 !in emptyObjectArray.indices) != range3.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/charDownTo.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/charDownTo.kt deleted file mode 100644 index a2256df17ba..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/charDownTo.kt +++ /dev/null @@ -1,159 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = '3' downTo '1' -val range1 = '1' downTo '3' - -val element0 = '0' -val element1 = '1' -val element2 = '2' -val element3 = '3' -val element4 = '4' - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ('0' in '3' downTo '1' != range0.contains('0')) throw AssertionError() - if ('0' !in '3' downTo '1' != !range0.contains('0')) throw AssertionError() - if (!('0' in '3' downTo '1') != !range0.contains('0')) throw AssertionError() - if (!('0' !in '3' downTo '1') != range0.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '3' downTo '1' != range0.contains(element0)) throw AssertionError() - if (element0 !in '3' downTo '1' != !range0.contains(element0)) throw AssertionError() - if (!(element0 in '3' downTo '1') != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in '3' downTo '1') != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ('1' in '3' downTo '1' != range0.contains('1')) throw AssertionError() - if ('1' !in '3' downTo '1' != !range0.contains('1')) throw AssertionError() - if (!('1' in '3' downTo '1') != !range0.contains('1')) throw AssertionError() - if (!('1' !in '3' downTo '1') != range0.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '3' downTo '1' != range0.contains(element1)) throw AssertionError() - if (element1 !in '3' downTo '1' != !range0.contains(element1)) throw AssertionError() - if (!(element1 in '3' downTo '1') != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in '3' downTo '1') != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ('2' in '3' downTo '1' != range0.contains('2')) throw AssertionError() - if ('2' !in '3' downTo '1' != !range0.contains('2')) throw AssertionError() - if (!('2' in '3' downTo '1') != !range0.contains('2')) throw AssertionError() - if (!('2' !in '3' downTo '1') != range0.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '3' downTo '1' != range0.contains(element2)) throw AssertionError() - if (element2 !in '3' downTo '1' != !range0.contains(element2)) throw AssertionError() - if (!(element2 in '3' downTo '1') != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in '3' downTo '1') != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ('3' in '3' downTo '1' != range0.contains('3')) throw AssertionError() - if ('3' !in '3' downTo '1' != !range0.contains('3')) throw AssertionError() - if (!('3' in '3' downTo '1') != !range0.contains('3')) throw AssertionError() - if (!('3' !in '3' downTo '1') != range0.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '3' downTo '1' != range0.contains(element3)) throw AssertionError() - if (element3 !in '3' downTo '1' != !range0.contains(element3)) throw AssertionError() - if (!(element3 in '3' downTo '1') != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in '3' downTo '1') != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ('4' in '3' downTo '1' != range0.contains('4')) throw AssertionError() - if ('4' !in '3' downTo '1' != !range0.contains('4')) throw AssertionError() - if (!('4' in '3' downTo '1') != !range0.contains('4')) throw AssertionError() - if (!('4' !in '3' downTo '1') != range0.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '3' downTo '1' != range0.contains(element4)) throw AssertionError() - if (element4 !in '3' downTo '1' != !range0.contains(element4)) throw AssertionError() - if (!(element4 in '3' downTo '1') != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in '3' downTo '1') != range0.contains(element4)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ('0' in '1' downTo '3' != range1.contains('0')) throw AssertionError() - if ('0' !in '1' downTo '3' != !range1.contains('0')) throw AssertionError() - if (!('0' in '1' downTo '3') != !range1.contains('0')) throw AssertionError() - if (!('0' !in '1' downTo '3') != range1.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '1' downTo '3' != range1.contains(element0)) throw AssertionError() - if (element0 !in '1' downTo '3' != !range1.contains(element0)) throw AssertionError() - if (!(element0 in '1' downTo '3') != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in '1' downTo '3') != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ('1' in '1' downTo '3' != range1.contains('1')) throw AssertionError() - if ('1' !in '1' downTo '3' != !range1.contains('1')) throw AssertionError() - if (!('1' in '1' downTo '3') != !range1.contains('1')) throw AssertionError() - if (!('1' !in '1' downTo '3') != range1.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '1' downTo '3' != range1.contains(element1)) throw AssertionError() - if (element1 !in '1' downTo '3' != !range1.contains(element1)) throw AssertionError() - if (!(element1 in '1' downTo '3') != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in '1' downTo '3') != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ('2' in '1' downTo '3' != range1.contains('2')) throw AssertionError() - if ('2' !in '1' downTo '3' != !range1.contains('2')) throw AssertionError() - if (!('2' in '1' downTo '3') != !range1.contains('2')) throw AssertionError() - if (!('2' !in '1' downTo '3') != range1.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '1' downTo '3' != range1.contains(element2)) throw AssertionError() - if (element2 !in '1' downTo '3' != !range1.contains(element2)) throw AssertionError() - if (!(element2 in '1' downTo '3') != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in '1' downTo '3') != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ('3' in '1' downTo '3' != range1.contains('3')) throw AssertionError() - if ('3' !in '1' downTo '3' != !range1.contains('3')) throw AssertionError() - if (!('3' in '1' downTo '3') != !range1.contains('3')) throw AssertionError() - if (!('3' !in '1' downTo '3') != range1.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '1' downTo '3' != range1.contains(element3)) throw AssertionError() - if (element3 !in '1' downTo '3' != !range1.contains(element3)) throw AssertionError() - if (!(element3 in '1' downTo '3') != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in '1' downTo '3') != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ('4' in '1' downTo '3' != range1.contains('4')) throw AssertionError() - if ('4' !in '1' downTo '3' != !range1.contains('4')) throw AssertionError() - if (!('4' in '1' downTo '3') != !range1.contains('4')) throw AssertionError() - if (!('4' !in '1' downTo '3') != range1.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '1' downTo '3' != range1.contains(element4)) throw AssertionError() - if (element4 !in '1' downTo '3' != !range1.contains(element4)) throw AssertionError() - if (!(element4 in '1' downTo '3') != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in '1' downTo '3') != range1.contains(element4)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/charRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/charRangeLiteral.kt deleted file mode 100644 index ba93f6b044d..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/charRangeLiteral.kt +++ /dev/null @@ -1,159 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = '1' .. '3' -val range1 = '3' .. '1' - -val element0 = '0' -val element1 = '1' -val element2 = '2' -val element3 = '3' -val element4 = '4' - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ('0' in '1' .. '3' != range0.contains('0')) throw AssertionError() - if ('0' !in '1' .. '3' != !range0.contains('0')) throw AssertionError() - if (!('0' in '1' .. '3') != !range0.contains('0')) throw AssertionError() - if (!('0' !in '1' .. '3') != range0.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '1' .. '3' != range0.contains(element0)) throw AssertionError() - if (element0 !in '1' .. '3' != !range0.contains(element0)) throw AssertionError() - if (!(element0 in '1' .. '3') != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in '1' .. '3') != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ('1' in '1' .. '3' != range0.contains('1')) throw AssertionError() - if ('1' !in '1' .. '3' != !range0.contains('1')) throw AssertionError() - if (!('1' in '1' .. '3') != !range0.contains('1')) throw AssertionError() - if (!('1' !in '1' .. '3') != range0.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '1' .. '3' != range0.contains(element1)) throw AssertionError() - if (element1 !in '1' .. '3' != !range0.contains(element1)) throw AssertionError() - if (!(element1 in '1' .. '3') != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in '1' .. '3') != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ('2' in '1' .. '3' != range0.contains('2')) throw AssertionError() - if ('2' !in '1' .. '3' != !range0.contains('2')) throw AssertionError() - if (!('2' in '1' .. '3') != !range0.contains('2')) throw AssertionError() - if (!('2' !in '1' .. '3') != range0.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '1' .. '3' != range0.contains(element2)) throw AssertionError() - if (element2 !in '1' .. '3' != !range0.contains(element2)) throw AssertionError() - if (!(element2 in '1' .. '3') != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in '1' .. '3') != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ('3' in '1' .. '3' != range0.contains('3')) throw AssertionError() - if ('3' !in '1' .. '3' != !range0.contains('3')) throw AssertionError() - if (!('3' in '1' .. '3') != !range0.contains('3')) throw AssertionError() - if (!('3' !in '1' .. '3') != range0.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '1' .. '3' != range0.contains(element3)) throw AssertionError() - if (element3 !in '1' .. '3' != !range0.contains(element3)) throw AssertionError() - if (!(element3 in '1' .. '3') != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in '1' .. '3') != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ('4' in '1' .. '3' != range0.contains('4')) throw AssertionError() - if ('4' !in '1' .. '3' != !range0.contains('4')) throw AssertionError() - if (!('4' in '1' .. '3') != !range0.contains('4')) throw AssertionError() - if (!('4' !in '1' .. '3') != range0.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '1' .. '3' != range0.contains(element4)) throw AssertionError() - if (element4 !in '1' .. '3' != !range0.contains(element4)) throw AssertionError() - if (!(element4 in '1' .. '3') != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in '1' .. '3') != range0.contains(element4)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ('0' in '3' .. '1' != range1.contains('0')) throw AssertionError() - if ('0' !in '3' .. '1' != !range1.contains('0')) throw AssertionError() - if (!('0' in '3' .. '1') != !range1.contains('0')) throw AssertionError() - if (!('0' !in '3' .. '1') != range1.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '3' .. '1' != range1.contains(element0)) throw AssertionError() - if (element0 !in '3' .. '1' != !range1.contains(element0)) throw AssertionError() - if (!(element0 in '3' .. '1') != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in '3' .. '1') != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ('1' in '3' .. '1' != range1.contains('1')) throw AssertionError() - if ('1' !in '3' .. '1' != !range1.contains('1')) throw AssertionError() - if (!('1' in '3' .. '1') != !range1.contains('1')) throw AssertionError() - if (!('1' !in '3' .. '1') != range1.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '3' .. '1' != range1.contains(element1)) throw AssertionError() - if (element1 !in '3' .. '1' != !range1.contains(element1)) throw AssertionError() - if (!(element1 in '3' .. '1') != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in '3' .. '1') != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ('2' in '3' .. '1' != range1.contains('2')) throw AssertionError() - if ('2' !in '3' .. '1' != !range1.contains('2')) throw AssertionError() - if (!('2' in '3' .. '1') != !range1.contains('2')) throw AssertionError() - if (!('2' !in '3' .. '1') != range1.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '3' .. '1' != range1.contains(element2)) throw AssertionError() - if (element2 !in '3' .. '1' != !range1.contains(element2)) throw AssertionError() - if (!(element2 in '3' .. '1') != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in '3' .. '1') != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ('3' in '3' .. '1' != range1.contains('3')) throw AssertionError() - if ('3' !in '3' .. '1' != !range1.contains('3')) throw AssertionError() - if (!('3' in '3' .. '1') != !range1.contains('3')) throw AssertionError() - if (!('3' !in '3' .. '1') != range1.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '3' .. '1' != range1.contains(element3)) throw AssertionError() - if (element3 !in '3' .. '1' != !range1.contains(element3)) throw AssertionError() - if (!(element3 in '3' .. '1') != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in '3' .. '1') != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ('4' in '3' .. '1' != range1.contains('4')) throw AssertionError() - if ('4' !in '3' .. '1' != !range1.contains('4')) throw AssertionError() - if (!('4' in '3' .. '1') != !range1.contains('4')) throw AssertionError() - if (!('4' !in '3' .. '1') != range1.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '3' .. '1' != range1.contains(element4)) throw AssertionError() - if (element4 !in '3' .. '1' != !range1.contains(element4)) throw AssertionError() - if (!(element4 in '3' .. '1') != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in '3' .. '1') != range1.contains(element4)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/charSequenceIndices.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/charSequenceIndices.kt deleted file mode 100644 index 7f6d4ac8921..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/charSequenceIndices.kt +++ /dev/null @@ -1,1059 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - -val charSequence: CharSequence = "123" -val emptyCharSequence: CharSequence = "" - -val range0 = charSequence.indices -val range1 = emptyCharSequence.indices - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in charSequence.indices != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in charSequence.indices != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in charSequence.indices) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in charSequence.indices) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in charSequence.indices != range0.contains(element0)) throw AssertionError() - if (element0 !in charSequence.indices != !range0.contains(element0)) throw AssertionError() - if (!(element0 in charSequence.indices) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in charSequence.indices) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in charSequence.indices != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in charSequence.indices != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in charSequence.indices) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in charSequence.indices) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in charSequence.indices != range0.contains(element1)) throw AssertionError() - if (element1 !in charSequence.indices != !range0.contains(element1)) throw AssertionError() - if (!(element1 in charSequence.indices) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in charSequence.indices) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in charSequence.indices != range0.contains((-1))) throw AssertionError() - if ((-1) !in charSequence.indices != !range0.contains((-1))) throw AssertionError() - if (!((-1) in charSequence.indices) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in charSequence.indices) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in charSequence.indices != range0.contains(element2)) throw AssertionError() - if (element2 !in charSequence.indices != !range0.contains(element2)) throw AssertionError() - if (!(element2 in charSequence.indices) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in charSequence.indices) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in charSequence.indices != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in charSequence.indices != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in charSequence.indices) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in charSequence.indices) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in charSequence.indices != range0.contains(element3)) throw AssertionError() - if (element3 !in charSequence.indices != !range0.contains(element3)) throw AssertionError() - if (!(element3 in charSequence.indices) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in charSequence.indices) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in charSequence.indices != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in charSequence.indices != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in charSequence.indices) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in charSequence.indices) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in charSequence.indices != range0.contains(element4)) throw AssertionError() - if (element4 !in charSequence.indices != !range0.contains(element4)) throw AssertionError() - if (!(element4 in charSequence.indices) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in charSequence.indices) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in charSequence.indices != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in charSequence.indices != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in charSequence.indices) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in charSequence.indices) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in charSequence.indices != range0.contains(element5)) throw AssertionError() - if (element5 !in charSequence.indices != !range0.contains(element5)) throw AssertionError() - if (!(element5 in charSequence.indices) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in charSequence.indices) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in charSequence.indices != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in charSequence.indices != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in charSequence.indices) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in charSequence.indices) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in charSequence.indices != range0.contains(element6)) throw AssertionError() - if (element6 !in charSequence.indices != !range0.contains(element6)) throw AssertionError() - if (!(element6 in charSequence.indices) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in charSequence.indices) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in charSequence.indices != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in charSequence.indices != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in charSequence.indices) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in charSequence.indices) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in charSequence.indices != range0.contains(element7)) throw AssertionError() - if (element7 !in charSequence.indices != !range0.contains(element7)) throw AssertionError() - if (!(element7 in charSequence.indices) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in charSequence.indices) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in charSequence.indices != range0.contains(0)) throw AssertionError() - if (0 !in charSequence.indices != !range0.contains(0)) throw AssertionError() - if (!(0 in charSequence.indices) != !range0.contains(0)) throw AssertionError() - if (!(0 !in charSequence.indices) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in charSequence.indices != range0.contains(element8)) throw AssertionError() - if (element8 !in charSequence.indices != !range0.contains(element8)) throw AssertionError() - if (!(element8 in charSequence.indices) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in charSequence.indices) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in charSequence.indices != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in charSequence.indices != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in charSequence.indices) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in charSequence.indices) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in charSequence.indices != range0.contains(element9)) throw AssertionError() - if (element9 !in charSequence.indices != !range0.contains(element9)) throw AssertionError() - if (!(element9 in charSequence.indices) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in charSequence.indices) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in charSequence.indices != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in charSequence.indices != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in charSequence.indices) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in charSequence.indices) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in charSequence.indices != range0.contains(element10)) throw AssertionError() - if (element10 !in charSequence.indices != !range0.contains(element10)) throw AssertionError() - if (!(element10 in charSequence.indices) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in charSequence.indices) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in charSequence.indices != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in charSequence.indices != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in charSequence.indices) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in charSequence.indices) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in charSequence.indices != range0.contains(element11)) throw AssertionError() - if (element11 !in charSequence.indices != !range0.contains(element11)) throw AssertionError() - if (!(element11 in charSequence.indices) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in charSequence.indices) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in charSequence.indices != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in charSequence.indices != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in charSequence.indices) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in charSequence.indices) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in charSequence.indices != range0.contains(element12)) throw AssertionError() - if (element12 !in charSequence.indices != !range0.contains(element12)) throw AssertionError() - if (!(element12 in charSequence.indices) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in charSequence.indices) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in charSequence.indices != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in charSequence.indices != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in charSequence.indices) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in charSequence.indices) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in charSequence.indices != range0.contains(element13)) throw AssertionError() - if (element13 !in charSequence.indices != !range0.contains(element13)) throw AssertionError() - if (!(element13 in charSequence.indices) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in charSequence.indices) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in charSequence.indices != range0.contains(1)) throw AssertionError() - if (1 !in charSequence.indices != !range0.contains(1)) throw AssertionError() - if (!(1 in charSequence.indices) != !range0.contains(1)) throw AssertionError() - if (!(1 !in charSequence.indices) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in charSequence.indices != range0.contains(element14)) throw AssertionError() - if (element14 !in charSequence.indices != !range0.contains(element14)) throw AssertionError() - if (!(element14 in charSequence.indices) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in charSequence.indices) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in charSequence.indices != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in charSequence.indices != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in charSequence.indices) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in charSequence.indices) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in charSequence.indices != range0.contains(element15)) throw AssertionError() - if (element15 !in charSequence.indices != !range0.contains(element15)) throw AssertionError() - if (!(element15 in charSequence.indices) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in charSequence.indices) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in charSequence.indices != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in charSequence.indices != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in charSequence.indices) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in charSequence.indices) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in charSequence.indices != range0.contains(element16)) throw AssertionError() - if (element16 !in charSequence.indices != !range0.contains(element16)) throw AssertionError() - if (!(element16 in charSequence.indices) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in charSequence.indices) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in charSequence.indices != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in charSequence.indices != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in charSequence.indices) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in charSequence.indices) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in charSequence.indices != range0.contains(element17)) throw AssertionError() - if (element17 !in charSequence.indices != !range0.contains(element17)) throw AssertionError() - if (!(element17 in charSequence.indices) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in charSequence.indices) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in charSequence.indices != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in charSequence.indices != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in charSequence.indices) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in charSequence.indices) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in charSequence.indices != range0.contains(element18)) throw AssertionError() - if (element18 !in charSequence.indices != !range0.contains(element18)) throw AssertionError() - if (!(element18 in charSequence.indices) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in charSequence.indices) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in charSequence.indices != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in charSequence.indices != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in charSequence.indices) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in charSequence.indices) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in charSequence.indices != range0.contains(element19)) throw AssertionError() - if (element19 !in charSequence.indices != !range0.contains(element19)) throw AssertionError() - if (!(element19 in charSequence.indices) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in charSequence.indices) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in charSequence.indices != range0.contains(2)) throw AssertionError() - if (2 !in charSequence.indices != !range0.contains(2)) throw AssertionError() - if (!(2 in charSequence.indices) != !range0.contains(2)) throw AssertionError() - if (!(2 !in charSequence.indices) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in charSequence.indices != range0.contains(element20)) throw AssertionError() - if (element20 !in charSequence.indices != !range0.contains(element20)) throw AssertionError() - if (!(element20 in charSequence.indices) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in charSequence.indices) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in charSequence.indices != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in charSequence.indices != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in charSequence.indices) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in charSequence.indices) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in charSequence.indices != range0.contains(element21)) throw AssertionError() - if (element21 !in charSequence.indices != !range0.contains(element21)) throw AssertionError() - if (!(element21 in charSequence.indices) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in charSequence.indices) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in charSequence.indices != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in charSequence.indices != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in charSequence.indices) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in charSequence.indices) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in charSequence.indices != range0.contains(element22)) throw AssertionError() - if (element22 !in charSequence.indices != !range0.contains(element22)) throw AssertionError() - if (!(element22 in charSequence.indices) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in charSequence.indices) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in charSequence.indices != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in charSequence.indices != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in charSequence.indices) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in charSequence.indices) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in charSequence.indices != range0.contains(element23)) throw AssertionError() - if (element23 !in charSequence.indices != !range0.contains(element23)) throw AssertionError() - if (!(element23 in charSequence.indices) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in charSequence.indices) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in charSequence.indices != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in charSequence.indices != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in charSequence.indices) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in charSequence.indices) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in charSequence.indices != range0.contains(element24)) throw AssertionError() - if (element24 !in charSequence.indices != !range0.contains(element24)) throw AssertionError() - if (!(element24 in charSequence.indices) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in charSequence.indices) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in charSequence.indices != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in charSequence.indices != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in charSequence.indices) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in charSequence.indices) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in charSequence.indices != range0.contains(element25)) throw AssertionError() - if (element25 !in charSequence.indices != !range0.contains(element25)) throw AssertionError() - if (!(element25 in charSequence.indices) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in charSequence.indices) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in charSequence.indices != range0.contains(3)) throw AssertionError() - if (3 !in charSequence.indices != !range0.contains(3)) throw AssertionError() - if (!(3 in charSequence.indices) != !range0.contains(3)) throw AssertionError() - if (!(3 !in charSequence.indices) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in charSequence.indices != range0.contains(element26)) throw AssertionError() - if (element26 !in charSequence.indices != !range0.contains(element26)) throw AssertionError() - if (!(element26 in charSequence.indices) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in charSequence.indices) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in charSequence.indices != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in charSequence.indices != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in charSequence.indices) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in charSequence.indices) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in charSequence.indices != range0.contains(element27)) throw AssertionError() - if (element27 !in charSequence.indices != !range0.contains(element27)) throw AssertionError() - if (!(element27 in charSequence.indices) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in charSequence.indices) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in charSequence.indices != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in charSequence.indices != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in charSequence.indices) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in charSequence.indices) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in charSequence.indices != range0.contains(element28)) throw AssertionError() - if (element28 !in charSequence.indices != !range0.contains(element28)) throw AssertionError() - if (!(element28 in charSequence.indices) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in charSequence.indices) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in charSequence.indices != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in charSequence.indices != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in charSequence.indices) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in charSequence.indices) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in charSequence.indices != range0.contains(element29)) throw AssertionError() - if (element29 !in charSequence.indices != !range0.contains(element29)) throw AssertionError() - if (!(element29 in charSequence.indices) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in charSequence.indices) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in charSequence.indices != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in charSequence.indices != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in charSequence.indices) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in charSequence.indices) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in charSequence.indices != range0.contains(element30)) throw AssertionError() - if (element30 !in charSequence.indices != !range0.contains(element30)) throw AssertionError() - if (!(element30 in charSequence.indices) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in charSequence.indices) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in charSequence.indices != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in charSequence.indices != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in charSequence.indices) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in charSequence.indices) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in charSequence.indices != range0.contains(element31)) throw AssertionError() - if (element31 !in charSequence.indices != !range0.contains(element31)) throw AssertionError() - if (!(element31 in charSequence.indices) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in charSequence.indices) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in charSequence.indices != range0.contains(4)) throw AssertionError() - if (4 !in charSequence.indices != !range0.contains(4)) throw AssertionError() - if (!(4 in charSequence.indices) != !range0.contains(4)) throw AssertionError() - if (!(4 !in charSequence.indices) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in charSequence.indices != range0.contains(element32)) throw AssertionError() - if (element32 !in charSequence.indices != !range0.contains(element32)) throw AssertionError() - if (!(element32 in charSequence.indices) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in charSequence.indices) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in charSequence.indices != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in charSequence.indices != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in charSequence.indices) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in charSequence.indices) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in charSequence.indices != range0.contains(element33)) throw AssertionError() - if (element33 !in charSequence.indices != !range0.contains(element33)) throw AssertionError() - if (!(element33 in charSequence.indices) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in charSequence.indices) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in charSequence.indices != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in charSequence.indices != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in charSequence.indices) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in charSequence.indices) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in charSequence.indices != range0.contains(element34)) throw AssertionError() - if (element34 !in charSequence.indices != !range0.contains(element34)) throw AssertionError() - if (!(element34 in charSequence.indices) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in charSequence.indices) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in charSequence.indices != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in charSequence.indices != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in charSequence.indices) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in charSequence.indices) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in charSequence.indices != range0.contains(element35)) throw AssertionError() - if (element35 !in charSequence.indices != !range0.contains(element35)) throw AssertionError() - if (!(element35 in charSequence.indices) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in charSequence.indices) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in emptyCharSequence.indices != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in emptyCharSequence.indices != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in emptyCharSequence.indices) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in emptyCharSequence.indices) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in emptyCharSequence.indices != range1.contains(element0)) throw AssertionError() - if (element0 !in emptyCharSequence.indices != !range1.contains(element0)) throw AssertionError() - if (!(element0 in emptyCharSequence.indices) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in emptyCharSequence.indices) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in emptyCharSequence.indices != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in emptyCharSequence.indices != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in emptyCharSequence.indices) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in emptyCharSequence.indices) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in emptyCharSequence.indices != range1.contains(element1)) throw AssertionError() - if (element1 !in emptyCharSequence.indices != !range1.contains(element1)) throw AssertionError() - if (!(element1 in emptyCharSequence.indices) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in emptyCharSequence.indices) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in emptyCharSequence.indices != range1.contains((-1))) throw AssertionError() - if ((-1) !in emptyCharSequence.indices != !range1.contains((-1))) throw AssertionError() - if (!((-1) in emptyCharSequence.indices) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in emptyCharSequence.indices) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in emptyCharSequence.indices != range1.contains(element2)) throw AssertionError() - if (element2 !in emptyCharSequence.indices != !range1.contains(element2)) throw AssertionError() - if (!(element2 in emptyCharSequence.indices) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in emptyCharSequence.indices) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in emptyCharSequence.indices != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in emptyCharSequence.indices != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in emptyCharSequence.indices) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in emptyCharSequence.indices) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in emptyCharSequence.indices != range1.contains(element3)) throw AssertionError() - if (element3 !in emptyCharSequence.indices != !range1.contains(element3)) throw AssertionError() - if (!(element3 in emptyCharSequence.indices) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in emptyCharSequence.indices) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in emptyCharSequence.indices != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in emptyCharSequence.indices != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in emptyCharSequence.indices) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in emptyCharSequence.indices) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in emptyCharSequence.indices != range1.contains(element4)) throw AssertionError() - if (element4 !in emptyCharSequence.indices != !range1.contains(element4)) throw AssertionError() - if (!(element4 in emptyCharSequence.indices) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in emptyCharSequence.indices) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in emptyCharSequence.indices != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in emptyCharSequence.indices != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in emptyCharSequence.indices) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in emptyCharSequence.indices) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in emptyCharSequence.indices != range1.contains(element5)) throw AssertionError() - if (element5 !in emptyCharSequence.indices != !range1.contains(element5)) throw AssertionError() - if (!(element5 in emptyCharSequence.indices) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in emptyCharSequence.indices) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in emptyCharSequence.indices != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in emptyCharSequence.indices != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in emptyCharSequence.indices) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in emptyCharSequence.indices) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in emptyCharSequence.indices != range1.contains(element6)) throw AssertionError() - if (element6 !in emptyCharSequence.indices != !range1.contains(element6)) throw AssertionError() - if (!(element6 in emptyCharSequence.indices) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in emptyCharSequence.indices) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in emptyCharSequence.indices != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in emptyCharSequence.indices != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in emptyCharSequence.indices) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in emptyCharSequence.indices) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in emptyCharSequence.indices != range1.contains(element7)) throw AssertionError() - if (element7 !in emptyCharSequence.indices != !range1.contains(element7)) throw AssertionError() - if (!(element7 in emptyCharSequence.indices) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in emptyCharSequence.indices) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in emptyCharSequence.indices != range1.contains(0)) throw AssertionError() - if (0 !in emptyCharSequence.indices != !range1.contains(0)) throw AssertionError() - if (!(0 in emptyCharSequence.indices) != !range1.contains(0)) throw AssertionError() - if (!(0 !in emptyCharSequence.indices) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in emptyCharSequence.indices != range1.contains(element8)) throw AssertionError() - if (element8 !in emptyCharSequence.indices != !range1.contains(element8)) throw AssertionError() - if (!(element8 in emptyCharSequence.indices) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in emptyCharSequence.indices) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in emptyCharSequence.indices != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in emptyCharSequence.indices != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in emptyCharSequence.indices) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in emptyCharSequence.indices) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in emptyCharSequence.indices != range1.contains(element9)) throw AssertionError() - if (element9 !in emptyCharSequence.indices != !range1.contains(element9)) throw AssertionError() - if (!(element9 in emptyCharSequence.indices) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in emptyCharSequence.indices) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in emptyCharSequence.indices != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in emptyCharSequence.indices != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in emptyCharSequence.indices) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in emptyCharSequence.indices) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in emptyCharSequence.indices != range1.contains(element10)) throw AssertionError() - if (element10 !in emptyCharSequence.indices != !range1.contains(element10)) throw AssertionError() - if (!(element10 in emptyCharSequence.indices) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in emptyCharSequence.indices) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in emptyCharSequence.indices != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in emptyCharSequence.indices != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in emptyCharSequence.indices) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in emptyCharSequence.indices) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in emptyCharSequence.indices != range1.contains(element11)) throw AssertionError() - if (element11 !in emptyCharSequence.indices != !range1.contains(element11)) throw AssertionError() - if (!(element11 in emptyCharSequence.indices) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in emptyCharSequence.indices) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in emptyCharSequence.indices != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in emptyCharSequence.indices != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in emptyCharSequence.indices) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in emptyCharSequence.indices) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in emptyCharSequence.indices != range1.contains(element12)) throw AssertionError() - if (element12 !in emptyCharSequence.indices != !range1.contains(element12)) throw AssertionError() - if (!(element12 in emptyCharSequence.indices) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in emptyCharSequence.indices) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in emptyCharSequence.indices != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in emptyCharSequence.indices != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in emptyCharSequence.indices) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in emptyCharSequence.indices) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in emptyCharSequence.indices != range1.contains(element13)) throw AssertionError() - if (element13 !in emptyCharSequence.indices != !range1.contains(element13)) throw AssertionError() - if (!(element13 in emptyCharSequence.indices) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in emptyCharSequence.indices) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in emptyCharSequence.indices != range1.contains(1)) throw AssertionError() - if (1 !in emptyCharSequence.indices != !range1.contains(1)) throw AssertionError() - if (!(1 in emptyCharSequence.indices) != !range1.contains(1)) throw AssertionError() - if (!(1 !in emptyCharSequence.indices) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in emptyCharSequence.indices != range1.contains(element14)) throw AssertionError() - if (element14 !in emptyCharSequence.indices != !range1.contains(element14)) throw AssertionError() - if (!(element14 in emptyCharSequence.indices) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in emptyCharSequence.indices) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in emptyCharSequence.indices != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in emptyCharSequence.indices != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in emptyCharSequence.indices) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in emptyCharSequence.indices) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in emptyCharSequence.indices != range1.contains(element15)) throw AssertionError() - if (element15 !in emptyCharSequence.indices != !range1.contains(element15)) throw AssertionError() - if (!(element15 in emptyCharSequence.indices) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in emptyCharSequence.indices) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in emptyCharSequence.indices != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in emptyCharSequence.indices != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in emptyCharSequence.indices) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in emptyCharSequence.indices) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in emptyCharSequence.indices != range1.contains(element16)) throw AssertionError() - if (element16 !in emptyCharSequence.indices != !range1.contains(element16)) throw AssertionError() - if (!(element16 in emptyCharSequence.indices) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in emptyCharSequence.indices) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in emptyCharSequence.indices != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in emptyCharSequence.indices != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in emptyCharSequence.indices) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in emptyCharSequence.indices) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in emptyCharSequence.indices != range1.contains(element17)) throw AssertionError() - if (element17 !in emptyCharSequence.indices != !range1.contains(element17)) throw AssertionError() - if (!(element17 in emptyCharSequence.indices) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in emptyCharSequence.indices) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in emptyCharSequence.indices != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in emptyCharSequence.indices != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in emptyCharSequence.indices) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in emptyCharSequence.indices) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in emptyCharSequence.indices != range1.contains(element18)) throw AssertionError() - if (element18 !in emptyCharSequence.indices != !range1.contains(element18)) throw AssertionError() - if (!(element18 in emptyCharSequence.indices) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in emptyCharSequence.indices) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in emptyCharSequence.indices != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in emptyCharSequence.indices != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in emptyCharSequence.indices) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in emptyCharSequence.indices) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in emptyCharSequence.indices != range1.contains(element19)) throw AssertionError() - if (element19 !in emptyCharSequence.indices != !range1.contains(element19)) throw AssertionError() - if (!(element19 in emptyCharSequence.indices) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in emptyCharSequence.indices) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in emptyCharSequence.indices != range1.contains(2)) throw AssertionError() - if (2 !in emptyCharSequence.indices != !range1.contains(2)) throw AssertionError() - if (!(2 in emptyCharSequence.indices) != !range1.contains(2)) throw AssertionError() - if (!(2 !in emptyCharSequence.indices) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in emptyCharSequence.indices != range1.contains(element20)) throw AssertionError() - if (element20 !in emptyCharSequence.indices != !range1.contains(element20)) throw AssertionError() - if (!(element20 in emptyCharSequence.indices) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in emptyCharSequence.indices) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in emptyCharSequence.indices != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in emptyCharSequence.indices != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in emptyCharSequence.indices) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in emptyCharSequence.indices) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in emptyCharSequence.indices != range1.contains(element21)) throw AssertionError() - if (element21 !in emptyCharSequence.indices != !range1.contains(element21)) throw AssertionError() - if (!(element21 in emptyCharSequence.indices) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in emptyCharSequence.indices) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in emptyCharSequence.indices != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in emptyCharSequence.indices != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in emptyCharSequence.indices) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in emptyCharSequence.indices) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in emptyCharSequence.indices != range1.contains(element22)) throw AssertionError() - if (element22 !in emptyCharSequence.indices != !range1.contains(element22)) throw AssertionError() - if (!(element22 in emptyCharSequence.indices) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in emptyCharSequence.indices) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in emptyCharSequence.indices != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in emptyCharSequence.indices != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in emptyCharSequence.indices) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in emptyCharSequence.indices) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in emptyCharSequence.indices != range1.contains(element23)) throw AssertionError() - if (element23 !in emptyCharSequence.indices != !range1.contains(element23)) throw AssertionError() - if (!(element23 in emptyCharSequence.indices) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in emptyCharSequence.indices) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in emptyCharSequence.indices != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in emptyCharSequence.indices != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in emptyCharSequence.indices) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in emptyCharSequence.indices) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in emptyCharSequence.indices != range1.contains(element24)) throw AssertionError() - if (element24 !in emptyCharSequence.indices != !range1.contains(element24)) throw AssertionError() - if (!(element24 in emptyCharSequence.indices) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in emptyCharSequence.indices) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in emptyCharSequence.indices != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in emptyCharSequence.indices != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in emptyCharSequence.indices) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in emptyCharSequence.indices) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in emptyCharSequence.indices != range1.contains(element25)) throw AssertionError() - if (element25 !in emptyCharSequence.indices != !range1.contains(element25)) throw AssertionError() - if (!(element25 in emptyCharSequence.indices) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in emptyCharSequence.indices) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in emptyCharSequence.indices != range1.contains(3)) throw AssertionError() - if (3 !in emptyCharSequence.indices != !range1.contains(3)) throw AssertionError() - if (!(3 in emptyCharSequence.indices) != !range1.contains(3)) throw AssertionError() - if (!(3 !in emptyCharSequence.indices) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in emptyCharSequence.indices != range1.contains(element26)) throw AssertionError() - if (element26 !in emptyCharSequence.indices != !range1.contains(element26)) throw AssertionError() - if (!(element26 in emptyCharSequence.indices) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in emptyCharSequence.indices) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in emptyCharSequence.indices != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in emptyCharSequence.indices != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in emptyCharSequence.indices) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in emptyCharSequence.indices) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in emptyCharSequence.indices != range1.contains(element27)) throw AssertionError() - if (element27 !in emptyCharSequence.indices != !range1.contains(element27)) throw AssertionError() - if (!(element27 in emptyCharSequence.indices) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in emptyCharSequence.indices) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in emptyCharSequence.indices != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in emptyCharSequence.indices != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in emptyCharSequence.indices) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in emptyCharSequence.indices) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in emptyCharSequence.indices != range1.contains(element28)) throw AssertionError() - if (element28 !in emptyCharSequence.indices != !range1.contains(element28)) throw AssertionError() - if (!(element28 in emptyCharSequence.indices) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in emptyCharSequence.indices) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in emptyCharSequence.indices != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in emptyCharSequence.indices != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in emptyCharSequence.indices) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in emptyCharSequence.indices) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in emptyCharSequence.indices != range1.contains(element29)) throw AssertionError() - if (element29 !in emptyCharSequence.indices != !range1.contains(element29)) throw AssertionError() - if (!(element29 in emptyCharSequence.indices) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in emptyCharSequence.indices) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in emptyCharSequence.indices != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in emptyCharSequence.indices != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in emptyCharSequence.indices) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in emptyCharSequence.indices) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in emptyCharSequence.indices != range1.contains(element30)) throw AssertionError() - if (element30 !in emptyCharSequence.indices != !range1.contains(element30)) throw AssertionError() - if (!(element30 in emptyCharSequence.indices) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in emptyCharSequence.indices) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in emptyCharSequence.indices != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in emptyCharSequence.indices != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in emptyCharSequence.indices) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in emptyCharSequence.indices) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in emptyCharSequence.indices != range1.contains(element31)) throw AssertionError() - if (element31 !in emptyCharSequence.indices != !range1.contains(element31)) throw AssertionError() - if (!(element31 in emptyCharSequence.indices) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in emptyCharSequence.indices) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in emptyCharSequence.indices != range1.contains(4)) throw AssertionError() - if (4 !in emptyCharSequence.indices != !range1.contains(4)) throw AssertionError() - if (!(4 in emptyCharSequence.indices) != !range1.contains(4)) throw AssertionError() - if (!(4 !in emptyCharSequence.indices) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in emptyCharSequence.indices != range1.contains(element32)) throw AssertionError() - if (element32 !in emptyCharSequence.indices != !range1.contains(element32)) throw AssertionError() - if (!(element32 in emptyCharSequence.indices) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in emptyCharSequence.indices) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in emptyCharSequence.indices != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in emptyCharSequence.indices != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in emptyCharSequence.indices) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in emptyCharSequence.indices) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in emptyCharSequence.indices != range1.contains(element33)) throw AssertionError() - if (element33 !in emptyCharSequence.indices != !range1.contains(element33)) throw AssertionError() - if (!(element33 in emptyCharSequence.indices) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in emptyCharSequence.indices) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in emptyCharSequence.indices != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in emptyCharSequence.indices != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in emptyCharSequence.indices) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in emptyCharSequence.indices) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in emptyCharSequence.indices != range1.contains(element34)) throw AssertionError() - if (element34 !in emptyCharSequence.indices != !range1.contains(element34)) throw AssertionError() - if (!(element34 in emptyCharSequence.indices) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in emptyCharSequence.indices) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in emptyCharSequence.indices != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in emptyCharSequence.indices != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in emptyCharSequence.indices) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in emptyCharSequence.indices) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in emptyCharSequence.indices != range1.contains(element35)) throw AssertionError() - if (element35 !in emptyCharSequence.indices != !range1.contains(element35)) throw AssertionError() - if (!(element35 in emptyCharSequence.indices) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in emptyCharSequence.indices) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/charUntil.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/charUntil.kt deleted file mode 100644 index 380a63eee82..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/charUntil.kt +++ /dev/null @@ -1,159 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = '1' until '3' -val range1 = '3' until '1' - -val element0 = '0' -val element1 = '1' -val element2 = '2' -val element3 = '3' -val element4 = '4' - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ('0' in '1' until '3' != range0.contains('0')) throw AssertionError() - if ('0' !in '1' until '3' != !range0.contains('0')) throw AssertionError() - if (!('0' in '1' until '3') != !range0.contains('0')) throw AssertionError() - if (!('0' !in '1' until '3') != range0.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '1' until '3' != range0.contains(element0)) throw AssertionError() - if (element0 !in '1' until '3' != !range0.contains(element0)) throw AssertionError() - if (!(element0 in '1' until '3') != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in '1' until '3') != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ('1' in '1' until '3' != range0.contains('1')) throw AssertionError() - if ('1' !in '1' until '3' != !range0.contains('1')) throw AssertionError() - if (!('1' in '1' until '3') != !range0.contains('1')) throw AssertionError() - if (!('1' !in '1' until '3') != range0.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '1' until '3' != range0.contains(element1)) throw AssertionError() - if (element1 !in '1' until '3' != !range0.contains(element1)) throw AssertionError() - if (!(element1 in '1' until '3') != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in '1' until '3') != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ('2' in '1' until '3' != range0.contains('2')) throw AssertionError() - if ('2' !in '1' until '3' != !range0.contains('2')) throw AssertionError() - if (!('2' in '1' until '3') != !range0.contains('2')) throw AssertionError() - if (!('2' !in '1' until '3') != range0.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '1' until '3' != range0.contains(element2)) throw AssertionError() - if (element2 !in '1' until '3' != !range0.contains(element2)) throw AssertionError() - if (!(element2 in '1' until '3') != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in '1' until '3') != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ('3' in '1' until '3' != range0.contains('3')) throw AssertionError() - if ('3' !in '1' until '3' != !range0.contains('3')) throw AssertionError() - if (!('3' in '1' until '3') != !range0.contains('3')) throw AssertionError() - if (!('3' !in '1' until '3') != range0.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '1' until '3' != range0.contains(element3)) throw AssertionError() - if (element3 !in '1' until '3' != !range0.contains(element3)) throw AssertionError() - if (!(element3 in '1' until '3') != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in '1' until '3') != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ('4' in '1' until '3' != range0.contains('4')) throw AssertionError() - if ('4' !in '1' until '3' != !range0.contains('4')) throw AssertionError() - if (!('4' in '1' until '3') != !range0.contains('4')) throw AssertionError() - if (!('4' !in '1' until '3') != range0.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '1' until '3' != range0.contains(element4)) throw AssertionError() - if (element4 !in '1' until '3' != !range0.contains(element4)) throw AssertionError() - if (!(element4 in '1' until '3') != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in '1' until '3') != range0.contains(element4)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ('0' in '3' until '1' != range1.contains('0')) throw AssertionError() - if ('0' !in '3' until '1' != !range1.contains('0')) throw AssertionError() - if (!('0' in '3' until '1') != !range1.contains('0')) throw AssertionError() - if (!('0' !in '3' until '1') != range1.contains('0')) throw AssertionError() - // no local optimizations - if (element0 in '3' until '1' != range1.contains(element0)) throw AssertionError() - if (element0 !in '3' until '1' != !range1.contains(element0)) throw AssertionError() - if (!(element0 in '3' until '1') != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in '3' until '1') != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ('1' in '3' until '1' != range1.contains('1')) throw AssertionError() - if ('1' !in '3' until '1' != !range1.contains('1')) throw AssertionError() - if (!('1' in '3' until '1') != !range1.contains('1')) throw AssertionError() - if (!('1' !in '3' until '1') != range1.contains('1')) throw AssertionError() - // no local optimizations - if (element1 in '3' until '1' != range1.contains(element1)) throw AssertionError() - if (element1 !in '3' until '1' != !range1.contains(element1)) throw AssertionError() - if (!(element1 in '3' until '1') != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in '3' until '1') != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ('2' in '3' until '1' != range1.contains('2')) throw AssertionError() - if ('2' !in '3' until '1' != !range1.contains('2')) throw AssertionError() - if (!('2' in '3' until '1') != !range1.contains('2')) throw AssertionError() - if (!('2' !in '3' until '1') != range1.contains('2')) throw AssertionError() - // no local optimizations - if (element2 in '3' until '1' != range1.contains(element2)) throw AssertionError() - if (element2 !in '3' until '1' != !range1.contains(element2)) throw AssertionError() - if (!(element2 in '3' until '1') != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in '3' until '1') != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ('3' in '3' until '1' != range1.contains('3')) throw AssertionError() - if ('3' !in '3' until '1' != !range1.contains('3')) throw AssertionError() - if (!('3' in '3' until '1') != !range1.contains('3')) throw AssertionError() - if (!('3' !in '3' until '1') != range1.contains('3')) throw AssertionError() - // no local optimizations - if (element3 in '3' until '1' != range1.contains(element3)) throw AssertionError() - if (element3 !in '3' until '1' != !range1.contains(element3)) throw AssertionError() - if (!(element3 in '3' until '1') != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in '3' until '1') != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ('4' in '3' until '1' != range1.contains('4')) throw AssertionError() - if ('4' !in '3' until '1' != !range1.contains('4')) throw AssertionError() - if (!('4' in '3' until '1') != !range1.contains('4')) throw AssertionError() - if (!('4' !in '3' until '1') != range1.contains('4')) throw AssertionError() - // no local optimizations - if (element4 in '3' until '1' != range1.contains(element4)) throw AssertionError() - if (element4 !in '3' until '1' != !range1.contains(element4)) throw AssertionError() - if (!(element4 in '3' until '1') != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in '3' until '1') != range1.contains(element4)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/collectionIndices.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/collectionIndices.kt deleted file mode 100644 index 952f5e7b4e9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/collectionIndices.kt +++ /dev/null @@ -1,1059 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - -val collection = listOf(1, 2, 3) -val emptyCollection = listOf() - -val range0 = collection.indices -val range1 = emptyCollection.indices - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in collection.indices != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in collection.indices != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in collection.indices) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in collection.indices) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in collection.indices != range0.contains(element0)) throw AssertionError() - if (element0 !in collection.indices != !range0.contains(element0)) throw AssertionError() - if (!(element0 in collection.indices) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in collection.indices) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in collection.indices != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in collection.indices != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in collection.indices) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in collection.indices) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in collection.indices != range0.contains(element1)) throw AssertionError() - if (element1 !in collection.indices != !range0.contains(element1)) throw AssertionError() - if (!(element1 in collection.indices) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in collection.indices) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in collection.indices != range0.contains((-1))) throw AssertionError() - if ((-1) !in collection.indices != !range0.contains((-1))) throw AssertionError() - if (!((-1) in collection.indices) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in collection.indices) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in collection.indices != range0.contains(element2)) throw AssertionError() - if (element2 !in collection.indices != !range0.contains(element2)) throw AssertionError() - if (!(element2 in collection.indices) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in collection.indices) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in collection.indices != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in collection.indices != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in collection.indices) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in collection.indices) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in collection.indices != range0.contains(element3)) throw AssertionError() - if (element3 !in collection.indices != !range0.contains(element3)) throw AssertionError() - if (!(element3 in collection.indices) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in collection.indices) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in collection.indices != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in collection.indices != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in collection.indices) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in collection.indices) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in collection.indices != range0.contains(element4)) throw AssertionError() - if (element4 !in collection.indices != !range0.contains(element4)) throw AssertionError() - if (!(element4 in collection.indices) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in collection.indices) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in collection.indices != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in collection.indices != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in collection.indices) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in collection.indices) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in collection.indices != range0.contains(element5)) throw AssertionError() - if (element5 !in collection.indices != !range0.contains(element5)) throw AssertionError() - if (!(element5 in collection.indices) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in collection.indices) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in collection.indices != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in collection.indices != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in collection.indices) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in collection.indices) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in collection.indices != range0.contains(element6)) throw AssertionError() - if (element6 !in collection.indices != !range0.contains(element6)) throw AssertionError() - if (!(element6 in collection.indices) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in collection.indices) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in collection.indices != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in collection.indices != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in collection.indices) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in collection.indices) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in collection.indices != range0.contains(element7)) throw AssertionError() - if (element7 !in collection.indices != !range0.contains(element7)) throw AssertionError() - if (!(element7 in collection.indices) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in collection.indices) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in collection.indices != range0.contains(0)) throw AssertionError() - if (0 !in collection.indices != !range0.contains(0)) throw AssertionError() - if (!(0 in collection.indices) != !range0.contains(0)) throw AssertionError() - if (!(0 !in collection.indices) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in collection.indices != range0.contains(element8)) throw AssertionError() - if (element8 !in collection.indices != !range0.contains(element8)) throw AssertionError() - if (!(element8 in collection.indices) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in collection.indices) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in collection.indices != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in collection.indices != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in collection.indices) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in collection.indices) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in collection.indices != range0.contains(element9)) throw AssertionError() - if (element9 !in collection.indices != !range0.contains(element9)) throw AssertionError() - if (!(element9 in collection.indices) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in collection.indices) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in collection.indices != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in collection.indices != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in collection.indices) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in collection.indices) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in collection.indices != range0.contains(element10)) throw AssertionError() - if (element10 !in collection.indices != !range0.contains(element10)) throw AssertionError() - if (!(element10 in collection.indices) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in collection.indices) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in collection.indices != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in collection.indices != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in collection.indices) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in collection.indices) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in collection.indices != range0.contains(element11)) throw AssertionError() - if (element11 !in collection.indices != !range0.contains(element11)) throw AssertionError() - if (!(element11 in collection.indices) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in collection.indices) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in collection.indices != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in collection.indices != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in collection.indices) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in collection.indices) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in collection.indices != range0.contains(element12)) throw AssertionError() - if (element12 !in collection.indices != !range0.contains(element12)) throw AssertionError() - if (!(element12 in collection.indices) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in collection.indices) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in collection.indices != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in collection.indices != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in collection.indices) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in collection.indices) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in collection.indices != range0.contains(element13)) throw AssertionError() - if (element13 !in collection.indices != !range0.contains(element13)) throw AssertionError() - if (!(element13 in collection.indices) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in collection.indices) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in collection.indices != range0.contains(1)) throw AssertionError() - if (1 !in collection.indices != !range0.contains(1)) throw AssertionError() - if (!(1 in collection.indices) != !range0.contains(1)) throw AssertionError() - if (!(1 !in collection.indices) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in collection.indices != range0.contains(element14)) throw AssertionError() - if (element14 !in collection.indices != !range0.contains(element14)) throw AssertionError() - if (!(element14 in collection.indices) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in collection.indices) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in collection.indices != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in collection.indices != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in collection.indices) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in collection.indices) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in collection.indices != range0.contains(element15)) throw AssertionError() - if (element15 !in collection.indices != !range0.contains(element15)) throw AssertionError() - if (!(element15 in collection.indices) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in collection.indices) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in collection.indices != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in collection.indices != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in collection.indices) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in collection.indices) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in collection.indices != range0.contains(element16)) throw AssertionError() - if (element16 !in collection.indices != !range0.contains(element16)) throw AssertionError() - if (!(element16 in collection.indices) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in collection.indices) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in collection.indices != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in collection.indices != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in collection.indices) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in collection.indices) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in collection.indices != range0.contains(element17)) throw AssertionError() - if (element17 !in collection.indices != !range0.contains(element17)) throw AssertionError() - if (!(element17 in collection.indices) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in collection.indices) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in collection.indices != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in collection.indices != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in collection.indices) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in collection.indices) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in collection.indices != range0.contains(element18)) throw AssertionError() - if (element18 !in collection.indices != !range0.contains(element18)) throw AssertionError() - if (!(element18 in collection.indices) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in collection.indices) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in collection.indices != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in collection.indices != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in collection.indices) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in collection.indices) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in collection.indices != range0.contains(element19)) throw AssertionError() - if (element19 !in collection.indices != !range0.contains(element19)) throw AssertionError() - if (!(element19 in collection.indices) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in collection.indices) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in collection.indices != range0.contains(2)) throw AssertionError() - if (2 !in collection.indices != !range0.contains(2)) throw AssertionError() - if (!(2 in collection.indices) != !range0.contains(2)) throw AssertionError() - if (!(2 !in collection.indices) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in collection.indices != range0.contains(element20)) throw AssertionError() - if (element20 !in collection.indices != !range0.contains(element20)) throw AssertionError() - if (!(element20 in collection.indices) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in collection.indices) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in collection.indices != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in collection.indices != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in collection.indices) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in collection.indices) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in collection.indices != range0.contains(element21)) throw AssertionError() - if (element21 !in collection.indices != !range0.contains(element21)) throw AssertionError() - if (!(element21 in collection.indices) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in collection.indices) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in collection.indices != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in collection.indices != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in collection.indices) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in collection.indices) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in collection.indices != range0.contains(element22)) throw AssertionError() - if (element22 !in collection.indices != !range0.contains(element22)) throw AssertionError() - if (!(element22 in collection.indices) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in collection.indices) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in collection.indices != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in collection.indices != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in collection.indices) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in collection.indices) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in collection.indices != range0.contains(element23)) throw AssertionError() - if (element23 !in collection.indices != !range0.contains(element23)) throw AssertionError() - if (!(element23 in collection.indices) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in collection.indices) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in collection.indices != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in collection.indices != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in collection.indices) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in collection.indices) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in collection.indices != range0.contains(element24)) throw AssertionError() - if (element24 !in collection.indices != !range0.contains(element24)) throw AssertionError() - if (!(element24 in collection.indices) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in collection.indices) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in collection.indices != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in collection.indices != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in collection.indices) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in collection.indices) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in collection.indices != range0.contains(element25)) throw AssertionError() - if (element25 !in collection.indices != !range0.contains(element25)) throw AssertionError() - if (!(element25 in collection.indices) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in collection.indices) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in collection.indices != range0.contains(3)) throw AssertionError() - if (3 !in collection.indices != !range0.contains(3)) throw AssertionError() - if (!(3 in collection.indices) != !range0.contains(3)) throw AssertionError() - if (!(3 !in collection.indices) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in collection.indices != range0.contains(element26)) throw AssertionError() - if (element26 !in collection.indices != !range0.contains(element26)) throw AssertionError() - if (!(element26 in collection.indices) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in collection.indices) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in collection.indices != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in collection.indices != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in collection.indices) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in collection.indices) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in collection.indices != range0.contains(element27)) throw AssertionError() - if (element27 !in collection.indices != !range0.contains(element27)) throw AssertionError() - if (!(element27 in collection.indices) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in collection.indices) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in collection.indices != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in collection.indices != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in collection.indices) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in collection.indices) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in collection.indices != range0.contains(element28)) throw AssertionError() - if (element28 !in collection.indices != !range0.contains(element28)) throw AssertionError() - if (!(element28 in collection.indices) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in collection.indices) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in collection.indices != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in collection.indices != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in collection.indices) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in collection.indices) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in collection.indices != range0.contains(element29)) throw AssertionError() - if (element29 !in collection.indices != !range0.contains(element29)) throw AssertionError() - if (!(element29 in collection.indices) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in collection.indices) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in collection.indices != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in collection.indices != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in collection.indices) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in collection.indices) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in collection.indices != range0.contains(element30)) throw AssertionError() - if (element30 !in collection.indices != !range0.contains(element30)) throw AssertionError() - if (!(element30 in collection.indices) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in collection.indices) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in collection.indices != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in collection.indices != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in collection.indices) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in collection.indices) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in collection.indices != range0.contains(element31)) throw AssertionError() - if (element31 !in collection.indices != !range0.contains(element31)) throw AssertionError() - if (!(element31 in collection.indices) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in collection.indices) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in collection.indices != range0.contains(4)) throw AssertionError() - if (4 !in collection.indices != !range0.contains(4)) throw AssertionError() - if (!(4 in collection.indices) != !range0.contains(4)) throw AssertionError() - if (!(4 !in collection.indices) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in collection.indices != range0.contains(element32)) throw AssertionError() - if (element32 !in collection.indices != !range0.contains(element32)) throw AssertionError() - if (!(element32 in collection.indices) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in collection.indices) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in collection.indices != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in collection.indices != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in collection.indices) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in collection.indices) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in collection.indices != range0.contains(element33)) throw AssertionError() - if (element33 !in collection.indices != !range0.contains(element33)) throw AssertionError() - if (!(element33 in collection.indices) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in collection.indices) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in collection.indices != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in collection.indices != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in collection.indices) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in collection.indices) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in collection.indices != range0.contains(element34)) throw AssertionError() - if (element34 !in collection.indices != !range0.contains(element34)) throw AssertionError() - if (!(element34 in collection.indices) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in collection.indices) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in collection.indices != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in collection.indices != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in collection.indices) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in collection.indices) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in collection.indices != range0.contains(element35)) throw AssertionError() - if (element35 !in collection.indices != !range0.contains(element35)) throw AssertionError() - if (!(element35 in collection.indices) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in collection.indices) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in emptyCollection.indices != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in emptyCollection.indices != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in emptyCollection.indices) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in emptyCollection.indices) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in emptyCollection.indices != range1.contains(element0)) throw AssertionError() - if (element0 !in emptyCollection.indices != !range1.contains(element0)) throw AssertionError() - if (!(element0 in emptyCollection.indices) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in emptyCollection.indices) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in emptyCollection.indices != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in emptyCollection.indices != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in emptyCollection.indices) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in emptyCollection.indices) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in emptyCollection.indices != range1.contains(element1)) throw AssertionError() - if (element1 !in emptyCollection.indices != !range1.contains(element1)) throw AssertionError() - if (!(element1 in emptyCollection.indices) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in emptyCollection.indices) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in emptyCollection.indices != range1.contains((-1))) throw AssertionError() - if ((-1) !in emptyCollection.indices != !range1.contains((-1))) throw AssertionError() - if (!((-1) in emptyCollection.indices) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in emptyCollection.indices) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in emptyCollection.indices != range1.contains(element2)) throw AssertionError() - if (element2 !in emptyCollection.indices != !range1.contains(element2)) throw AssertionError() - if (!(element2 in emptyCollection.indices) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in emptyCollection.indices) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in emptyCollection.indices != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in emptyCollection.indices != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in emptyCollection.indices) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in emptyCollection.indices) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in emptyCollection.indices != range1.contains(element3)) throw AssertionError() - if (element3 !in emptyCollection.indices != !range1.contains(element3)) throw AssertionError() - if (!(element3 in emptyCollection.indices) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in emptyCollection.indices) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in emptyCollection.indices != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in emptyCollection.indices != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in emptyCollection.indices) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in emptyCollection.indices) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in emptyCollection.indices != range1.contains(element4)) throw AssertionError() - if (element4 !in emptyCollection.indices != !range1.contains(element4)) throw AssertionError() - if (!(element4 in emptyCollection.indices) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in emptyCollection.indices) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in emptyCollection.indices != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in emptyCollection.indices != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in emptyCollection.indices) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in emptyCollection.indices) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in emptyCollection.indices != range1.contains(element5)) throw AssertionError() - if (element5 !in emptyCollection.indices != !range1.contains(element5)) throw AssertionError() - if (!(element5 in emptyCollection.indices) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in emptyCollection.indices) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in emptyCollection.indices != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in emptyCollection.indices != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in emptyCollection.indices) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in emptyCollection.indices) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in emptyCollection.indices != range1.contains(element6)) throw AssertionError() - if (element6 !in emptyCollection.indices != !range1.contains(element6)) throw AssertionError() - if (!(element6 in emptyCollection.indices) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in emptyCollection.indices) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in emptyCollection.indices != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in emptyCollection.indices != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in emptyCollection.indices) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in emptyCollection.indices) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in emptyCollection.indices != range1.contains(element7)) throw AssertionError() - if (element7 !in emptyCollection.indices != !range1.contains(element7)) throw AssertionError() - if (!(element7 in emptyCollection.indices) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in emptyCollection.indices) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in emptyCollection.indices != range1.contains(0)) throw AssertionError() - if (0 !in emptyCollection.indices != !range1.contains(0)) throw AssertionError() - if (!(0 in emptyCollection.indices) != !range1.contains(0)) throw AssertionError() - if (!(0 !in emptyCollection.indices) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in emptyCollection.indices != range1.contains(element8)) throw AssertionError() - if (element8 !in emptyCollection.indices != !range1.contains(element8)) throw AssertionError() - if (!(element8 in emptyCollection.indices) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in emptyCollection.indices) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in emptyCollection.indices != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in emptyCollection.indices != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in emptyCollection.indices) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in emptyCollection.indices) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in emptyCollection.indices != range1.contains(element9)) throw AssertionError() - if (element9 !in emptyCollection.indices != !range1.contains(element9)) throw AssertionError() - if (!(element9 in emptyCollection.indices) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in emptyCollection.indices) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in emptyCollection.indices != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in emptyCollection.indices != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in emptyCollection.indices) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in emptyCollection.indices) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in emptyCollection.indices != range1.contains(element10)) throw AssertionError() - if (element10 !in emptyCollection.indices != !range1.contains(element10)) throw AssertionError() - if (!(element10 in emptyCollection.indices) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in emptyCollection.indices) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in emptyCollection.indices != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in emptyCollection.indices != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in emptyCollection.indices) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in emptyCollection.indices) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in emptyCollection.indices != range1.contains(element11)) throw AssertionError() - if (element11 !in emptyCollection.indices != !range1.contains(element11)) throw AssertionError() - if (!(element11 in emptyCollection.indices) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in emptyCollection.indices) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in emptyCollection.indices != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in emptyCollection.indices != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in emptyCollection.indices) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in emptyCollection.indices) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in emptyCollection.indices != range1.contains(element12)) throw AssertionError() - if (element12 !in emptyCollection.indices != !range1.contains(element12)) throw AssertionError() - if (!(element12 in emptyCollection.indices) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in emptyCollection.indices) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in emptyCollection.indices != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in emptyCollection.indices != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in emptyCollection.indices) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in emptyCollection.indices) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in emptyCollection.indices != range1.contains(element13)) throw AssertionError() - if (element13 !in emptyCollection.indices != !range1.contains(element13)) throw AssertionError() - if (!(element13 in emptyCollection.indices) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in emptyCollection.indices) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in emptyCollection.indices != range1.contains(1)) throw AssertionError() - if (1 !in emptyCollection.indices != !range1.contains(1)) throw AssertionError() - if (!(1 in emptyCollection.indices) != !range1.contains(1)) throw AssertionError() - if (!(1 !in emptyCollection.indices) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in emptyCollection.indices != range1.contains(element14)) throw AssertionError() - if (element14 !in emptyCollection.indices != !range1.contains(element14)) throw AssertionError() - if (!(element14 in emptyCollection.indices) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in emptyCollection.indices) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in emptyCollection.indices != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in emptyCollection.indices != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in emptyCollection.indices) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in emptyCollection.indices) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in emptyCollection.indices != range1.contains(element15)) throw AssertionError() - if (element15 !in emptyCollection.indices != !range1.contains(element15)) throw AssertionError() - if (!(element15 in emptyCollection.indices) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in emptyCollection.indices) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in emptyCollection.indices != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in emptyCollection.indices != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in emptyCollection.indices) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in emptyCollection.indices) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in emptyCollection.indices != range1.contains(element16)) throw AssertionError() - if (element16 !in emptyCollection.indices != !range1.contains(element16)) throw AssertionError() - if (!(element16 in emptyCollection.indices) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in emptyCollection.indices) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in emptyCollection.indices != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in emptyCollection.indices != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in emptyCollection.indices) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in emptyCollection.indices) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in emptyCollection.indices != range1.contains(element17)) throw AssertionError() - if (element17 !in emptyCollection.indices != !range1.contains(element17)) throw AssertionError() - if (!(element17 in emptyCollection.indices) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in emptyCollection.indices) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in emptyCollection.indices != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in emptyCollection.indices != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in emptyCollection.indices) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in emptyCollection.indices) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in emptyCollection.indices != range1.contains(element18)) throw AssertionError() - if (element18 !in emptyCollection.indices != !range1.contains(element18)) throw AssertionError() - if (!(element18 in emptyCollection.indices) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in emptyCollection.indices) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in emptyCollection.indices != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in emptyCollection.indices != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in emptyCollection.indices) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in emptyCollection.indices) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in emptyCollection.indices != range1.contains(element19)) throw AssertionError() - if (element19 !in emptyCollection.indices != !range1.contains(element19)) throw AssertionError() - if (!(element19 in emptyCollection.indices) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in emptyCollection.indices) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in emptyCollection.indices != range1.contains(2)) throw AssertionError() - if (2 !in emptyCollection.indices != !range1.contains(2)) throw AssertionError() - if (!(2 in emptyCollection.indices) != !range1.contains(2)) throw AssertionError() - if (!(2 !in emptyCollection.indices) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in emptyCollection.indices != range1.contains(element20)) throw AssertionError() - if (element20 !in emptyCollection.indices != !range1.contains(element20)) throw AssertionError() - if (!(element20 in emptyCollection.indices) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in emptyCollection.indices) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in emptyCollection.indices != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in emptyCollection.indices != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in emptyCollection.indices) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in emptyCollection.indices) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in emptyCollection.indices != range1.contains(element21)) throw AssertionError() - if (element21 !in emptyCollection.indices != !range1.contains(element21)) throw AssertionError() - if (!(element21 in emptyCollection.indices) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in emptyCollection.indices) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in emptyCollection.indices != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in emptyCollection.indices != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in emptyCollection.indices) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in emptyCollection.indices) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in emptyCollection.indices != range1.contains(element22)) throw AssertionError() - if (element22 !in emptyCollection.indices != !range1.contains(element22)) throw AssertionError() - if (!(element22 in emptyCollection.indices) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in emptyCollection.indices) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in emptyCollection.indices != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in emptyCollection.indices != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in emptyCollection.indices) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in emptyCollection.indices) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in emptyCollection.indices != range1.contains(element23)) throw AssertionError() - if (element23 !in emptyCollection.indices != !range1.contains(element23)) throw AssertionError() - if (!(element23 in emptyCollection.indices) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in emptyCollection.indices) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in emptyCollection.indices != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in emptyCollection.indices != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in emptyCollection.indices) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in emptyCollection.indices) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in emptyCollection.indices != range1.contains(element24)) throw AssertionError() - if (element24 !in emptyCollection.indices != !range1.contains(element24)) throw AssertionError() - if (!(element24 in emptyCollection.indices) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in emptyCollection.indices) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in emptyCollection.indices != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in emptyCollection.indices != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in emptyCollection.indices) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in emptyCollection.indices) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in emptyCollection.indices != range1.contains(element25)) throw AssertionError() - if (element25 !in emptyCollection.indices != !range1.contains(element25)) throw AssertionError() - if (!(element25 in emptyCollection.indices) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in emptyCollection.indices) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in emptyCollection.indices != range1.contains(3)) throw AssertionError() - if (3 !in emptyCollection.indices != !range1.contains(3)) throw AssertionError() - if (!(3 in emptyCollection.indices) != !range1.contains(3)) throw AssertionError() - if (!(3 !in emptyCollection.indices) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in emptyCollection.indices != range1.contains(element26)) throw AssertionError() - if (element26 !in emptyCollection.indices != !range1.contains(element26)) throw AssertionError() - if (!(element26 in emptyCollection.indices) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in emptyCollection.indices) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in emptyCollection.indices != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in emptyCollection.indices != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in emptyCollection.indices) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in emptyCollection.indices) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in emptyCollection.indices != range1.contains(element27)) throw AssertionError() - if (element27 !in emptyCollection.indices != !range1.contains(element27)) throw AssertionError() - if (!(element27 in emptyCollection.indices) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in emptyCollection.indices) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in emptyCollection.indices != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in emptyCollection.indices != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in emptyCollection.indices) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in emptyCollection.indices) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in emptyCollection.indices != range1.contains(element28)) throw AssertionError() - if (element28 !in emptyCollection.indices != !range1.contains(element28)) throw AssertionError() - if (!(element28 in emptyCollection.indices) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in emptyCollection.indices) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in emptyCollection.indices != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in emptyCollection.indices != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in emptyCollection.indices) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in emptyCollection.indices) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in emptyCollection.indices != range1.contains(element29)) throw AssertionError() - if (element29 !in emptyCollection.indices != !range1.contains(element29)) throw AssertionError() - if (!(element29 in emptyCollection.indices) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in emptyCollection.indices) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in emptyCollection.indices != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in emptyCollection.indices != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in emptyCollection.indices) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in emptyCollection.indices) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in emptyCollection.indices != range1.contains(element30)) throw AssertionError() - if (element30 !in emptyCollection.indices != !range1.contains(element30)) throw AssertionError() - if (!(element30 in emptyCollection.indices) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in emptyCollection.indices) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in emptyCollection.indices != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in emptyCollection.indices != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in emptyCollection.indices) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in emptyCollection.indices) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in emptyCollection.indices != range1.contains(element31)) throw AssertionError() - if (element31 !in emptyCollection.indices != !range1.contains(element31)) throw AssertionError() - if (!(element31 in emptyCollection.indices) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in emptyCollection.indices) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in emptyCollection.indices != range1.contains(4)) throw AssertionError() - if (4 !in emptyCollection.indices != !range1.contains(4)) throw AssertionError() - if (!(4 in emptyCollection.indices) != !range1.contains(4)) throw AssertionError() - if (!(4 !in emptyCollection.indices) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in emptyCollection.indices != range1.contains(element32)) throw AssertionError() - if (element32 !in emptyCollection.indices != !range1.contains(element32)) throw AssertionError() - if (!(element32 in emptyCollection.indices) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in emptyCollection.indices) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in emptyCollection.indices != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in emptyCollection.indices != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in emptyCollection.indices) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in emptyCollection.indices) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in emptyCollection.indices != range1.contains(element33)) throw AssertionError() - if (element33 !in emptyCollection.indices != !range1.contains(element33)) throw AssertionError() - if (!(element33 in emptyCollection.indices) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in emptyCollection.indices) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in emptyCollection.indices != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in emptyCollection.indices != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in emptyCollection.indices) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in emptyCollection.indices) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in emptyCollection.indices != range1.contains(element34)) throw AssertionError() - if (element34 !in emptyCollection.indices != !range1.contains(element34)) throw AssertionError() - if (!(element34 in emptyCollection.indices) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in emptyCollection.indices) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in emptyCollection.indices != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in emptyCollection.indices != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in emptyCollection.indices) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in emptyCollection.indices) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in emptyCollection.indices != range1.contains(element35)) throw AssertionError() - if (element35 !in emptyCollection.indices != !range1.contains(element35)) throw AssertionError() - if (!(element35 in emptyCollection.indices) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in emptyCollection.indices) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt deleted file mode 100644 index aee5167c174..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1.0 .. 3.0 -val range1 = 3.0 .. 1.0 - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1.0 .. 3.0 != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1.0 .. 3.0 != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1.0 .. 3.0) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1.0 .. 3.0) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1.0 .. 3.0 != range0.contains(element0)) throw AssertionError() - if (element0 !in 1.0 .. 3.0 != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1.0 .. 3.0) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1.0 .. 3.0) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1.0 .. 3.0 != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1.0 .. 3.0 != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1.0 .. 3.0) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1.0 .. 3.0) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1.0 .. 3.0 != range0.contains(element1)) throw AssertionError() - if (element1 !in 1.0 .. 3.0 != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1.0 .. 3.0) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1.0 .. 3.0) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1.0 .. 3.0 != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1.0 .. 3.0 != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1.0 .. 3.0) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1.0 .. 3.0) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1.0 .. 3.0 != range0.contains(element2)) throw AssertionError() - if (element2 !in 1.0 .. 3.0 != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1.0 .. 3.0) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1.0 .. 3.0) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1.0 .. 3.0 != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1.0 .. 3.0 != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1.0 .. 3.0) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1.0 .. 3.0) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1.0 .. 3.0 != range0.contains(element3)) throw AssertionError() - if (element3 !in 1.0 .. 3.0 != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1.0 .. 3.0) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1.0 .. 3.0) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1.0 .. 3.0 != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1.0 .. 3.0 != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1.0 .. 3.0) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1.0 .. 3.0) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1.0 .. 3.0 != range0.contains(element4)) throw AssertionError() - if (element4 !in 1.0 .. 3.0 != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1.0 .. 3.0) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1.0 .. 3.0) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1.0 .. 3.0 != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1.0 .. 3.0 != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1.0 .. 3.0) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1.0 .. 3.0) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1.0 .. 3.0 != range0.contains(element5)) throw AssertionError() - if (element5 !in 1.0 .. 3.0 != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1.0 .. 3.0) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1.0 .. 3.0) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1.0 .. 3.0 != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1.0 .. 3.0 != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1.0 .. 3.0) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1.0 .. 3.0) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1.0 .. 3.0 != range0.contains(element6)) throw AssertionError() - if (element6 !in 1.0 .. 3.0 != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1.0 .. 3.0) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1.0 .. 3.0) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1.0 .. 3.0 != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1.0 .. 3.0 != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1.0 .. 3.0) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1.0 .. 3.0) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1.0 .. 3.0 != range0.contains(element7)) throw AssertionError() - if (element7 !in 1.0 .. 3.0 != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1.0 .. 3.0) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1.0 .. 3.0) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1.0 .. 3.0 != range0.contains(0)) throw AssertionError() - if (0 !in 1.0 .. 3.0 != !range0.contains(0)) throw AssertionError() - if (!(0 in 1.0 .. 3.0) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1.0 .. 3.0) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1.0 .. 3.0 != range0.contains(element8)) throw AssertionError() - if (element8 !in 1.0 .. 3.0 != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1.0 .. 3.0) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1.0 .. 3.0) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1.0 .. 3.0 != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1.0 .. 3.0 != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1.0 .. 3.0) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1.0 .. 3.0) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1.0 .. 3.0 != range0.contains(element9)) throw AssertionError() - if (element9 !in 1.0 .. 3.0 != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1.0 .. 3.0) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1.0 .. 3.0) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1.0 .. 3.0 != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1.0 .. 3.0 != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1.0 .. 3.0) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1.0 .. 3.0) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1.0 .. 3.0 != range0.contains(element10)) throw AssertionError() - if (element10 !in 1.0 .. 3.0 != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1.0 .. 3.0) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1.0 .. 3.0) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1.0 .. 3.0 != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1.0 .. 3.0 != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1.0 .. 3.0) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1.0 .. 3.0) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1.0 .. 3.0 != range0.contains(element11)) throw AssertionError() - if (element11 !in 1.0 .. 3.0 != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1.0 .. 3.0) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1.0 .. 3.0) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1.0 .. 3.0 != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1.0 .. 3.0 != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1.0 .. 3.0) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1.0 .. 3.0) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1.0 .. 3.0 != range0.contains(element12)) throw AssertionError() - if (element12 !in 1.0 .. 3.0 != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1.0 .. 3.0) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1.0 .. 3.0) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1.0 .. 3.0 != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1.0 .. 3.0 != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1.0 .. 3.0) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1.0 .. 3.0) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1.0 .. 3.0 != range0.contains(element13)) throw AssertionError() - if (element13 !in 1.0 .. 3.0 != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1.0 .. 3.0) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1.0 .. 3.0) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1.0 .. 3.0 != range0.contains(1)) throw AssertionError() - if (1 !in 1.0 .. 3.0 != !range0.contains(1)) throw AssertionError() - if (!(1 in 1.0 .. 3.0) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1.0 .. 3.0) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1.0 .. 3.0 != range0.contains(element14)) throw AssertionError() - if (element14 !in 1.0 .. 3.0 != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1.0 .. 3.0) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1.0 .. 3.0) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1.0 .. 3.0 != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1.0 .. 3.0 != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1.0 .. 3.0) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1.0 .. 3.0) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1.0 .. 3.0 != range0.contains(element15)) throw AssertionError() - if (element15 !in 1.0 .. 3.0 != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1.0 .. 3.0) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1.0 .. 3.0) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1.0 .. 3.0 != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1.0 .. 3.0 != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1.0 .. 3.0) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1.0 .. 3.0) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1.0 .. 3.0 != range0.contains(element16)) throw AssertionError() - if (element16 !in 1.0 .. 3.0 != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1.0 .. 3.0) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1.0 .. 3.0) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1.0 .. 3.0 != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1.0 .. 3.0 != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1.0 .. 3.0) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1.0 .. 3.0) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1.0 .. 3.0 != range0.contains(element17)) throw AssertionError() - if (element17 !in 1.0 .. 3.0 != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1.0 .. 3.0) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1.0 .. 3.0) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1.0 .. 3.0 != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1.0 .. 3.0 != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1.0 .. 3.0) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1.0 .. 3.0) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1.0 .. 3.0 != range0.contains(element18)) throw AssertionError() - if (element18 !in 1.0 .. 3.0 != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1.0 .. 3.0) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1.0 .. 3.0) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1.0 .. 3.0 != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1.0 .. 3.0 != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1.0 .. 3.0) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1.0 .. 3.0) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1.0 .. 3.0 != range0.contains(element19)) throw AssertionError() - if (element19 !in 1.0 .. 3.0 != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1.0 .. 3.0) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1.0 .. 3.0) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1.0 .. 3.0 != range0.contains(2)) throw AssertionError() - if (2 !in 1.0 .. 3.0 != !range0.contains(2)) throw AssertionError() - if (!(2 in 1.0 .. 3.0) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1.0 .. 3.0) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1.0 .. 3.0 != range0.contains(element20)) throw AssertionError() - if (element20 !in 1.0 .. 3.0 != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1.0 .. 3.0) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1.0 .. 3.0) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1.0 .. 3.0 != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1.0 .. 3.0 != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1.0 .. 3.0) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1.0 .. 3.0) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1.0 .. 3.0 != range0.contains(element21)) throw AssertionError() - if (element21 !in 1.0 .. 3.0 != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1.0 .. 3.0) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1.0 .. 3.0) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1.0 .. 3.0 != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1.0 .. 3.0 != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1.0 .. 3.0) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1.0 .. 3.0) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1.0 .. 3.0 != range0.contains(element22)) throw AssertionError() - if (element22 !in 1.0 .. 3.0 != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1.0 .. 3.0) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1.0 .. 3.0) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1.0 .. 3.0 != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1.0 .. 3.0 != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1.0 .. 3.0) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1.0 .. 3.0) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1.0 .. 3.0 != range0.contains(element23)) throw AssertionError() - if (element23 !in 1.0 .. 3.0 != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1.0 .. 3.0) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1.0 .. 3.0) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1.0 .. 3.0 != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1.0 .. 3.0 != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1.0 .. 3.0) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1.0 .. 3.0) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1.0 .. 3.0 != range0.contains(element24)) throw AssertionError() - if (element24 !in 1.0 .. 3.0 != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1.0 .. 3.0) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1.0 .. 3.0) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1.0 .. 3.0 != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1.0 .. 3.0 != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1.0 .. 3.0) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1.0 .. 3.0) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1.0 .. 3.0 != range0.contains(element25)) throw AssertionError() - if (element25 !in 1.0 .. 3.0 != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1.0 .. 3.0) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1.0 .. 3.0) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1.0 .. 3.0 != range0.contains(3)) throw AssertionError() - if (3 !in 1.0 .. 3.0 != !range0.contains(3)) throw AssertionError() - if (!(3 in 1.0 .. 3.0) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1.0 .. 3.0) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1.0 .. 3.0 != range0.contains(element26)) throw AssertionError() - if (element26 !in 1.0 .. 3.0 != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1.0 .. 3.0) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1.0 .. 3.0) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1.0 .. 3.0 != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1.0 .. 3.0 != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1.0 .. 3.0) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1.0 .. 3.0) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1.0 .. 3.0 != range0.contains(element27)) throw AssertionError() - if (element27 !in 1.0 .. 3.0 != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1.0 .. 3.0) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1.0 .. 3.0) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1.0 .. 3.0 != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1.0 .. 3.0 != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1.0 .. 3.0) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1.0 .. 3.0) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1.0 .. 3.0 != range0.contains(element28)) throw AssertionError() - if (element28 !in 1.0 .. 3.0 != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1.0 .. 3.0) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1.0 .. 3.0) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1.0 .. 3.0 != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1.0 .. 3.0 != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1.0 .. 3.0) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1.0 .. 3.0) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1.0 .. 3.0 != range0.contains(element29)) throw AssertionError() - if (element29 !in 1.0 .. 3.0 != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1.0 .. 3.0) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1.0 .. 3.0) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1.0 .. 3.0 != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1.0 .. 3.0 != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1.0 .. 3.0) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1.0 .. 3.0) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1.0 .. 3.0 != range0.contains(element30)) throw AssertionError() - if (element30 !in 1.0 .. 3.0 != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1.0 .. 3.0) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1.0 .. 3.0) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1.0 .. 3.0 != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1.0 .. 3.0 != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1.0 .. 3.0) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1.0 .. 3.0) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1.0 .. 3.0 != range0.contains(element31)) throw AssertionError() - if (element31 !in 1.0 .. 3.0 != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1.0 .. 3.0) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1.0 .. 3.0) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1.0 .. 3.0 != range0.contains(4)) throw AssertionError() - if (4 !in 1.0 .. 3.0 != !range0.contains(4)) throw AssertionError() - if (!(4 in 1.0 .. 3.0) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1.0 .. 3.0) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1.0 .. 3.0 != range0.contains(element32)) throw AssertionError() - if (element32 !in 1.0 .. 3.0 != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1.0 .. 3.0) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1.0 .. 3.0) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1.0 .. 3.0 != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1.0 .. 3.0 != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1.0 .. 3.0) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1.0 .. 3.0) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1.0 .. 3.0 != range0.contains(element33)) throw AssertionError() - if (element33 !in 1.0 .. 3.0 != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1.0 .. 3.0) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1.0 .. 3.0) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1.0 .. 3.0 != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1.0 .. 3.0 != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1.0 .. 3.0) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1.0 .. 3.0) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1.0 .. 3.0 != range0.contains(element34)) throw AssertionError() - if (element34 !in 1.0 .. 3.0 != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1.0 .. 3.0) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1.0 .. 3.0) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1.0 .. 3.0 != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1.0 .. 3.0 != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1.0 .. 3.0) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1.0 .. 3.0) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1.0 .. 3.0 != range0.contains(element35)) throw AssertionError() - if (element35 !in 1.0 .. 3.0 != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1.0 .. 3.0) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1.0 .. 3.0) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3.0 .. 1.0 != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3.0 .. 1.0 != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3.0 .. 1.0) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3.0 .. 1.0) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3.0 .. 1.0 != range1.contains(element0)) throw AssertionError() - if (element0 !in 3.0 .. 1.0 != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3.0 .. 1.0) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3.0 .. 1.0) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3.0 .. 1.0 != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3.0 .. 1.0 != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3.0 .. 1.0) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3.0 .. 1.0) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3.0 .. 1.0 != range1.contains(element1)) throw AssertionError() - if (element1 !in 3.0 .. 1.0 != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3.0 .. 1.0) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3.0 .. 1.0) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3.0 .. 1.0 != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3.0 .. 1.0 != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3.0 .. 1.0) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3.0 .. 1.0) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3.0 .. 1.0 != range1.contains(element2)) throw AssertionError() - if (element2 !in 3.0 .. 1.0 != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3.0 .. 1.0) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3.0 .. 1.0) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3.0 .. 1.0 != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3.0 .. 1.0 != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3.0 .. 1.0) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3.0 .. 1.0) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3.0 .. 1.0 != range1.contains(element3)) throw AssertionError() - if (element3 !in 3.0 .. 1.0 != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3.0 .. 1.0) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3.0 .. 1.0) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3.0 .. 1.0 != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3.0 .. 1.0 != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3.0 .. 1.0) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3.0 .. 1.0) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3.0 .. 1.0 != range1.contains(element4)) throw AssertionError() - if (element4 !in 3.0 .. 1.0 != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3.0 .. 1.0) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3.0 .. 1.0) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3.0 .. 1.0 != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3.0 .. 1.0 != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3.0 .. 1.0) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3.0 .. 1.0) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3.0 .. 1.0 != range1.contains(element5)) throw AssertionError() - if (element5 !in 3.0 .. 1.0 != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3.0 .. 1.0) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3.0 .. 1.0) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3.0 .. 1.0 != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3.0 .. 1.0 != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3.0 .. 1.0) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3.0 .. 1.0) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3.0 .. 1.0 != range1.contains(element6)) throw AssertionError() - if (element6 !in 3.0 .. 1.0 != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3.0 .. 1.0) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3.0 .. 1.0) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3.0 .. 1.0 != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3.0 .. 1.0 != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3.0 .. 1.0) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3.0 .. 1.0) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3.0 .. 1.0 != range1.contains(element7)) throw AssertionError() - if (element7 !in 3.0 .. 1.0 != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3.0 .. 1.0) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3.0 .. 1.0) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3.0 .. 1.0 != range1.contains(0)) throw AssertionError() - if (0 !in 3.0 .. 1.0 != !range1.contains(0)) throw AssertionError() - if (!(0 in 3.0 .. 1.0) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3.0 .. 1.0) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3.0 .. 1.0 != range1.contains(element8)) throw AssertionError() - if (element8 !in 3.0 .. 1.0 != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3.0 .. 1.0) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3.0 .. 1.0) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3.0 .. 1.0 != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3.0 .. 1.0 != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3.0 .. 1.0) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3.0 .. 1.0) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3.0 .. 1.0 != range1.contains(element9)) throw AssertionError() - if (element9 !in 3.0 .. 1.0 != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3.0 .. 1.0) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3.0 .. 1.0) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3.0 .. 1.0 != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3.0 .. 1.0 != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3.0 .. 1.0) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3.0 .. 1.0) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3.0 .. 1.0 != range1.contains(element10)) throw AssertionError() - if (element10 !in 3.0 .. 1.0 != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3.0 .. 1.0) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3.0 .. 1.0) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3.0 .. 1.0 != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3.0 .. 1.0 != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3.0 .. 1.0) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3.0 .. 1.0) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3.0 .. 1.0 != range1.contains(element11)) throw AssertionError() - if (element11 !in 3.0 .. 1.0 != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3.0 .. 1.0) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3.0 .. 1.0) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3.0 .. 1.0 != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3.0 .. 1.0 != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3.0 .. 1.0) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3.0 .. 1.0) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3.0 .. 1.0 != range1.contains(element12)) throw AssertionError() - if (element12 !in 3.0 .. 1.0 != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3.0 .. 1.0) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3.0 .. 1.0) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3.0 .. 1.0 != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3.0 .. 1.0 != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3.0 .. 1.0) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3.0 .. 1.0) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3.0 .. 1.0 != range1.contains(element13)) throw AssertionError() - if (element13 !in 3.0 .. 1.0 != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3.0 .. 1.0) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3.0 .. 1.0) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3.0 .. 1.0 != range1.contains(1)) throw AssertionError() - if (1 !in 3.0 .. 1.0 != !range1.contains(1)) throw AssertionError() - if (!(1 in 3.0 .. 1.0) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3.0 .. 1.0) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3.0 .. 1.0 != range1.contains(element14)) throw AssertionError() - if (element14 !in 3.0 .. 1.0 != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3.0 .. 1.0) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3.0 .. 1.0) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3.0 .. 1.0 != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3.0 .. 1.0 != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3.0 .. 1.0) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3.0 .. 1.0) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3.0 .. 1.0 != range1.contains(element15)) throw AssertionError() - if (element15 !in 3.0 .. 1.0 != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3.0 .. 1.0) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3.0 .. 1.0) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3.0 .. 1.0 != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3.0 .. 1.0 != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3.0 .. 1.0) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3.0 .. 1.0) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3.0 .. 1.0 != range1.contains(element16)) throw AssertionError() - if (element16 !in 3.0 .. 1.0 != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3.0 .. 1.0) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3.0 .. 1.0) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3.0 .. 1.0 != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3.0 .. 1.0 != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3.0 .. 1.0) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3.0 .. 1.0) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3.0 .. 1.0 != range1.contains(element17)) throw AssertionError() - if (element17 !in 3.0 .. 1.0 != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3.0 .. 1.0) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3.0 .. 1.0) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3.0 .. 1.0 != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3.0 .. 1.0 != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3.0 .. 1.0) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3.0 .. 1.0) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3.0 .. 1.0 != range1.contains(element18)) throw AssertionError() - if (element18 !in 3.0 .. 1.0 != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3.0 .. 1.0) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3.0 .. 1.0) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3.0 .. 1.0 != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3.0 .. 1.0 != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3.0 .. 1.0) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3.0 .. 1.0) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3.0 .. 1.0 != range1.contains(element19)) throw AssertionError() - if (element19 !in 3.0 .. 1.0 != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3.0 .. 1.0) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3.0 .. 1.0) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3.0 .. 1.0 != range1.contains(2)) throw AssertionError() - if (2 !in 3.0 .. 1.0 != !range1.contains(2)) throw AssertionError() - if (!(2 in 3.0 .. 1.0) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3.0 .. 1.0) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3.0 .. 1.0 != range1.contains(element20)) throw AssertionError() - if (element20 !in 3.0 .. 1.0 != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3.0 .. 1.0) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3.0 .. 1.0) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3.0 .. 1.0 != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3.0 .. 1.0 != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3.0 .. 1.0) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3.0 .. 1.0) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3.0 .. 1.0 != range1.contains(element21)) throw AssertionError() - if (element21 !in 3.0 .. 1.0 != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3.0 .. 1.0) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3.0 .. 1.0) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3.0 .. 1.0 != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3.0 .. 1.0 != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3.0 .. 1.0) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3.0 .. 1.0) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3.0 .. 1.0 != range1.contains(element22)) throw AssertionError() - if (element22 !in 3.0 .. 1.0 != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3.0 .. 1.0) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3.0 .. 1.0) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3.0 .. 1.0 != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3.0 .. 1.0 != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3.0 .. 1.0) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3.0 .. 1.0) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3.0 .. 1.0 != range1.contains(element23)) throw AssertionError() - if (element23 !in 3.0 .. 1.0 != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3.0 .. 1.0) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3.0 .. 1.0) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3.0 .. 1.0 != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3.0 .. 1.0 != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3.0 .. 1.0) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3.0 .. 1.0) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3.0 .. 1.0 != range1.contains(element24)) throw AssertionError() - if (element24 !in 3.0 .. 1.0 != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3.0 .. 1.0) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3.0 .. 1.0) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3.0 .. 1.0 != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3.0 .. 1.0 != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3.0 .. 1.0) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3.0 .. 1.0) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3.0 .. 1.0 != range1.contains(element25)) throw AssertionError() - if (element25 !in 3.0 .. 1.0 != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3.0 .. 1.0) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3.0 .. 1.0) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3.0 .. 1.0 != range1.contains(3)) throw AssertionError() - if (3 !in 3.0 .. 1.0 != !range1.contains(3)) throw AssertionError() - if (!(3 in 3.0 .. 1.0) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3.0 .. 1.0) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3.0 .. 1.0 != range1.contains(element26)) throw AssertionError() - if (element26 !in 3.0 .. 1.0 != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3.0 .. 1.0) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3.0 .. 1.0) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3.0 .. 1.0 != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3.0 .. 1.0 != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3.0 .. 1.0) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3.0 .. 1.0) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3.0 .. 1.0 != range1.contains(element27)) throw AssertionError() - if (element27 !in 3.0 .. 1.0 != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3.0 .. 1.0) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3.0 .. 1.0) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3.0 .. 1.0 != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3.0 .. 1.0 != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3.0 .. 1.0) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3.0 .. 1.0) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3.0 .. 1.0 != range1.contains(element28)) throw AssertionError() - if (element28 !in 3.0 .. 1.0 != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3.0 .. 1.0) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3.0 .. 1.0) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3.0 .. 1.0 != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3.0 .. 1.0 != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3.0 .. 1.0) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3.0 .. 1.0) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3.0 .. 1.0 != range1.contains(element29)) throw AssertionError() - if (element29 !in 3.0 .. 1.0 != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3.0 .. 1.0) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3.0 .. 1.0) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3.0 .. 1.0 != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3.0 .. 1.0 != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3.0 .. 1.0) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3.0 .. 1.0) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3.0 .. 1.0 != range1.contains(element30)) throw AssertionError() - if (element30 !in 3.0 .. 1.0 != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3.0 .. 1.0) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3.0 .. 1.0) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3.0 .. 1.0 != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3.0 .. 1.0 != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3.0 .. 1.0) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3.0 .. 1.0) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3.0 .. 1.0 != range1.contains(element31)) throw AssertionError() - if (element31 !in 3.0 .. 1.0 != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3.0 .. 1.0) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3.0 .. 1.0) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3.0 .. 1.0 != range1.contains(4)) throw AssertionError() - if (4 !in 3.0 .. 1.0 != !range1.contains(4)) throw AssertionError() - if (!(4 in 3.0 .. 1.0) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3.0 .. 1.0) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3.0 .. 1.0 != range1.contains(element32)) throw AssertionError() - if (element32 !in 3.0 .. 1.0 != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3.0 .. 1.0) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3.0 .. 1.0) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3.0 .. 1.0 != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3.0 .. 1.0 != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3.0 .. 1.0) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3.0 .. 1.0) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3.0 .. 1.0 != range1.contains(element33)) throw AssertionError() - if (element33 !in 3.0 .. 1.0 != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3.0 .. 1.0) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3.0 .. 1.0) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3.0 .. 1.0 != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3.0 .. 1.0 != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3.0 .. 1.0) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3.0 .. 1.0) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3.0 .. 1.0 != range1.contains(element34)) throw AssertionError() - if (element34 !in 3.0 .. 1.0 != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3.0 .. 1.0) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3.0 .. 1.0) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3.0 .. 1.0 != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3.0 .. 1.0 != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3.0 .. 1.0) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3.0 .. 1.0) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3.0 .. 1.0 != range1.contains(element35)) throw AssertionError() - if (element35 !in 3.0 .. 1.0 != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3.0 .. 1.0) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3.0 .. 1.0) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/floatRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/floatRangeLiteral.kt deleted file mode 100644 index 9e098f9c705..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/floatRangeLiteral.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1.0F .. 3.0F -val range1 = 3.0F .. 1.0F - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1.0F .. 3.0F != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1.0F .. 3.0F != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1.0F .. 3.0F) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1.0F .. 3.0F) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1.0F .. 3.0F != range0.contains(element0)) throw AssertionError() - if (element0 !in 1.0F .. 3.0F != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1.0F .. 3.0F) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1.0F .. 3.0F) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1.0F .. 3.0F != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1.0F .. 3.0F != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1.0F .. 3.0F) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1.0F .. 3.0F) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1.0F .. 3.0F != range0.contains(element1)) throw AssertionError() - if (element1 !in 1.0F .. 3.0F != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1.0F .. 3.0F) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1.0F .. 3.0F) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1.0F .. 3.0F != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1.0F .. 3.0F != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1.0F .. 3.0F) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1.0F .. 3.0F) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1.0F .. 3.0F != range0.contains(element2)) throw AssertionError() - if (element2 !in 1.0F .. 3.0F != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1.0F .. 3.0F) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1.0F .. 3.0F) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1.0F .. 3.0F != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1.0F .. 3.0F != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1.0F .. 3.0F) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1.0F .. 3.0F) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1.0F .. 3.0F != range0.contains(element3)) throw AssertionError() - if (element3 !in 1.0F .. 3.0F != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1.0F .. 3.0F) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1.0F .. 3.0F) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1.0F .. 3.0F != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1.0F .. 3.0F != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1.0F .. 3.0F) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1.0F .. 3.0F) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1.0F .. 3.0F != range0.contains(element4)) throw AssertionError() - if (element4 !in 1.0F .. 3.0F != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1.0F .. 3.0F) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1.0F .. 3.0F) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1.0F .. 3.0F != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1.0F .. 3.0F != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1.0F .. 3.0F) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1.0F .. 3.0F) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1.0F .. 3.0F != range0.contains(element5)) throw AssertionError() - if (element5 !in 1.0F .. 3.0F != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1.0F .. 3.0F) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1.0F .. 3.0F) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1.0F .. 3.0F != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1.0F .. 3.0F != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1.0F .. 3.0F) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1.0F .. 3.0F) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1.0F .. 3.0F != range0.contains(element6)) throw AssertionError() - if (element6 !in 1.0F .. 3.0F != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1.0F .. 3.0F) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1.0F .. 3.0F) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1.0F .. 3.0F != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1.0F .. 3.0F != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1.0F .. 3.0F) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1.0F .. 3.0F) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1.0F .. 3.0F != range0.contains(element7)) throw AssertionError() - if (element7 !in 1.0F .. 3.0F != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1.0F .. 3.0F) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1.0F .. 3.0F) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1.0F .. 3.0F != range0.contains(0)) throw AssertionError() - if (0 !in 1.0F .. 3.0F != !range0.contains(0)) throw AssertionError() - if (!(0 in 1.0F .. 3.0F) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1.0F .. 3.0F) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1.0F .. 3.0F != range0.contains(element8)) throw AssertionError() - if (element8 !in 1.0F .. 3.0F != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1.0F .. 3.0F) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1.0F .. 3.0F) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1.0F .. 3.0F != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1.0F .. 3.0F != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1.0F .. 3.0F) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1.0F .. 3.0F) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1.0F .. 3.0F != range0.contains(element9)) throw AssertionError() - if (element9 !in 1.0F .. 3.0F != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1.0F .. 3.0F) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1.0F .. 3.0F) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1.0F .. 3.0F != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1.0F .. 3.0F != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1.0F .. 3.0F) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1.0F .. 3.0F) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1.0F .. 3.0F != range0.contains(element10)) throw AssertionError() - if (element10 !in 1.0F .. 3.0F != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1.0F .. 3.0F) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1.0F .. 3.0F) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1.0F .. 3.0F != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1.0F .. 3.0F != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1.0F .. 3.0F) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1.0F .. 3.0F) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1.0F .. 3.0F != range0.contains(element11)) throw AssertionError() - if (element11 !in 1.0F .. 3.0F != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1.0F .. 3.0F) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1.0F .. 3.0F) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1.0F .. 3.0F != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1.0F .. 3.0F != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1.0F .. 3.0F) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1.0F .. 3.0F) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1.0F .. 3.0F != range0.contains(element12)) throw AssertionError() - if (element12 !in 1.0F .. 3.0F != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1.0F .. 3.0F) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1.0F .. 3.0F) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1.0F .. 3.0F != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1.0F .. 3.0F != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1.0F .. 3.0F) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1.0F .. 3.0F) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1.0F .. 3.0F != range0.contains(element13)) throw AssertionError() - if (element13 !in 1.0F .. 3.0F != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1.0F .. 3.0F) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1.0F .. 3.0F) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1.0F .. 3.0F != range0.contains(1)) throw AssertionError() - if (1 !in 1.0F .. 3.0F != !range0.contains(1)) throw AssertionError() - if (!(1 in 1.0F .. 3.0F) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1.0F .. 3.0F) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1.0F .. 3.0F != range0.contains(element14)) throw AssertionError() - if (element14 !in 1.0F .. 3.0F != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1.0F .. 3.0F) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1.0F .. 3.0F) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1.0F .. 3.0F != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1.0F .. 3.0F != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1.0F .. 3.0F) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1.0F .. 3.0F) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1.0F .. 3.0F != range0.contains(element15)) throw AssertionError() - if (element15 !in 1.0F .. 3.0F != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1.0F .. 3.0F) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1.0F .. 3.0F) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1.0F .. 3.0F != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1.0F .. 3.0F != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1.0F .. 3.0F) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1.0F .. 3.0F) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1.0F .. 3.0F != range0.contains(element16)) throw AssertionError() - if (element16 !in 1.0F .. 3.0F != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1.0F .. 3.0F) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1.0F .. 3.0F) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1.0F .. 3.0F != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1.0F .. 3.0F != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1.0F .. 3.0F) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1.0F .. 3.0F) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1.0F .. 3.0F != range0.contains(element17)) throw AssertionError() - if (element17 !in 1.0F .. 3.0F != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1.0F .. 3.0F) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1.0F .. 3.0F) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1.0F .. 3.0F != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1.0F .. 3.0F != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1.0F .. 3.0F) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1.0F .. 3.0F) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1.0F .. 3.0F != range0.contains(element18)) throw AssertionError() - if (element18 !in 1.0F .. 3.0F != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1.0F .. 3.0F) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1.0F .. 3.0F) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1.0F .. 3.0F != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1.0F .. 3.0F != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1.0F .. 3.0F) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1.0F .. 3.0F) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1.0F .. 3.0F != range0.contains(element19)) throw AssertionError() - if (element19 !in 1.0F .. 3.0F != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1.0F .. 3.0F) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1.0F .. 3.0F) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1.0F .. 3.0F != range0.contains(2)) throw AssertionError() - if (2 !in 1.0F .. 3.0F != !range0.contains(2)) throw AssertionError() - if (!(2 in 1.0F .. 3.0F) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1.0F .. 3.0F) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1.0F .. 3.0F != range0.contains(element20)) throw AssertionError() - if (element20 !in 1.0F .. 3.0F != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1.0F .. 3.0F) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1.0F .. 3.0F) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1.0F .. 3.0F != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1.0F .. 3.0F != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1.0F .. 3.0F) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1.0F .. 3.0F) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1.0F .. 3.0F != range0.contains(element21)) throw AssertionError() - if (element21 !in 1.0F .. 3.0F != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1.0F .. 3.0F) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1.0F .. 3.0F) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1.0F .. 3.0F != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1.0F .. 3.0F != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1.0F .. 3.0F) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1.0F .. 3.0F) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1.0F .. 3.0F != range0.contains(element22)) throw AssertionError() - if (element22 !in 1.0F .. 3.0F != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1.0F .. 3.0F) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1.0F .. 3.0F) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1.0F .. 3.0F != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1.0F .. 3.0F != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1.0F .. 3.0F) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1.0F .. 3.0F) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1.0F .. 3.0F != range0.contains(element23)) throw AssertionError() - if (element23 !in 1.0F .. 3.0F != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1.0F .. 3.0F) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1.0F .. 3.0F) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1.0F .. 3.0F != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1.0F .. 3.0F != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1.0F .. 3.0F) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1.0F .. 3.0F) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1.0F .. 3.0F != range0.contains(element24)) throw AssertionError() - if (element24 !in 1.0F .. 3.0F != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1.0F .. 3.0F) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1.0F .. 3.0F) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1.0F .. 3.0F != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1.0F .. 3.0F != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1.0F .. 3.0F) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1.0F .. 3.0F) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1.0F .. 3.0F != range0.contains(element25)) throw AssertionError() - if (element25 !in 1.0F .. 3.0F != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1.0F .. 3.0F) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1.0F .. 3.0F) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1.0F .. 3.0F != range0.contains(3)) throw AssertionError() - if (3 !in 1.0F .. 3.0F != !range0.contains(3)) throw AssertionError() - if (!(3 in 1.0F .. 3.0F) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1.0F .. 3.0F) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1.0F .. 3.0F != range0.contains(element26)) throw AssertionError() - if (element26 !in 1.0F .. 3.0F != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1.0F .. 3.0F) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1.0F .. 3.0F) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1.0F .. 3.0F != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1.0F .. 3.0F != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1.0F .. 3.0F) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1.0F .. 3.0F) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1.0F .. 3.0F != range0.contains(element27)) throw AssertionError() - if (element27 !in 1.0F .. 3.0F != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1.0F .. 3.0F) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1.0F .. 3.0F) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1.0F .. 3.0F != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1.0F .. 3.0F != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1.0F .. 3.0F) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1.0F .. 3.0F) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1.0F .. 3.0F != range0.contains(element28)) throw AssertionError() - if (element28 !in 1.0F .. 3.0F != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1.0F .. 3.0F) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1.0F .. 3.0F) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1.0F .. 3.0F != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1.0F .. 3.0F != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1.0F .. 3.0F) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1.0F .. 3.0F) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1.0F .. 3.0F != range0.contains(element29)) throw AssertionError() - if (element29 !in 1.0F .. 3.0F != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1.0F .. 3.0F) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1.0F .. 3.0F) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1.0F .. 3.0F != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1.0F .. 3.0F != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1.0F .. 3.0F) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1.0F .. 3.0F) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1.0F .. 3.0F != range0.contains(element30)) throw AssertionError() - if (element30 !in 1.0F .. 3.0F != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1.0F .. 3.0F) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1.0F .. 3.0F) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1.0F .. 3.0F != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1.0F .. 3.0F != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1.0F .. 3.0F) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1.0F .. 3.0F) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1.0F .. 3.0F != range0.contains(element31)) throw AssertionError() - if (element31 !in 1.0F .. 3.0F != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1.0F .. 3.0F) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1.0F .. 3.0F) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1.0F .. 3.0F != range0.contains(4)) throw AssertionError() - if (4 !in 1.0F .. 3.0F != !range0.contains(4)) throw AssertionError() - if (!(4 in 1.0F .. 3.0F) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1.0F .. 3.0F) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1.0F .. 3.0F != range0.contains(element32)) throw AssertionError() - if (element32 !in 1.0F .. 3.0F != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1.0F .. 3.0F) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1.0F .. 3.0F) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1.0F .. 3.0F != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1.0F .. 3.0F != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1.0F .. 3.0F) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1.0F .. 3.0F) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1.0F .. 3.0F != range0.contains(element33)) throw AssertionError() - if (element33 !in 1.0F .. 3.0F != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1.0F .. 3.0F) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1.0F .. 3.0F) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1.0F .. 3.0F != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1.0F .. 3.0F != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1.0F .. 3.0F) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1.0F .. 3.0F) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1.0F .. 3.0F != range0.contains(element34)) throw AssertionError() - if (element34 !in 1.0F .. 3.0F != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1.0F .. 3.0F) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1.0F .. 3.0F) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1.0F .. 3.0F != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1.0F .. 3.0F != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1.0F .. 3.0F) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1.0F .. 3.0F) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1.0F .. 3.0F != range0.contains(element35)) throw AssertionError() - if (element35 !in 1.0F .. 3.0F != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1.0F .. 3.0F) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1.0F .. 3.0F) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3.0F .. 1.0F != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3.0F .. 1.0F != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3.0F .. 1.0F) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3.0F .. 1.0F) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3.0F .. 1.0F != range1.contains(element0)) throw AssertionError() - if (element0 !in 3.0F .. 1.0F != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3.0F .. 1.0F) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3.0F .. 1.0F) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3.0F .. 1.0F != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3.0F .. 1.0F != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3.0F .. 1.0F) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3.0F .. 1.0F) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3.0F .. 1.0F != range1.contains(element1)) throw AssertionError() - if (element1 !in 3.0F .. 1.0F != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3.0F .. 1.0F) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3.0F .. 1.0F) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3.0F .. 1.0F != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3.0F .. 1.0F != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3.0F .. 1.0F) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3.0F .. 1.0F) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3.0F .. 1.0F != range1.contains(element2)) throw AssertionError() - if (element2 !in 3.0F .. 1.0F != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3.0F .. 1.0F) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3.0F .. 1.0F) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3.0F .. 1.0F != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3.0F .. 1.0F != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3.0F .. 1.0F) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3.0F .. 1.0F) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3.0F .. 1.0F != range1.contains(element3)) throw AssertionError() - if (element3 !in 3.0F .. 1.0F != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3.0F .. 1.0F) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3.0F .. 1.0F) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3.0F .. 1.0F != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3.0F .. 1.0F != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3.0F .. 1.0F) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3.0F .. 1.0F) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3.0F .. 1.0F != range1.contains(element4)) throw AssertionError() - if (element4 !in 3.0F .. 1.0F != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3.0F .. 1.0F) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3.0F .. 1.0F) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3.0F .. 1.0F != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3.0F .. 1.0F != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3.0F .. 1.0F) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3.0F .. 1.0F) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3.0F .. 1.0F != range1.contains(element5)) throw AssertionError() - if (element5 !in 3.0F .. 1.0F != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3.0F .. 1.0F) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3.0F .. 1.0F) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3.0F .. 1.0F != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3.0F .. 1.0F != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3.0F .. 1.0F) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3.0F .. 1.0F) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3.0F .. 1.0F != range1.contains(element6)) throw AssertionError() - if (element6 !in 3.0F .. 1.0F != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3.0F .. 1.0F) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3.0F .. 1.0F) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3.0F .. 1.0F != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3.0F .. 1.0F != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3.0F .. 1.0F) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3.0F .. 1.0F) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3.0F .. 1.0F != range1.contains(element7)) throw AssertionError() - if (element7 !in 3.0F .. 1.0F != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3.0F .. 1.0F) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3.0F .. 1.0F) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3.0F .. 1.0F != range1.contains(0)) throw AssertionError() - if (0 !in 3.0F .. 1.0F != !range1.contains(0)) throw AssertionError() - if (!(0 in 3.0F .. 1.0F) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3.0F .. 1.0F) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3.0F .. 1.0F != range1.contains(element8)) throw AssertionError() - if (element8 !in 3.0F .. 1.0F != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3.0F .. 1.0F) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3.0F .. 1.0F) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3.0F .. 1.0F != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3.0F .. 1.0F != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3.0F .. 1.0F) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3.0F .. 1.0F) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3.0F .. 1.0F != range1.contains(element9)) throw AssertionError() - if (element9 !in 3.0F .. 1.0F != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3.0F .. 1.0F) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3.0F .. 1.0F) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3.0F .. 1.0F != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3.0F .. 1.0F != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3.0F .. 1.0F) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3.0F .. 1.0F) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3.0F .. 1.0F != range1.contains(element10)) throw AssertionError() - if (element10 !in 3.0F .. 1.0F != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3.0F .. 1.0F) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3.0F .. 1.0F) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3.0F .. 1.0F != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3.0F .. 1.0F != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3.0F .. 1.0F) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3.0F .. 1.0F) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3.0F .. 1.0F != range1.contains(element11)) throw AssertionError() - if (element11 !in 3.0F .. 1.0F != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3.0F .. 1.0F) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3.0F .. 1.0F) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3.0F .. 1.0F != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3.0F .. 1.0F != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3.0F .. 1.0F) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3.0F .. 1.0F) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3.0F .. 1.0F != range1.contains(element12)) throw AssertionError() - if (element12 !in 3.0F .. 1.0F != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3.0F .. 1.0F) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3.0F .. 1.0F) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3.0F .. 1.0F != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3.0F .. 1.0F != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3.0F .. 1.0F) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3.0F .. 1.0F) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3.0F .. 1.0F != range1.contains(element13)) throw AssertionError() - if (element13 !in 3.0F .. 1.0F != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3.0F .. 1.0F) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3.0F .. 1.0F) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3.0F .. 1.0F != range1.contains(1)) throw AssertionError() - if (1 !in 3.0F .. 1.0F != !range1.contains(1)) throw AssertionError() - if (!(1 in 3.0F .. 1.0F) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3.0F .. 1.0F) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3.0F .. 1.0F != range1.contains(element14)) throw AssertionError() - if (element14 !in 3.0F .. 1.0F != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3.0F .. 1.0F) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3.0F .. 1.0F) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3.0F .. 1.0F != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3.0F .. 1.0F != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3.0F .. 1.0F) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3.0F .. 1.0F) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3.0F .. 1.0F != range1.contains(element15)) throw AssertionError() - if (element15 !in 3.0F .. 1.0F != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3.0F .. 1.0F) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3.0F .. 1.0F) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3.0F .. 1.0F != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3.0F .. 1.0F != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3.0F .. 1.0F) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3.0F .. 1.0F) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3.0F .. 1.0F != range1.contains(element16)) throw AssertionError() - if (element16 !in 3.0F .. 1.0F != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3.0F .. 1.0F) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3.0F .. 1.0F) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3.0F .. 1.0F != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3.0F .. 1.0F != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3.0F .. 1.0F) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3.0F .. 1.0F) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3.0F .. 1.0F != range1.contains(element17)) throw AssertionError() - if (element17 !in 3.0F .. 1.0F != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3.0F .. 1.0F) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3.0F .. 1.0F) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3.0F .. 1.0F != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3.0F .. 1.0F != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3.0F .. 1.0F) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3.0F .. 1.0F) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3.0F .. 1.0F != range1.contains(element18)) throw AssertionError() - if (element18 !in 3.0F .. 1.0F != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3.0F .. 1.0F) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3.0F .. 1.0F) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3.0F .. 1.0F != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3.0F .. 1.0F != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3.0F .. 1.0F) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3.0F .. 1.0F) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3.0F .. 1.0F != range1.contains(element19)) throw AssertionError() - if (element19 !in 3.0F .. 1.0F != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3.0F .. 1.0F) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3.0F .. 1.0F) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3.0F .. 1.0F != range1.contains(2)) throw AssertionError() - if (2 !in 3.0F .. 1.0F != !range1.contains(2)) throw AssertionError() - if (!(2 in 3.0F .. 1.0F) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3.0F .. 1.0F) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3.0F .. 1.0F != range1.contains(element20)) throw AssertionError() - if (element20 !in 3.0F .. 1.0F != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3.0F .. 1.0F) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3.0F .. 1.0F) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3.0F .. 1.0F != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3.0F .. 1.0F != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3.0F .. 1.0F) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3.0F .. 1.0F) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3.0F .. 1.0F != range1.contains(element21)) throw AssertionError() - if (element21 !in 3.0F .. 1.0F != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3.0F .. 1.0F) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3.0F .. 1.0F) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3.0F .. 1.0F != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3.0F .. 1.0F != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3.0F .. 1.0F) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3.0F .. 1.0F) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3.0F .. 1.0F != range1.contains(element22)) throw AssertionError() - if (element22 !in 3.0F .. 1.0F != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3.0F .. 1.0F) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3.0F .. 1.0F) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3.0F .. 1.0F != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3.0F .. 1.0F != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3.0F .. 1.0F) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3.0F .. 1.0F) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3.0F .. 1.0F != range1.contains(element23)) throw AssertionError() - if (element23 !in 3.0F .. 1.0F != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3.0F .. 1.0F) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3.0F .. 1.0F) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3.0F .. 1.0F != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3.0F .. 1.0F != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3.0F .. 1.0F) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3.0F .. 1.0F) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3.0F .. 1.0F != range1.contains(element24)) throw AssertionError() - if (element24 !in 3.0F .. 1.0F != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3.0F .. 1.0F) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3.0F .. 1.0F) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3.0F .. 1.0F != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3.0F .. 1.0F != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3.0F .. 1.0F) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3.0F .. 1.0F) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3.0F .. 1.0F != range1.contains(element25)) throw AssertionError() - if (element25 !in 3.0F .. 1.0F != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3.0F .. 1.0F) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3.0F .. 1.0F) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3.0F .. 1.0F != range1.contains(3)) throw AssertionError() - if (3 !in 3.0F .. 1.0F != !range1.contains(3)) throw AssertionError() - if (!(3 in 3.0F .. 1.0F) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3.0F .. 1.0F) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3.0F .. 1.0F != range1.contains(element26)) throw AssertionError() - if (element26 !in 3.0F .. 1.0F != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3.0F .. 1.0F) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3.0F .. 1.0F) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3.0F .. 1.0F != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3.0F .. 1.0F != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3.0F .. 1.0F) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3.0F .. 1.0F) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3.0F .. 1.0F != range1.contains(element27)) throw AssertionError() - if (element27 !in 3.0F .. 1.0F != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3.0F .. 1.0F) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3.0F .. 1.0F) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3.0F .. 1.0F != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3.0F .. 1.0F != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3.0F .. 1.0F) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3.0F .. 1.0F) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3.0F .. 1.0F != range1.contains(element28)) throw AssertionError() - if (element28 !in 3.0F .. 1.0F != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3.0F .. 1.0F) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3.0F .. 1.0F) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3.0F .. 1.0F != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3.0F .. 1.0F != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3.0F .. 1.0F) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3.0F .. 1.0F) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3.0F .. 1.0F != range1.contains(element29)) throw AssertionError() - if (element29 !in 3.0F .. 1.0F != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3.0F .. 1.0F) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3.0F .. 1.0F) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3.0F .. 1.0F != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3.0F .. 1.0F != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3.0F .. 1.0F) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3.0F .. 1.0F) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3.0F .. 1.0F != range1.contains(element30)) throw AssertionError() - if (element30 !in 3.0F .. 1.0F != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3.0F .. 1.0F) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3.0F .. 1.0F) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3.0F .. 1.0F != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3.0F .. 1.0F != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3.0F .. 1.0F) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3.0F .. 1.0F) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3.0F .. 1.0F != range1.contains(element31)) throw AssertionError() - if (element31 !in 3.0F .. 1.0F != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3.0F .. 1.0F) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3.0F .. 1.0F) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3.0F .. 1.0F != range1.contains(4)) throw AssertionError() - if (4 !in 3.0F .. 1.0F != !range1.contains(4)) throw AssertionError() - if (!(4 in 3.0F .. 1.0F) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3.0F .. 1.0F) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3.0F .. 1.0F != range1.contains(element32)) throw AssertionError() - if (element32 !in 3.0F .. 1.0F != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3.0F .. 1.0F) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3.0F .. 1.0F) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3.0F .. 1.0F != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3.0F .. 1.0F != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3.0F .. 1.0F) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3.0F .. 1.0F) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3.0F .. 1.0F != range1.contains(element33)) throw AssertionError() - if (element33 !in 3.0F .. 1.0F != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3.0F .. 1.0F) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3.0F .. 1.0F) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3.0F .. 1.0F != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3.0F .. 1.0F != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3.0F .. 1.0F) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3.0F .. 1.0F) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3.0F .. 1.0F != range1.contains(element34)) throw AssertionError() - if (element34 !in 3.0F .. 1.0F != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3.0F .. 1.0F) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3.0F .. 1.0F) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3.0F .. 1.0F != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3.0F .. 1.0F != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3.0F .. 1.0F) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3.0F .. 1.0F) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3.0F .. 1.0F != range1.contains(element35)) throw AssertionError() - if (element35 !in 3.0F .. 1.0F != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3.0F .. 1.0F) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3.0F .. 1.0F) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/intDownTo.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/intDownTo.kt deleted file mode 100644 index 5bda3e06c2f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/intDownTo.kt +++ /dev/null @@ -1,43 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 3 downTo 1 -val range1 = 1 downTo 3 - -val element0 = 1 - -fun box(): String { - testR0xE0() - testR1xE0() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if (1 in 3 downTo 1 != range0.contains(1)) throw AssertionError() - if (1 !in 3 downTo 1 != !range0.contains(1)) throw AssertionError() - if (!(1 in 3 downTo 1) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 3 downTo 1) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element0 in 3 downTo 1 != range0.contains(element0)) throw AssertionError() - if (element0 !in 3 downTo 1 != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 3 downTo 1) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 3 downTo 1) != range0.contains(element0)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if (1 in 1 downTo 3 != range1.contains(1)) throw AssertionError() - if (1 !in 1 downTo 3 != !range1.contains(1)) throw AssertionError() - if (!(1 in 1 downTo 3) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 1 downTo 3) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element0 in 1 downTo 3 != range1.contains(element0)) throw AssertionError() - if (element0 !in 1 downTo 3 != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 1 downTo 3) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 1 downTo 3) != range1.contains(element0)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/intRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/intRangeLiteral.kt deleted file mode 100644 index 5552b83dc8d..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/intRangeLiteral.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1 .. 3 -val range1 = 3 .. 1 - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1 .. 3 != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1 .. 3 != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1 .. 3) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1 .. 3) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1 .. 3 != range0.contains(element0)) throw AssertionError() - if (element0 !in 1 .. 3 != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1 .. 3) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1 .. 3) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1 .. 3 != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1 .. 3 != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1 .. 3) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1 .. 3) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1 .. 3 != range0.contains(element1)) throw AssertionError() - if (element1 !in 1 .. 3 != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1 .. 3) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1 .. 3) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1 .. 3 != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1 .. 3 != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1 .. 3) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1 .. 3) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1 .. 3 != range0.contains(element2)) throw AssertionError() - if (element2 !in 1 .. 3 != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1 .. 3) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1 .. 3) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1 .. 3 != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1 .. 3 != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1 .. 3) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1 .. 3) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1 .. 3 != range0.contains(element3)) throw AssertionError() - if (element3 !in 1 .. 3 != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1 .. 3) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1 .. 3) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1 .. 3 != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1 .. 3 != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1 .. 3) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1 .. 3) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1 .. 3 != range0.contains(element4)) throw AssertionError() - if (element4 !in 1 .. 3 != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1 .. 3) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1 .. 3) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1 .. 3 != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1 .. 3 != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1 .. 3) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1 .. 3) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1 .. 3 != range0.contains(element5)) throw AssertionError() - if (element5 !in 1 .. 3 != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1 .. 3) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1 .. 3) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1 .. 3 != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1 .. 3 != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1 .. 3) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1 .. 3) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1 .. 3 != range0.contains(element6)) throw AssertionError() - if (element6 !in 1 .. 3 != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1 .. 3) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1 .. 3) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1 .. 3 != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1 .. 3 != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1 .. 3) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1 .. 3) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1 .. 3 != range0.contains(element7)) throw AssertionError() - if (element7 !in 1 .. 3 != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1 .. 3) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1 .. 3) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1 .. 3 != range0.contains(0)) throw AssertionError() - if (0 !in 1 .. 3 != !range0.contains(0)) throw AssertionError() - if (!(0 in 1 .. 3) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1 .. 3) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1 .. 3 != range0.contains(element8)) throw AssertionError() - if (element8 !in 1 .. 3 != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1 .. 3) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1 .. 3) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1 .. 3 != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1 .. 3 != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1 .. 3) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1 .. 3) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1 .. 3 != range0.contains(element9)) throw AssertionError() - if (element9 !in 1 .. 3 != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1 .. 3) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1 .. 3) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1 .. 3 != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1 .. 3 != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1 .. 3) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1 .. 3) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1 .. 3 != range0.contains(element10)) throw AssertionError() - if (element10 !in 1 .. 3 != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1 .. 3) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1 .. 3) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1 .. 3 != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1 .. 3 != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1 .. 3) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1 .. 3) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1 .. 3 != range0.contains(element11)) throw AssertionError() - if (element11 !in 1 .. 3 != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1 .. 3) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1 .. 3) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1 .. 3 != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1 .. 3 != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1 .. 3) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1 .. 3) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1 .. 3 != range0.contains(element12)) throw AssertionError() - if (element12 !in 1 .. 3 != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1 .. 3) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1 .. 3) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1 .. 3 != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1 .. 3 != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1 .. 3) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1 .. 3) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1 .. 3 != range0.contains(element13)) throw AssertionError() - if (element13 !in 1 .. 3 != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1 .. 3) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1 .. 3) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1 .. 3 != range0.contains(1)) throw AssertionError() - if (1 !in 1 .. 3 != !range0.contains(1)) throw AssertionError() - if (!(1 in 1 .. 3) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1 .. 3) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1 .. 3 != range0.contains(element14)) throw AssertionError() - if (element14 !in 1 .. 3 != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1 .. 3) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1 .. 3) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1 .. 3 != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1 .. 3 != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1 .. 3) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1 .. 3) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1 .. 3 != range0.contains(element15)) throw AssertionError() - if (element15 !in 1 .. 3 != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1 .. 3) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1 .. 3) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1 .. 3 != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1 .. 3 != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1 .. 3) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1 .. 3) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1 .. 3 != range0.contains(element16)) throw AssertionError() - if (element16 !in 1 .. 3 != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1 .. 3) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1 .. 3) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1 .. 3 != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1 .. 3 != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1 .. 3) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1 .. 3) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1 .. 3 != range0.contains(element17)) throw AssertionError() - if (element17 !in 1 .. 3 != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1 .. 3) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1 .. 3) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1 .. 3 != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1 .. 3 != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1 .. 3) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1 .. 3) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1 .. 3 != range0.contains(element18)) throw AssertionError() - if (element18 !in 1 .. 3 != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1 .. 3) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1 .. 3) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1 .. 3 != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1 .. 3 != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1 .. 3) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1 .. 3) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1 .. 3 != range0.contains(element19)) throw AssertionError() - if (element19 !in 1 .. 3 != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1 .. 3) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1 .. 3) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1 .. 3 != range0.contains(2)) throw AssertionError() - if (2 !in 1 .. 3 != !range0.contains(2)) throw AssertionError() - if (!(2 in 1 .. 3) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1 .. 3) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1 .. 3 != range0.contains(element20)) throw AssertionError() - if (element20 !in 1 .. 3 != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1 .. 3) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1 .. 3) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1 .. 3 != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1 .. 3 != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1 .. 3) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1 .. 3) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1 .. 3 != range0.contains(element21)) throw AssertionError() - if (element21 !in 1 .. 3 != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1 .. 3) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1 .. 3) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1 .. 3 != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1 .. 3 != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1 .. 3) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1 .. 3) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1 .. 3 != range0.contains(element22)) throw AssertionError() - if (element22 !in 1 .. 3 != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1 .. 3) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1 .. 3) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1 .. 3 != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1 .. 3 != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1 .. 3) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1 .. 3) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1 .. 3 != range0.contains(element23)) throw AssertionError() - if (element23 !in 1 .. 3 != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1 .. 3) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1 .. 3) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1 .. 3 != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1 .. 3 != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1 .. 3) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1 .. 3) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1 .. 3 != range0.contains(element24)) throw AssertionError() - if (element24 !in 1 .. 3 != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1 .. 3) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1 .. 3) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1 .. 3 != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1 .. 3 != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1 .. 3) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1 .. 3) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1 .. 3 != range0.contains(element25)) throw AssertionError() - if (element25 !in 1 .. 3 != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1 .. 3) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1 .. 3) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1 .. 3 != range0.contains(3)) throw AssertionError() - if (3 !in 1 .. 3 != !range0.contains(3)) throw AssertionError() - if (!(3 in 1 .. 3) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1 .. 3) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1 .. 3 != range0.contains(element26)) throw AssertionError() - if (element26 !in 1 .. 3 != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1 .. 3) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1 .. 3) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1 .. 3 != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1 .. 3 != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1 .. 3) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1 .. 3) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1 .. 3 != range0.contains(element27)) throw AssertionError() - if (element27 !in 1 .. 3 != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1 .. 3) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1 .. 3) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1 .. 3 != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1 .. 3 != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1 .. 3) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1 .. 3) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1 .. 3 != range0.contains(element28)) throw AssertionError() - if (element28 !in 1 .. 3 != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1 .. 3) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1 .. 3) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1 .. 3 != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1 .. 3 != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1 .. 3) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1 .. 3) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1 .. 3 != range0.contains(element29)) throw AssertionError() - if (element29 !in 1 .. 3 != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1 .. 3) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1 .. 3) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1 .. 3 != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1 .. 3 != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1 .. 3) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1 .. 3) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1 .. 3 != range0.contains(element30)) throw AssertionError() - if (element30 !in 1 .. 3 != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1 .. 3) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1 .. 3) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1 .. 3 != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1 .. 3 != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1 .. 3) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1 .. 3) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1 .. 3 != range0.contains(element31)) throw AssertionError() - if (element31 !in 1 .. 3 != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1 .. 3) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1 .. 3) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1 .. 3 != range0.contains(4)) throw AssertionError() - if (4 !in 1 .. 3 != !range0.contains(4)) throw AssertionError() - if (!(4 in 1 .. 3) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1 .. 3) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1 .. 3 != range0.contains(element32)) throw AssertionError() - if (element32 !in 1 .. 3 != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1 .. 3) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1 .. 3) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1 .. 3 != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1 .. 3 != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1 .. 3) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1 .. 3) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1 .. 3 != range0.contains(element33)) throw AssertionError() - if (element33 !in 1 .. 3 != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1 .. 3) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1 .. 3) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1 .. 3 != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1 .. 3 != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1 .. 3) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1 .. 3) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1 .. 3 != range0.contains(element34)) throw AssertionError() - if (element34 !in 1 .. 3 != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1 .. 3) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1 .. 3) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1 .. 3 != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1 .. 3 != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1 .. 3) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1 .. 3) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1 .. 3 != range0.contains(element35)) throw AssertionError() - if (element35 !in 1 .. 3 != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1 .. 3) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1 .. 3) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3 .. 1 != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3 .. 1 != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3 .. 1) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3 .. 1) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3 .. 1 != range1.contains(element0)) throw AssertionError() - if (element0 !in 3 .. 1 != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3 .. 1) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3 .. 1) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3 .. 1 != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3 .. 1 != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3 .. 1) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3 .. 1) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3 .. 1 != range1.contains(element1)) throw AssertionError() - if (element1 !in 3 .. 1 != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3 .. 1) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3 .. 1) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3 .. 1 != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3 .. 1 != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3 .. 1) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3 .. 1) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3 .. 1 != range1.contains(element2)) throw AssertionError() - if (element2 !in 3 .. 1 != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3 .. 1) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3 .. 1) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3 .. 1 != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3 .. 1 != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3 .. 1) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3 .. 1) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3 .. 1 != range1.contains(element3)) throw AssertionError() - if (element3 !in 3 .. 1 != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3 .. 1) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3 .. 1) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3 .. 1 != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3 .. 1 != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3 .. 1) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3 .. 1) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3 .. 1 != range1.contains(element4)) throw AssertionError() - if (element4 !in 3 .. 1 != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3 .. 1) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3 .. 1) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3 .. 1 != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3 .. 1 != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3 .. 1) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3 .. 1) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3 .. 1 != range1.contains(element5)) throw AssertionError() - if (element5 !in 3 .. 1 != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3 .. 1) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3 .. 1) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3 .. 1 != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3 .. 1 != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3 .. 1) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3 .. 1) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3 .. 1 != range1.contains(element6)) throw AssertionError() - if (element6 !in 3 .. 1 != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3 .. 1) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3 .. 1) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3 .. 1 != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3 .. 1 != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3 .. 1) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3 .. 1) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3 .. 1 != range1.contains(element7)) throw AssertionError() - if (element7 !in 3 .. 1 != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3 .. 1) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3 .. 1) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3 .. 1 != range1.contains(0)) throw AssertionError() - if (0 !in 3 .. 1 != !range1.contains(0)) throw AssertionError() - if (!(0 in 3 .. 1) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3 .. 1) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3 .. 1 != range1.contains(element8)) throw AssertionError() - if (element8 !in 3 .. 1 != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3 .. 1) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3 .. 1) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3 .. 1 != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3 .. 1 != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3 .. 1) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3 .. 1) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3 .. 1 != range1.contains(element9)) throw AssertionError() - if (element9 !in 3 .. 1 != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3 .. 1) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3 .. 1) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3 .. 1 != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3 .. 1 != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3 .. 1) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3 .. 1) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3 .. 1 != range1.contains(element10)) throw AssertionError() - if (element10 !in 3 .. 1 != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3 .. 1) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3 .. 1) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3 .. 1 != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3 .. 1 != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3 .. 1) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3 .. 1) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3 .. 1 != range1.contains(element11)) throw AssertionError() - if (element11 !in 3 .. 1 != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3 .. 1) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3 .. 1) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3 .. 1 != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3 .. 1 != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3 .. 1) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3 .. 1) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3 .. 1 != range1.contains(element12)) throw AssertionError() - if (element12 !in 3 .. 1 != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3 .. 1) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3 .. 1) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3 .. 1 != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3 .. 1 != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3 .. 1) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3 .. 1) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3 .. 1 != range1.contains(element13)) throw AssertionError() - if (element13 !in 3 .. 1 != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3 .. 1) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3 .. 1) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3 .. 1 != range1.contains(1)) throw AssertionError() - if (1 !in 3 .. 1 != !range1.contains(1)) throw AssertionError() - if (!(1 in 3 .. 1) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3 .. 1) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3 .. 1 != range1.contains(element14)) throw AssertionError() - if (element14 !in 3 .. 1 != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3 .. 1) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3 .. 1) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3 .. 1 != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3 .. 1 != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3 .. 1) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3 .. 1) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3 .. 1 != range1.contains(element15)) throw AssertionError() - if (element15 !in 3 .. 1 != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3 .. 1) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3 .. 1) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3 .. 1 != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3 .. 1 != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3 .. 1) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3 .. 1) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3 .. 1 != range1.contains(element16)) throw AssertionError() - if (element16 !in 3 .. 1 != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3 .. 1) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3 .. 1) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3 .. 1 != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3 .. 1 != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3 .. 1) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3 .. 1) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3 .. 1 != range1.contains(element17)) throw AssertionError() - if (element17 !in 3 .. 1 != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3 .. 1) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3 .. 1) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3 .. 1 != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3 .. 1 != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3 .. 1) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3 .. 1) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3 .. 1 != range1.contains(element18)) throw AssertionError() - if (element18 !in 3 .. 1 != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3 .. 1) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3 .. 1) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3 .. 1 != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3 .. 1 != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3 .. 1) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3 .. 1) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3 .. 1 != range1.contains(element19)) throw AssertionError() - if (element19 !in 3 .. 1 != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3 .. 1) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3 .. 1) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3 .. 1 != range1.contains(2)) throw AssertionError() - if (2 !in 3 .. 1 != !range1.contains(2)) throw AssertionError() - if (!(2 in 3 .. 1) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3 .. 1) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3 .. 1 != range1.contains(element20)) throw AssertionError() - if (element20 !in 3 .. 1 != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3 .. 1) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3 .. 1) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3 .. 1 != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3 .. 1 != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3 .. 1) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3 .. 1) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3 .. 1 != range1.contains(element21)) throw AssertionError() - if (element21 !in 3 .. 1 != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3 .. 1) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3 .. 1) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3 .. 1 != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3 .. 1 != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3 .. 1) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3 .. 1) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3 .. 1 != range1.contains(element22)) throw AssertionError() - if (element22 !in 3 .. 1 != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3 .. 1) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3 .. 1) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3 .. 1 != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3 .. 1 != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3 .. 1) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3 .. 1) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3 .. 1 != range1.contains(element23)) throw AssertionError() - if (element23 !in 3 .. 1 != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3 .. 1) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3 .. 1) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3 .. 1 != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3 .. 1 != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3 .. 1) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3 .. 1) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3 .. 1 != range1.contains(element24)) throw AssertionError() - if (element24 !in 3 .. 1 != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3 .. 1) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3 .. 1) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3 .. 1 != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3 .. 1 != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3 .. 1) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3 .. 1) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3 .. 1 != range1.contains(element25)) throw AssertionError() - if (element25 !in 3 .. 1 != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3 .. 1) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3 .. 1) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3 .. 1 != range1.contains(3)) throw AssertionError() - if (3 !in 3 .. 1 != !range1.contains(3)) throw AssertionError() - if (!(3 in 3 .. 1) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3 .. 1) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3 .. 1 != range1.contains(element26)) throw AssertionError() - if (element26 !in 3 .. 1 != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3 .. 1) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3 .. 1) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3 .. 1 != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3 .. 1 != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3 .. 1) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3 .. 1) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3 .. 1 != range1.contains(element27)) throw AssertionError() - if (element27 !in 3 .. 1 != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3 .. 1) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3 .. 1) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3 .. 1 != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3 .. 1 != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3 .. 1) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3 .. 1) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3 .. 1 != range1.contains(element28)) throw AssertionError() - if (element28 !in 3 .. 1 != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3 .. 1) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3 .. 1) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3 .. 1 != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3 .. 1 != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3 .. 1) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3 .. 1) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3 .. 1 != range1.contains(element29)) throw AssertionError() - if (element29 !in 3 .. 1 != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3 .. 1) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3 .. 1) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3 .. 1 != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3 .. 1 != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3 .. 1) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3 .. 1) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3 .. 1 != range1.contains(element30)) throw AssertionError() - if (element30 !in 3 .. 1 != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3 .. 1) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3 .. 1) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3 .. 1 != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3 .. 1 != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3 .. 1) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3 .. 1) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3 .. 1 != range1.contains(element31)) throw AssertionError() - if (element31 !in 3 .. 1 != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3 .. 1) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3 .. 1) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3 .. 1 != range1.contains(4)) throw AssertionError() - if (4 !in 3 .. 1 != !range1.contains(4)) throw AssertionError() - if (!(4 in 3 .. 1) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3 .. 1) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3 .. 1 != range1.contains(element32)) throw AssertionError() - if (element32 !in 3 .. 1 != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3 .. 1) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3 .. 1) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3 .. 1 != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3 .. 1 != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3 .. 1) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3 .. 1) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3 .. 1 != range1.contains(element33)) throw AssertionError() - if (element33 !in 3 .. 1 != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3 .. 1) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3 .. 1) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3 .. 1 != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3 .. 1 != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3 .. 1) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3 .. 1) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3 .. 1 != range1.contains(element34)) throw AssertionError() - if (element34 !in 3 .. 1 != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3 .. 1) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3 .. 1) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3 .. 1 != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3 .. 1 != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3 .. 1) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3 .. 1) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3 .. 1 != range1.contains(element35)) throw AssertionError() - if (element35 !in 3 .. 1 != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3 .. 1) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3 .. 1) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/intUntil.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/intUntil.kt deleted file mode 100644 index 036c8f06b55..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/intUntil.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1 until 3 -val range1 = 3 until 1 - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1 until 3 != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1 until 3 != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1 until 3) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1 until 3) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1 until 3 != range0.contains(element0)) throw AssertionError() - if (element0 !in 1 until 3 != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1 until 3) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1 until 3) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1 until 3 != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1 until 3 != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1 until 3) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1 until 3) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1 until 3 != range0.contains(element1)) throw AssertionError() - if (element1 !in 1 until 3 != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1 until 3) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1 until 3) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1 until 3 != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1 until 3 != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1 until 3) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1 until 3) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1 until 3 != range0.contains(element2)) throw AssertionError() - if (element2 !in 1 until 3 != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1 until 3) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1 until 3) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1 until 3 != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1 until 3 != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1 until 3) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1 until 3) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1 until 3 != range0.contains(element3)) throw AssertionError() - if (element3 !in 1 until 3 != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1 until 3) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1 until 3) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1 until 3 != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1 until 3 != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1 until 3) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1 until 3) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1 until 3 != range0.contains(element4)) throw AssertionError() - if (element4 !in 1 until 3 != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1 until 3) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1 until 3) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1 until 3 != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1 until 3 != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1 until 3) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1 until 3) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1 until 3 != range0.contains(element5)) throw AssertionError() - if (element5 !in 1 until 3 != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1 until 3) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1 until 3) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1 until 3 != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1 until 3 != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1 until 3) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1 until 3) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1 until 3 != range0.contains(element6)) throw AssertionError() - if (element6 !in 1 until 3 != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1 until 3) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1 until 3) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1 until 3 != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1 until 3 != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1 until 3) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1 until 3) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1 until 3 != range0.contains(element7)) throw AssertionError() - if (element7 !in 1 until 3 != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1 until 3) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1 until 3) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1 until 3 != range0.contains(0)) throw AssertionError() - if (0 !in 1 until 3 != !range0.contains(0)) throw AssertionError() - if (!(0 in 1 until 3) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1 until 3) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1 until 3 != range0.contains(element8)) throw AssertionError() - if (element8 !in 1 until 3 != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1 until 3) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1 until 3) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1 until 3 != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1 until 3 != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1 until 3) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1 until 3) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1 until 3 != range0.contains(element9)) throw AssertionError() - if (element9 !in 1 until 3 != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1 until 3) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1 until 3) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1 until 3 != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1 until 3 != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1 until 3) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1 until 3) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1 until 3 != range0.contains(element10)) throw AssertionError() - if (element10 !in 1 until 3 != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1 until 3) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1 until 3) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1 until 3 != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1 until 3 != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1 until 3) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1 until 3) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1 until 3 != range0.contains(element11)) throw AssertionError() - if (element11 !in 1 until 3 != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1 until 3) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1 until 3) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1 until 3 != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1 until 3 != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1 until 3) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1 until 3) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1 until 3 != range0.contains(element12)) throw AssertionError() - if (element12 !in 1 until 3 != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1 until 3) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1 until 3) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1 until 3 != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1 until 3 != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1 until 3) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1 until 3) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1 until 3 != range0.contains(element13)) throw AssertionError() - if (element13 !in 1 until 3 != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1 until 3) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1 until 3) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1 until 3 != range0.contains(1)) throw AssertionError() - if (1 !in 1 until 3 != !range0.contains(1)) throw AssertionError() - if (!(1 in 1 until 3) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1 until 3) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1 until 3 != range0.contains(element14)) throw AssertionError() - if (element14 !in 1 until 3 != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1 until 3) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1 until 3) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1 until 3 != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1 until 3 != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1 until 3) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1 until 3) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1 until 3 != range0.contains(element15)) throw AssertionError() - if (element15 !in 1 until 3 != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1 until 3) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1 until 3) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1 until 3 != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1 until 3 != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1 until 3) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1 until 3) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1 until 3 != range0.contains(element16)) throw AssertionError() - if (element16 !in 1 until 3 != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1 until 3) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1 until 3) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1 until 3 != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1 until 3 != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1 until 3) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1 until 3) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1 until 3 != range0.contains(element17)) throw AssertionError() - if (element17 !in 1 until 3 != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1 until 3) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1 until 3) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1 until 3 != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1 until 3 != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1 until 3) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1 until 3) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1 until 3 != range0.contains(element18)) throw AssertionError() - if (element18 !in 1 until 3 != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1 until 3) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1 until 3) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1 until 3 != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1 until 3 != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1 until 3) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1 until 3) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1 until 3 != range0.contains(element19)) throw AssertionError() - if (element19 !in 1 until 3 != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1 until 3) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1 until 3) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1 until 3 != range0.contains(2)) throw AssertionError() - if (2 !in 1 until 3 != !range0.contains(2)) throw AssertionError() - if (!(2 in 1 until 3) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1 until 3) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1 until 3 != range0.contains(element20)) throw AssertionError() - if (element20 !in 1 until 3 != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1 until 3) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1 until 3) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1 until 3 != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1 until 3 != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1 until 3) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1 until 3) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1 until 3 != range0.contains(element21)) throw AssertionError() - if (element21 !in 1 until 3 != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1 until 3) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1 until 3) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1 until 3 != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1 until 3 != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1 until 3) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1 until 3) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1 until 3 != range0.contains(element22)) throw AssertionError() - if (element22 !in 1 until 3 != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1 until 3) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1 until 3) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1 until 3 != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1 until 3 != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1 until 3) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1 until 3) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1 until 3 != range0.contains(element23)) throw AssertionError() - if (element23 !in 1 until 3 != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1 until 3) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1 until 3) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1 until 3 != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1 until 3 != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1 until 3) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1 until 3) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1 until 3 != range0.contains(element24)) throw AssertionError() - if (element24 !in 1 until 3 != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1 until 3) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1 until 3) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1 until 3 != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1 until 3 != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1 until 3) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1 until 3) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1 until 3 != range0.contains(element25)) throw AssertionError() - if (element25 !in 1 until 3 != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1 until 3) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1 until 3) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1 until 3 != range0.contains(3)) throw AssertionError() - if (3 !in 1 until 3 != !range0.contains(3)) throw AssertionError() - if (!(3 in 1 until 3) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1 until 3) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1 until 3 != range0.contains(element26)) throw AssertionError() - if (element26 !in 1 until 3 != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1 until 3) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1 until 3) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1 until 3 != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1 until 3 != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1 until 3) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1 until 3) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1 until 3 != range0.contains(element27)) throw AssertionError() - if (element27 !in 1 until 3 != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1 until 3) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1 until 3) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1 until 3 != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1 until 3 != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1 until 3) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1 until 3) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1 until 3 != range0.contains(element28)) throw AssertionError() - if (element28 !in 1 until 3 != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1 until 3) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1 until 3) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1 until 3 != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1 until 3 != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1 until 3) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1 until 3) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1 until 3 != range0.contains(element29)) throw AssertionError() - if (element29 !in 1 until 3 != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1 until 3) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1 until 3) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1 until 3 != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1 until 3 != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1 until 3) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1 until 3) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1 until 3 != range0.contains(element30)) throw AssertionError() - if (element30 !in 1 until 3 != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1 until 3) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1 until 3) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1 until 3 != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1 until 3 != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1 until 3) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1 until 3) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1 until 3 != range0.contains(element31)) throw AssertionError() - if (element31 !in 1 until 3 != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1 until 3) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1 until 3) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1 until 3 != range0.contains(4)) throw AssertionError() - if (4 !in 1 until 3 != !range0.contains(4)) throw AssertionError() - if (!(4 in 1 until 3) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1 until 3) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1 until 3 != range0.contains(element32)) throw AssertionError() - if (element32 !in 1 until 3 != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1 until 3) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1 until 3) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1 until 3 != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1 until 3 != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1 until 3) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1 until 3) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1 until 3 != range0.contains(element33)) throw AssertionError() - if (element33 !in 1 until 3 != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1 until 3) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1 until 3) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1 until 3 != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1 until 3 != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1 until 3) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1 until 3) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1 until 3 != range0.contains(element34)) throw AssertionError() - if (element34 !in 1 until 3 != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1 until 3) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1 until 3) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1 until 3 != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1 until 3 != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1 until 3) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1 until 3) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1 until 3 != range0.contains(element35)) throw AssertionError() - if (element35 !in 1 until 3 != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1 until 3) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1 until 3) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3 until 1 != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3 until 1 != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3 until 1) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3 until 1) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3 until 1 != range1.contains(element0)) throw AssertionError() - if (element0 !in 3 until 1 != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3 until 1) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3 until 1) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3 until 1 != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3 until 1 != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3 until 1) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3 until 1) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3 until 1 != range1.contains(element1)) throw AssertionError() - if (element1 !in 3 until 1 != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3 until 1) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3 until 1) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3 until 1 != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3 until 1 != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3 until 1) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3 until 1) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3 until 1 != range1.contains(element2)) throw AssertionError() - if (element2 !in 3 until 1 != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3 until 1) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3 until 1) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3 until 1 != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3 until 1 != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3 until 1) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3 until 1) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3 until 1 != range1.contains(element3)) throw AssertionError() - if (element3 !in 3 until 1 != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3 until 1) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3 until 1) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3 until 1 != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3 until 1 != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3 until 1) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3 until 1) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3 until 1 != range1.contains(element4)) throw AssertionError() - if (element4 !in 3 until 1 != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3 until 1) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3 until 1) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3 until 1 != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3 until 1 != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3 until 1) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3 until 1) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3 until 1 != range1.contains(element5)) throw AssertionError() - if (element5 !in 3 until 1 != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3 until 1) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3 until 1) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3 until 1 != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3 until 1 != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3 until 1) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3 until 1) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3 until 1 != range1.contains(element6)) throw AssertionError() - if (element6 !in 3 until 1 != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3 until 1) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3 until 1) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3 until 1 != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3 until 1 != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3 until 1) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3 until 1) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3 until 1 != range1.contains(element7)) throw AssertionError() - if (element7 !in 3 until 1 != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3 until 1) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3 until 1) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3 until 1 != range1.contains(0)) throw AssertionError() - if (0 !in 3 until 1 != !range1.contains(0)) throw AssertionError() - if (!(0 in 3 until 1) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3 until 1) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3 until 1 != range1.contains(element8)) throw AssertionError() - if (element8 !in 3 until 1 != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3 until 1) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3 until 1) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3 until 1 != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3 until 1 != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3 until 1) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3 until 1) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3 until 1 != range1.contains(element9)) throw AssertionError() - if (element9 !in 3 until 1 != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3 until 1) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3 until 1) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3 until 1 != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3 until 1 != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3 until 1) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3 until 1) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3 until 1 != range1.contains(element10)) throw AssertionError() - if (element10 !in 3 until 1 != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3 until 1) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3 until 1) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3 until 1 != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3 until 1 != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3 until 1) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3 until 1) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3 until 1 != range1.contains(element11)) throw AssertionError() - if (element11 !in 3 until 1 != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3 until 1) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3 until 1) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3 until 1 != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3 until 1 != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3 until 1) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3 until 1) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3 until 1 != range1.contains(element12)) throw AssertionError() - if (element12 !in 3 until 1 != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3 until 1) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3 until 1) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3 until 1 != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3 until 1 != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3 until 1) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3 until 1) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3 until 1 != range1.contains(element13)) throw AssertionError() - if (element13 !in 3 until 1 != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3 until 1) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3 until 1) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3 until 1 != range1.contains(1)) throw AssertionError() - if (1 !in 3 until 1 != !range1.contains(1)) throw AssertionError() - if (!(1 in 3 until 1) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3 until 1) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3 until 1 != range1.contains(element14)) throw AssertionError() - if (element14 !in 3 until 1 != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3 until 1) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3 until 1) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3 until 1 != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3 until 1 != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3 until 1) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3 until 1) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3 until 1 != range1.contains(element15)) throw AssertionError() - if (element15 !in 3 until 1 != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3 until 1) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3 until 1) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3 until 1 != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3 until 1 != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3 until 1) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3 until 1) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3 until 1 != range1.contains(element16)) throw AssertionError() - if (element16 !in 3 until 1 != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3 until 1) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3 until 1) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3 until 1 != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3 until 1 != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3 until 1) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3 until 1) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3 until 1 != range1.contains(element17)) throw AssertionError() - if (element17 !in 3 until 1 != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3 until 1) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3 until 1) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3 until 1 != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3 until 1 != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3 until 1) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3 until 1) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3 until 1 != range1.contains(element18)) throw AssertionError() - if (element18 !in 3 until 1 != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3 until 1) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3 until 1) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3 until 1 != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3 until 1 != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3 until 1) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3 until 1) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3 until 1 != range1.contains(element19)) throw AssertionError() - if (element19 !in 3 until 1 != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3 until 1) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3 until 1) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3 until 1 != range1.contains(2)) throw AssertionError() - if (2 !in 3 until 1 != !range1.contains(2)) throw AssertionError() - if (!(2 in 3 until 1) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3 until 1) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3 until 1 != range1.contains(element20)) throw AssertionError() - if (element20 !in 3 until 1 != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3 until 1) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3 until 1) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3 until 1 != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3 until 1 != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3 until 1) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3 until 1) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3 until 1 != range1.contains(element21)) throw AssertionError() - if (element21 !in 3 until 1 != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3 until 1) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3 until 1) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3 until 1 != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3 until 1 != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3 until 1) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3 until 1) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3 until 1 != range1.contains(element22)) throw AssertionError() - if (element22 !in 3 until 1 != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3 until 1) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3 until 1) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3 until 1 != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3 until 1 != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3 until 1) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3 until 1) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3 until 1 != range1.contains(element23)) throw AssertionError() - if (element23 !in 3 until 1 != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3 until 1) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3 until 1) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3 until 1 != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3 until 1 != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3 until 1) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3 until 1) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3 until 1 != range1.contains(element24)) throw AssertionError() - if (element24 !in 3 until 1 != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3 until 1) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3 until 1) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3 until 1 != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3 until 1 != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3 until 1) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3 until 1) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3 until 1 != range1.contains(element25)) throw AssertionError() - if (element25 !in 3 until 1 != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3 until 1) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3 until 1) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3 until 1 != range1.contains(3)) throw AssertionError() - if (3 !in 3 until 1 != !range1.contains(3)) throw AssertionError() - if (!(3 in 3 until 1) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3 until 1) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3 until 1 != range1.contains(element26)) throw AssertionError() - if (element26 !in 3 until 1 != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3 until 1) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3 until 1) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3 until 1 != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3 until 1 != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3 until 1) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3 until 1) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3 until 1 != range1.contains(element27)) throw AssertionError() - if (element27 !in 3 until 1 != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3 until 1) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3 until 1) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3 until 1 != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3 until 1 != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3 until 1) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3 until 1) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3 until 1 != range1.contains(element28)) throw AssertionError() - if (element28 !in 3 until 1 != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3 until 1) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3 until 1) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3 until 1 != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3 until 1 != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3 until 1) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3 until 1) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3 until 1 != range1.contains(element29)) throw AssertionError() - if (element29 !in 3 until 1 != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3 until 1) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3 until 1) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3 until 1 != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3 until 1 != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3 until 1) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3 until 1) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3 until 1 != range1.contains(element30)) throw AssertionError() - if (element30 !in 3 until 1 != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3 until 1) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3 until 1) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3 until 1 != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3 until 1 != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3 until 1) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3 until 1) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3 until 1 != range1.contains(element31)) throw AssertionError() - if (element31 !in 3 until 1 != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3 until 1) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3 until 1) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3 until 1 != range1.contains(4)) throw AssertionError() - if (4 !in 3 until 1 != !range1.contains(4)) throw AssertionError() - if (!(4 in 3 until 1) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3 until 1) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3 until 1 != range1.contains(element32)) throw AssertionError() - if (element32 !in 3 until 1 != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3 until 1) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3 until 1) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3 until 1 != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3 until 1 != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3 until 1) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3 until 1) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3 until 1 != range1.contains(element33)) throw AssertionError() - if (element33 !in 3 until 1 != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3 until 1) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3 until 1) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3 until 1 != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3 until 1 != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3 until 1) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3 until 1) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3 until 1 != range1.contains(element34)) throw AssertionError() - if (element34 !in 3 until 1 != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3 until 1) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3 until 1) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3 until 1 != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3 until 1 != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3 until 1) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3 until 1) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3 until 1 != range1.contains(element35)) throw AssertionError() - if (element35 !in 3 until 1 != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3 until 1) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3 until 1) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/longDownTo.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/longDownTo.kt deleted file mode 100644 index 46a94bf7c1f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/longDownTo.kt +++ /dev/null @@ -1,43 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 3L downTo 1L -val range1 = 1L downTo 3L - -val element0 = 1L - -fun box(): String { - testR0xE0() - testR1xE0() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if (1L in 3L downTo 1L != range0.contains(1L)) throw AssertionError() - if (1L !in 3L downTo 1L != !range0.contains(1L)) throw AssertionError() - if (!(1L in 3L downTo 1L) != !range0.contains(1L)) throw AssertionError() - if (!(1L !in 3L downTo 1L) != range0.contains(1L)) throw AssertionError() - // no local optimizations - if (element0 in 3L downTo 1L != range0.contains(element0)) throw AssertionError() - if (element0 !in 3L downTo 1L != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 3L downTo 1L) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 3L downTo 1L) != range0.contains(element0)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if (1L in 1L downTo 3L != range1.contains(1L)) throw AssertionError() - if (1L !in 1L downTo 3L != !range1.contains(1L)) throw AssertionError() - if (!(1L in 1L downTo 3L) != !range1.contains(1L)) throw AssertionError() - if (!(1L !in 1L downTo 3L) != range1.contains(1L)) throw AssertionError() - // no local optimizations - if (element0 in 1L downTo 3L != range1.contains(element0)) throw AssertionError() - if (element0 !in 1L downTo 3L != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 1L downTo 3L) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 1L downTo 3L) != range1.contains(element0)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/longRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/longRangeLiteral.kt deleted file mode 100644 index 2d31e154f78..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/longRangeLiteral.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1L .. 3L -val range1 = 3L .. 1L - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1L .. 3L != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1L .. 3L != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1L .. 3L) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1L .. 3L) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1L .. 3L != range0.contains(element0)) throw AssertionError() - if (element0 !in 1L .. 3L != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1L .. 3L) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1L .. 3L) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1L .. 3L != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1L .. 3L != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1L .. 3L) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1L .. 3L) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1L .. 3L != range0.contains(element1)) throw AssertionError() - if (element1 !in 1L .. 3L != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1L .. 3L) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1L .. 3L) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1L .. 3L != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1L .. 3L != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1L .. 3L) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1L .. 3L) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1L .. 3L != range0.contains(element2)) throw AssertionError() - if (element2 !in 1L .. 3L != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1L .. 3L) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1L .. 3L) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1L .. 3L != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1L .. 3L != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1L .. 3L) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1L .. 3L) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1L .. 3L != range0.contains(element3)) throw AssertionError() - if (element3 !in 1L .. 3L != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1L .. 3L) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1L .. 3L) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1L .. 3L != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1L .. 3L != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1L .. 3L) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1L .. 3L) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1L .. 3L != range0.contains(element4)) throw AssertionError() - if (element4 !in 1L .. 3L != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1L .. 3L) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1L .. 3L) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1L .. 3L != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1L .. 3L != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1L .. 3L) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1L .. 3L) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1L .. 3L != range0.contains(element5)) throw AssertionError() - if (element5 !in 1L .. 3L != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1L .. 3L) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1L .. 3L) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1L .. 3L != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1L .. 3L != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1L .. 3L) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1L .. 3L) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1L .. 3L != range0.contains(element6)) throw AssertionError() - if (element6 !in 1L .. 3L != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1L .. 3L) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1L .. 3L) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1L .. 3L != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1L .. 3L != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1L .. 3L) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1L .. 3L) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1L .. 3L != range0.contains(element7)) throw AssertionError() - if (element7 !in 1L .. 3L != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1L .. 3L) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1L .. 3L) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1L .. 3L != range0.contains(0)) throw AssertionError() - if (0 !in 1L .. 3L != !range0.contains(0)) throw AssertionError() - if (!(0 in 1L .. 3L) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1L .. 3L) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1L .. 3L != range0.contains(element8)) throw AssertionError() - if (element8 !in 1L .. 3L != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1L .. 3L) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1L .. 3L) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1L .. 3L != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1L .. 3L != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1L .. 3L) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1L .. 3L) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1L .. 3L != range0.contains(element9)) throw AssertionError() - if (element9 !in 1L .. 3L != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1L .. 3L) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1L .. 3L) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1L .. 3L != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1L .. 3L != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1L .. 3L) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1L .. 3L) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1L .. 3L != range0.contains(element10)) throw AssertionError() - if (element10 !in 1L .. 3L != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1L .. 3L) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1L .. 3L) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1L .. 3L != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1L .. 3L != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1L .. 3L) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1L .. 3L) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1L .. 3L != range0.contains(element11)) throw AssertionError() - if (element11 !in 1L .. 3L != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1L .. 3L) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1L .. 3L) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1L .. 3L != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1L .. 3L != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1L .. 3L) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1L .. 3L) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1L .. 3L != range0.contains(element12)) throw AssertionError() - if (element12 !in 1L .. 3L != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1L .. 3L) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1L .. 3L) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1L .. 3L != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1L .. 3L != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1L .. 3L) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1L .. 3L) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1L .. 3L != range0.contains(element13)) throw AssertionError() - if (element13 !in 1L .. 3L != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1L .. 3L) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1L .. 3L) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1L .. 3L != range0.contains(1)) throw AssertionError() - if (1 !in 1L .. 3L != !range0.contains(1)) throw AssertionError() - if (!(1 in 1L .. 3L) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1L .. 3L) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1L .. 3L != range0.contains(element14)) throw AssertionError() - if (element14 !in 1L .. 3L != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1L .. 3L) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1L .. 3L) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1L .. 3L != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1L .. 3L != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1L .. 3L) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1L .. 3L) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1L .. 3L != range0.contains(element15)) throw AssertionError() - if (element15 !in 1L .. 3L != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1L .. 3L) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1L .. 3L) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1L .. 3L != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1L .. 3L != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1L .. 3L) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1L .. 3L) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1L .. 3L != range0.contains(element16)) throw AssertionError() - if (element16 !in 1L .. 3L != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1L .. 3L) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1L .. 3L) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1L .. 3L != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1L .. 3L != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1L .. 3L) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1L .. 3L) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1L .. 3L != range0.contains(element17)) throw AssertionError() - if (element17 !in 1L .. 3L != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1L .. 3L) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1L .. 3L) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1L .. 3L != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1L .. 3L != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1L .. 3L) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1L .. 3L) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1L .. 3L != range0.contains(element18)) throw AssertionError() - if (element18 !in 1L .. 3L != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1L .. 3L) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1L .. 3L) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1L .. 3L != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1L .. 3L != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1L .. 3L) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1L .. 3L) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1L .. 3L != range0.contains(element19)) throw AssertionError() - if (element19 !in 1L .. 3L != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1L .. 3L) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1L .. 3L) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1L .. 3L != range0.contains(2)) throw AssertionError() - if (2 !in 1L .. 3L != !range0.contains(2)) throw AssertionError() - if (!(2 in 1L .. 3L) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1L .. 3L) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1L .. 3L != range0.contains(element20)) throw AssertionError() - if (element20 !in 1L .. 3L != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1L .. 3L) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1L .. 3L) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1L .. 3L != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1L .. 3L != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1L .. 3L) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1L .. 3L) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1L .. 3L != range0.contains(element21)) throw AssertionError() - if (element21 !in 1L .. 3L != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1L .. 3L) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1L .. 3L) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1L .. 3L != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1L .. 3L != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1L .. 3L) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1L .. 3L) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1L .. 3L != range0.contains(element22)) throw AssertionError() - if (element22 !in 1L .. 3L != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1L .. 3L) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1L .. 3L) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1L .. 3L != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1L .. 3L != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1L .. 3L) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1L .. 3L) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1L .. 3L != range0.contains(element23)) throw AssertionError() - if (element23 !in 1L .. 3L != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1L .. 3L) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1L .. 3L) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1L .. 3L != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1L .. 3L != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1L .. 3L) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1L .. 3L) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1L .. 3L != range0.contains(element24)) throw AssertionError() - if (element24 !in 1L .. 3L != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1L .. 3L) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1L .. 3L) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1L .. 3L != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1L .. 3L != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1L .. 3L) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1L .. 3L) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1L .. 3L != range0.contains(element25)) throw AssertionError() - if (element25 !in 1L .. 3L != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1L .. 3L) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1L .. 3L) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1L .. 3L != range0.contains(3)) throw AssertionError() - if (3 !in 1L .. 3L != !range0.contains(3)) throw AssertionError() - if (!(3 in 1L .. 3L) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1L .. 3L) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1L .. 3L != range0.contains(element26)) throw AssertionError() - if (element26 !in 1L .. 3L != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1L .. 3L) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1L .. 3L) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1L .. 3L != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1L .. 3L != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1L .. 3L) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1L .. 3L) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1L .. 3L != range0.contains(element27)) throw AssertionError() - if (element27 !in 1L .. 3L != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1L .. 3L) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1L .. 3L) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1L .. 3L != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1L .. 3L != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1L .. 3L) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1L .. 3L) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1L .. 3L != range0.contains(element28)) throw AssertionError() - if (element28 !in 1L .. 3L != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1L .. 3L) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1L .. 3L) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1L .. 3L != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1L .. 3L != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1L .. 3L) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1L .. 3L) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1L .. 3L != range0.contains(element29)) throw AssertionError() - if (element29 !in 1L .. 3L != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1L .. 3L) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1L .. 3L) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1L .. 3L != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1L .. 3L != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1L .. 3L) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1L .. 3L) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1L .. 3L != range0.contains(element30)) throw AssertionError() - if (element30 !in 1L .. 3L != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1L .. 3L) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1L .. 3L) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1L .. 3L != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1L .. 3L != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1L .. 3L) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1L .. 3L) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1L .. 3L != range0.contains(element31)) throw AssertionError() - if (element31 !in 1L .. 3L != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1L .. 3L) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1L .. 3L) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1L .. 3L != range0.contains(4)) throw AssertionError() - if (4 !in 1L .. 3L != !range0.contains(4)) throw AssertionError() - if (!(4 in 1L .. 3L) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1L .. 3L) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1L .. 3L != range0.contains(element32)) throw AssertionError() - if (element32 !in 1L .. 3L != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1L .. 3L) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1L .. 3L) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1L .. 3L != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1L .. 3L != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1L .. 3L) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1L .. 3L) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1L .. 3L != range0.contains(element33)) throw AssertionError() - if (element33 !in 1L .. 3L != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1L .. 3L) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1L .. 3L) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1L .. 3L != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1L .. 3L != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1L .. 3L) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1L .. 3L) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1L .. 3L != range0.contains(element34)) throw AssertionError() - if (element34 !in 1L .. 3L != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1L .. 3L) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1L .. 3L) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1L .. 3L != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1L .. 3L != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1L .. 3L) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1L .. 3L) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1L .. 3L != range0.contains(element35)) throw AssertionError() - if (element35 !in 1L .. 3L != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1L .. 3L) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1L .. 3L) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3L .. 1L != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3L .. 1L != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3L .. 1L) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3L .. 1L) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3L .. 1L != range1.contains(element0)) throw AssertionError() - if (element0 !in 3L .. 1L != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3L .. 1L) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3L .. 1L) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3L .. 1L != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3L .. 1L != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3L .. 1L) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3L .. 1L) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3L .. 1L != range1.contains(element1)) throw AssertionError() - if (element1 !in 3L .. 1L != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3L .. 1L) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3L .. 1L) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3L .. 1L != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3L .. 1L != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3L .. 1L) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3L .. 1L) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3L .. 1L != range1.contains(element2)) throw AssertionError() - if (element2 !in 3L .. 1L != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3L .. 1L) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3L .. 1L) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3L .. 1L != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3L .. 1L != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3L .. 1L) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3L .. 1L) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3L .. 1L != range1.contains(element3)) throw AssertionError() - if (element3 !in 3L .. 1L != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3L .. 1L) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3L .. 1L) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3L .. 1L != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3L .. 1L != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3L .. 1L) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3L .. 1L) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3L .. 1L != range1.contains(element4)) throw AssertionError() - if (element4 !in 3L .. 1L != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3L .. 1L) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3L .. 1L) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3L .. 1L != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3L .. 1L != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3L .. 1L) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3L .. 1L) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3L .. 1L != range1.contains(element5)) throw AssertionError() - if (element5 !in 3L .. 1L != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3L .. 1L) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3L .. 1L) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3L .. 1L != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3L .. 1L != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3L .. 1L) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3L .. 1L) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3L .. 1L != range1.contains(element6)) throw AssertionError() - if (element6 !in 3L .. 1L != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3L .. 1L) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3L .. 1L) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3L .. 1L != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3L .. 1L != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3L .. 1L) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3L .. 1L) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3L .. 1L != range1.contains(element7)) throw AssertionError() - if (element7 !in 3L .. 1L != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3L .. 1L) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3L .. 1L) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3L .. 1L != range1.contains(0)) throw AssertionError() - if (0 !in 3L .. 1L != !range1.contains(0)) throw AssertionError() - if (!(0 in 3L .. 1L) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3L .. 1L) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3L .. 1L != range1.contains(element8)) throw AssertionError() - if (element8 !in 3L .. 1L != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3L .. 1L) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3L .. 1L) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3L .. 1L != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3L .. 1L != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3L .. 1L) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3L .. 1L) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3L .. 1L != range1.contains(element9)) throw AssertionError() - if (element9 !in 3L .. 1L != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3L .. 1L) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3L .. 1L) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3L .. 1L != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3L .. 1L != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3L .. 1L) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3L .. 1L) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3L .. 1L != range1.contains(element10)) throw AssertionError() - if (element10 !in 3L .. 1L != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3L .. 1L) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3L .. 1L) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3L .. 1L != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3L .. 1L != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3L .. 1L) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3L .. 1L) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3L .. 1L != range1.contains(element11)) throw AssertionError() - if (element11 !in 3L .. 1L != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3L .. 1L) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3L .. 1L) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3L .. 1L != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3L .. 1L != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3L .. 1L) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3L .. 1L) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3L .. 1L != range1.contains(element12)) throw AssertionError() - if (element12 !in 3L .. 1L != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3L .. 1L) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3L .. 1L) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3L .. 1L != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3L .. 1L != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3L .. 1L) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3L .. 1L) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3L .. 1L != range1.contains(element13)) throw AssertionError() - if (element13 !in 3L .. 1L != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3L .. 1L) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3L .. 1L) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3L .. 1L != range1.contains(1)) throw AssertionError() - if (1 !in 3L .. 1L != !range1.contains(1)) throw AssertionError() - if (!(1 in 3L .. 1L) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3L .. 1L) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3L .. 1L != range1.contains(element14)) throw AssertionError() - if (element14 !in 3L .. 1L != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3L .. 1L) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3L .. 1L) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3L .. 1L != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3L .. 1L != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3L .. 1L) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3L .. 1L) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3L .. 1L != range1.contains(element15)) throw AssertionError() - if (element15 !in 3L .. 1L != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3L .. 1L) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3L .. 1L) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3L .. 1L != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3L .. 1L != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3L .. 1L) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3L .. 1L) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3L .. 1L != range1.contains(element16)) throw AssertionError() - if (element16 !in 3L .. 1L != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3L .. 1L) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3L .. 1L) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3L .. 1L != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3L .. 1L != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3L .. 1L) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3L .. 1L) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3L .. 1L != range1.contains(element17)) throw AssertionError() - if (element17 !in 3L .. 1L != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3L .. 1L) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3L .. 1L) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3L .. 1L != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3L .. 1L != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3L .. 1L) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3L .. 1L) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3L .. 1L != range1.contains(element18)) throw AssertionError() - if (element18 !in 3L .. 1L != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3L .. 1L) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3L .. 1L) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3L .. 1L != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3L .. 1L != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3L .. 1L) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3L .. 1L) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3L .. 1L != range1.contains(element19)) throw AssertionError() - if (element19 !in 3L .. 1L != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3L .. 1L) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3L .. 1L) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3L .. 1L != range1.contains(2)) throw AssertionError() - if (2 !in 3L .. 1L != !range1.contains(2)) throw AssertionError() - if (!(2 in 3L .. 1L) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3L .. 1L) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3L .. 1L != range1.contains(element20)) throw AssertionError() - if (element20 !in 3L .. 1L != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3L .. 1L) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3L .. 1L) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3L .. 1L != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3L .. 1L != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3L .. 1L) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3L .. 1L) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3L .. 1L != range1.contains(element21)) throw AssertionError() - if (element21 !in 3L .. 1L != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3L .. 1L) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3L .. 1L) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3L .. 1L != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3L .. 1L != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3L .. 1L) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3L .. 1L) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3L .. 1L != range1.contains(element22)) throw AssertionError() - if (element22 !in 3L .. 1L != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3L .. 1L) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3L .. 1L) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3L .. 1L != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3L .. 1L != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3L .. 1L) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3L .. 1L) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3L .. 1L != range1.contains(element23)) throw AssertionError() - if (element23 !in 3L .. 1L != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3L .. 1L) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3L .. 1L) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3L .. 1L != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3L .. 1L != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3L .. 1L) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3L .. 1L) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3L .. 1L != range1.contains(element24)) throw AssertionError() - if (element24 !in 3L .. 1L != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3L .. 1L) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3L .. 1L) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3L .. 1L != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3L .. 1L != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3L .. 1L) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3L .. 1L) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3L .. 1L != range1.contains(element25)) throw AssertionError() - if (element25 !in 3L .. 1L != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3L .. 1L) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3L .. 1L) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3L .. 1L != range1.contains(3)) throw AssertionError() - if (3 !in 3L .. 1L != !range1.contains(3)) throw AssertionError() - if (!(3 in 3L .. 1L) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3L .. 1L) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3L .. 1L != range1.contains(element26)) throw AssertionError() - if (element26 !in 3L .. 1L != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3L .. 1L) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3L .. 1L) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3L .. 1L != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3L .. 1L != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3L .. 1L) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3L .. 1L) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3L .. 1L != range1.contains(element27)) throw AssertionError() - if (element27 !in 3L .. 1L != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3L .. 1L) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3L .. 1L) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3L .. 1L != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3L .. 1L != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3L .. 1L) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3L .. 1L) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3L .. 1L != range1.contains(element28)) throw AssertionError() - if (element28 !in 3L .. 1L != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3L .. 1L) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3L .. 1L) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3L .. 1L != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3L .. 1L != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3L .. 1L) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3L .. 1L) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3L .. 1L != range1.contains(element29)) throw AssertionError() - if (element29 !in 3L .. 1L != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3L .. 1L) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3L .. 1L) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3L .. 1L != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3L .. 1L != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3L .. 1L) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3L .. 1L) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3L .. 1L != range1.contains(element30)) throw AssertionError() - if (element30 !in 3L .. 1L != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3L .. 1L) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3L .. 1L) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3L .. 1L != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3L .. 1L != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3L .. 1L) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3L .. 1L) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3L .. 1L != range1.contains(element31)) throw AssertionError() - if (element31 !in 3L .. 1L != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3L .. 1L) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3L .. 1L) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3L .. 1L != range1.contains(4)) throw AssertionError() - if (4 !in 3L .. 1L != !range1.contains(4)) throw AssertionError() - if (!(4 in 3L .. 1L) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3L .. 1L) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3L .. 1L != range1.contains(element32)) throw AssertionError() - if (element32 !in 3L .. 1L != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3L .. 1L) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3L .. 1L) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3L .. 1L != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3L .. 1L != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3L .. 1L) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3L .. 1L) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3L .. 1L != range1.contains(element33)) throw AssertionError() - if (element33 !in 3L .. 1L != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3L .. 1L) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3L .. 1L) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3L .. 1L != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3L .. 1L != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3L .. 1L) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3L .. 1L) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3L .. 1L != range1.contains(element34)) throw AssertionError() - if (element34 !in 3L .. 1L != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3L .. 1L) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3L .. 1L) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3L .. 1L != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3L .. 1L != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3L .. 1L) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3L .. 1L) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3L .. 1L != range1.contains(element35)) throw AssertionError() - if (element35 !in 3L .. 1L != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3L .. 1L) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3L .. 1L) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/generated/longUntil.kt b/backend.native/tests/external/codegen/box/ranges/contains/generated/longUntil.kt deleted file mode 100644 index 15efde78c8f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/generated/longUntil.kt +++ /dev/null @@ -1,1058 +0,0 @@ -// Auto-generated by GenerateInRangeExpressionTestData. Do not edit! -// WITH_RUNTIME - - - -val range0 = 1L until 3L -val range1 = 3L until 1L - -val element0 = (-1).toByte() -val element1 = (-1).toShort() -val element2 = (-1) -val element3 = (-1).toLong() -val element4 = (-1).toFloat() -val element5 = (-1).toDouble() -val element6 = 0.toByte() -val element7 = 0.toShort() -val element8 = 0 -val element9 = 0.toLong() -val element10 = 0.toFloat() -val element11 = 0.toDouble() -val element12 = 1.toByte() -val element13 = 1.toShort() -val element14 = 1 -val element15 = 1.toLong() -val element16 = 1.toFloat() -val element17 = 1.toDouble() -val element18 = 2.toByte() -val element19 = 2.toShort() -val element20 = 2 -val element21 = 2.toLong() -val element22 = 2.toFloat() -val element23 = 2.toDouble() -val element24 = 3.toByte() -val element25 = 3.toShort() -val element26 = 3 -val element27 = 3.toLong() -val element28 = 3.toFloat() -val element29 = 3.toDouble() -val element30 = 4.toByte() -val element31 = 4.toShort() -val element32 = 4 -val element33 = 4.toLong() -val element34 = 4.toFloat() -val element35 = 4.toDouble() - -fun box(): String { - testR0xE0() - testR0xE1() - testR0xE2() - testR0xE3() - testR0xE4() - testR0xE5() - testR0xE6() - testR0xE7() - testR0xE8() - testR0xE9() - testR0xE10() - testR0xE11() - testR0xE12() - testR0xE13() - testR0xE14() - testR0xE15() - testR0xE16() - testR0xE17() - testR0xE18() - testR0xE19() - testR0xE20() - testR0xE21() - testR0xE22() - testR0xE23() - testR0xE24() - testR0xE25() - testR0xE26() - testR0xE27() - testR0xE28() - testR0xE29() - testR0xE30() - testR0xE31() - testR0xE32() - testR0xE33() - testR0xE34() - testR0xE35() - testR1xE0() - testR1xE1() - testR1xE2() - testR1xE3() - testR1xE4() - testR1xE5() - testR1xE6() - testR1xE7() - testR1xE8() - testR1xE9() - testR1xE10() - testR1xE11() - testR1xE12() - testR1xE13() - testR1xE14() - testR1xE15() - testR1xE16() - testR1xE17() - testR1xE18() - testR1xE19() - testR1xE20() - testR1xE21() - testR1xE22() - testR1xE23() - testR1xE24() - testR1xE25() - testR1xE26() - testR1xE27() - testR1xE28() - testR1xE29() - testR1xE30() - testR1xE31() - testR1xE32() - testR1xE33() - testR1xE34() - testR1xE35() - return "OK" -} - -fun testR0xE0() { - // with possible local optimizations - if ((-1).toByte() in 1L until 3L != range0.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 1L until 3L != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 1L until 3L) != !range0.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 1L until 3L) != range0.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 1L until 3L != range0.contains(element0)) throw AssertionError() - if (element0 !in 1L until 3L != !range0.contains(element0)) throw AssertionError() - if (!(element0 in 1L until 3L) != !range0.contains(element0)) throw AssertionError() - if (!(element0 !in 1L until 3L) != range0.contains(element0)) throw AssertionError() -} - -fun testR0xE1() { - // with possible local optimizations - if ((-1).toShort() in 1L until 3L != range0.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 1L until 3L != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 1L until 3L) != !range0.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 1L until 3L) != range0.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 1L until 3L != range0.contains(element1)) throw AssertionError() - if (element1 !in 1L until 3L != !range0.contains(element1)) throw AssertionError() - if (!(element1 in 1L until 3L) != !range0.contains(element1)) throw AssertionError() - if (!(element1 !in 1L until 3L) != range0.contains(element1)) throw AssertionError() -} - -fun testR0xE2() { - // with possible local optimizations - if ((-1) in 1L until 3L != range0.contains((-1))) throw AssertionError() - if ((-1) !in 1L until 3L != !range0.contains((-1))) throw AssertionError() - if (!((-1) in 1L until 3L) != !range0.contains((-1))) throw AssertionError() - if (!((-1) !in 1L until 3L) != range0.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 1L until 3L != range0.contains(element2)) throw AssertionError() - if (element2 !in 1L until 3L != !range0.contains(element2)) throw AssertionError() - if (!(element2 in 1L until 3L) != !range0.contains(element2)) throw AssertionError() - if (!(element2 !in 1L until 3L) != range0.contains(element2)) throw AssertionError() -} - -fun testR0xE3() { - // with possible local optimizations - if ((-1).toLong() in 1L until 3L != range0.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 1L until 3L != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 1L until 3L) != !range0.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 1L until 3L) != range0.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 1L until 3L != range0.contains(element3)) throw AssertionError() - if (element3 !in 1L until 3L != !range0.contains(element3)) throw AssertionError() - if (!(element3 in 1L until 3L) != !range0.contains(element3)) throw AssertionError() - if (!(element3 !in 1L until 3L) != range0.contains(element3)) throw AssertionError() -} - -fun testR0xE4() { - // with possible local optimizations - if ((-1).toFloat() in 1L until 3L != range0.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 1L until 3L != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 1L until 3L) != !range0.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 1L until 3L) != range0.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 1L until 3L != range0.contains(element4)) throw AssertionError() - if (element4 !in 1L until 3L != !range0.contains(element4)) throw AssertionError() - if (!(element4 in 1L until 3L) != !range0.contains(element4)) throw AssertionError() - if (!(element4 !in 1L until 3L) != range0.contains(element4)) throw AssertionError() -} - -fun testR0xE5() { - // with possible local optimizations - if ((-1).toDouble() in 1L until 3L != range0.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 1L until 3L != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 1L until 3L) != !range0.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 1L until 3L) != range0.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 1L until 3L != range0.contains(element5)) throw AssertionError() - if (element5 !in 1L until 3L != !range0.contains(element5)) throw AssertionError() - if (!(element5 in 1L until 3L) != !range0.contains(element5)) throw AssertionError() - if (!(element5 !in 1L until 3L) != range0.contains(element5)) throw AssertionError() -} - -fun testR0xE6() { - // with possible local optimizations - if (0.toByte() in 1L until 3L != range0.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 1L until 3L != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 1L until 3L) != !range0.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 1L until 3L) != range0.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 1L until 3L != range0.contains(element6)) throw AssertionError() - if (element6 !in 1L until 3L != !range0.contains(element6)) throw AssertionError() - if (!(element6 in 1L until 3L) != !range0.contains(element6)) throw AssertionError() - if (!(element6 !in 1L until 3L) != range0.contains(element6)) throw AssertionError() -} - -fun testR0xE7() { - // with possible local optimizations - if (0.toShort() in 1L until 3L != range0.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 1L until 3L != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 1L until 3L) != !range0.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 1L until 3L) != range0.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 1L until 3L != range0.contains(element7)) throw AssertionError() - if (element7 !in 1L until 3L != !range0.contains(element7)) throw AssertionError() - if (!(element7 in 1L until 3L) != !range0.contains(element7)) throw AssertionError() - if (!(element7 !in 1L until 3L) != range0.contains(element7)) throw AssertionError() -} - -fun testR0xE8() { - // with possible local optimizations - if (0 in 1L until 3L != range0.contains(0)) throw AssertionError() - if (0 !in 1L until 3L != !range0.contains(0)) throw AssertionError() - if (!(0 in 1L until 3L) != !range0.contains(0)) throw AssertionError() - if (!(0 !in 1L until 3L) != range0.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 1L until 3L != range0.contains(element8)) throw AssertionError() - if (element8 !in 1L until 3L != !range0.contains(element8)) throw AssertionError() - if (!(element8 in 1L until 3L) != !range0.contains(element8)) throw AssertionError() - if (!(element8 !in 1L until 3L) != range0.contains(element8)) throw AssertionError() -} - -fun testR0xE9() { - // with possible local optimizations - if (0.toLong() in 1L until 3L != range0.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 1L until 3L != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 1L until 3L) != !range0.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 1L until 3L) != range0.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 1L until 3L != range0.contains(element9)) throw AssertionError() - if (element9 !in 1L until 3L != !range0.contains(element9)) throw AssertionError() - if (!(element9 in 1L until 3L) != !range0.contains(element9)) throw AssertionError() - if (!(element9 !in 1L until 3L) != range0.contains(element9)) throw AssertionError() -} - -fun testR0xE10() { - // with possible local optimizations - if (0.toFloat() in 1L until 3L != range0.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 1L until 3L != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 1L until 3L) != !range0.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 1L until 3L) != range0.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 1L until 3L != range0.contains(element10)) throw AssertionError() - if (element10 !in 1L until 3L != !range0.contains(element10)) throw AssertionError() - if (!(element10 in 1L until 3L) != !range0.contains(element10)) throw AssertionError() - if (!(element10 !in 1L until 3L) != range0.contains(element10)) throw AssertionError() -} - -fun testR0xE11() { - // with possible local optimizations - if (0.toDouble() in 1L until 3L != range0.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 1L until 3L != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 1L until 3L) != !range0.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 1L until 3L) != range0.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 1L until 3L != range0.contains(element11)) throw AssertionError() - if (element11 !in 1L until 3L != !range0.contains(element11)) throw AssertionError() - if (!(element11 in 1L until 3L) != !range0.contains(element11)) throw AssertionError() - if (!(element11 !in 1L until 3L) != range0.contains(element11)) throw AssertionError() -} - -fun testR0xE12() { - // with possible local optimizations - if (1.toByte() in 1L until 3L != range0.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 1L until 3L != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 1L until 3L) != !range0.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 1L until 3L) != range0.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 1L until 3L != range0.contains(element12)) throw AssertionError() - if (element12 !in 1L until 3L != !range0.contains(element12)) throw AssertionError() - if (!(element12 in 1L until 3L) != !range0.contains(element12)) throw AssertionError() - if (!(element12 !in 1L until 3L) != range0.contains(element12)) throw AssertionError() -} - -fun testR0xE13() { - // with possible local optimizations - if (1.toShort() in 1L until 3L != range0.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 1L until 3L != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 1L until 3L) != !range0.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 1L until 3L) != range0.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 1L until 3L != range0.contains(element13)) throw AssertionError() - if (element13 !in 1L until 3L != !range0.contains(element13)) throw AssertionError() - if (!(element13 in 1L until 3L) != !range0.contains(element13)) throw AssertionError() - if (!(element13 !in 1L until 3L) != range0.contains(element13)) throw AssertionError() -} - -fun testR0xE14() { - // with possible local optimizations - if (1 in 1L until 3L != range0.contains(1)) throw AssertionError() - if (1 !in 1L until 3L != !range0.contains(1)) throw AssertionError() - if (!(1 in 1L until 3L) != !range0.contains(1)) throw AssertionError() - if (!(1 !in 1L until 3L) != range0.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 1L until 3L != range0.contains(element14)) throw AssertionError() - if (element14 !in 1L until 3L != !range0.contains(element14)) throw AssertionError() - if (!(element14 in 1L until 3L) != !range0.contains(element14)) throw AssertionError() - if (!(element14 !in 1L until 3L) != range0.contains(element14)) throw AssertionError() -} - -fun testR0xE15() { - // with possible local optimizations - if (1.toLong() in 1L until 3L != range0.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 1L until 3L != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 1L until 3L) != !range0.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 1L until 3L) != range0.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 1L until 3L != range0.contains(element15)) throw AssertionError() - if (element15 !in 1L until 3L != !range0.contains(element15)) throw AssertionError() - if (!(element15 in 1L until 3L) != !range0.contains(element15)) throw AssertionError() - if (!(element15 !in 1L until 3L) != range0.contains(element15)) throw AssertionError() -} - -fun testR0xE16() { - // with possible local optimizations - if (1.toFloat() in 1L until 3L != range0.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 1L until 3L != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 1L until 3L) != !range0.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 1L until 3L) != range0.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 1L until 3L != range0.contains(element16)) throw AssertionError() - if (element16 !in 1L until 3L != !range0.contains(element16)) throw AssertionError() - if (!(element16 in 1L until 3L) != !range0.contains(element16)) throw AssertionError() - if (!(element16 !in 1L until 3L) != range0.contains(element16)) throw AssertionError() -} - -fun testR0xE17() { - // with possible local optimizations - if (1.toDouble() in 1L until 3L != range0.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 1L until 3L != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 1L until 3L) != !range0.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 1L until 3L) != range0.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 1L until 3L != range0.contains(element17)) throw AssertionError() - if (element17 !in 1L until 3L != !range0.contains(element17)) throw AssertionError() - if (!(element17 in 1L until 3L) != !range0.contains(element17)) throw AssertionError() - if (!(element17 !in 1L until 3L) != range0.contains(element17)) throw AssertionError() -} - -fun testR0xE18() { - // with possible local optimizations - if (2.toByte() in 1L until 3L != range0.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 1L until 3L != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 1L until 3L) != !range0.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 1L until 3L) != range0.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 1L until 3L != range0.contains(element18)) throw AssertionError() - if (element18 !in 1L until 3L != !range0.contains(element18)) throw AssertionError() - if (!(element18 in 1L until 3L) != !range0.contains(element18)) throw AssertionError() - if (!(element18 !in 1L until 3L) != range0.contains(element18)) throw AssertionError() -} - -fun testR0xE19() { - // with possible local optimizations - if (2.toShort() in 1L until 3L != range0.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 1L until 3L != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 1L until 3L) != !range0.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 1L until 3L) != range0.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 1L until 3L != range0.contains(element19)) throw AssertionError() - if (element19 !in 1L until 3L != !range0.contains(element19)) throw AssertionError() - if (!(element19 in 1L until 3L) != !range0.contains(element19)) throw AssertionError() - if (!(element19 !in 1L until 3L) != range0.contains(element19)) throw AssertionError() -} - -fun testR0xE20() { - // with possible local optimizations - if (2 in 1L until 3L != range0.contains(2)) throw AssertionError() - if (2 !in 1L until 3L != !range0.contains(2)) throw AssertionError() - if (!(2 in 1L until 3L) != !range0.contains(2)) throw AssertionError() - if (!(2 !in 1L until 3L) != range0.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 1L until 3L != range0.contains(element20)) throw AssertionError() - if (element20 !in 1L until 3L != !range0.contains(element20)) throw AssertionError() - if (!(element20 in 1L until 3L) != !range0.contains(element20)) throw AssertionError() - if (!(element20 !in 1L until 3L) != range0.contains(element20)) throw AssertionError() -} - -fun testR0xE21() { - // with possible local optimizations - if (2.toLong() in 1L until 3L != range0.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 1L until 3L != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 1L until 3L) != !range0.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 1L until 3L) != range0.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 1L until 3L != range0.contains(element21)) throw AssertionError() - if (element21 !in 1L until 3L != !range0.contains(element21)) throw AssertionError() - if (!(element21 in 1L until 3L) != !range0.contains(element21)) throw AssertionError() - if (!(element21 !in 1L until 3L) != range0.contains(element21)) throw AssertionError() -} - -fun testR0xE22() { - // with possible local optimizations - if (2.toFloat() in 1L until 3L != range0.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 1L until 3L != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 1L until 3L) != !range0.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 1L until 3L) != range0.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 1L until 3L != range0.contains(element22)) throw AssertionError() - if (element22 !in 1L until 3L != !range0.contains(element22)) throw AssertionError() - if (!(element22 in 1L until 3L) != !range0.contains(element22)) throw AssertionError() - if (!(element22 !in 1L until 3L) != range0.contains(element22)) throw AssertionError() -} - -fun testR0xE23() { - // with possible local optimizations - if (2.toDouble() in 1L until 3L != range0.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 1L until 3L != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 1L until 3L) != !range0.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 1L until 3L) != range0.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 1L until 3L != range0.contains(element23)) throw AssertionError() - if (element23 !in 1L until 3L != !range0.contains(element23)) throw AssertionError() - if (!(element23 in 1L until 3L) != !range0.contains(element23)) throw AssertionError() - if (!(element23 !in 1L until 3L) != range0.contains(element23)) throw AssertionError() -} - -fun testR0xE24() { - // with possible local optimizations - if (3.toByte() in 1L until 3L != range0.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 1L until 3L != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 1L until 3L) != !range0.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 1L until 3L) != range0.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 1L until 3L != range0.contains(element24)) throw AssertionError() - if (element24 !in 1L until 3L != !range0.contains(element24)) throw AssertionError() - if (!(element24 in 1L until 3L) != !range0.contains(element24)) throw AssertionError() - if (!(element24 !in 1L until 3L) != range0.contains(element24)) throw AssertionError() -} - -fun testR0xE25() { - // with possible local optimizations - if (3.toShort() in 1L until 3L != range0.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 1L until 3L != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 1L until 3L) != !range0.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 1L until 3L) != range0.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 1L until 3L != range0.contains(element25)) throw AssertionError() - if (element25 !in 1L until 3L != !range0.contains(element25)) throw AssertionError() - if (!(element25 in 1L until 3L) != !range0.contains(element25)) throw AssertionError() - if (!(element25 !in 1L until 3L) != range0.contains(element25)) throw AssertionError() -} - -fun testR0xE26() { - // with possible local optimizations - if (3 in 1L until 3L != range0.contains(3)) throw AssertionError() - if (3 !in 1L until 3L != !range0.contains(3)) throw AssertionError() - if (!(3 in 1L until 3L) != !range0.contains(3)) throw AssertionError() - if (!(3 !in 1L until 3L) != range0.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 1L until 3L != range0.contains(element26)) throw AssertionError() - if (element26 !in 1L until 3L != !range0.contains(element26)) throw AssertionError() - if (!(element26 in 1L until 3L) != !range0.contains(element26)) throw AssertionError() - if (!(element26 !in 1L until 3L) != range0.contains(element26)) throw AssertionError() -} - -fun testR0xE27() { - // with possible local optimizations - if (3.toLong() in 1L until 3L != range0.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 1L until 3L != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 1L until 3L) != !range0.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 1L until 3L) != range0.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 1L until 3L != range0.contains(element27)) throw AssertionError() - if (element27 !in 1L until 3L != !range0.contains(element27)) throw AssertionError() - if (!(element27 in 1L until 3L) != !range0.contains(element27)) throw AssertionError() - if (!(element27 !in 1L until 3L) != range0.contains(element27)) throw AssertionError() -} - -fun testR0xE28() { - // with possible local optimizations - if (3.toFloat() in 1L until 3L != range0.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 1L until 3L != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 1L until 3L) != !range0.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 1L until 3L) != range0.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 1L until 3L != range0.contains(element28)) throw AssertionError() - if (element28 !in 1L until 3L != !range0.contains(element28)) throw AssertionError() - if (!(element28 in 1L until 3L) != !range0.contains(element28)) throw AssertionError() - if (!(element28 !in 1L until 3L) != range0.contains(element28)) throw AssertionError() -} - -fun testR0xE29() { - // with possible local optimizations - if (3.toDouble() in 1L until 3L != range0.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 1L until 3L != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 1L until 3L) != !range0.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 1L until 3L) != range0.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 1L until 3L != range0.contains(element29)) throw AssertionError() - if (element29 !in 1L until 3L != !range0.contains(element29)) throw AssertionError() - if (!(element29 in 1L until 3L) != !range0.contains(element29)) throw AssertionError() - if (!(element29 !in 1L until 3L) != range0.contains(element29)) throw AssertionError() -} - -fun testR0xE30() { - // with possible local optimizations - if (4.toByte() in 1L until 3L != range0.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 1L until 3L != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 1L until 3L) != !range0.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 1L until 3L) != range0.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 1L until 3L != range0.contains(element30)) throw AssertionError() - if (element30 !in 1L until 3L != !range0.contains(element30)) throw AssertionError() - if (!(element30 in 1L until 3L) != !range0.contains(element30)) throw AssertionError() - if (!(element30 !in 1L until 3L) != range0.contains(element30)) throw AssertionError() -} - -fun testR0xE31() { - // with possible local optimizations - if (4.toShort() in 1L until 3L != range0.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 1L until 3L != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 1L until 3L) != !range0.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 1L until 3L) != range0.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 1L until 3L != range0.contains(element31)) throw AssertionError() - if (element31 !in 1L until 3L != !range0.contains(element31)) throw AssertionError() - if (!(element31 in 1L until 3L) != !range0.contains(element31)) throw AssertionError() - if (!(element31 !in 1L until 3L) != range0.contains(element31)) throw AssertionError() -} - -fun testR0xE32() { - // with possible local optimizations - if (4 in 1L until 3L != range0.contains(4)) throw AssertionError() - if (4 !in 1L until 3L != !range0.contains(4)) throw AssertionError() - if (!(4 in 1L until 3L) != !range0.contains(4)) throw AssertionError() - if (!(4 !in 1L until 3L) != range0.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 1L until 3L != range0.contains(element32)) throw AssertionError() - if (element32 !in 1L until 3L != !range0.contains(element32)) throw AssertionError() - if (!(element32 in 1L until 3L) != !range0.contains(element32)) throw AssertionError() - if (!(element32 !in 1L until 3L) != range0.contains(element32)) throw AssertionError() -} - -fun testR0xE33() { - // with possible local optimizations - if (4.toLong() in 1L until 3L != range0.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 1L until 3L != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 1L until 3L) != !range0.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 1L until 3L) != range0.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 1L until 3L != range0.contains(element33)) throw AssertionError() - if (element33 !in 1L until 3L != !range0.contains(element33)) throw AssertionError() - if (!(element33 in 1L until 3L) != !range0.contains(element33)) throw AssertionError() - if (!(element33 !in 1L until 3L) != range0.contains(element33)) throw AssertionError() -} - -fun testR0xE34() { - // with possible local optimizations - if (4.toFloat() in 1L until 3L != range0.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 1L until 3L != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 1L until 3L) != !range0.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 1L until 3L) != range0.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 1L until 3L != range0.contains(element34)) throw AssertionError() - if (element34 !in 1L until 3L != !range0.contains(element34)) throw AssertionError() - if (!(element34 in 1L until 3L) != !range0.contains(element34)) throw AssertionError() - if (!(element34 !in 1L until 3L) != range0.contains(element34)) throw AssertionError() -} - -fun testR0xE35() { - // with possible local optimizations - if (4.toDouble() in 1L until 3L != range0.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 1L until 3L != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 1L until 3L) != !range0.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 1L until 3L) != range0.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 1L until 3L != range0.contains(element35)) throw AssertionError() - if (element35 !in 1L until 3L != !range0.contains(element35)) throw AssertionError() - if (!(element35 in 1L until 3L) != !range0.contains(element35)) throw AssertionError() - if (!(element35 !in 1L until 3L) != range0.contains(element35)) throw AssertionError() -} - -fun testR1xE0() { - // with possible local optimizations - if ((-1).toByte() in 3L until 1L != range1.contains((-1).toByte())) throw AssertionError() - if ((-1).toByte() !in 3L until 1L != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() in 3L until 1L) != !range1.contains((-1).toByte())) throw AssertionError() - if (!((-1).toByte() !in 3L until 1L) != range1.contains((-1).toByte())) throw AssertionError() - // no local optimizations - if (element0 in 3L until 1L != range1.contains(element0)) throw AssertionError() - if (element0 !in 3L until 1L != !range1.contains(element0)) throw AssertionError() - if (!(element0 in 3L until 1L) != !range1.contains(element0)) throw AssertionError() - if (!(element0 !in 3L until 1L) != range1.contains(element0)) throw AssertionError() -} - -fun testR1xE1() { - // with possible local optimizations - if ((-1).toShort() in 3L until 1L != range1.contains((-1).toShort())) throw AssertionError() - if ((-1).toShort() !in 3L until 1L != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() in 3L until 1L) != !range1.contains((-1).toShort())) throw AssertionError() - if (!((-1).toShort() !in 3L until 1L) != range1.contains((-1).toShort())) throw AssertionError() - // no local optimizations - if (element1 in 3L until 1L != range1.contains(element1)) throw AssertionError() - if (element1 !in 3L until 1L != !range1.contains(element1)) throw AssertionError() - if (!(element1 in 3L until 1L) != !range1.contains(element1)) throw AssertionError() - if (!(element1 !in 3L until 1L) != range1.contains(element1)) throw AssertionError() -} - -fun testR1xE2() { - // with possible local optimizations - if ((-1) in 3L until 1L != range1.contains((-1))) throw AssertionError() - if ((-1) !in 3L until 1L != !range1.contains((-1))) throw AssertionError() - if (!((-1) in 3L until 1L) != !range1.contains((-1))) throw AssertionError() - if (!((-1) !in 3L until 1L) != range1.contains((-1))) throw AssertionError() - // no local optimizations - if (element2 in 3L until 1L != range1.contains(element2)) throw AssertionError() - if (element2 !in 3L until 1L != !range1.contains(element2)) throw AssertionError() - if (!(element2 in 3L until 1L) != !range1.contains(element2)) throw AssertionError() - if (!(element2 !in 3L until 1L) != range1.contains(element2)) throw AssertionError() -} - -fun testR1xE3() { - // with possible local optimizations - if ((-1).toLong() in 3L until 1L != range1.contains((-1).toLong())) throw AssertionError() - if ((-1).toLong() !in 3L until 1L != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() in 3L until 1L) != !range1.contains((-1).toLong())) throw AssertionError() - if (!((-1).toLong() !in 3L until 1L) != range1.contains((-1).toLong())) throw AssertionError() - // no local optimizations - if (element3 in 3L until 1L != range1.contains(element3)) throw AssertionError() - if (element3 !in 3L until 1L != !range1.contains(element3)) throw AssertionError() - if (!(element3 in 3L until 1L) != !range1.contains(element3)) throw AssertionError() - if (!(element3 !in 3L until 1L) != range1.contains(element3)) throw AssertionError() -} - -fun testR1xE4() { - // with possible local optimizations - if ((-1).toFloat() in 3L until 1L != range1.contains((-1).toFloat())) throw AssertionError() - if ((-1).toFloat() !in 3L until 1L != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() in 3L until 1L) != !range1.contains((-1).toFloat())) throw AssertionError() - if (!((-1).toFloat() !in 3L until 1L) != range1.contains((-1).toFloat())) throw AssertionError() - // no local optimizations - if (element4 in 3L until 1L != range1.contains(element4)) throw AssertionError() - if (element4 !in 3L until 1L != !range1.contains(element4)) throw AssertionError() - if (!(element4 in 3L until 1L) != !range1.contains(element4)) throw AssertionError() - if (!(element4 !in 3L until 1L) != range1.contains(element4)) throw AssertionError() -} - -fun testR1xE5() { - // with possible local optimizations - if ((-1).toDouble() in 3L until 1L != range1.contains((-1).toDouble())) throw AssertionError() - if ((-1).toDouble() !in 3L until 1L != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() in 3L until 1L) != !range1.contains((-1).toDouble())) throw AssertionError() - if (!((-1).toDouble() !in 3L until 1L) != range1.contains((-1).toDouble())) throw AssertionError() - // no local optimizations - if (element5 in 3L until 1L != range1.contains(element5)) throw AssertionError() - if (element5 !in 3L until 1L != !range1.contains(element5)) throw AssertionError() - if (!(element5 in 3L until 1L) != !range1.contains(element5)) throw AssertionError() - if (!(element5 !in 3L until 1L) != range1.contains(element5)) throw AssertionError() -} - -fun testR1xE6() { - // with possible local optimizations - if (0.toByte() in 3L until 1L != range1.contains(0.toByte())) throw AssertionError() - if (0.toByte() !in 3L until 1L != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() in 3L until 1L) != !range1.contains(0.toByte())) throw AssertionError() - if (!(0.toByte() !in 3L until 1L) != range1.contains(0.toByte())) throw AssertionError() - // no local optimizations - if (element6 in 3L until 1L != range1.contains(element6)) throw AssertionError() - if (element6 !in 3L until 1L != !range1.contains(element6)) throw AssertionError() - if (!(element6 in 3L until 1L) != !range1.contains(element6)) throw AssertionError() - if (!(element6 !in 3L until 1L) != range1.contains(element6)) throw AssertionError() -} - -fun testR1xE7() { - // with possible local optimizations - if (0.toShort() in 3L until 1L != range1.contains(0.toShort())) throw AssertionError() - if (0.toShort() !in 3L until 1L != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() in 3L until 1L) != !range1.contains(0.toShort())) throw AssertionError() - if (!(0.toShort() !in 3L until 1L) != range1.contains(0.toShort())) throw AssertionError() - // no local optimizations - if (element7 in 3L until 1L != range1.contains(element7)) throw AssertionError() - if (element7 !in 3L until 1L != !range1.contains(element7)) throw AssertionError() - if (!(element7 in 3L until 1L) != !range1.contains(element7)) throw AssertionError() - if (!(element7 !in 3L until 1L) != range1.contains(element7)) throw AssertionError() -} - -fun testR1xE8() { - // with possible local optimizations - if (0 in 3L until 1L != range1.contains(0)) throw AssertionError() - if (0 !in 3L until 1L != !range1.contains(0)) throw AssertionError() - if (!(0 in 3L until 1L) != !range1.contains(0)) throw AssertionError() - if (!(0 !in 3L until 1L) != range1.contains(0)) throw AssertionError() - // no local optimizations - if (element8 in 3L until 1L != range1.contains(element8)) throw AssertionError() - if (element8 !in 3L until 1L != !range1.contains(element8)) throw AssertionError() - if (!(element8 in 3L until 1L) != !range1.contains(element8)) throw AssertionError() - if (!(element8 !in 3L until 1L) != range1.contains(element8)) throw AssertionError() -} - -fun testR1xE9() { - // with possible local optimizations - if (0.toLong() in 3L until 1L != range1.contains(0.toLong())) throw AssertionError() - if (0.toLong() !in 3L until 1L != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() in 3L until 1L) != !range1.contains(0.toLong())) throw AssertionError() - if (!(0.toLong() !in 3L until 1L) != range1.contains(0.toLong())) throw AssertionError() - // no local optimizations - if (element9 in 3L until 1L != range1.contains(element9)) throw AssertionError() - if (element9 !in 3L until 1L != !range1.contains(element9)) throw AssertionError() - if (!(element9 in 3L until 1L) != !range1.contains(element9)) throw AssertionError() - if (!(element9 !in 3L until 1L) != range1.contains(element9)) throw AssertionError() -} - -fun testR1xE10() { - // with possible local optimizations - if (0.toFloat() in 3L until 1L != range1.contains(0.toFloat())) throw AssertionError() - if (0.toFloat() !in 3L until 1L != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() in 3L until 1L) != !range1.contains(0.toFloat())) throw AssertionError() - if (!(0.toFloat() !in 3L until 1L) != range1.contains(0.toFloat())) throw AssertionError() - // no local optimizations - if (element10 in 3L until 1L != range1.contains(element10)) throw AssertionError() - if (element10 !in 3L until 1L != !range1.contains(element10)) throw AssertionError() - if (!(element10 in 3L until 1L) != !range1.contains(element10)) throw AssertionError() - if (!(element10 !in 3L until 1L) != range1.contains(element10)) throw AssertionError() -} - -fun testR1xE11() { - // with possible local optimizations - if (0.toDouble() in 3L until 1L != range1.contains(0.toDouble())) throw AssertionError() - if (0.toDouble() !in 3L until 1L != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() in 3L until 1L) != !range1.contains(0.toDouble())) throw AssertionError() - if (!(0.toDouble() !in 3L until 1L) != range1.contains(0.toDouble())) throw AssertionError() - // no local optimizations - if (element11 in 3L until 1L != range1.contains(element11)) throw AssertionError() - if (element11 !in 3L until 1L != !range1.contains(element11)) throw AssertionError() - if (!(element11 in 3L until 1L) != !range1.contains(element11)) throw AssertionError() - if (!(element11 !in 3L until 1L) != range1.contains(element11)) throw AssertionError() -} - -fun testR1xE12() { - // with possible local optimizations - if (1.toByte() in 3L until 1L != range1.contains(1.toByte())) throw AssertionError() - if (1.toByte() !in 3L until 1L != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() in 3L until 1L) != !range1.contains(1.toByte())) throw AssertionError() - if (!(1.toByte() !in 3L until 1L) != range1.contains(1.toByte())) throw AssertionError() - // no local optimizations - if (element12 in 3L until 1L != range1.contains(element12)) throw AssertionError() - if (element12 !in 3L until 1L != !range1.contains(element12)) throw AssertionError() - if (!(element12 in 3L until 1L) != !range1.contains(element12)) throw AssertionError() - if (!(element12 !in 3L until 1L) != range1.contains(element12)) throw AssertionError() -} - -fun testR1xE13() { - // with possible local optimizations - if (1.toShort() in 3L until 1L != range1.contains(1.toShort())) throw AssertionError() - if (1.toShort() !in 3L until 1L != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() in 3L until 1L) != !range1.contains(1.toShort())) throw AssertionError() - if (!(1.toShort() !in 3L until 1L) != range1.contains(1.toShort())) throw AssertionError() - // no local optimizations - if (element13 in 3L until 1L != range1.contains(element13)) throw AssertionError() - if (element13 !in 3L until 1L != !range1.contains(element13)) throw AssertionError() - if (!(element13 in 3L until 1L) != !range1.contains(element13)) throw AssertionError() - if (!(element13 !in 3L until 1L) != range1.contains(element13)) throw AssertionError() -} - -fun testR1xE14() { - // with possible local optimizations - if (1 in 3L until 1L != range1.contains(1)) throw AssertionError() - if (1 !in 3L until 1L != !range1.contains(1)) throw AssertionError() - if (!(1 in 3L until 1L) != !range1.contains(1)) throw AssertionError() - if (!(1 !in 3L until 1L) != range1.contains(1)) throw AssertionError() - // no local optimizations - if (element14 in 3L until 1L != range1.contains(element14)) throw AssertionError() - if (element14 !in 3L until 1L != !range1.contains(element14)) throw AssertionError() - if (!(element14 in 3L until 1L) != !range1.contains(element14)) throw AssertionError() - if (!(element14 !in 3L until 1L) != range1.contains(element14)) throw AssertionError() -} - -fun testR1xE15() { - // with possible local optimizations - if (1.toLong() in 3L until 1L != range1.contains(1.toLong())) throw AssertionError() - if (1.toLong() !in 3L until 1L != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() in 3L until 1L) != !range1.contains(1.toLong())) throw AssertionError() - if (!(1.toLong() !in 3L until 1L) != range1.contains(1.toLong())) throw AssertionError() - // no local optimizations - if (element15 in 3L until 1L != range1.contains(element15)) throw AssertionError() - if (element15 !in 3L until 1L != !range1.contains(element15)) throw AssertionError() - if (!(element15 in 3L until 1L) != !range1.contains(element15)) throw AssertionError() - if (!(element15 !in 3L until 1L) != range1.contains(element15)) throw AssertionError() -} - -fun testR1xE16() { - // with possible local optimizations - if (1.toFloat() in 3L until 1L != range1.contains(1.toFloat())) throw AssertionError() - if (1.toFloat() !in 3L until 1L != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() in 3L until 1L) != !range1.contains(1.toFloat())) throw AssertionError() - if (!(1.toFloat() !in 3L until 1L) != range1.contains(1.toFloat())) throw AssertionError() - // no local optimizations - if (element16 in 3L until 1L != range1.contains(element16)) throw AssertionError() - if (element16 !in 3L until 1L != !range1.contains(element16)) throw AssertionError() - if (!(element16 in 3L until 1L) != !range1.contains(element16)) throw AssertionError() - if (!(element16 !in 3L until 1L) != range1.contains(element16)) throw AssertionError() -} - -fun testR1xE17() { - // with possible local optimizations - if (1.toDouble() in 3L until 1L != range1.contains(1.toDouble())) throw AssertionError() - if (1.toDouble() !in 3L until 1L != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() in 3L until 1L) != !range1.contains(1.toDouble())) throw AssertionError() - if (!(1.toDouble() !in 3L until 1L) != range1.contains(1.toDouble())) throw AssertionError() - // no local optimizations - if (element17 in 3L until 1L != range1.contains(element17)) throw AssertionError() - if (element17 !in 3L until 1L != !range1.contains(element17)) throw AssertionError() - if (!(element17 in 3L until 1L) != !range1.contains(element17)) throw AssertionError() - if (!(element17 !in 3L until 1L) != range1.contains(element17)) throw AssertionError() -} - -fun testR1xE18() { - // with possible local optimizations - if (2.toByte() in 3L until 1L != range1.contains(2.toByte())) throw AssertionError() - if (2.toByte() !in 3L until 1L != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() in 3L until 1L) != !range1.contains(2.toByte())) throw AssertionError() - if (!(2.toByte() !in 3L until 1L) != range1.contains(2.toByte())) throw AssertionError() - // no local optimizations - if (element18 in 3L until 1L != range1.contains(element18)) throw AssertionError() - if (element18 !in 3L until 1L != !range1.contains(element18)) throw AssertionError() - if (!(element18 in 3L until 1L) != !range1.contains(element18)) throw AssertionError() - if (!(element18 !in 3L until 1L) != range1.contains(element18)) throw AssertionError() -} - -fun testR1xE19() { - // with possible local optimizations - if (2.toShort() in 3L until 1L != range1.contains(2.toShort())) throw AssertionError() - if (2.toShort() !in 3L until 1L != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() in 3L until 1L) != !range1.contains(2.toShort())) throw AssertionError() - if (!(2.toShort() !in 3L until 1L) != range1.contains(2.toShort())) throw AssertionError() - // no local optimizations - if (element19 in 3L until 1L != range1.contains(element19)) throw AssertionError() - if (element19 !in 3L until 1L != !range1.contains(element19)) throw AssertionError() - if (!(element19 in 3L until 1L) != !range1.contains(element19)) throw AssertionError() - if (!(element19 !in 3L until 1L) != range1.contains(element19)) throw AssertionError() -} - -fun testR1xE20() { - // with possible local optimizations - if (2 in 3L until 1L != range1.contains(2)) throw AssertionError() - if (2 !in 3L until 1L != !range1.contains(2)) throw AssertionError() - if (!(2 in 3L until 1L) != !range1.contains(2)) throw AssertionError() - if (!(2 !in 3L until 1L) != range1.contains(2)) throw AssertionError() - // no local optimizations - if (element20 in 3L until 1L != range1.contains(element20)) throw AssertionError() - if (element20 !in 3L until 1L != !range1.contains(element20)) throw AssertionError() - if (!(element20 in 3L until 1L) != !range1.contains(element20)) throw AssertionError() - if (!(element20 !in 3L until 1L) != range1.contains(element20)) throw AssertionError() -} - -fun testR1xE21() { - // with possible local optimizations - if (2.toLong() in 3L until 1L != range1.contains(2.toLong())) throw AssertionError() - if (2.toLong() !in 3L until 1L != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() in 3L until 1L) != !range1.contains(2.toLong())) throw AssertionError() - if (!(2.toLong() !in 3L until 1L) != range1.contains(2.toLong())) throw AssertionError() - // no local optimizations - if (element21 in 3L until 1L != range1.contains(element21)) throw AssertionError() - if (element21 !in 3L until 1L != !range1.contains(element21)) throw AssertionError() - if (!(element21 in 3L until 1L) != !range1.contains(element21)) throw AssertionError() - if (!(element21 !in 3L until 1L) != range1.contains(element21)) throw AssertionError() -} - -fun testR1xE22() { - // with possible local optimizations - if (2.toFloat() in 3L until 1L != range1.contains(2.toFloat())) throw AssertionError() - if (2.toFloat() !in 3L until 1L != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() in 3L until 1L) != !range1.contains(2.toFloat())) throw AssertionError() - if (!(2.toFloat() !in 3L until 1L) != range1.contains(2.toFloat())) throw AssertionError() - // no local optimizations - if (element22 in 3L until 1L != range1.contains(element22)) throw AssertionError() - if (element22 !in 3L until 1L != !range1.contains(element22)) throw AssertionError() - if (!(element22 in 3L until 1L) != !range1.contains(element22)) throw AssertionError() - if (!(element22 !in 3L until 1L) != range1.contains(element22)) throw AssertionError() -} - -fun testR1xE23() { - // with possible local optimizations - if (2.toDouble() in 3L until 1L != range1.contains(2.toDouble())) throw AssertionError() - if (2.toDouble() !in 3L until 1L != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() in 3L until 1L) != !range1.contains(2.toDouble())) throw AssertionError() - if (!(2.toDouble() !in 3L until 1L) != range1.contains(2.toDouble())) throw AssertionError() - // no local optimizations - if (element23 in 3L until 1L != range1.contains(element23)) throw AssertionError() - if (element23 !in 3L until 1L != !range1.contains(element23)) throw AssertionError() - if (!(element23 in 3L until 1L) != !range1.contains(element23)) throw AssertionError() - if (!(element23 !in 3L until 1L) != range1.contains(element23)) throw AssertionError() -} - -fun testR1xE24() { - // with possible local optimizations - if (3.toByte() in 3L until 1L != range1.contains(3.toByte())) throw AssertionError() - if (3.toByte() !in 3L until 1L != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() in 3L until 1L) != !range1.contains(3.toByte())) throw AssertionError() - if (!(3.toByte() !in 3L until 1L) != range1.contains(3.toByte())) throw AssertionError() - // no local optimizations - if (element24 in 3L until 1L != range1.contains(element24)) throw AssertionError() - if (element24 !in 3L until 1L != !range1.contains(element24)) throw AssertionError() - if (!(element24 in 3L until 1L) != !range1.contains(element24)) throw AssertionError() - if (!(element24 !in 3L until 1L) != range1.contains(element24)) throw AssertionError() -} - -fun testR1xE25() { - // with possible local optimizations - if (3.toShort() in 3L until 1L != range1.contains(3.toShort())) throw AssertionError() - if (3.toShort() !in 3L until 1L != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() in 3L until 1L) != !range1.contains(3.toShort())) throw AssertionError() - if (!(3.toShort() !in 3L until 1L) != range1.contains(3.toShort())) throw AssertionError() - // no local optimizations - if (element25 in 3L until 1L != range1.contains(element25)) throw AssertionError() - if (element25 !in 3L until 1L != !range1.contains(element25)) throw AssertionError() - if (!(element25 in 3L until 1L) != !range1.contains(element25)) throw AssertionError() - if (!(element25 !in 3L until 1L) != range1.contains(element25)) throw AssertionError() -} - -fun testR1xE26() { - // with possible local optimizations - if (3 in 3L until 1L != range1.contains(3)) throw AssertionError() - if (3 !in 3L until 1L != !range1.contains(3)) throw AssertionError() - if (!(3 in 3L until 1L) != !range1.contains(3)) throw AssertionError() - if (!(3 !in 3L until 1L) != range1.contains(3)) throw AssertionError() - // no local optimizations - if (element26 in 3L until 1L != range1.contains(element26)) throw AssertionError() - if (element26 !in 3L until 1L != !range1.contains(element26)) throw AssertionError() - if (!(element26 in 3L until 1L) != !range1.contains(element26)) throw AssertionError() - if (!(element26 !in 3L until 1L) != range1.contains(element26)) throw AssertionError() -} - -fun testR1xE27() { - // with possible local optimizations - if (3.toLong() in 3L until 1L != range1.contains(3.toLong())) throw AssertionError() - if (3.toLong() !in 3L until 1L != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() in 3L until 1L) != !range1.contains(3.toLong())) throw AssertionError() - if (!(3.toLong() !in 3L until 1L) != range1.contains(3.toLong())) throw AssertionError() - // no local optimizations - if (element27 in 3L until 1L != range1.contains(element27)) throw AssertionError() - if (element27 !in 3L until 1L != !range1.contains(element27)) throw AssertionError() - if (!(element27 in 3L until 1L) != !range1.contains(element27)) throw AssertionError() - if (!(element27 !in 3L until 1L) != range1.contains(element27)) throw AssertionError() -} - -fun testR1xE28() { - // with possible local optimizations - if (3.toFloat() in 3L until 1L != range1.contains(3.toFloat())) throw AssertionError() - if (3.toFloat() !in 3L until 1L != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() in 3L until 1L) != !range1.contains(3.toFloat())) throw AssertionError() - if (!(3.toFloat() !in 3L until 1L) != range1.contains(3.toFloat())) throw AssertionError() - // no local optimizations - if (element28 in 3L until 1L != range1.contains(element28)) throw AssertionError() - if (element28 !in 3L until 1L != !range1.contains(element28)) throw AssertionError() - if (!(element28 in 3L until 1L) != !range1.contains(element28)) throw AssertionError() - if (!(element28 !in 3L until 1L) != range1.contains(element28)) throw AssertionError() -} - -fun testR1xE29() { - // with possible local optimizations - if (3.toDouble() in 3L until 1L != range1.contains(3.toDouble())) throw AssertionError() - if (3.toDouble() !in 3L until 1L != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() in 3L until 1L) != !range1.contains(3.toDouble())) throw AssertionError() - if (!(3.toDouble() !in 3L until 1L) != range1.contains(3.toDouble())) throw AssertionError() - // no local optimizations - if (element29 in 3L until 1L != range1.contains(element29)) throw AssertionError() - if (element29 !in 3L until 1L != !range1.contains(element29)) throw AssertionError() - if (!(element29 in 3L until 1L) != !range1.contains(element29)) throw AssertionError() - if (!(element29 !in 3L until 1L) != range1.contains(element29)) throw AssertionError() -} - -fun testR1xE30() { - // with possible local optimizations - if (4.toByte() in 3L until 1L != range1.contains(4.toByte())) throw AssertionError() - if (4.toByte() !in 3L until 1L != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() in 3L until 1L) != !range1.contains(4.toByte())) throw AssertionError() - if (!(4.toByte() !in 3L until 1L) != range1.contains(4.toByte())) throw AssertionError() - // no local optimizations - if (element30 in 3L until 1L != range1.contains(element30)) throw AssertionError() - if (element30 !in 3L until 1L != !range1.contains(element30)) throw AssertionError() - if (!(element30 in 3L until 1L) != !range1.contains(element30)) throw AssertionError() - if (!(element30 !in 3L until 1L) != range1.contains(element30)) throw AssertionError() -} - -fun testR1xE31() { - // with possible local optimizations - if (4.toShort() in 3L until 1L != range1.contains(4.toShort())) throw AssertionError() - if (4.toShort() !in 3L until 1L != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() in 3L until 1L) != !range1.contains(4.toShort())) throw AssertionError() - if (!(4.toShort() !in 3L until 1L) != range1.contains(4.toShort())) throw AssertionError() - // no local optimizations - if (element31 in 3L until 1L != range1.contains(element31)) throw AssertionError() - if (element31 !in 3L until 1L != !range1.contains(element31)) throw AssertionError() - if (!(element31 in 3L until 1L) != !range1.contains(element31)) throw AssertionError() - if (!(element31 !in 3L until 1L) != range1.contains(element31)) throw AssertionError() -} - -fun testR1xE32() { - // with possible local optimizations - if (4 in 3L until 1L != range1.contains(4)) throw AssertionError() - if (4 !in 3L until 1L != !range1.contains(4)) throw AssertionError() - if (!(4 in 3L until 1L) != !range1.contains(4)) throw AssertionError() - if (!(4 !in 3L until 1L) != range1.contains(4)) throw AssertionError() - // no local optimizations - if (element32 in 3L until 1L != range1.contains(element32)) throw AssertionError() - if (element32 !in 3L until 1L != !range1.contains(element32)) throw AssertionError() - if (!(element32 in 3L until 1L) != !range1.contains(element32)) throw AssertionError() - if (!(element32 !in 3L until 1L) != range1.contains(element32)) throw AssertionError() -} - -fun testR1xE33() { - // with possible local optimizations - if (4.toLong() in 3L until 1L != range1.contains(4.toLong())) throw AssertionError() - if (4.toLong() !in 3L until 1L != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() in 3L until 1L) != !range1.contains(4.toLong())) throw AssertionError() - if (!(4.toLong() !in 3L until 1L) != range1.contains(4.toLong())) throw AssertionError() - // no local optimizations - if (element33 in 3L until 1L != range1.contains(element33)) throw AssertionError() - if (element33 !in 3L until 1L != !range1.contains(element33)) throw AssertionError() - if (!(element33 in 3L until 1L) != !range1.contains(element33)) throw AssertionError() - if (!(element33 !in 3L until 1L) != range1.contains(element33)) throw AssertionError() -} - -fun testR1xE34() { - // with possible local optimizations - if (4.toFloat() in 3L until 1L != range1.contains(4.toFloat())) throw AssertionError() - if (4.toFloat() !in 3L until 1L != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() in 3L until 1L) != !range1.contains(4.toFloat())) throw AssertionError() - if (!(4.toFloat() !in 3L until 1L) != range1.contains(4.toFloat())) throw AssertionError() - // no local optimizations - if (element34 in 3L until 1L != range1.contains(element34)) throw AssertionError() - if (element34 !in 3L until 1L != !range1.contains(element34)) throw AssertionError() - if (!(element34 in 3L until 1L) != !range1.contains(element34)) throw AssertionError() - if (!(element34 !in 3L until 1L) != range1.contains(element34)) throw AssertionError() -} - -fun testR1xE35() { - // with possible local optimizations - if (4.toDouble() in 3L until 1L != range1.contains(4.toDouble())) throw AssertionError() - if (4.toDouble() !in 3L until 1L != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() in 3L until 1L) != !range1.contains(4.toDouble())) throw AssertionError() - if (!(4.toDouble() !in 3L until 1L) != range1.contains(4.toDouble())) throw AssertionError() - // no local optimizations - if (element35 in 3L until 1L != range1.contains(element35)) throw AssertionError() - if (element35 !in 3L until 1L != !range1.contains(element35)) throw AssertionError() - if (!(element35 in 3L until 1L) != !range1.contains(element35)) throw AssertionError() - if (!(element35 !in 3L until 1L) != range1.contains(element35)) throw AssertionError() -} - - diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inArray.kt b/backend.native/tests/external/codegen/box/ranges/contains/inArray.kt deleted file mode 100644 index 496d9095a00..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inArray.kt +++ /dev/null @@ -1,7 +0,0 @@ -// WITH_RUNTIME - -fun box(): String = when { - 0 in intArrayOf(1, 2, 3) -> "fail 1" - 1 !in intArrayOf(1, 2, 3) -> "fail 2" - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inCharSequence.kt b/backend.native/tests/external/codegen/box/ranges/contains/inCharSequence.kt deleted file mode 100644 index 56b17a69f6f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inCharSequence.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -val charSeq: String = "123" - -fun box(): String = when { - '0' in charSeq -> "fail 1" - '1' !in charSeq -> "fail 2" - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inComparableRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inComparableRange.kt deleted file mode 100644 index 71b784e107f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inComparableRange.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -class ComparablePair>(val first: T, val second: T) : Comparable> { - override fun compareTo(other: ComparablePair): Int { - val result = first.compareTo(other.first) - return if (result != 0) result else second.compareTo(other.second) - } -} - -fun > genericRangeTo(start: T, endInclusive: T) = start..endInclusive -operator fun Double.rangeTo(other: Double) = genericRangeTo(this, other) -// some weird inverted range -operator fun Float.rangeTo(other: Float) = object : ClosedFloatingPointRange { - override val endInclusive: Float = this@rangeTo - override val start: Float = other - override fun lessThanOrEquals(a: Float, b: Float) = a >= b -} - -fun check(x: Double, left: Double, right: Double): Boolean { - val result = x in left..right - val range = left..right - assert(result == x in range) { "Failed: unoptimized === unoptimized for custom double $range" } - return result -} - -fun check(x: Float, left: Float, right: Float): Boolean { - val result = x in left..right - val range = left..right - assert(result == x in range) { "Failed: unoptimized === unoptimized for standard float $range" } - return result -} - -fun box(): String { - assert("a" !in "b".."c") - assert("b" in "a".."d") - - assert(ComparablePair(2, 2) !in ComparablePair(1, 10)..ComparablePair(2, 1)) - assert(ComparablePair(2, 2) in ComparablePair(2, 0)..ComparablePair(2, 10)) - - assert(!check(-0.0, 0.0, 0.0)) - assert(check(Double.NaN, Double.NaN, Double.NaN)) - - assert(check(-0.0f, 0.0f, 0.0f)) - assert(!check(Float.NaN, Float.NaN, Float.NaN)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inCustomObjectRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inCustomObjectRange.kt deleted file mode 100644 index c52fda80d82..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inCustomObjectRange.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -class A(val z: Int) : Comparable { - override fun compareTo(other: A): Int { - return z.compareTo(other.z) - } -} - -operator fun A.rangeTo(that: A): ClosedRange = object: ClosedRange { - override val endInclusive: A - get() = that - override val start: A - get() = this@rangeTo -} - -operator fun ClosedRange.iterator() = (start.z..endInclusive.z).map { A(it) }.iterator() - -fun box(): String { - if (!( A(2) in A(1)..A(12) )) return "Fail 1" - if ( A(2) !in A(1)..A(12) ) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inDoubleRangeLiteralVsComparableRangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/contains/inDoubleRangeLiteralVsComparableRangeLiteral.kt deleted file mode 100644 index 824d7ef428f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inDoubleRangeLiteralVsComparableRangeLiteral.kt +++ /dev/null @@ -1,22 +0,0 @@ -// IGNORE_BACKEND: JS -// WITH_RUNTIME - -val DOUBLE_RANGE = 0.0 .. -0.0 - -val PZERO = 0.0 as Comparable -val NZERO = -0.0 as Comparable -val COMPARABLE_RANGE = PZERO .. NZERO - -fun box(): String { - if (!(0.0 in DOUBLE_RANGE)) return "fail 1 in Double" - if (0.0 !in DOUBLE_RANGE) return "fail 1 !in Double" - if (!(-0.0 in DOUBLE_RANGE)) return "fail 2 in Double" - if (-0.0 !in DOUBLE_RANGE) return "fail 2 !in Double" - - if (PZERO in COMPARABLE_RANGE) return "fail 3 in Comparable" - if (!(PZERO !in COMPARABLE_RANGE)) return "fail 3 !in Comparable" - if (NZERO in COMPARABLE_RANGE) return "fail 4 in Comparable" - if (!(NZERO !in COMPARABLE_RANGE)) return "fail 4a !in Comparable" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inExtensionRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inExtensionRange.kt deleted file mode 100644 index 53a4b73663e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inExtensionRange.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -operator fun Int.rangeTo(right: String): ClosedRange = this..this + 1 -operator fun Long.rangeTo(right: Double): ClosedRange = this..right.toLong() + 1 -operator fun String.rangeTo(right: Int): ClosedRange = this..this - -fun box(): String { - assert(0 !in 1.."a") - assert(1 in 1.."a") - - assert(0L !in 1L..2.0) - assert(2L in 1L..3.0) - - assert("a" !in "b"..1) - assert("a" in "a"..1) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inIntRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inIntRange.kt deleted file mode 100644 index 59a939acf24..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inIntRange.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun box(): String { - for (x in 1..10) { - assert(x in 1..10) - assert(x + 10 !in 1..10) - } - - var x = 0 - assert(0 !in 1..2) - - assert(++x in 1..1) - assert(++x !in 1..1) - - assert(sideEffect(x) in 2..3) - return "OK" -} - - -var invocationCounter = 0 -fun sideEffect(x: Int): Int { - ++invocationCounter - assert(invocationCounter == 1) - return x -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inIterable.kt b/backend.native/tests/external/codegen/box/ranges/contains/inIterable.kt deleted file mode 100644 index 8a418e12d1a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inIterable.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -val iterable: Iterable = listOf(1, 2, 3) - -fun box(): String = when { - 0 in iterable -> "fail 1" - 1 !in iterable -> "fail 2" - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inNonMatchingRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inNonMatchingRange.kt deleted file mode 100644 index 53c3c656980..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inNonMatchingRange.kt +++ /dev/null @@ -1,55 +0,0 @@ -// WITH_RUNTIME - -fun inInt(x: Long): Boolean { - return x in 1..2 -} - -fun notInInt(x: Long): Boolean { - return x !in 1..2 -} - -fun inLong(x: Int): Boolean { - return x in 1L..2L -} - -fun notInLong(x: Int): Boolean { - return x !in 1L..2L -} - -fun inFloat(x: Double): Boolean { - return x in 1.0f..2.0f -} - -fun notInFloat(x: Double): Boolean { - return x !in 1.0f..2.0f -} - -fun inDouble(x: Float): Boolean { - return x in 1.0..2.0 -} - -fun notInDouble(x: Float): Boolean { - return x !in 1.0..2.0 -} - -fun box(): String { - return when { - !inInt(1L) -> "Fail !inInt" - inInt(0L) -> "Fail inInt" - notInInt(1L) -> "Fail notInInt" - !notInInt(0L) -> "Fail !notInInt" - !inLong(1) -> "Fail !inLong" - inLong(0) -> "Fail inLong" - notInLong(1) -> "Fail notInLong" - !notInLong(0) -> "Fail !notInLong" - !inFloat(1.0) -> "Fain !inFloat" - inFloat(0.0) -> "Fain inFloat" - notInFloat(1.0) -> "Fail notInFloat" - !notInFloat(0.0) -> "Fail !notInFloat" - !inDouble(1.0F) -> "Fail !inDouble" - inDouble(0.0F) -> "Fail inDouble" - notInDouble(1.0F) -> "Fail notInDouble" - !notInDouble(0.0F) -> "Fail !notInDouble" - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableDoubleRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableDoubleRange.kt deleted file mode 100644 index f7aa5bf5729..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableDoubleRange.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun check(x: Double, left: Double, right: Double): Boolean { - val result = x in left..right - val manual = x >= left && x <= right - val range = left..right - assert(result == manual) { "Failed: optimized === manual for $range" } - assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } - return result -} - -fun checkUnoptimized(x: Double, range: ClosedRange): Boolean { - return x in range -} - -fun box(): String { - assert(check(1.0, 0.0, 2.0)) - assert(!check(1.0, -1.0, 0.0)) - - assert(check(Double.MIN_VALUE, 0.0, 1.0)) - assert(check(Double.MAX_VALUE, Double.MAX_VALUE - Double.MIN_VALUE, Double.MAX_VALUE)) - assert(!check(Double.NaN, Double.NaN, Double.NaN)) - assert(!check(0.0, Double.NaN, Double.NaN)) - - assert(check(-0.0, -0.0, +0.0)) - assert(check(-0.0, -0.0, -0.0)) - assert(check(-0.0, +0.0, +0.0)) - assert(check(+0.0, -0.0, -0.0)) - assert(check(+0.0, +0.0, +0.0)) - assert(check(+0.0, -0.0, +0.0)) - - var value = 0.0 - assert(++value in 1.0..1.0) - assert(++value !in 1.0..1.0) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableFloatRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableFloatRange.kt deleted file mode 100644 index 8b21a83ad34..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableFloatRange.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun check(x: Float, left: Float, right: Float): Boolean { - val result = x in left..right - val manual = x >= left && x <= right - val range = left..right - assert(result == manual) { "Failed: optimized === manual for $range" } - assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } - return result -} - -fun checkUnoptimized(x: Float, range: ClosedRange): Boolean { - return x in range -} - -fun box(): String { - assert(check(1.0f, 0.0f, 2.0f)) - assert(!check(1.0f, -1.0f, 0.0f)) - - assert(check(Float.MIN_VALUE, 0.0f, 1.0f)) - assert(check(Float.MAX_VALUE, Float.MAX_VALUE - Float.MIN_VALUE, Float.MAX_VALUE)) - assert(!check(Float.NaN, Float.NaN, Float.NaN)) - assert(!check(0.0f, Float.NaN, Float.NaN)) - - assert(check(-0.0f, -0.0f, +0.0f)) - assert(check(-0.0f, -0.0f, -0.0f)) - assert(check(-0.0f, +0.0f, +0.0f)) - assert(check(+0.0f, -0.0f, -0.0f)) - assert(check(+0.0f, +0.0f, +0.0f)) - assert(check(+0.0f, -0.0f, +0.0f)) - - var value = 0.0f - assert(++value in 1.0f..1.0f) - assert(++value !in 1.0f..1.0f) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableIntRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableIntRange.kt deleted file mode 100644 index 9f4a914c9d1..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableIntRange.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun check(x: Int, left: Int, right: Int): Boolean { - val result = x in left..right - val manual = x >= left && x <= right - val range = left..right - assert(result == manual) { "Failed: optimized === manual for $range" } - assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } - return result -} - -fun checkUnoptimized(x: Int, range: ClosedRange): Boolean { - return x in range -} - -fun box(): String { - assert(check(1, 0, 2)) - assert(!check(1, -1, 0)) - assert(!check(239, 239, 238)) - assert(check(239, 238, 239)) - - assert(check(Int.MIN_VALUE, Int.MIN_VALUE, Int.MIN_VALUE)) - assert(check(Int.MAX_VALUE, Int.MIN_VALUE, Int.MAX_VALUE)) - - var value = 0 - assert(++value in 1..1) - assert(++value !in 1..1) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableLongRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableLongRange.kt deleted file mode 100644 index 8bf77137b1a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inOptimizableLongRange.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun check(x: Long, left: Long, right: Long): Boolean { - val result = x in left..right - val manual = x >= left && x <= right - val range = left..right - assert(result == manual) { "Failed: optimized === manual for $range" } - assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } - return result -} - -fun checkUnoptimized(x: Long, range: ClosedRange): Boolean { - return x in range -} - -fun box(): String { - assert(check(1L, 0L, 2L)) - assert(!check(1L, -1L, 0L)) - assert(!check(239L, 239L, 238L)) - assert(check(239L, 238L, 239L)) - - assert(check(Long.MIN_VALUE, Long.MIN_VALUE, Long.MIN_VALUE)) - assert(check(Long.MAX_VALUE, Long.MIN_VALUE, Long.MAX_VALUE)) - - var value = 0L - assert(++value in 1L..1L) - assert(++value !in 1L..1L) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveProgression.kt b/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveProgression.kt deleted file mode 100644 index 96f588d5b97..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveProgression.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -val progression = 1 .. 3 step 2 - -fun box(): String = when { - 0 in progression -> "fail 1" - 1 !in progression -> "fail 2" - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveRange.kt deleted file mode 100644 index 2113dca0c54..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inPrimitiveRange.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -val range = 1 .. 3 - -fun box(): String = when { - 0 in range -> "fail 1" - 1 !in range -> "fail 2" - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inRangeLiteralComposition.kt b/backend.native/tests/external/codegen/box/ranges/contains/inRangeLiteralComposition.kt deleted file mode 100644 index 2e086ceafcd..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inRangeLiteralComposition.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME - -val i1 = 1 -val i2 = 2 -val i3 = 3 - -fun box(): String { - if (!(i2 in i1 .. i3 && i1 !in i2 .. i3)) return "Fail 1 &&" - if (!(i2 in i1 .. i3 || i1 !in i2 .. i3)) return "Fail 1 ||" - - // const-folded in JVM BE - if (!(2 in 1 .. 3 && 1 !in 2 .. 3)) return "Fail 2 &&" - if (!(2 in 1 .. 3 || 1 !in 2 .. 3)) return "Fail 2 ||" - - val xs = listOf(1, 2, 3) - if (!(1 in xs && 10 !in xs)) return "Fail 3 &&" - if (!(1 in xs || 10 !in xs)) return "Fail 3 ||" - - val iarr = intArrayOf(1, 2, 3) - if (!(1 in iarr && 10 !in iarr)) return "Fail 4 &&" - if (!(1 in iarr || 10 !in iarr)) return "Fail 4 ||" - - if (!("b" in "a" .. "c" && "a" !in "b" .. "c")) return "Fail 5 &&" - if (!("b" in "a" .. "c" || "a" !in "b" .. "c")) return "Fail 5 ||" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithCustomContains.kt b/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithCustomContains.kt deleted file mode 100644 index 277550e0034..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithCustomContains.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -class Value(val x: Int) : Comparable { - override fun compareTo(other: Value): Int { - throw AssertionError("Should not be called") - } -} - -class ValueRange(override val start: Value, - override val endInclusive: Value) : ClosedRange { - - override fun contains(value: Value): Boolean { - return value.x == 42 - } -} - -operator fun Value.rangeTo(other: Value): ClosedRange = ValueRange(this, other) - -fun box(): String { - assert(Value(42) in Value(1)..Value(2)) - assert(Value(41) !in Value(40)..Value(42)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithImplicitReceiver.kt deleted file mode 100644 index 8c39def7709..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithImplicitReceiver.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun Long.inLongs(l: Long, r: Long): Boolean { - return this in l..r -} - -fun Double.inDoubles(l: Double, r: Double): Boolean { - return this in l..r -} - -fun box(): String { - assert(2L.inLongs(1L, 3L)) - assert(!2L.inLongs(0L, 1L)) - - assert(2.0.inDoubles(1.0, 3.0)) - assert(!2.0.inDoubles(0.0, 1.0)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithNonmatchingArguments.kt b/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithNonmatchingArguments.kt deleted file mode 100644 index 0b8e25beb45..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithNonmatchingArguments.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun box(): String { - assert(Long.MAX_VALUE !in Int.MIN_VALUE..Int.MAX_VALUE) - assert(Int.MAX_VALUE in Long.MIN_VALUE..Long.MAX_VALUE) - assert(Double.MAX_VALUE !in Float.MIN_VALUE..Float.MAX_VALUE) - assert(Float.MIN_VALUE in 0..1) - assert(2.0 !in 1..0) - assert(1.0f in 0L..2L) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithSmartCast.kt b/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithSmartCast.kt deleted file mode 100644 index 1c314ffa31f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inRangeWithSmartCast.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun check(x: Any?): Boolean { - if (x is Int) { - return x in 239..240 - } - - throw java.lang.AssertionError() -} - -fun check(x: Any?, l: Any?, r: Any?): Boolean { - if (x is Int && l is Int && r is Int) { - return x in l..r - } - - throw java.lang.AssertionError() -} - - -fun box(): String { - assert(check(239)) - assert(check(239, 239, 240)) - assert(!check(238)) - assert(!check(238, 239, 240)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/contains/inUntil.kt b/backend.native/tests/external/codegen/box/ranges/contains/inUntil.kt deleted file mode 100644 index 126dd80728c..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/inUntil.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - if (!(1 in 0 until 10)) return "Fail 1 in" - if (1 !in 0 until 10) return "Fail 1 !in" - - if (10 in 0 until 10) return "Fail 2 in" - if (!(10 !in 0 until 10)) return "Fail 2 !in" - - if (!(1.toByte() in 0.toByte() until 10.toByte())) return "Fail 1 in Byte" - if (1.toByte() !in 0.toByte() until 10.toByte()) return "Fail 1 !in Byte" - - if (10.toByte() in 0.toByte() until 10.toByte()) return "Fail 2 in Byte" - if (!(10.toByte() !in 0.toByte() until 10.toByte())) return "Fail 2 !in Byte" - - if (!(1.toShort() in 0.toShort() until 10.toShort())) return "Fail 1 in Short" - if (1.toShort() !in 0.toShort() until 10.toShort()) return "Fail 1 !in Short" - - if (10.toShort() in 0.toShort() until 10.toShort()) return "Fail 2 in Short" - if (!(10.toShort() !in 0.toShort() until 10.toShort())) return "Fail 2 !in Short" - - if (!(1.toLong() in 0.toLong() until 10.toLong())) return "Fail 1 in Long" - if (1.toLong() !in 0.toLong() until 10.toLong()) return "Fail 1 !in Long" - - if (10.toLong() in 0.toLong() until 10.toLong()) return "Fail 2 in Long" - if (!(10.toLong() !in 0.toLong() until 10.toLong())) return "Fail 2 !in Long" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/kt20106.kt b/backend.native/tests/external/codegen/box/ranges/contains/kt20106.kt deleted file mode 100644 index 2b2097f1e04..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/kt20106.kt +++ /dev/null @@ -1,7 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val strSet = setOf("a", "b") - val xx = "a" to ("a" in strSet) - return if (!xx.second) "fail" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/nullableInPrimitiveRange.kt b/backend.native/tests/external/codegen/box/ranges/contains/nullableInPrimitiveRange.kt deleted file mode 100644 index fd05c2601f9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/nullableInPrimitiveRange.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -val x: Int? = 42 -val n: Int? = null - -fun box(): String { - if (x in 0..2) return "Fail in" - if (!(x !in 0..2)) return "Fail !in" - - if (n in 0..2) return "Fail in null" - if (!(n !in 0..2)) return "Fail !in null" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/contains/rangeContainsString.kt b/backend.native/tests/external/codegen/box/ranges/contains/rangeContainsString.kt deleted file mode 100644 index 9e2c9269f96..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/contains/rangeContainsString.kt +++ /dev/null @@ -1,5 +0,0 @@ -operator fun IntRange.contains(s: String): Boolean = true - -fun box(): String { - return if ("s" in 0..1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/emptyDownto.kt b/backend.native/tests/external/codegen/box/ranges/expression/emptyDownto.kt deleted file mode 100644 index 41f9e9357a0..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/emptyDownto.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 5 downTo 10 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for 5 downTo 10: $list1" - } - - val list2 = ArrayList() - val range2 = 5.toByte() downTo 10.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for 5.toByte() downTo 10.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 5.toShort() downTo 10.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for 5.toShort() downTo 10.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 5.toLong() downTo 10.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'a' downTo 'z' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for 'a' downTo 'z': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/emptyRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/emptyRange.kt deleted file mode 100644 index 01f8c158cac..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/emptyRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 10..5 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for 10..5: $list1" - } - - val list2 = ArrayList() - val range2 = 10.toByte()..(-5).toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for 10.toByte()..(-5).toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 10.toShort()..(-5).toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for 10.toShort()..(-5).toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 10.toLong()..-5.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for 10.toLong()..-5.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'z'..'a' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for 'z'..'a': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/inexactDownToMinValue.kt deleted file mode 100644 index cd4f47398a1..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/inexactDownToMinValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = (MinI + 5) downTo MinI step 3 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI + 5, MinI + 2)) { - return "Wrong elements for (MinI + 5) downTo MinI step 3: $list1" - } - - val list2 = ArrayList() - val range2 = (MinB + 5).toByte() downTo MinB step 3 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MinB + 5).toInt(), (MinB + 2).toInt())) { - return "Wrong elements for (MinB + 5).toByte() downTo MinB step 3: $list2" - } - - val list3 = ArrayList() - val range3 = (MinS + 5).toShort() downTo MinS step 3 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MinS + 5).toInt(), (MinS + 2).toInt())) { - return "Wrong elements for (MinS + 5).toShort() downTo MinS step 3: $list3" - } - - val list4 = ArrayList() - val range4 = (MinL + 5).toLong() downTo MinL step 3 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MinL + 5).toLong(), (MinL + 2).toLong())) { - return "Wrong elements for (MinL + 5).toLong() downTo MinL step 3: $list4" - } - - val list5 = ArrayList() - val range5 = (MinC + 5) downTo MinC step 3 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MinC + 5), (MinC + 2))) { - return "Wrong elements for (MinC + 5) downTo MinC step 3: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedDownTo.kt deleted file mode 100644 index 5b7871e8f3f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedDownTo.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 8 downTo 3 step 2 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(8, 6, 4)) { - return "Wrong elements for 8 downTo 3 step 2: $list1" - } - - val list2 = ArrayList() - val range2 = 8.toByte() downTo 3.toByte() step 2 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toByte() downTo 3.toByte() step 2: $list2" - } - - val list3 = ArrayList() - val range3 = 8.toShort() downTo 3.toShort() step 2 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toShort() downTo 3.toShort() step 2: $list3" - } - - val list4 = ArrayList() - val range4 = 8.toLong() downTo 3.toLong() step 2.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'd' downTo 'a' step 2 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('d', 'b')) { - return "Wrong elements for 'd' downTo 'a' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedRange.kt deleted file mode 100644 index f746a9fd09b..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/inexactSteppedRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 3..8 step 2 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 5, 7)) { - return "Wrong elements for 3..8 step 2: $list1" - } - - val list2 = ArrayList() - val range2 = 3.toByte()..8.toByte() step 2 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toByte()..8.toByte() step 2: $list2" - } - - val list3 = ArrayList() - val range3 = 3.toShort()..8.toShort() step 2 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toShort()..8.toShort() step 2: $list3" - } - - val list4 = ArrayList() - val range4 = 3.toLong()..8.toLong() step 2.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'a'..'d' step 2 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'c')) { - return "Wrong elements for 'a'..'d' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/inexactToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/inexactToMaxValue.kt deleted file mode 100644 index 6181201dc99..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/inexactToMaxValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = (MaxI - 5)..MaxI step 3 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 5, MaxI - 2)) { - return "Wrong elements for (MaxI - 5)..MaxI step 3: $list1" - } - - val list2 = ArrayList() - val range2 = (MaxB - 5).toByte()..MaxB step 3 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 5).toInt(), (MaxB - 2).toInt())) { - return "Wrong elements for (MaxB - 5).toByte()..MaxB step 3: $list2" - } - - val list3 = ArrayList() - val range3 = (MaxS - 5).toShort()..MaxS step 3 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 5).toInt(), (MaxS - 2).toInt())) { - return "Wrong elements for (MaxS - 5).toShort()..MaxS step 3: $list3" - } - - val list4 = ArrayList() - val range4 = (MaxL - 5).toLong()..MaxL step 3 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 5).toLong(), (MaxL - 2).toLong())) { - return "Wrong elements for (MaxL - 5).toLong()..MaxL step 3: $list4" - } - - val list5 = ArrayList() - val range5 = (MaxC - 5)..MaxC step 3 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 5), (MaxC - 2))) { - return "Wrong elements for (MaxC - 5)..MaxC step 3: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt deleted file mode 100644 index 57ef91abc6b..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/maxValueMinusTwoToMaxValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = (MaxI - 2)..MaxI - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 2, MaxI - 1, MaxI)) { - return "Wrong elements for (MaxI - 2)..MaxI: $list1" - } - - val list2 = ArrayList() - val range2 = (MaxB - 2).toByte()..MaxB - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 2).toInt(), (MaxB - 1).toInt(), MaxB.toInt())) { - return "Wrong elements for (MaxB - 2).toByte()..MaxB: $list2" - } - - val list3 = ArrayList() - val range3 = (MaxS - 2).toShort()..MaxS - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 2).toInt(), (MaxS - 1).toInt(), MaxS.toInt())) { - return "Wrong elements for (MaxS - 2).toShort()..MaxS: $list3" - } - - val list4 = ArrayList() - val range4 = (MaxL - 2).toLong()..MaxL - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL)) { - return "Wrong elements for (MaxL - 2).toLong()..MaxL: $list4" - } - - val list5 = ArrayList() - val range5 = (MaxC - 2)..MaxC - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 2), (MaxC - 1), MaxC)) { - return "Wrong elements for (MaxC - 2)..MaxC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMaxValue.kt deleted file mode 100644 index 67a34700482..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMaxValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = MaxI..MaxI - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI)) { - return "Wrong elements for MaxI..MaxI: $list1" - } - - val list2 = ArrayList() - val range2 = MaxB..MaxB - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MaxB.toInt())) { - return "Wrong elements for MaxB..MaxB: $list2" - } - - val list3 = ArrayList() - val range3 = MaxS..MaxS - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MaxS.toInt())) { - return "Wrong elements for MaxS..MaxS: $list3" - } - - val list4 = ArrayList() - val range4 = MaxL..MaxL - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MaxL)) { - return "Wrong elements for MaxL..MaxL: $list4" - } - - val list5 = ArrayList() - val range5 = MaxC..MaxC - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MaxC)) { - return "Wrong elements for MaxC..MaxC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMinValue.kt deleted file mode 100644 index b636e72842a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/maxValueToMinValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = MaxI..MinI - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for MaxI..MinI: $list1" - } - - val list2 = ArrayList() - val range2 = MaxB..MinB - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for MaxB..MinB: $list2" - } - - val list3 = ArrayList() - val range3 = MaxS..MinS - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for MaxS..MinS: $list3" - } - - val list4 = ArrayList() - val range4 = MaxL..MinL - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for MaxL..MinL: $list4" - } - - val list5 = ArrayList() - val range5 = MaxC..MinC - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for MaxC..MinC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/oneElementDownTo.kt b/backend.native/tests/external/codegen/box/ranges/expression/oneElementDownTo.kt deleted file mode 100644 index 302fd2bc7c3..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/oneElementDownTo.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 5 downTo 5 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5)) { - return "Wrong elements for 5 downTo 5: $list1" - } - - val list2 = ArrayList() - val range2 = 5.toByte() downTo 5.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5)) { - return "Wrong elements for 5.toByte() downTo 5.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 5.toShort() downTo 5.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5)) { - return "Wrong elements for 5.toShort() downTo 5.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 5.toLong() downTo 5.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(5.toLong())) { - return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'k' downTo 'k' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('k')) { - return "Wrong elements for 'k' downTo 'k': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/oneElementRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/oneElementRange.kt deleted file mode 100644 index 065acfd5333..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/oneElementRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 5..5 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5)) { - return "Wrong elements for 5..5: $list1" - } - - val list2 = ArrayList() - val range2 = 5.toByte()..5.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5)) { - return "Wrong elements for 5.toByte()..5.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 5.toShort()..5.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5)) { - return "Wrong elements for 5.toShort()..5.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 5.toLong()..5.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(5.toLong())) { - return "Wrong elements for 5.toLong()..5.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'k'..'k' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('k')) { - return "Wrong elements for 'k'..'k': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/openRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/openRange.kt deleted file mode 100644 index c9a06cc49d6..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/openRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 1 until 5 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1 until 5: $list1" - } - - val list2 = ArrayList() - val range2 = 1.toByte() until 5.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toByte() until 5.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 1.toShort() until 5.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toShort() until 5.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 1.toLong() until 5.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toLong() until 5.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'a' until 'd' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'b', 'c')) { - return "Wrong elements for 'a' until 'd': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/progressionDownToMinValue.kt deleted file mode 100644 index bda317415de..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/progressionDownToMinValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = (MinI + 2) downTo MinI step 1 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI + 2, MinI + 1, MinI)) { - return "Wrong elements for (MinI + 2) downTo MinI step 1: $list1" - } - - val list2 = ArrayList() - val range2 = (MinB + 2).toByte() downTo MinB step 1 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MinB + 2).toInt(), (MinB + 1).toInt(), MinB.toInt())) { - return "Wrong elements for (MinB + 2).toByte() downTo MinB step 1: $list2" - } - - val list3 = ArrayList() - val range3 = (MinS + 2).toShort() downTo MinS step 1 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MinS + 2).toInt(), (MinS + 1).toInt(), MinS.toInt())) { - return "Wrong elements for (MinS + 2).toShort() downTo MinS step 1: $list3" - } - - val list4 = ArrayList() - val range4 = (MinL + 2).toLong() downTo MinL step 1 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL)) { - return "Wrong elements for (MinL + 2).toLong() downTo MinL step 1: $list4" - } - - val list5 = ArrayList() - val range5 = (MinC + 2) downTo MinC step 1 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MinC + 2), (MinC + 1), MinC)) { - return "Wrong elements for (MinC + 2) downTo MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt deleted file mode 100644 index 3f8621c2fca..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = (MaxI - 2)..MaxI step 2 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 2, MaxI)) { - return "Wrong elements for (MaxI - 2)..MaxI step 2: $list1" - } - - val list2 = ArrayList() - val range2 = (MaxB - 2).toByte()..MaxB step 2 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 2).toInt(), MaxB.toInt())) { - return "Wrong elements for (MaxB - 2).toByte()..MaxB step 2: $list2" - } - - val list3 = ArrayList() - val range3 = (MaxS - 2).toShort()..MaxS step 2 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 2).toInt(), MaxS.toInt())) { - return "Wrong elements for (MaxS - 2).toShort()..MaxS step 2: $list3" - } - - val list4 = ArrayList() - val range4 = (MaxL - 2).toLong()..MaxL step 2 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 2).toLong(), MaxL)) { - return "Wrong elements for (MaxL - 2).toLong()..MaxL step 2: $list4" - } - - val list5 = ArrayList() - val range5 = (MaxC - 2)..MaxC step 2 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 2), MaxC)) { - return "Wrong elements for (MaxC - 2)..MaxC step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt deleted file mode 100644 index 48a8af62402..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMaxValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = MaxI..MaxI step 1 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI)) { - return "Wrong elements for MaxI..MaxI step 1: $list1" - } - - val list2 = ArrayList() - val range2 = MaxB..MaxB step 1 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MaxB.toInt())) { - return "Wrong elements for MaxB..MaxB step 1: $list2" - } - - val list3 = ArrayList() - val range3 = MaxS..MaxS step 1 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MaxS.toInt())) { - return "Wrong elements for MaxS..MaxS step 1: $list3" - } - - val list4 = ArrayList() - val range4 = MaxL..MaxL step 1 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MaxL)) { - return "Wrong elements for MaxL..MaxL step 1: $list4" - } - - val list5 = ArrayList() - val range5 = MaxC..MaxC step 1 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MaxC)) { - return "Wrong elements for MaxC..MaxC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt deleted file mode 100644 index 86eb6031690..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/progressionMaxValueToMinValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = MaxI..MinI step 1 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for MaxI..MinI step 1: $list1" - } - - val list2 = ArrayList() - val range2 = MaxB..MinB step 1 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for MaxB..MinB step 1: $list2" - } - - val list3 = ArrayList() - val range3 = MaxS..MinS step 1 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for MaxS..MinS step 1: $list3" - } - - val list4 = ArrayList() - val range4 = MaxL..MinL step 1 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for MaxL..MinL step 1: $list4" - } - - val list5 = ArrayList() - val range5 = MaxC..MinC step 1 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for MaxC..MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/expression/progressionMinValueToMinValue.kt deleted file mode 100644 index fee9a5f92c7..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/progressionMinValueToMinValue.kt +++ /dev/null @@ -1,74 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - val range1 = MinI..MinI step 1 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI)) { - return "Wrong elements for MinI..MinI step 1: $list1" - } - - val list2 = ArrayList() - val range2 = MinB..MinB step 1 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MinB.toInt())) { - return "Wrong elements for MinB..MinB step 1: $list2" - } - - val list3 = ArrayList() - val range3 = MinS..MinS step 1 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MinS.toInt())) { - return "Wrong elements for MinS..MinS step 1: $list3" - } - - val list4 = ArrayList() - val range4 = MinL..MinL step 1 - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MinL)) { - return "Wrong elements for MinL..MinL step 1: $list4" - } - - val list5 = ArrayList() - val range5 = MinC..MinC step 1 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MinC)) { - return "Wrong elements for MinC..MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedBackSequence.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedBackSequence.kt deleted file mode 100644 index 3542aa875b8..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedBackSequence.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (5 downTo 3).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5)) { - return "Wrong elements for (5 downTo 3).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (5.toByte() downTo 3.toByte()).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toByte() downTo 3.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (5.toShort() downTo 3.toShort()).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toShort() downTo 3.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = (5.toLong() downTo 3.toLong()).reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - val range5 = ('c' downTo 'a').reversed() - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'b', 'c')) { - return "Wrong elements for ('c' downTo 'a').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyBackSequence.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyBackSequence.kt deleted file mode 100644 index dc259b75860..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyBackSequence.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (3 downTo 5).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for (3 downTo 5).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (3.toByte() downTo 5.toByte()).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for (3.toByte() downTo 5.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (3.toShort() downTo 5.toShort()).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for (3.toShort() downTo 5.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = (3.toLong() downTo 5.toLong()).reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - val range5 = ('a' downTo 'c').reversed() - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for ('a' downTo 'c').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyRange.kt deleted file mode 100644 index 436528a5cd9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedEmptyRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (5..3).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for (5..3).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (5.toByte()..3.toByte()).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for (5.toByte()..3.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (5.toShort()..3.toShort()).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for (5.toShort()..3.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = (5.toLong()..3.toLong()).reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - val range5 = ('c'..'a').reversed() - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for ('c'..'a').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedInexactSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedInexactSteppedDownTo.kt deleted file mode 100644 index 03d7e797926..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedInexactSteppedDownTo.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (8 downTo 3 step 2).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(4, 6, 8)) { - return "Wrong elements for (8 downTo 3 step 2).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (8.toByte() downTo 3.toByte() step 2).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toByte() downTo 3.toByte() step 2).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (8.toShort() downTo 3.toShort() step 2).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toShort() downTo 3.toShort() step 2).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = (8.toLong() downTo 3.toLong() step 2.toLong()).reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - val range5 = ('d' downTo 'a' step 2).reversed() - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('b', 'd')) { - return "Wrong elements for ('d' downTo 'a' step 2).reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedRange.kt deleted file mode 100644 index 098c28bf0aa..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedRange.kt +++ /dev/null @@ -1,47 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (3..5).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5, 4, 3)) { - return "Wrong elements for (3..5).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (3.toShort()..5.toShort()).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5, 4, 3)) { - return "Wrong elements for (3.toShort()..5.toShort()).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (3.toLong()..5.toLong()).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5, 4, 3)) { - return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = ('a'..'c').reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf('c', 'b', 'a')) { - return "Wrong elements for ('a'..'c').reversed(): $list4" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/reversedSimpleSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/reversedSimpleSteppedRange.kt deleted file mode 100644 index 43771a5928e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/reversedSimpleSteppedRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (3..9 step 2).reversed() - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3..9 step 2).reversed(): $list1" - } - - val list2 = ArrayList() - val range2 = (3.toByte()..9.toByte() step 2).reversed() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toByte()..9.toByte() step 2).reversed(): $list2" - } - - val list3 = ArrayList() - val range3 = (3.toShort()..9.toShort() step 2).reversed() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toShort()..9.toShort() step 2).reversed(): $list3" - } - - val list4 = ArrayList() - val range4 = (3.toLong()..9.toLong() step 2.toLong()).reversed() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - val range5 = ('c'..'g' step 2).reversed() - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'e', 'c')) { - return "Wrong elements for ('c'..'g' step 2).reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/simpleDownTo.kt b/backend.native/tests/external/codegen/box/ranges/expression/simpleDownTo.kt deleted file mode 100644 index ad8974021a5..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/simpleDownTo.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 9 downTo 3 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9 downTo 3: $list1" - } - - val list2 = ArrayList() - val range2 = 9.toByte() downTo 3.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toByte() downTo 3.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 9.toShort() downTo 3.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toShort() downTo 3.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 9.toLong() downTo 3.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'g' downTo 'c' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'f', 'e', 'd', 'c')) { - return "Wrong elements for 'g' downTo 'c': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/simpleRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/simpleRange.kt deleted file mode 100644 index 306ab1d6ed0..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/simpleRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 3..9 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3..9: $list1" - } - - val list2 = ArrayList() - val range2 = 3.toByte()..9.toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toByte()..9.toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = 3.toShort()..9.toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toShort()..9.toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = 3.toLong()..9.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toLong()..9.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'c'..'g' - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { - return "Wrong elements for 'c'..'g': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/simpleRangeWithNonConstantEnds.kt b/backend.native/tests/external/codegen/box/ranges/expression/simpleRangeWithNonConstantEnds.kt deleted file mode 100644 index 42a9d01dcf6..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/simpleRangeWithNonConstantEnds.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = (1 + 2)..(10 - 1) - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1 + 2)..(10 - 1): $list1" - } - - val list2 = ArrayList() - val range2 = (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte() - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(): $list2" - } - - val list3 = ArrayList() - val range3 = (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort() - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(): $list3" - } - - val list4 = ArrayList() - val range4 = (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()) - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4" - } - - val list5 = ArrayList() - val range5 = ("ace"[1])..("age"[1]) - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { - return "Wrong elements for (\"ace\"[1])..(\"age\"[1]): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedDownTo.kt deleted file mode 100644 index 2b5ad22293a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedDownTo.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 9 downTo 3 step 2 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9 downTo 3 step 2: $list1" - } - - val list2 = ArrayList() - val range2 = 9.toByte() downTo 3.toByte() step 2 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toByte() downTo 3.toByte() step 2: $list2" - } - - val list3 = ArrayList() - val range3 = 9.toShort() downTo 3.toShort() step 2 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toShort() downTo 3.toShort() step 2: $list3" - } - - val list4 = ArrayList() - val range4 = 9.toLong() downTo 3.toLong() step 2.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'g' downTo 'c' step 2 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'e', 'c')) { - return "Wrong elements for 'g' downTo 'c' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedRange.kt deleted file mode 100644 index 132a8fc2a88..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/expression/simpleSteppedRange.kt +++ /dev/null @@ -1,57 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - val range1 = 3..9 step 2 - for (i in range1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3..9 step 2: $list1" - } - - val list2 = ArrayList() - val range2 = 3.toByte()..9.toByte() step 2 - for (i in range2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toByte()..9.toByte() step 2: $list2" - } - - val list3 = ArrayList() - val range3 = 3.toShort()..9.toShort() step 2 - for (i in range3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toShort()..9.toShort() step 2: $list3" - } - - val list4 = ArrayList() - val range4 = 3.toLong()..9.toLong() step 2.toLong() - for (i in range4) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - val range5 = 'c'..'g' step 2 - for (i in range5) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'e', 'g')) { - return "Wrong elements for 'c'..'g' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forByteProgressionWithIntIncrement.kt b/backend.native/tests/external/codegen/box/ranges/forByteProgressionWithIntIncrement.kt deleted file mode 100644 index 8596acc44fd..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forByteProgressionWithIntIncrement.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - for (element in 5.toByte()..1.toByte() step 255) { - return "Fail: iterating over an empty progression, element: $element" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInDownTo.kt b/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInDownTo.kt deleted file mode 100644 index fd046640e37..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInDownTo.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - for (i in 4 downTo 1) { - sum = sum * 10 + i - } - assertEquals(4321, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt deleted file mode 100644 index 45214ff7d0e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - val dt = 4 downTo 1 - for (i in dt) { - sum = sum * 10 + i - } - assertEquals(4321, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forLongInDownTo.kt b/backend.native/tests/external/codegen/box/ranges/forInDownTo/forLongInDownTo.kt deleted file mode 100644 index 4d1e9793cce..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forLongInDownTo.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0L - for (i in 4L downTo 1L) { - sum = sum * 10L + i - } - assertEquals(4321L, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forNullableIntInDownTo.kt b/backend.native/tests/external/codegen/box/ranges/forInDownTo/forNullableIntInDownTo.kt deleted file mode 100644 index 26109378c1b..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInDownTo/forNullableIntInDownTo.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - for (i: Int? in 4 downTo 1) { - sum = sum * 10 + (i ?: 0) - } - assertEquals(4321, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCharSequenceIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCharSequenceIndices.kt deleted file mode 100644 index 1600771fa32..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCharSequenceIndices.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -fun test(s: CharSequence): Int { - var result = 0 - for (i in s.indices) { - result = result * 10 + (i + 1) - } - return result -} - -fun box(): String { - val test = test("abcd") - if (test != 1234) return "Fail: $test" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt deleted file mode 100644 index ec23e8a7493..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun Collection.sumIndices(): Int { - var sum = 0 - for (i in indices) { - sum += i - } - return sum -} - -fun box(): String { - val list = listOf(0, 0, 0, 0) - val sum = list.sumIndices() - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionIndices.kt deleted file mode 100644 index f4b018a1ee8..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInCollectionIndices.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - for (i in listOf(0, 0, 0, 0).indices) { - sum += i - } - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt deleted file mode 100644 index b46b4812732..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun sumIndices(coll: Collection<*>?): Int { - var sum = 0 - for (i in coll?.indices ?: return 0) { - sum += i - } - return sum -} - -fun box(): String { - assertEquals(6, sumIndices(listOf(0, 0, 0, 0))) - assertEquals(0, sumIndices(null)) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInObjectArrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInObjectArrayIndices.kt deleted file mode 100644 index db45263759f..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInObjectArrayIndices.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - for (i in arrayOf("", "", "", "").indices) { - sum += i - } - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInPrimitiveArrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forInPrimitiveArrayIndices.kt deleted file mode 100644 index e1e5fb603d7..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forInPrimitiveArrayIndices.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - var sum = 0 - for (i in intArrayOf(0, 0, 0, 0).indices) { - sum += i - } - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInArrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInArrayIndices.kt deleted file mode 100644 index 2fb6c207bda..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInArrayIndices.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun suppressBoxingOptimization(ni: Int?) {} - -fun box(): String { - var sum = 0 - for (i: Int? in arrayOf("", "", "", "").indices) { - suppressBoxingOptimization(i) - sum += i ?: 0 - } - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInCollectionIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInCollectionIndices.kt deleted file mode 100644 index 295f66bf5c9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/forNullableIntInCollectionIndices.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun suppressBoxingOptimization(ni: Int?) {} - -fun box(): String { - var sum = 0 - for (i: Int? in listOf("", "", "", "").indices) { - suppressBoxingOptimization(i) - sum += i ?: 0 - } - assertEquals(6, sum) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/indexOfLast.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/indexOfLast.kt deleted file mode 100644 index 4d776ba833e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/indexOfLast.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun Array.indexOfLast(predicate: (T) -> Boolean): Int { - for (index in indices.reversed()) { - if (predicate(this[index])) { - return index - } - } - return -1 -} - -val ints = arrayOf(1, 2, 3, 2, 1) - -fun box(): String { - assertEquals(-1, ints.indexOfLast { it == 4 }) - assertEquals(4, ints.indexOfLast { it == 1 }) - assertEquals(3, ints.indexOfLast { it == 2 }) - assertEquals(2, ints.indexOfLast { it == 3 }) - assertEquals(-1, ints.indexOfLast { it == 0 }) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt deleted file mode 100644 index a702ad58de0..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -abstract class BaseGeneric(val t: T) { - abstract fun iterate() -} - -class Derived(array: Array) : BaseGeneric>(array) { - var test = 0 - - override fun iterate() { - test = 0 - for (i in t.indices) { - test = test * 10 + (i + 1) - } - } -} - -fun box(): String { - val t = Derived(arrayOf("", "", "", "")) - t.iterate() - return if (t.test == 1234) "OK" else "Fail: ${t.test}" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt deleted file mode 100644 index 6a66952d7d5..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -abstract class BaseGeneric(val t: T) { - abstract fun iterate() -} - -class Derived(t: List) : BaseGeneric>(t) { - var test = 0 - - override fun iterate() { - test = 0 - for (i in t.indices) { - test = test * 10 + (i + 1) - } - } -} - -fun box(): String { - val t = Derived(listOf("", "", "", "")) - t.iterate() - return if (t.test == 1234) "OK" else "Fail: ${t.test}" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt deleted file mode 100644 index 1ff6d06f18a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -abstract class BaseGeneric(val t: T) { - abstract fun iterate() -} - -class Derived(array: DoubleArray) : BaseGeneric(array) { - var test = 0 - - override fun iterate() { - test = 0 - for (i in t.indices) { - test = test * 10 + (i + 1) - } - } -} - -fun box(): String { - val t = Derived(doubleArrayOf(0.0, 0.0, 0.0, 0.0)) - t.iterate() - return if (t.test == 1234) "OK" else "Fail: ${t.test}" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt deleted file mode 100644 index adeb7decaed..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -abstract class BaseGeneric(val t: T) { - abstract fun iterate() -} - -class Derived(t: List) : BaseGeneric>(t) { - var test = 0 - - override fun iterate() { - test = 0 - for (i in t.indices) { - test = test * 10 + (i + 1) - } - } -} - -fun box(): String { - val t = Derived(listOf(1, 2, 3, 4)) - t.iterate() - return if (t.test == 1234) "OK" else "Fail: ${t.test}" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Array.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Array.kt deleted file mode 100644 index 47b299b9a5c..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Array.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun test(x: Any): Int { - var sum = 0 - if (x is IntArray) { - for (i in x.indices) { - sum = sum * 10 + i - } - } - return sum -} - -fun box(): String { - // Only run this test if primitive array `is` checks work (KT-17137) - if ((intArrayOf() as Any) is Array<*>) return "OK" - - assertEquals(123, test(intArrayOf(0, 0, 0, 0))) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_CharSequence.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_CharSequence.kt deleted file mode 100644 index a0d45d7698e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_CharSequence.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun test(x: Any): Int { - var sum = 0 - if (x is String) { - for (i in x.indices) { - sum = sum * 10 + i - } - } - return sum -} - -fun box(): String { - assertEquals(123, test("0000")) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Collection.kt b/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Collection.kt deleted file mode 100644 index 9bd4610d351..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInIndices/kt13241_Collection.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun test(x: Any): Int { - var sum = 0 - if (x is List<*>) { - for (i in x.indices) { - sum = sum * 10 + i - } - } - return sum -} - -fun box(): String { - assertEquals(123, test(listOf(0, 0, 0, 0))) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt b/backend.native/tests/external/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt deleted file mode 100644 index 0fdbe711937..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt +++ /dev/null @@ -1,39 +0,0 @@ -fun test1(): Long { - var s = 0L - for (i in 1L..4) { - s = s * 10 + i - } - return s -} - -fun test2(): Long { - var s = 0L - for (i in 1L..4.toShort()) { - s = s * 10 + i - } - return s -} - -fun testLI(a: Long, b: Int): Long { - var s = 0L - for (i in a..b) { - s = s * 10 + i - } - return s -} - -fun testLS(a: Long, b: Short): Long { - var s = 0L - for (i in a..b) { - s = s * 10 + i - } - return s -} - -fun box(): String { - if (test1() != 1234L) return "Fail 1" - if (test2() != 1234L) return "Fail 1" - if (testLI(1L, 4) != 1234L) return "Fail 2" - if (testLS(1L, 4.toShort()) != 1234L) return "Fail 2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInRangeToConstWithOverflow.kt b/backend.native/tests/external/codegen/box/ranges/forInRangeToConstWithOverflow.kt deleted file mode 100644 index b5cce712005..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInRangeToConstWithOverflow.kt +++ /dev/null @@ -1,12 +0,0 @@ -const val M = Int.MAX_VALUE - -fun box(): String { - var step = 0 - for (i in M .. M) { - ++step - if (step > 1) throw AssertionError("Should be executed once") - } - if (step != 1) throw AssertionError("Should be executed once") - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/box/ranges/forInRangeWithImplicitReceiver.kt deleted file mode 100644 index a29e5a77e5e..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInRangeWithImplicitReceiver.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun Int.digitsUpto(end: Int): Int { - var sum = 0 - for (i in rangeTo(end)) { - sum = sum*10 + i - } - return sum -} - -fun box(): String { - assertEquals(1234, 1.digitsUpto(4)) - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt deleted file mode 100644 index 9ee13af7b5a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - testChar() - testNullableChar() - return "OK" -} - -private fun testChar() { - var sum = "" - for (ch in '1' until '5') { - sum = sum + ch - } - assertEquals("1234", sum) -} - -private fun testNullableChar() { - var sum = "" - for (ch: Char? in '1' until '5') { - sum = sum + (ch ?: break) - } - assertEquals("1234", sum) -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt deleted file mode 100644 index 5b7357ba109..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - for (ch in (-10).toChar() until '\u0000') { - throw AssertionError("This loop shoud not be executed") - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt deleted file mode 100644 index 45e865c4d72..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - testIntInIntUntilInt() - testNullableIntInIntUntilInt() - return "OK" -} - -private fun testIntInIntUntilInt() { - var sum = 0 - for (i in 1 until 5) { - sum = sum * 10 + i - } - assertEquals(1234, sum) -} - -private fun testNullableIntInIntUntilInt() { - var sum = 0 - for (i: Int? in 1 until 5) { - sum = sum * 10 + (i?.toInt() ?: break) - } - assertEquals(1234, sum) -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt deleted file mode 100644 index 549b8d6fa9a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - for (i in 10 until 0) { - throw AssertionError("This loop should not be executed") - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt deleted file mode 100644 index 93e0853225b..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun testLongInLongUntilLong() { - var sum = 0 - for (i in 1L until 5L) { - sum = sum * 10 + i.toInt() - } - assertEquals(1234, sum) -} - -fun testLongInLongUntilInt() { - var sum = 0 - for (i in 1L until 5.toInt()) { - sum = sum * 10 + i.toInt() - } - assertEquals(1234, sum) -} - -fun testLongInIntUntilLong() { - var sum = 0 - for (i in 1.toInt() until 5L) { - sum = sum * 10 + i.toInt() - } - assertEquals(1234, sum) -} - -fun testNullableLongInIntUntilLong() { - var sum = 0 - for (i: Long? in 1.toInt() until 5L) { - sum = sum * 10 + (i?.toInt() ?: break) - } - assertEquals(1234, sum) -} - -fun box(): String { - testLongInLongUntilLong() - testLongInIntUntilLong() - testLongInLongUntilInt() - testNullableLongInIntUntilLong() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt deleted file mode 100644 index bf012c8d0ff..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - for (i in Int.MAX_VALUE until Int.MAX_VALUE) { - throw AssertionError("This loop shoud not be executed") - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt deleted file mode 100644 index 31ae7acede2..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - for (i in 0 until Int.MIN_VALUE) { - throw AssertionError("This loop shoud not be executed") - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt deleted file mode 100644 index b44b7f9f440..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - for (i in 0 until Long.MIN_VALUE) { - throw AssertionError("This loop shoud not be executed") - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt deleted file mode 100644 index 0cbaf4531ad..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - testIntInIntUntilSmartcastInt() - return "OK" -} - -private fun testIntInIntUntilSmartcastInt() { - var sum = 0 - - val a: Any = 5 - if (a is Int) { - for (i: Int in 1 until a) { - sum = sum * 10 + i - } - } - - assertEquals(1234, sum) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forIntRange.kt b/backend.native/tests/external/codegen/box/ranges/forIntRange.kt deleted file mode 100644 index 1dd52f48533..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forIntRange.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -fun box() : String { - val a = arrayOfNulls(3) - a[0] = "a" - a[1] = "b" - a[2] = "c" - - var result = 0 - for(i in a.indices) { - result += i - } - if (result != 3) return "FAIL" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/forNullableIntInRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/box/ranges/forNullableIntInRangeWithImplicitReceiver.kt deleted file mode 100644 index 8f9a4534ea6..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/forNullableIntInRangeWithImplicitReceiver.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun suppressBoxingOptimization(ni: Int?) {} - -fun Int.digitsUpto(end: Int): Int { - var sum = 0 - for (i: Int? in rangeTo(end)) { - suppressBoxingOptimization(i) - sum = sum*10 + i!! - } - return sum -} - -fun box(): String { - assertEquals(1234, 1.digitsUpto(4)) - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/ranges/literal/emptyDownto.kt b/backend.native/tests/external/codegen/box/ranges/literal/emptyDownto.kt deleted file mode 100644 index ac36fbd5d62..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/emptyDownto.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 5 downTo 10) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for 5 downTo 10: $list1" - } - - val list2 = ArrayList() - for (i in 5.toByte() downTo 10.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for 5.toByte() downTo 10.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 5.toShort() downTo 10.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for 5.toShort() downTo 10.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 5.toLong() downTo 10.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'a' downTo 'z') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for 'a' downTo 'z': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/emptyRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/emptyRange.kt deleted file mode 100644 index e977c4b9461..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/emptyRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 10..5) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for 10..5: $list1" - } - - val list2 = ArrayList() - for (i in 10.toByte()..(-5).toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for 10.toByte()..(-5).toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 10.toShort()..(-5).toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for 10.toShort()..(-5).toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 10.toLong()..-5.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for 10.toLong()..-5.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'z'..'a') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for 'z'..'a': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/inexactDownToMinValue.kt deleted file mode 100644 index 72d497bb477..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/inexactDownToMinValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in (MinI + 5) downTo MinI step 3) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI + 5, MinI + 2)) { - return "Wrong elements for (MinI + 5) downTo MinI step 3: $list1" - } - - val list2 = ArrayList() - for (i in (MinB + 5).toByte() downTo MinB step 3) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MinB + 5).toInt(), (MinB + 2).toInt())) { - return "Wrong elements for (MinB + 5).toByte() downTo MinB step 3: $list2" - } - - val list3 = ArrayList() - for (i in (MinS + 5).toShort() downTo MinS step 3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MinS + 5).toInt(), (MinS + 2).toInt())) { - return "Wrong elements for (MinS + 5).toShort() downTo MinS step 3: $list3" - } - - val list4 = ArrayList() - for (i in (MinL + 5).toLong() downTo MinL step 3) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MinL + 5).toLong(), (MinL + 2).toLong())) { - return "Wrong elements for (MinL + 5).toLong() downTo MinL step 3: $list4" - } - - val list5 = ArrayList() - for (i in (MinC + 5) downTo MinC step 3) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MinC + 5), (MinC + 2))) { - return "Wrong elements for (MinC + 5) downTo MinC step 3: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedDownTo.kt deleted file mode 100644 index 1696d7a1cb9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedDownTo.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 8 downTo 3 step 2) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(8, 6, 4)) { - return "Wrong elements for 8 downTo 3 step 2: $list1" - } - - val list2 = ArrayList() - for (i in 8.toByte() downTo 3.toByte() step 2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toByte() downTo 3.toByte() step 2: $list2" - } - - val list3 = ArrayList() - for (i in 8.toShort() downTo 3.toShort() step 2) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toShort() downTo 3.toShort() step 2: $list3" - } - - val list4 = ArrayList() - for (i in 8.toLong() downTo 3.toLong() step 2.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(8, 6, 4)) { - return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'd' downTo 'a' step 2) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('d', 'b')) { - return "Wrong elements for 'd' downTo 'a' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedRange.kt deleted file mode 100644 index b7aec1243ad..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/inexactSteppedRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 3..8 step 2) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 5, 7)) { - return "Wrong elements for 3..8 step 2: $list1" - } - - val list2 = ArrayList() - for (i in 3.toByte()..8.toByte() step 2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toByte()..8.toByte() step 2: $list2" - } - - val list3 = ArrayList() - for (i in 3.toShort()..8.toShort() step 2) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toShort()..8.toShort() step 2: $list3" - } - - val list4 = ArrayList() - for (i in 3.toLong()..8.toLong() step 2.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 5, 7)) { - return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'a'..'d' step 2) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'c')) { - return "Wrong elements for 'a'..'d' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/inexactToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/inexactToMaxValue.kt deleted file mode 100644 index 9de5402fe11..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/inexactToMaxValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in (MaxI - 5)..MaxI step 3) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 5, MaxI - 2)) { - return "Wrong elements for (MaxI - 5)..MaxI step 3: $list1" - } - - val list2 = ArrayList() - for (i in (MaxB - 5).toByte()..MaxB step 3) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 5).toInt(), (MaxB - 2).toInt())) { - return "Wrong elements for (MaxB - 5).toByte()..MaxB step 3: $list2" - } - - val list3 = ArrayList() - for (i in (MaxS - 5).toShort()..MaxS step 3) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 5).toInt(), (MaxS - 2).toInt())) { - return "Wrong elements for (MaxS - 5).toShort()..MaxS step 3: $list3" - } - - val list4 = ArrayList() - for (i in (MaxL - 5).toLong()..MaxL step 3) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 5).toLong(), (MaxL - 2).toLong())) { - return "Wrong elements for (MaxL - 5).toLong()..MaxL step 3: $list4" - } - - val list5 = ArrayList() - for (i in (MaxC - 5)..MaxC step 3) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 5), (MaxC - 2))) { - return "Wrong elements for (MaxC - 5)..MaxC step 3: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt deleted file mode 100644 index dabb4b7eec1..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/maxValueMinusTwoToMaxValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in (MaxI - 2)..MaxI) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 2, MaxI - 1, MaxI)) { - return "Wrong elements for (MaxI - 2)..MaxI: $list1" - } - - val list2 = ArrayList() - for (i in (MaxB - 2).toByte()..MaxB) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 2).toInt(), (MaxB - 1).toInt(), MaxB.toInt())) { - return "Wrong elements for (MaxB - 2).toByte()..MaxB: $list2" - } - - val list3 = ArrayList() - for (i in (MaxS - 2).toShort()..MaxS) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 2).toInt(), (MaxS - 1).toInt(), MaxS.toInt())) { - return "Wrong elements for (MaxS - 2).toShort()..MaxS: $list3" - } - - val list4 = ArrayList() - for (i in (MaxL - 2).toLong()..MaxL) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL)) { - return "Wrong elements for (MaxL - 2).toLong()..MaxL: $list4" - } - - val list5 = ArrayList() - for (i in (MaxC - 2)..MaxC) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 2), (MaxC - 1), MaxC)) { - return "Wrong elements for (MaxC - 2)..MaxC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMaxValue.kt deleted file mode 100644 index 5c174a24557..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMaxValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in MaxI..MaxI) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI)) { - return "Wrong elements for MaxI..MaxI: $list1" - } - - val list2 = ArrayList() - for (i in MaxB..MaxB) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MaxB.toInt())) { - return "Wrong elements for MaxB..MaxB: $list2" - } - - val list3 = ArrayList() - for (i in MaxS..MaxS) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MaxS.toInt())) { - return "Wrong elements for MaxS..MaxS: $list3" - } - - val list4 = ArrayList() - for (i in MaxL..MaxL) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MaxL)) { - return "Wrong elements for MaxL..MaxL: $list4" - } - - val list5 = ArrayList() - for (i in MaxC..MaxC) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MaxC)) { - return "Wrong elements for MaxC..MaxC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMinValue.kt deleted file mode 100644 index bfb2f4c0d39..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/maxValueToMinValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in MaxI..MinI) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for MaxI..MinI: $list1" - } - - val list2 = ArrayList() - for (i in MaxB..MinB) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for MaxB..MinB: $list2" - } - - val list3 = ArrayList() - for (i in MaxS..MinS) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for MaxS..MinS: $list3" - } - - val list4 = ArrayList() - for (i in MaxL..MinL) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for MaxL..MinL: $list4" - } - - val list5 = ArrayList() - for (i in MaxC..MinC) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for MaxC..MinC: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/oneElementDownTo.kt b/backend.native/tests/external/codegen/box/ranges/literal/oneElementDownTo.kt deleted file mode 100644 index 9a5fd5f8589..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/oneElementDownTo.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 5 downTo 5) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5)) { - return "Wrong elements for 5 downTo 5: $list1" - } - - val list2 = ArrayList() - for (i in 5.toByte() downTo 5.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5)) { - return "Wrong elements for 5.toByte() downTo 5.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 5.toShort() downTo 5.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5)) { - return "Wrong elements for 5.toShort() downTo 5.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 5.toLong() downTo 5.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(5.toLong())) { - return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'k' downTo 'k') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('k')) { - return "Wrong elements for 'k' downTo 'k': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/oneElementRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/oneElementRange.kt deleted file mode 100644 index 3d7dc4fec09..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/oneElementRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 5..5) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5)) { - return "Wrong elements for 5..5: $list1" - } - - val list2 = ArrayList() - for (i in 5.toByte()..5.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5)) { - return "Wrong elements for 5.toByte()..5.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 5.toShort()..5.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5)) { - return "Wrong elements for 5.toShort()..5.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 5.toLong()..5.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(5.toLong())) { - return "Wrong elements for 5.toLong()..5.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'k'..'k') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('k')) { - return "Wrong elements for 'k'..'k': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/openRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/openRange.kt deleted file mode 100644 index 488600a9207..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/openRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 1 until 5) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1 until 5: $list1" - } - - val list2 = ArrayList() - for (i in 1.toByte() until 5.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toByte() until 5.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 1.toShort() until 5.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toShort() until 5.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 1.toLong() until 5.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(1, 2, 3, 4)) { - return "Wrong elements for 1.toLong() until 5.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'a' until 'd') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'b', 'c')) { - return "Wrong elements for 'a' until 'd': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/progressionDownToMinValue.kt deleted file mode 100644 index a62ca845133..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/progressionDownToMinValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in (MinI + 2) downTo MinI step 1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI + 2, MinI + 1, MinI)) { - return "Wrong elements for (MinI + 2) downTo MinI step 1: $list1" - } - - val list2 = ArrayList() - for (i in (MinB + 2).toByte() downTo MinB step 1) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MinB + 2).toInt(), (MinB + 1).toInt(), MinB.toInt())) { - return "Wrong elements for (MinB + 2).toByte() downTo MinB step 1: $list2" - } - - val list3 = ArrayList() - for (i in (MinS + 2).toShort() downTo MinS step 1) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MinS + 2).toInt(), (MinS + 1).toInt(), MinS.toInt())) { - return "Wrong elements for (MinS + 2).toShort() downTo MinS step 1: $list3" - } - - val list4 = ArrayList() - for (i in (MinL + 2).toLong() downTo MinL step 1) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL)) { - return "Wrong elements for (MinL + 2).toLong() downTo MinL step 1: $list4" - } - - val list5 = ArrayList() - for (i in (MinC + 2) downTo MinC step 1) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MinC + 2), (MinC + 1), MinC)) { - return "Wrong elements for (MinC + 2) downTo MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt deleted file mode 100644 index ed239fc2925..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in (MaxI - 2)..MaxI step 2) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI - 2, MaxI)) { - return "Wrong elements for (MaxI - 2)..MaxI step 2: $list1" - } - - val list2 = ArrayList() - for (i in (MaxB - 2).toByte()..MaxB step 2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf((MaxB - 2).toInt(), MaxB.toInt())) { - return "Wrong elements for (MaxB - 2).toByte()..MaxB step 2: $list2" - } - - val list3 = ArrayList() - for (i in (MaxS - 2).toShort()..MaxS step 2) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf((MaxS - 2).toInt(), MaxS.toInt())) { - return "Wrong elements for (MaxS - 2).toShort()..MaxS step 2: $list3" - } - - val list4 = ArrayList() - for (i in (MaxL - 2).toLong()..MaxL step 2) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf((MaxL - 2).toLong(), MaxL)) { - return "Wrong elements for (MaxL - 2).toLong()..MaxL step 2: $list4" - } - - val list5 = ArrayList() - for (i in (MaxC - 2)..MaxC step 2) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf((MaxC - 2), MaxC)) { - return "Wrong elements for (MaxC - 2)..MaxC step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt deleted file mode 100644 index af2334ee40b..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMaxValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in MaxI..MaxI step 1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MaxI)) { - return "Wrong elements for MaxI..MaxI step 1: $list1" - } - - val list2 = ArrayList() - for (i in MaxB..MaxB step 1) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MaxB.toInt())) { - return "Wrong elements for MaxB..MaxB step 1: $list2" - } - - val list3 = ArrayList() - for (i in MaxS..MaxS step 1) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MaxS.toInt())) { - return "Wrong elements for MaxS..MaxS step 1: $list3" - } - - val list4 = ArrayList() - for (i in MaxL..MaxL step 1) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MaxL)) { - return "Wrong elements for MaxL..MaxL step 1: $list4" - } - - val list5 = ArrayList() - for (i in MaxC..MaxC step 1) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MaxC)) { - return "Wrong elements for MaxC..MaxC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt deleted file mode 100644 index 7a8a189025d..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/progressionMaxValueToMinValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in MaxI..MinI step 1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for MaxI..MinI step 1: $list1" - } - - val list2 = ArrayList() - for (i in MaxB..MinB step 1) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for MaxB..MinB step 1: $list2" - } - - val list3 = ArrayList() - for (i in MaxS..MinS step 1) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for MaxS..MinS step 1: $list3" - } - - val list4 = ArrayList() - for (i in MaxL..MinL step 1) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for MaxL..MinL step 1: $list4" - } - - val list5 = ArrayList() - for (i in MaxC..MinC step 1) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for MaxC..MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/box/ranges/literal/progressionMinValueToMinValue.kt deleted file mode 100644 index b0f74526ec6..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/progressionMinValueToMinValue.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// TODO: muted automatically, investigate should it be ran for NATIVE or not -// IGNORE_BACKEND: NATIVE - -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -import java.lang.Integer.MAX_VALUE as MaxI -import java.lang.Integer.MIN_VALUE as MinI -import java.lang.Byte.MAX_VALUE as MaxB -import java.lang.Byte.MIN_VALUE as MinB -import java.lang.Short.MAX_VALUE as MaxS -import java.lang.Short.MIN_VALUE as MinS -import java.lang.Long.MAX_VALUE as MaxL -import java.lang.Long.MIN_VALUE as MinL -import java.lang.Character.MAX_VALUE as MaxC -import java.lang.Character.MIN_VALUE as MinC - -fun box(): String { - val list1 = ArrayList() - for (i in MinI..MinI step 1) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(MinI)) { - return "Wrong elements for MinI..MinI step 1: $list1" - } - - val list2 = ArrayList() - for (i in MinB..MinB step 1) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(MinB.toInt())) { - return "Wrong elements for MinB..MinB step 1: $list2" - } - - val list3 = ArrayList() - for (i in MinS..MinS step 1) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(MinS.toInt())) { - return "Wrong elements for MinS..MinS step 1: $list3" - } - - val list4 = ArrayList() - for (i in MinL..MinL step 1) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(MinL)) { - return "Wrong elements for MinL..MinL step 1: $list4" - } - - val list5 = ArrayList() - for (i in MinC..MinC step 1) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf(MinC)) { - return "Wrong elements for MinC..MinC step 1: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedBackSequence.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedBackSequence.kt deleted file mode 100644 index f4cd7ae0df6..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedBackSequence.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (5 downTo 3).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5)) { - return "Wrong elements for (5 downTo 3).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (5.toByte() downTo 3.toByte()).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toByte() downTo 3.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (5.toShort() downTo 3.toShort()).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toShort() downTo 3.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in (5.toLong() downTo 3.toLong()).reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5)) { - return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - for (i in ('c' downTo 'a').reversed()) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('a', 'b', 'c')) { - return "Wrong elements for ('c' downTo 'a').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyBackSequence.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyBackSequence.kt deleted file mode 100644 index 9c2bab57838..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyBackSequence.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (3 downTo 5).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for (3 downTo 5).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (3.toByte() downTo 5.toByte()).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for (3.toByte() downTo 5.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (3.toShort() downTo 5.toShort()).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for (3.toShort() downTo 5.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in (3.toLong() downTo 5.toLong()).reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - for (i in ('a' downTo 'c').reversed()) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for ('a' downTo 'c').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyRange.kt deleted file mode 100644 index c2442883533..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedEmptyRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (5..3).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf()) { - return "Wrong elements for (5..3).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (5.toByte()..3.toByte()).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf()) { - return "Wrong elements for (5.toByte()..3.toByte()).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (5.toShort()..3.toShort()).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf()) { - return "Wrong elements for (5.toShort()..3.toShort()).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in (5.toLong()..3.toLong()).reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf()) { - return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - for (i in ('c'..'a').reversed()) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf()) { - return "Wrong elements for ('c'..'a').reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedInexactSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedInexactSteppedDownTo.kt deleted file mode 100644 index 63c431ab3c8..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedInexactSteppedDownTo.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (8 downTo 3 step 2).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(4, 6, 8)) { - return "Wrong elements for (8 downTo 3 step 2).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (8.toByte() downTo 3.toByte() step 2).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toByte() downTo 3.toByte() step 2).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (8.toShort() downTo 3.toShort() step 2).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toShort() downTo 3.toShort() step 2).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in (8.toLong() downTo 3.toLong() step 2.toLong()).reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(4, 6, 8)) { - return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - for (i in ('d' downTo 'a' step 2).reversed()) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('b', 'd')) { - return "Wrong elements for ('d' downTo 'a' step 2).reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedRange.kt deleted file mode 100644 index 1d4e6649437..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedRange.kt +++ /dev/null @@ -1,43 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (3..5).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(5, 4, 3)) { - return "Wrong elements for (3..5).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (3.toShort()..5.toShort()).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(5, 4, 3)) { - return "Wrong elements for (3.toShort()..5.toShort()).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (3.toLong()..5.toLong()).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(5, 4, 3)) { - return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in ('a'..'c').reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf('c', 'b', 'a')) { - return "Wrong elements for ('a'..'c').reversed(): $list4" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/reversedSimpleSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/reversedSimpleSteppedRange.kt deleted file mode 100644 index be85c5020c0..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/reversedSimpleSteppedRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (3..9 step 2).reversed()) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3..9 step 2).reversed(): $list1" - } - - val list2 = ArrayList() - for (i in (3.toByte()..9.toByte() step 2).reversed()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toByte()..9.toByte() step 2).reversed(): $list2" - } - - val list3 = ArrayList() - for (i in (3.toShort()..9.toShort() step 2).reversed()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toShort()..9.toShort() step 2).reversed(): $list3" - } - - val list4 = ArrayList() - for (i in (3.toLong()..9.toLong() step 2.toLong()).reversed()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 7, 5, 3)) { - return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4" - } - - val list5 = ArrayList() - for (i in ('c'..'g' step 2).reversed()) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'e', 'c')) { - return "Wrong elements for ('c'..'g' step 2).reversed(): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/simpleDownTo.kt b/backend.native/tests/external/codegen/box/ranges/literal/simpleDownTo.kt deleted file mode 100644 index 13bdb9a25e9..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/simpleDownTo.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 9 downTo 3) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9 downTo 3: $list1" - } - - val list2 = ArrayList() - for (i in 9.toByte() downTo 3.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toByte() downTo 3.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 9.toShort() downTo 3.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toShort() downTo 3.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 9.toLong() downTo 3.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 8, 7, 6, 5, 4, 3)) { - return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'g' downTo 'c') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'f', 'e', 'd', 'c')) { - return "Wrong elements for 'g' downTo 'c': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/simpleRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/simpleRange.kt deleted file mode 100644 index 3a074a477d1..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/simpleRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 3..9) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3..9: $list1" - } - - val list2 = ArrayList() - for (i in 3.toByte()..9.toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toByte()..9.toByte(): $list2" - } - - val list3 = ArrayList() - for (i in 3.toShort()..9.toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toShort()..9.toShort(): $list3" - } - - val list4 = ArrayList() - for (i in 3.toLong()..9.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for 3.toLong()..9.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'c'..'g') { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { - return "Wrong elements for 'c'..'g': $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/simpleRangeWithNonConstantEnds.kt b/backend.native/tests/external/codegen/box/ranges/literal/simpleRangeWithNonConstantEnds.kt deleted file mode 100644 index b242f085369..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/simpleRangeWithNonConstantEnds.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in (1 + 2)..(10 - 1)) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1 + 2)..(10 - 1): $list1" - } - - val list2 = ArrayList() - for (i in (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte()) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(): $list2" - } - - val list3 = ArrayList() - for (i in (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort()) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(): $list3" - } - - val list4 = ArrayList() - for (i in (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong())) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { - return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4" - } - - val list5 = ArrayList() - for (i in ("ace"[1])..("age"[1])) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { - return "Wrong elements for (\"ace\"[1])..(\"age\"[1]): $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedDownTo.kt b/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedDownTo.kt deleted file mode 100644 index 62dd8c70251..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedDownTo.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 9 downTo 3 step 2) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9 downTo 3 step 2: $list1" - } - - val list2 = ArrayList() - for (i in 9.toByte() downTo 3.toByte() step 2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toByte() downTo 3.toByte() step 2: $list2" - } - - val list3 = ArrayList() - for (i in 9.toShort() downTo 3.toShort() step 2) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toShort() downTo 3.toShort() step 2: $list3" - } - - val list4 = ArrayList() - for (i in 9.toLong() downTo 3.toLong() step 2.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(9, 7, 5, 3)) { - return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'g' downTo 'c' step 2) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('g', 'e', 'c')) { - return "Wrong elements for 'g' downTo 'c' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedRange.kt b/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedRange.kt deleted file mode 100644 index 4552ee0f9f7..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/literal/simpleSteppedRange.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! -// WITH_RUNTIME - - -fun box(): String { - val list1 = ArrayList() - for (i in 3..9 step 2) { - list1.add(i) - if (list1.size > 23) break - } - if (list1 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3..9 step 2: $list1" - } - - val list2 = ArrayList() - for (i in 3.toByte()..9.toByte() step 2) { - list2.add(i) - if (list2.size > 23) break - } - if (list2 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toByte()..9.toByte() step 2: $list2" - } - - val list3 = ArrayList() - for (i in 3.toShort()..9.toShort() step 2) { - list3.add(i) - if (list3.size > 23) break - } - if (list3 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toShort()..9.toShort() step 2: $list3" - } - - val list4 = ArrayList() - for (i in 3.toLong()..9.toLong() step 2.toLong()) { - list4.add(i) - if (list4.size > 23) break - } - if (list4 != listOf(3, 5, 7, 9)) { - return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4" - } - - val list5 = ArrayList() - for (i in 'c'..'g' step 2) { - list5.add(i) - if (list5.size > 23) break - } - if (list5 != listOf('c', 'e', 'g')) { - return "Wrong elements for 'c'..'g' step 2: $list5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt b/backend.native/tests/external/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt deleted file mode 100644 index d8fef0b509a..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME - -operator fun Int.component1(): String { - return arrayListOf("zero", "one", "two", "three")[this] -} - -operator fun Int.component2(): Int { - return arrayListOf(0, 1, 4, 9)[this] -} - -fun box(): String { - val strings = arrayListOf() - val squares = arrayListOf() - - for ((str, sq) in 1..3) { - strings.add(str) - squares.add(sq) - } - - if (strings != arrayListOf("one", "two", "three")) return "FAIL: $strings" - if (squares != arrayListOf(1, 4, 9)) return "FAIL: $squares" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt b/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt deleted file mode 100644 index 2caf1a33808..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/progressionExpression.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - var result = 0 - val intRange: IntProgression = 1..3 - for (i: Int? in intRange) { - result = sum(result, i) - } - return if (result == 6) "OK" else "fail: $result" -} - -fun sum(i: Int, z: Int?): Int { - return i + z!! -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt b/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt deleted file mode 100644 index 7cc906c09d2..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeExpression.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - var result = 0 - val intRange = 1..3 - for (i: Int? in intRange) { - result = sum(result, i) - } - return if (result == 6) "OK" else "fail: $result" -} - -fun sum(i: Int, z: Int?): Int { - return i + z!! -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt b/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt deleted file mode 100644 index 52713ad8bf7..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/nullableLoopParameter/rangeLiteral.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - var result = 0 - for (i: Int? in 1..3) { - result = sum(result, i) - } - return if (result == 6) "OK" else "fail: $result" -} - -fun sum(i: Int, z: Int?): Int { - return i + z!! -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/safeCallRangeTo.kt b/backend.native/tests/external/codegen/box/ranges/safeCallRangeTo.kt deleted file mode 100644 index 0d277d3c2bb..00000000000 --- a/backend.native/tests/external/codegen/box/ranges/safeCallRangeTo.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun charRange(x: Char?, y: Char) = x?.rangeTo(y) -fun byteRange(x: Byte?, y: Byte) = x?.rangeTo(y) -fun shortRange(x: Short?, y: Short) = x?.rangeTo(y) -fun intRange(x: Int?, y: Int) = x?.rangeTo(y) -fun longRange(x: Long?, y: Long) = x?.rangeTo(y) -fun floatRange(x: Float?, y: Float) = x?.rangeTo(y) -fun dougleRange(x: Double?, y: Double) = x?.rangeTo(y) - -inline fun testSafeRange(x: T, y: T, expectStr: String, safeRange: (T?, T) -> R?) { - val rNull = safeRange(null, y) - assert (rNull == null) { "${T::class.simpleName}: Expected: null, got $rNull" } - - val rxy = safeRange(x, y) - assert (rxy?.toString() == expectStr) { "${T::class.simpleName}: Expected: $expectStr, got $rxy" } -} - -fun box(): String { - testSafeRange('0', '1', "0..1", ::charRange) - testSafeRange(0, 1, "0..1", ::byteRange) - testSafeRange(0, 1, "0..1", ::shortRange) - testSafeRange(0, 1, "0..1", ::intRange) - testSafeRange(0L, 1L, "0..1", ::longRange) - testSafeRange(0.0f, 1.0f, "0.0..1.0", ::floatRange) - testSafeRange(0.0, 1.0, "0.0..1.0", ::dougleRange) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/annotationRetentionAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/annotationRetentionAnnotation.kt deleted file mode 100644 index c92c6a0cdd0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/annotationRetentionAnnotation.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -@Retention(AnnotationRetention.RUNTIME) -annotation class Anno - -fun box(): String { - val a = Anno::class.annotations - - if (a.size != 1) return "Fail 1: $a" - val ann = a.single() as? Retention ?: return "Fail 2: ${a.single()}" - assertEquals(AnnotationRetention.RUNTIME, ann.value) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt b/backend.native/tests/external/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt deleted file mode 100644 index 70c1720d4fc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -@Anno("J") -public class J { - @Anno("foo") - public static int foo = 42; - - @Anno("bar") - public static void bar() {} - - @Anno("constructor") - public J() {} -} - -// FILE: K.kt - -import kotlin.test.assertEquals - -annotation class Anno(val value: String) - -fun box(): String { - assertEquals("[@Anno(value=J)]", J::class.annotations.toString()) - assertEquals("[@Anno(value=foo)]", J::foo.annotations.toString()) - assertEquals("[@Anno(value=bar)]", J::bar.annotations.toString()) - assertEquals("[@Anno(value=constructor)]", ::J.annotations.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/findAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/findAnnotation.kt deleted file mode 100644 index 9db6204889b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/findAnnotation.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.full.findAnnotation -import kotlin.test.assertNull - -annotation class Yes(val value: String) -annotation class No(val value: String) - -@Yes("OK") -@No("Fail") -class Foo - -class Bar - -fun box(): String { - assertNull(Bar::class.findAnnotation()) - assertNull(Bar::class.findAnnotation()) - - return Foo::class.findAnnotation()?.value ?: "Fail: no annotation" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/openSuspendFun.kt b/backend.native/tests/external/codegen/box/reflection/annotations/openSuspendFun.kt deleted file mode 100644 index 36e5bb880c6..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/openSuspendFun.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -annotation class Anno - -open class Aaa { - @Anno - suspend open fun aaa() {} -} - -class Bbb { - @Anno - suspend fun bbb() {} -} - -fun box(): String { - val bbb = Bbb::class.declaredMemberFunctions.first { it.name == "bbb" }.annotations - assertEquals(1, bbb.size) - assertTrue(bbb.single() is Anno) - val aaa = Aaa::class.declaredMemberFunctions.first { it.name == "aaa" }.annotations - assertEquals(1, aaa.size) - assertTrue(aaa.single() is Anno) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/privateAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/privateAnnotation.kt deleted file mode 100644 index 38296e54dac..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/privateAnnotation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -annotation private class Ann(val name: String) - -class A { - @Ann("OK") - fun foo() {} -} - -fun box(): String { - val ann = A::class.members.single { it.name == "foo" }.annotations.single() as Ann - return ann.name -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/propertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/annotations/propertyAccessors.kt deleted file mode 100644 index 6817dd64513..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/propertyAccessors.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -annotation class Get -annotation class Set -annotation class SetParam - -var foo: String - @Get get() = "" - @Set set(@SetParam value) {} - -fun box(): String { - assert(::foo.getter.annotations.single() is Get) - assert(::foo.setter.annotations.single() is Set) - assert(::foo.setter.parameters.single().annotations.single() is SetParam) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/propertyWithoutBackingField.kt b/backend.native/tests/external/codegen/box/reflection/annotations/propertyWithoutBackingField.kt deleted file mode 100644 index 3a072a5d11e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/propertyWithoutBackingField.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -annotation class Ann(val value: String) - -@Ann("OK") -val property: String - get() = "" - -fun box(): String { - return (::property.annotations.single() as Ann).value -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/retentions.kt b/backend.native/tests/external/codegen/box/reflection/annotations/retentions.kt deleted file mode 100644 index 200c0e1aef0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/retentions.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -@Retention(AnnotationRetention.SOURCE) -annotation class SourceAnno - -@Retention(AnnotationRetention.BINARY) -annotation class BinaryAnno - -@Retention(AnnotationRetention.RUNTIME) -annotation class RuntimeAnno - -@SourceAnno -@BinaryAnno -@RuntimeAnno -fun box(): String { - assertEquals(listOf(RuntimeAnno::class.java), ::box.annotations.map { it.annotationClass.java }) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/simpleClassAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/simpleClassAnnotation.kt deleted file mode 100644 index 5da18e3627b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/simpleClassAnnotation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -@Retention(AnnotationRetention.RUNTIME) -annotation class Simple(val value: String) - -@Simple("OK") -class A - -fun box(): String { - return (A::class.annotations.single() as Simple).value -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/simpleConstructorAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/simpleConstructorAnnotation.kt deleted file mode 100644 index 2d7a036b18c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/simpleConstructorAnnotation.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -annotation class Primary -annotation class Secondary - -class C @Primary constructor() { - @Secondary - constructor(s: String): this() -} - -fun box(): String { - val ans = C::class.constructors.map { it.annotations.single().annotationClass.java.simpleName }.sorted() - if (ans != listOf("Primary", "Secondary")) return "Fail: $ans" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/simpleFunAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/simpleFunAnnotation.kt deleted file mode 100644 index 041cc3f2e6f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/simpleFunAnnotation.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -@Retention(AnnotationRetention.RUNTIME) -annotation class Simple(val value: String) - -@Simple("OK") -fun box(): String { - return (::box.annotations.single() as Simple).value -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/simpleParamAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/simpleParamAnnotation.kt deleted file mode 100644 index 1d45a826b86..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/simpleParamAnnotation.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -@Retention(AnnotationRetention.RUNTIME) -annotation class Simple(val value: String) - -fun test(@Simple("OK") x: Int) {} - -fun box(): String { - return (::test.parameters.single().annotations.single() as Simple).value -} diff --git a/backend.native/tests/external/codegen/box/reflection/annotations/simpleValAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/annotations/simpleValAnnotation.kt deleted file mode 100644 index 216ba88b987..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/annotations/simpleValAnnotation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -@Retention(AnnotationRetention.RUNTIME) -annotation class Simple(val value: String) - -@property:Simple("OK") -val foo: Int = 0 - -fun box(): String { - return (::foo.annotations.single() as Simple).value -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/companionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/companionObjectPropertyAccessors.kt deleted file mode 100644 index 8d50e06674f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/companionObjectPropertyAccessors.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -class Host { - companion object { - val x = 1 - var y = 2 - - val xx: Int - get() = x - - var yy: Int - get() = y - set(value) { y = value } - } -} - -val c_x = Host.Companion::x -val c_xx = Host.Companion::xx -val c_y = Host.Companion::y -val c_yy = Host.Companion::yy - -fun box(): String { - assertEquals(1, c_x.getter()) - assertEquals(1, c_x.getter.call()) - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_y.getter()) - assertEquals(2, c_y.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_y.getter()) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/extensionFunction.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/extensionFunction.kt deleted file mode 100644 index 6ab9b959aca..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/extensionFunction.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* - -fun String.foo(x: String) = this + x -fun String?.bar(x: String) = x - -fun box() = - (""::foo).call("O") + (null::bar).call("K") diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/extensionPropertyAccessors.kt deleted file mode 100644 index 4b56d041aca..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/extensionPropertyAccessors.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -class C(val x: Int, var y: Int) - -val C.xx: Int - get() = x - -var C.yy: Int - get() = y - set(value) { y = value } - - -val c = C(1, 2) - -val c_xx = c::xx -val c_y = c::y -val c_yy = c::yy - -fun box(): String { - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/innerClassConstructor.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/innerClassConstructor.kt deleted file mode 100644 index 57c2527502e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/innerClassConstructor.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class Outer(val x: String) { - inner class Inner(val y: String) { - fun foo() = x + y - } -} - -fun box(): String { - val innerCtor = Outer("O")::Inner - val inner = innerCtor.call("K") - return inner.foo() -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceField.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceField.kt deleted file mode 100644 index 9078fc60f7b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceField.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -// FILE: J.java -public class J { - public final int finalField; - public String mutableField; - - public J(int f, String m) { - this.finalField = f; - this.mutableField = m; - } -} - -// FILE: K.kt -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun box(): String { - val j = J(0, "") - - val jf = j::finalField - val jm = j::mutableField - - assertEquals(0, jf.getter()) - assertEquals(0, jf.getter.call()) - assertEquals("", jm.getter()) - assertEquals("", jm.getter.call()) - - jm.setter("1") - assertEquals("1", j.mutableField) - - jm.setter.call("2") - assertEquals("2", j.mutableField) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceMethod.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceMethod.kt deleted file mode 100644 index 062ef47a0d1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/javaInstanceMethod.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -// FILE: J.java -public class J { - private final int param; - - public J(int param) { - this.param = param; - } - - public String foo(int[] arr, Object[] arr2, Integer y) { - return "" + param + arr[0] + arr2[0] + y; - } -} - -// FILE: K.kt -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun box(): String { - val f = J(0)::foo - assertEquals( - listOf(IntArray::class.java, Array::class.java, Integer::class.java), - f.parameters.map { it.type.javaType } - ) - assertEquals(String::class.java, f.returnType.javaType) - - assertEquals("01A2", f.call(intArrayOf(1), arrayOf("A"), 2)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt deleted file mode 100644 index 783e11d7783..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -class Host { - companion object { - @JvmStatic val x = 1 - @JvmStatic var y = 2 - - @JvmStatic val xx: Int - get() = x - - @JvmStatic var yy: Int - get() = y - set(value) { y = value } - } -} - -val c_x = Host.Companion::x -val c_xx = Host.Companion::xx -val c_y = Host.Companion::y -val c_yy = Host.Companion::yy - -fun box(): String { - assertEquals(1, c_x.getter()) - assertEquals(1, c_x.getter.call()) - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_y.getter()) - assertEquals(2, c_y.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_y.getter()) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectFunction.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectFunction.kt deleted file mode 100644 index 0928bdf0e5a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectFunction.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* - -object Host { - @JvmStatic fun foo(x: String) = x -} - -class CompanionOwner { - companion object { - @JvmStatic fun bar(x: String) = x - } -} - -fun box(): String = - (Host::foo).call("O") + (CompanionOwner.Companion::bar).call("K") diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt deleted file mode 100644 index 26dec0d0f23..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -object Host { - @JvmStatic val x = 1 - @JvmStatic var y = 2 - - @JvmStatic val xx: Int - get() = x - - @JvmStatic var yy: Int - get() = y - set(value) { y = value } -} - -val c_x = Host::x -val c_xx = Host::xx -val c_y = Host::y -val c_yy = Host::yy - -fun box(): String { - assertEquals(1, c_x.getter()) - assertEquals(1, c_x.getter.call()) - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_y.getter()) - assertEquals(2, c_y.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_y.getter()) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/memberFunction.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/memberFunction.kt deleted file mode 100644 index 08854e132cf..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/memberFunction.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* - -class C(val k: String) { - fun foo(s: String) = s + k -} - -fun box(): String = - C("K")::foo.call("O") - diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/memberPropertyAccessors.kt deleted file mode 100644 index 35c955e3b15..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/memberPropertyAccessors.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -class C(val x: Int, var y: Int) { - val xx: Int - get() = x - - var yy: Int - get() = y - set(value) { y = value } -} - -val c = C(1, 2) - -val c_x = c::x -val c_xx = c::xx -val c_y = c::y -val c_yy = c::yy - -fun box(): String { - assertEquals(1, c_x.getter()) - assertEquals(1, c_x.getter.call()) - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_y.getter()) - assertEquals(2, c_y.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_y.getter()) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/objectFunction.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/objectFunction.kt deleted file mode 100644 index ba2c7788999..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/objectFunction.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* - -object Host { - fun foo(x: String) = x -} - -class CompanionOwner { - companion object { - fun bar(x: String) = x - } -} - -fun box(): String = - (Host::foo).call("O") + (CompanionOwner.Companion::bar).call("K") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/call/bound/objectPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/bound/objectPropertyAccessors.kt deleted file mode 100644 index 780f4aa2cda..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/bound/objectPropertyAccessors.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -object Host { - val x = 1 - var y = 2 - - val xx: Int - get() = x - - var yy: Int - get() = y - set(value) { y = value } -} - -val c_x = Host::x -val c_xx = Host::xx -val c_y = Host::y -val c_yy = Host::yy - -fun box(): String { - assertEquals(1, c_x.getter()) - assertEquals(1, c_x.getter.call()) - assertEquals(1, c_xx.getter()) - assertEquals(1, c_xx.getter.call()) - assertEquals(2, c_y.getter()) - assertEquals(2, c_y.getter.call()) - assertEquals(2, c_yy.getter()) - assertEquals(2, c_yy.getter.call()) - - c_y.setter(10) - assertEquals(10, c_y.getter()) - assertEquals(10, c_yy.getter()) - - c_yy.setter(20) - assertEquals(20, c_y.getter()) - assertEquals(20, c_yy.getter()) - - c_y.setter.call(100) - assertEquals(100, c_yy.getter.call()) - - c_yy.setter.call(200) - assertEquals(200, c_y.getter.call()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/callInstanceJavaMethod.kt b/backend.native/tests/external/codegen/box/reflection/call/callInstanceJavaMethod.kt deleted file mode 100644 index 8227fee6f6a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/callInstanceJavaMethod.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - private final int param; - - public J(int param) { - this.param = param; - } - - public String foo(int[] arr, Object[] arr2, Integer y) { - return "" + param + arr[0] + arr2[0] + y; - } -} - -// FILE: K.kt - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun box(): String { - val f = J::foo - assertEquals( - listOf(J::class.java, IntArray::class.java, Array::class.java, Integer::class.java), - f.parameters.map { it.type.javaType } - ) - assertEquals(String::class.java, f.returnType.javaType) - - assertEquals("01A2", f.call(J(0), intArrayOf(1), arrayOf("A"), 2)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/callPrivateJavaMethod.kt b/backend.native/tests/external/codegen/box/reflection/call/callPrivateJavaMethod.kt deleted file mode 100644 index 886689a585d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/callPrivateJavaMethod.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - private final String result; - - private J(String result) { - this.result = result; - } - - private String getResult() { - return result; - } -} - -// FILE: K.kt - -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* -import kotlin.test.* - -fun box(): String { - val c = J::class.constructors.single() - assertFalse(c.isAccessible) - assertFailsWith(IllegalCallableAccessException::class) { c.call("") } - - c.isAccessible = true - assertTrue(c.isAccessible) - val j = c.call("OK") - - val m = J::class.members.single { it.name == "getResult" } - assertFalse(m.isAccessible) - assertFailsWith(IllegalCallableAccessException::class) { m.call(j)!! } - - m.isAccessible = true - return m.call(j) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/callStaticJavaMethod.kt b/backend.native/tests/external/codegen/box/reflection/call/callStaticJavaMethod.kt deleted file mode 100644 index db9248b3f9a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/callStaticJavaMethod.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public static String foo(int x, int[] arr, Object[] arr2) { - return "" + x + arr[0] + arr2[0]; - } -} - -// FILE: K.kt - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun box(): String { - val f = J::foo - assertEquals(listOf(Integer.TYPE, IntArray::class.java, Array::class.java), f.parameters.map { it.type.javaType }) - assertEquals(String::class.java, f.returnType.javaType) - - assertEquals("01A", f.call(0, intArrayOf(1), arrayOf("A"))) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/cannotCallEnumConstructor.kt b/backend.native/tests/external/codegen/box/reflection/call/cannotCallEnumConstructor.kt deleted file mode 100644 index 16d57842386..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/cannotCallEnumConstructor.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* - -enum class E - -fun box(): String { - try { - val c = E::class.constructors.single() - c.isAccessible = true - c.call() - return "Fail: constructing an enum class should not be allowed" - } - catch (e: Throwable) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/disallowNullValueForNotNullField.kt b/backend.native/tests/external/codegen/box/reflection/call/disallowNullValueForNotNullField.kt deleted file mode 100644 index c9c3d77f4ce..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/disallowNullValueForNotNullField.kt +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -class A { - private var foo: String = "" -} - -object O { - @JvmStatic - private var bar: String = "" -} - -class CounterTest(t: T) { - private var baz: String? = "" - private var generic: T = t -} - -fun box(): String { - val p = A::class.memberProperties.single() as KMutableProperty1 - p.isAccessible = true - try { - p.setter.call(A(), null) - return "Fail: exception should have been thrown" - } catch (e: IllegalArgumentException) {} - - - val o = O::class.memberProperties.single() as KMutableProperty1 - o.isAccessible = true - try { - o.setter.call(O, null) - return "Fail: exception should have been thrown" - } catch (e: IllegalArgumentException) {} - - - val c = CounterTest::class.memberProperties.single { it.name == "baz" } as KMutableProperty1, String?> - c.isAccessible = true - c.setter.call(CounterTest(""), null) // Should not fail, because CounterTest::baz is nullable - val d = CounterTest::class.memberProperties.single { it.name == "generic" } as KMutableProperty1, String?> - d.isAccessible = true - d.setter.call(CounterTest(""), null) // Also should not fail, because we can't be sure about nullability of 'generic' - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/box/reflection/call/equalsHashCodeToString.kt deleted file mode 100644 index 9885d12c3c0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/equalsHashCodeToString.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A - -data class D(val s: String) - -fun box(): String { - val a = A() - assert(A::equals.call(a, a)) - assert(!A::equals.call(a, 0)) - assert(A::hashCode.call(a) == A::hashCode.call(a)) - assert(A::toString.call(a).startsWith("A@")) - - assert(D::equals.call(D("foo"), D("foo"))) - assert(!D::equals.call(D("foo"), D("bar"))) - assert(D::hashCode.call(D("foo")) == D::hashCode.call(D("foo"))) - assert(D::toString.call(D("foo")) == "D(s=foo)") - - assert(Int::equals.call(-1, -1)) - assert(Int::hashCode.call(0) != Int::hashCode.call(1)) - assert(Int::toString.call(42) == "42") - - assert(String::equals.call("beer", "beer")) - String::hashCode.call("beer") - - return String::toString.call("OK") -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/exceptionHappened.kt b/backend.native/tests/external/codegen/box/reflection/call/exceptionHappened.kt deleted file mode 100644 index 3cd7d8f73fe..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/exceptionHappened.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.InvocationTargetException - -fun fail(message: String) { - throw AssertionError(message) -} - -fun box(): String { - try { - ::fail.call("OK") - } catch (e: InvocationTargetException) { - return e.getTargetException().message.toString() - } - - return "Fail: no exception was thrown" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/fakeOverride.kt b/backend.native/tests/external/codegen/box/reflection/call/fakeOverride.kt deleted file mode 100644 index 39210c68142..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/fakeOverride.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -open class A { - fun foo() = "OK" -} - -class B : A() - -fun box(): String { - val foo = B::class.members.single { it.name == "foo" } - return foo.call(B()) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/fakeOverrideSubstituted.kt b/backend.native/tests/external/codegen/box/reflection/call/fakeOverrideSubstituted.kt deleted file mode 100644 index d98c38cd636..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/fakeOverrideSubstituted.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -open class A(val t: T) { - fun foo() = t -} - -class B(s: String) : A(s) - -fun box(): String { - val foo = B::class.members.single { it.name == "foo" } - return foo.call(B("OK")) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/incorrectNumberOfArguments.kt b/backend.native/tests/external/codegen/box/reflection/call/incorrectNumberOfArguments.kt deleted file mode 100644 index e08b3df5305..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/incorrectNumberOfArguments.kt +++ /dev/null @@ -1,108 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.isAccessible -import kotlin.reflect.KCallable -import kotlin.reflect.KFunction -import kotlin.reflect.KMutableProperty - -var foo: String = "" - -class A(private var bar: String = "") { - fun getBar() = A::bar -} - -object O { - @JvmStatic - private var baz: String = "" - - @JvmStatic - fun getBaz() = (O::class.members.single { it.name == "baz" } as KMutableProperty<*>).apply { isAccessible = true } - - fun getGetBaz() = O::class.members.single { it.name == "getBaz" } as KFunction<*> -} - -fun check(callable: KCallable<*>, vararg args: Any?) { - val expected = callable.parameters.size - val actual = args.size - - if (expected == actual) { - throw AssertionError("Bad test case: expected and actual number of arguments should differ (was $expected vs $actual)") - } - - val expectedExceptionMessage = "Callable expects $expected arguments, but $actual were provided." - - try { - callable.call(*args) - throw AssertionError("Fail: an IllegalArgumentException should have been thrown") - } catch (e: IllegalArgumentException) { - if (e.message != expectedExceptionMessage) { - // This most probably means that we don't check number of passed arguments in reflection - // and the default check from Java reflection yields an IllegalArgumentException, but with a not that helpful message - throw AssertionError("Fail: an exception with an unrecognized message was thrown: \"${e.message}\"" + - "\nExpected message was: $expectedExceptionMessage") - } - } -} - -fun box(): String { - check(::box, null) - check(::box, "") - - check(::A) - check(::A, null, "") - - check(O.getGetBaz()) - check(O.getGetBaz(), null, "") - - - val f = ::foo - check(f, null) - check(f, null, null) - check(f, arrayOf(null)) - check(f, "") - - check(f.getter, null) - check(f.getter, null, null) - check(f.getter, arrayOf(null)) - check(f.getter, "") - - check(f.setter) - check(f.setter, null, null) - check(f.setter, null, "") - - - val b = A().getBar() - - check(b) - check(b, null, null) - check(b, "", "") - - check(b.getter) - check(b.getter, null, null) - check(b.getter, "", "") - - check(b.setter) - check(b.setter, null) - check(b.setter, "") - - - val z = O.getBaz() - - check(z) - check(z, null, null) - check(z, "", "") - - check(z.getter) - check(z.getter, null, null) - check(z.getter, "", "") - - check(z.setter) - check(z.setter, null) - check(z.setter, "") - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/innerClassConstructor.kt b/backend.native/tests/external/codegen/box/reflection/call/innerClassConstructor.kt deleted file mode 100644 index 60aca8cd5cd..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/innerClassConstructor.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A { - class Nested(val result: String) - inner class Inner(val result: String) -} - -fun box(): String { - return (A::Nested).call("O").result + (A::Inner).call((::A).call(), "K").result -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/jvmStatic.kt b/backend.native/tests/external/codegen/box/reflection/call/jvmStatic.kt deleted file mode 100644 index 94ea4ffcf51..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/jvmStatic.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -object Obj { - @JvmStatic - fun foo() {} -} - -class C { - companion object { - @JvmStatic - fun bar() {} - } -} - -fun box(): String { - (Obj::class.members.single { it.name == "foo" }).call(Obj) - (C.Companion::class.members.single { it.name == "bar" }).call(C.Companion) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/jvmStaticInObjectIncorrectReceiver.kt b/backend.native/tests/external/codegen/box/reflection/call/jvmStaticInObjectIncorrectReceiver.kt deleted file mode 100644 index 34802763740..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/jvmStaticInObjectIncorrectReceiver.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -object Obj { - @JvmStatic - fun foo(s: String) {} - - @JvmStatic - fun bar() {} - - @JvmStatic - fun sly(obj: Obj) {} - - operator fun get(name: String) = Obj::class.members.single { it.name == name } -} - -fun box(): String { - // This should succeed - (Obj["foo"]).call(Obj, "") - (Obj["bar"]).call(Obj) - (Obj["sly"]).call(Obj, Obj) - - // This shouldn't: first argument should always be Obj - try { - (Obj["foo"]).call(null, "") - return "Fail foo" - } catch (e: IllegalArgumentException) {} - - try { - (Obj["bar"]).call("") - return "Fail bar" - } catch (e: IllegalArgumentException) {} - - try { - (Obj["sly"]).call(Obj) - return "Fail sly 1" - } catch (e: IllegalArgumentException) {} - - try { - (Obj["sly"]).call(null, Obj) - return "Fail sly 2" - } catch (e: IllegalArgumentException) {} - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/localClassMember.kt b/backend.native/tests/external/codegen/box/reflection/call/localClassMember.kt deleted file mode 100644 index 3651f0ed3d9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/localClassMember.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - class Local { - fun result(s: String) = s - } - - return Local::result.call(Local(), "OK") -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/memberOfGenericClass.kt b/backend.native/tests/external/codegen/box/reflection/call/memberOfGenericClass.kt deleted file mode 100644 index e01db003dc0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/memberOfGenericClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -var result = "Fail" - -class A { - fun foo(t: T) { - result = t as String - } -} - -fun box(): String { - (A::foo).call(A(), "OK") - return result -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/privateProperty.kt b/backend.native/tests/external/codegen/box/reflection/call/privateProperty.kt deleted file mode 100644 index a9dcc40ebfb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/privateProperty.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* -import kotlin.test.* - -class A(private var result: String) - -fun box(): String { - val a = A("abc") - - val p = A::class.declaredMemberProperties.single() as KMutableProperty1 - p.isAccessible = true - assertEquals("abc", p.call(a)) - assertEquals(Unit, p.setter.call(a, "def")) - assertEquals("def", p.getter.call(a)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/propertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/call/propertyAccessors.kt deleted file mode 100644 index c52ee4617e8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/propertyAccessors.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -val p0 = 1 -val Int.p1: Int get() = this -class A { - val Int.p2: Int get() = this -} - -var globalCounter = 0 - -var mp0 = 1 - set(value) { globalCounter += value } -var Int.mp1: Int - get() = this - set(value) { globalCounter += value } -class B { - var Int.mp2: Int - get() = this - set(value) { globalCounter += value } -} - - -fun box(): String { - assertEquals(1, (::p0).call()) - assertEquals(1, (::p0).getter.call()) - assertEquals(2, (Int::p1).call(2)) - assertEquals(2, (Int::p1).getter.call(2)) - val p2 = A::class.memberExtensionProperties.single() - assertEquals(3, p2.call(A(), 3)) - assertEquals(3, p2.getter.call(A(), 3)) - - assertEquals(1, (::mp0).call()) - assertEquals(1, (::mp0).getter.call()) - assertEquals(2, (Int::mp1).call(2)) - assertEquals(2, (Int::mp1).getter.call(2)) - val mp2 = B::class.memberExtensionProperties.single() as KMutableProperty2 - assertEquals(3, mp2.call(B(), 3)) - assertEquals(3, mp2.getter.call(B(), 3)) - - assertEquals(Unit, (::mp0).setter.call(1)) - assertEquals(Unit, (Int::mp1).setter.call(0, 3)) - assertEquals(Unit, mp2.setter.call(B(), 0, 5)) - if (globalCounter != 9) return "Fail: $globalCounter" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt b/backend.native/tests/external/codegen/box/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt deleted file mode 100644 index 3e8a009e650..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -data class Foo(val id: String) { - fun getId() = -42 // Fail -} - -fun box(): String { - return Foo::id.call(Foo("OK")) -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/protectedMembers.kt b/backend.native/tests/external/codegen/box/reflection/call/protectedMembers.kt deleted file mode 100644 index ab438543565..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/protectedMembers.kt +++ /dev/null @@ -1,35 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.* - -abstract class Base { - protected val protectedVal: String - get() = "1" - - var publicVarProtectedSet: String = "" - protected set - - protected fun protectedFun(): String = "3" -} - -class Derived : Base() - -fun member(name: String): KCallable<*> = Derived::class.members.single { it.name == name }.apply { isAccessible = true } - -fun box(): String { - val a = Derived() - - assertEquals("1", member("protectedVal").call(a)) - - val publicVarProtectedSet = member("publicVarProtectedSet") as KMutableProperty1 - publicVarProtectedSet.setter.call(a, "2") - assertEquals("2", publicVarProtectedSet.getter.call(a)) - assertEquals("2", publicVarProtectedSet.call(a)) - - assertEquals("3", member("protectedFun").call(a)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/returnUnit.kt b/backend.native/tests/external/codegen/box/reflection/call/returnUnit.kt deleted file mode 100644 index d7bc48f26c0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/returnUnit.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo() {} - -class A { - fun bar() {} -} - -object O { - @JvmStatic fun baz() {} -} - -fun nullableUnit(unit: Boolean): Unit? = if (unit) Unit else null - -fun box(): String { - assertEquals(Unit, ::foo.call()) - assertEquals(Unit, A::bar.call(A())) - assertEquals(Unit, O::class.members.single { it.name == "baz" }.call(O)) - - assertEquals(Unit, (::nullableUnit).call(true)) - assertEquals(null, (::nullableUnit).call(false)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/simpleConstructor.kt b/backend.native/tests/external/codegen/box/reflection/call/simpleConstructor.kt deleted file mode 100644 index 6a71248b113..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/simpleConstructor.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A(val result: String) - -fun box(): String { - val a = (::A).call("OK") - return a.result -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/simpleMemberFunction.kt b/backend.native/tests/external/codegen/box/reflection/call/simpleMemberFunction.kt deleted file mode 100644 index 52edb5a0b8e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/simpleMemberFunction.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A { - fun foo(x: Int, y: Int) = x + y -} - -fun box(): String { - val x = (A::foo).call(A(), 42, 239) - if (x != 281) return "Fail: $x" - - try { - (A::foo).call() - return "Fail: no exception" - } - catch (e: Exception) {} - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/call/simpleTopLevelFunctions.kt b/backend.native/tests/external/codegen/box/reflection/call/simpleTopLevelFunctions.kt deleted file mode 100644 index ea29b5e704d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/call/simpleTopLevelFunctions.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun String.foo(): Int = length - -var state = "Fail" - -fun bar(result: String) { - state = result -} - -fun box(): String { - val f = (String::foo).call("abc") - if (f != 3) return "Fail: $f" - - try { - (String::foo).call() - return "Fail: IllegalArgumentException should have been thrown" - } - catch (e: IllegalArgumentException) {} - - try { - (String::foo).call(42) - return "Fail: IllegalArgumentException should have been thrown" - } - catch (e: IllegalArgumentException) {} - - (::bar).call("OK") - return state -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionFunction.kt b/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionFunction.kt deleted file mode 100644 index 63fe644d988..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionFunction.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun String.extFun(k: String, s: String = "") = this + k + s - -fun box(): String { - val sExtFun = "O"::extFun - return sExtFun.callBy(mapOf(sExtFun.parameters[0] to "K")) -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionPropertyAcessor.kt b/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionPropertyAcessor.kt deleted file mode 100644 index 8e833ec0601..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/boundExtensionPropertyAcessor.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -val String.plusK: String - get() = this + "K" - -fun box(): String = - ("O"::plusK).getter.callBy(mapOf()) diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/boundJvmStaticInObject.kt b/backend.native/tests/external/codegen/box/reflection/callBy/boundJvmStaticInObject.kt deleted file mode 100644 index 7af5da2333c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/boundJvmStaticInObject.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -object Host { - @JvmStatic fun concat(s1: String, s2: String, s3: String = "K", s4: String = "x") = - s1 + s2 + s3 + s4 -} - -fun box(): String { - val concat = Host::concat - val concatParams = concat.parameters - return concat.callBy(mapOf( - concatParams[0] to "", - concatParams[1] to "O", - concatParams[3] to "" - )) -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/companionObject.kt b/backend.native/tests/external/codegen/box/reflection/callBy/companionObject.kt deleted file mode 100644 index 5f7e2e56051..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/companionObject.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class C { - companion object { - fun foo(a: String, b: String = "b") = a + b - } -} - -fun box(): String { - val f = C.Companion::class.members.single { it.name == "foo" } - - // Any object method currently requires the object instance passed - try { - f.callBy(mapOf( - f.parameters.single { it.name == "a" } to "a" - )) - return "Fail: IllegalArgumentException should have been thrown" - } - catch (e: IllegalArgumentException) { - // OK - } - - assertEquals("ab", f.callBy(mapOf( - f.parameters.first() to C, - f.parameters.single { it.name == "a" } to "a" - ))) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/defaultAndNonDefaultIntertwined.kt b/backend.native/tests/external/codegen/box/reflection/callBy/defaultAndNonDefaultIntertwined.kt deleted file mode 100644 index c75b0793f1b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/defaultAndNonDefaultIntertwined.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo(a: String, b: String = "b", c: String, d: String = "d", e: String) = - a + b + c + d + e - -fun box(): String { - val p = ::foo.parameters - assertEquals("abcde", ::foo.callBy(mapOf( - p[0] to "a", - p[2] to "c", - p[4] to "e" - ))) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/extensionFunction.kt b/backend.native/tests/external/codegen/box/reflection/callBy/extensionFunction.kt deleted file mode 100644 index b444a3c9358..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/extensionFunction.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun String.sum(other: String = "b") = this + other - -fun box(): String { - val f = String::sum - assertEquals("ab", f.callBy(mapOf(f.parameters.first() to "a"))) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInCompanionObject.kt b/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInCompanionObject.kt deleted file mode 100644 index f4c70d27d38..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInCompanionObject.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -// KT-12915 IAE on callBy of JvmStatic function with default arguments - -import kotlin.test.assertEquals - -class C { - companion object { - @JvmStatic - fun foo(a: String, b: String = "b") = a + b - } -} - -fun box(): String { - val f = C.Companion::class.members.single { it.name == "foo" } - - // Any object method currently requires the object instance passed - try { - f.callBy(mapOf( - f.parameters.single { it.name == "a" } to "a" - )) - return "Fail: IllegalArgumentException should have been thrown" - } - catch (e: IllegalArgumentException) { - // OK - } - - assertEquals("ab", f.callBy(mapOf( - f.parameters.first() to C, - f.parameters.single { it.name == "a" } to "a" - ))) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInObject.kt b/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInObject.kt deleted file mode 100644 index 83a1120e2c8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/jvmStaticInObject.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -object Obj { - @JvmStatic - fun foo(a: String, b: String = "b") = a + b -} - -fun box(): String { - val f = Obj::class.members.single { it.name == "foo" } - - // Any object method currently requires the object instance passed - try { - f.callBy(mapOf( - f.parameters.single { it.name == "a" } to "a" - )) - return "Fail: IllegalArgumentException should have been thrown" - } - catch (e: IllegalArgumentException) { - // OK - } - - assertEquals("ab", f.callBy(mapOf( - f.parameters.first() to Obj, - f.parameters.single { it.name == "a" } to "a" - ))) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultConstructor.kt b/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultConstructor.kt deleted file mode 100644 index 1a99569f436..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultConstructor.kt +++ /dev/null @@ -1,99 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.test.assertEquals - -// Generate: -// (1..70).map { " p${"%02d".format(it)}: Int," }.joinToString("\n") - -class A( - p01: Int, - p02: Int, - p03: Int, - p04: Int, - p05: Int, - p06: Int, - p07: Int, - p08: Int, - p09: Int, - p10: Int, - p11: Int, - p12: Int, - p13: Int, - p14: Int, - p15: Int, - p16: Int, - p17: Int, - p18: Int, - p19: Int, - p20: Int, - p21: Int, - p22: Int, - p23: Int, - p24: Int, - p25: Int, - p26: Int, - p27: Int, - p28: Int, - p29: Int, - p30: Int, - p31: Int, - p32: Int, - p33: Int, - p34: Int, - p35: Int, - p36: Int, - p37: Int, - p38: Int, - p39: Int, - p40: Int, - p41: Int, - p42: Int, - p43: Int, - p44: Int, - p45: Int, - p46: Int, - p47: Int, - p48: Int, - p49: Int, - p50: Int, - p51: Int, - p52: Int, - p53: Int, - p54: Int, - p55: Int, - p56: Int, - p57: Int, - p58: Int, - p59: Int, - p60: Int, - p61: Int, - p62: Int, - p63: Int, - p64: Int, - p65: Int, - p66: Int, - p67: Int, - p68: Int, - p69: Int, - p70: Int -) { - init { - assertEquals(1, p01) - assertEquals(41, p41) - assertEquals(42, p42) - assertEquals(43, p43) - assertEquals(70, p70) - } -} - -fun box(): String { - val f = A::class.constructors.single() - val parameters = f.parameters - - f.callBy(mapOf( - *((1..70)).map { i -> parameters[i - 1] to i }.toTypedArray() - )) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultFunction.kt b/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultFunction.kt deleted file mode 100644 index e316997b26f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsNoneDefaultFunction.kt +++ /dev/null @@ -1,100 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.test.assertEquals - -// Generate: -// (1..70).map { " p${"%02d".format(it)}: Int," }.joinToString("\n") - -class A { - fun foo( - p01: Int, - p02: Int, - p03: Int, - p04: Int, - p05: Int, - p06: Int, - p07: Int, - p08: Int, - p09: Int, - p10: Int, - p11: Int, - p12: Int, - p13: Int, - p14: Int, - p15: Int, - p16: Int, - p17: Int, - p18: Int, - p19: Int, - p20: Int, - p21: Int, - p22: Int, - p23: Int, - p24: Int, - p25: Int, - p26: Int, - p27: Int, - p28: Int, - p29: Int, - p30: Int, - p31: Int, - p32: Int, - p33: Int, - p34: Int, - p35: Int, - p36: Int, - p37: Int, - p38: Int, - p39: Int, - p40: Int, - p41: Int, - p42: Int, - p43: Int, - p44: Int, - p45: Int, - p46: Int, - p47: Int, - p48: Int, - p49: Int, - p50: Int, - p51: Int, - p52: Int, - p53: Int, - p54: Int, - p55: Int, - p56: Int, - p57: Int, - p58: Int, - p59: Int, - p60: Int, - p61: Int, - p62: Int, - p63: Int, - p64: Int, - p65: Int, - p66: Int, - p67: Int, - p68: Int, - p69: Int, - p70: Int - ) { - assertEquals(1, p01) - assertEquals(41, p41) - assertEquals(42, p42) - assertEquals(43, p43) - assertEquals(70, p70) - } -} - -fun box(): String { - val f = A::class.members.single { it.name == "foo" } - val parameters = f.parameters - - f.callBy(mapOf( - parameters.first() to A(), - *((1..70)).map { i -> parameters[i] to i }.toTypedArray() - )) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsOnlyOneDefault.kt b/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsOnlyOneDefault.kt deleted file mode 100644 index 8f9a92519fd..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/manyArgumentsOnlyOneDefault.kt +++ /dev/null @@ -1,102 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -// Generate: -// (1..70).map { " p${"%02d".format(it)}: Int," }.joinToString("\n") - -class A { - fun foo( - p01: Int, - p02: Int, - p03: Int, - p04: Int, - p05: Int, - p06: Int, - p07: Int, - p08: Int, - p09: Int, - p10: Int, - p11: Int, - p12: Int, - p13: Int, - p14: Int, - p15: Int, - p16: Int, - p17: Int, - p18: Int, - p19: Int, - p20: Int, - p21: Int, - p22: Int, - p23: Int, - p24: Int, - p25: Int, - p26: Int, - p27: Int, - p28: Int, - p29: Int, - p30: Int, - p31: Int, - p32: Int, - p33: Int, - p34: Int, - p35: Int, - p36: Int, - p37: Int, - p38: Int, - p39: Int, - p40: Int, - p41: Int, - p42: Int = 239, - p43: Int, - p44: Int, - p45: Int, - p46: Int, - p47: Int, - p48: Int, - p49: Int, - p50: Int, - p51: Int, - p52: Int, - p53: Int, - p54: Int, - p55: Int, - p56: Int, - p57: Int, - p58: Int, - p59: Int, - p60: Int, - p61: Int, - p62: Int, - p63: Int, - p64: Int, - p65: Int, - p66: Int, - p67: Int, - p68: Int, - p69: Int, - p70: Int - ) { - assertEquals(1, p01) - assertEquals(41, p41) - assertEquals(239, p42) - assertEquals(43, p43) - assertEquals(70, p70) - } -} - -fun box(): String { - val f = A::class.members.single { it.name == "foo" } - val parameters = f.parameters - - f.callBy(mapOf( - parameters.first() to A(), - *((1..41) + (43..70)).map { i -> parameters[i] to i }.toTypedArray() - )) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/manyMaskArguments.kt b/backend.native/tests/external/codegen/box/reflection/callBy/manyMaskArguments.kt deleted file mode 100644 index 002da4ac148..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/manyMaskArguments.kt +++ /dev/null @@ -1,100 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -// Generate: -// (1..70).map { " p${"%02d".format(it)}: Int = $it," }.joinToString("\n") - -class A { - fun foo( - p01: Int = 1, - p02: Int = 2, - p03: Int = 3, - p04: Int = 4, - p05: Int = 5, - p06: Int = 6, - p07: Int = 7, - p08: Int = 8, - p09: Int = 9, - p10: Int = 10, - p11: Int = 11, - p12: Int = 12, - p13: Int = 13, - p14: Int = 14, - p15: Int = 15, - p16: Int = 16, - p17: Int = 17, - p18: Int = 18, - p19: Int = 19, - p20: Int = 20, - p21: Int = 21, - p22: Int = 22, - p23: Int = 23, - p24: Int = 24, - p25: Int = 25, - p26: Int = 26, - p27: Int = 27, - p28: Int = 28, - p29: Int = 29, - p30: Int = 30, - p31: Int = 31, - p32: Int = 32, - p33: Int = 33, - p34: Int = 34, - p35: Int = 35, - p36: Int = 36, - p37: Int = 37, - p38: Int = 38, - p39: Int = 39, - p40: Int = 40, - p41: Int = 41, - p42: Int, - p43: Int = 43, - p44: Int = 44, - p45: Int = 45, - p46: Int = 46, - p47: Int = 47, - p48: Int = 48, - p49: Int = 49, - p50: Int = 50, - p51: Int = 51, - p52: Int = 52, - p53: Int = 53, - p54: Int = 54, - p55: Int = 55, - p56: Int = 56, - p57: Int = 57, - p58: Int = 58, - p59: Int = 59, - p60: Int = 60, - p61: Int = 61, - p62: Int = 62, - p63: Int = 63, - p64: Int = 64, - p65: Int = 65, - p66: Int = 66, - p67: Int = 67, - p68: Int = 68, - p69: Int = 69, - p70: Int = 70 - ) { - assertEquals(1, p01) - assertEquals(41, p41) - assertEquals(239, p42) - assertEquals(43, p43) - assertEquals(70, p70) - } -} - -fun box(): String { - val f = A::class.members.single { it.name == "foo" } - val parameters = f.parameters - f.callBy(mapOf( - parameters.first() to A(), - parameters.single { it.name == "p42" } to 239 - )) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/nonDefaultParameterOmitted.kt b/backend.native/tests/external/codegen/box/reflection/callBy/nonDefaultParameterOmitted.kt deleted file mode 100644 index fb25dac5f87..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/nonDefaultParameterOmitted.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun foo(x: Int, y: Int = 2) = x + y - -fun box(): String { - try { - ::foo.callBy(mapOf()) - return "Fail: IllegalArgumentException must have been thrown" - } - catch (e: IllegalArgumentException) { - // OK - } - - try { - ::foo.callBy(mapOf(::foo.parameters.last() to 1)) - return "Fail: IllegalArgumentException must have been thrown" - } - catch (e: IllegalArgumentException) { - // OK - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/nullValue.kt b/backend.native/tests/external/codegen/box/reflection/callBy/nullValue.kt deleted file mode 100644 index 289b8a26de6..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/nullValue.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertNull - -fun foo(x: String? = "Fail") { - assertNull(x) -} - -fun box(): String { - ::foo.callBy(mapOf(::foo.parameters.single() to null)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt b/backend.native/tests/external/codegen/box/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt deleted file mode 100644 index 71468dcc19f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import kotlin.test.assertEquals - -fun foo(result: String = "foo") { - assertEquals("box", result) - - // Check that this function was invoked directly and not through the "foo$default", i.e. there's no "foo$default" in the stack trace - val st = Thread.currentThread().stackTrace - for (i in 0..5) { - if ("foo\$default" in st[i].methodName) { - throw AssertionError("KCallable.call should invoke the method directly if all arguments are provided") - } - } -} - -fun box(): String { - ::foo.callBy(mapOf(::foo.parameters.single() to "box")) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/primitiveDefaultValues.kt b/backend.native/tests/external/codegen/box/reflection/callBy/primitiveDefaultValues.kt deleted file mode 100644 index 9e1ba89d17d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/primitiveDefaultValues.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun primitives( - boolean: Boolean = true, - character: Char = 'z', - byte: Byte = 5.toByte(), - short: Short = (-5).toShort(), - int: Int = 2000000000, - float: Float = -2.72f, - long: Long = 1000000000000000000L, - double: Double = 3.14159265359 -) { - assertEquals(true, boolean) - assertEquals('z', character) - assertEquals(5.toByte(), byte) - assertEquals((-5).toShort(), short) - assertEquals(2000000000, int) - assertEquals(-2.72f, float) - assertEquals(1000000000000000000L, long) - assertEquals(3.14159265359, double) -} - -fun box(): String { - ::primitives.callBy(emptyMap()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/privateMemberFunction.kt b/backend.native/tests/external/codegen/box/reflection/callBy/privateMemberFunction.kt deleted file mode 100644 index 1c9b4f4dbf1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/privateMemberFunction.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.IllegalCallableAccessException -import kotlin.reflect.jvm.isAccessible - -class A { - private fun foo(default: Any? = this) { - } - - fun f() = A::foo -} - -fun box(): String { - val a = A() - val f = a.f() - - try { - f.callBy(mapOf(f.parameters.first() to a)) - return "Fail: IllegalCallableAccessException should have been thrown" - } - catch (e: IllegalCallableAccessException) { - // OK - } - - f.isAccessible = true - f.callBy(mapOf(f.parameters.first() to a)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/simpleConstructor.kt b/backend.native/tests/external/codegen/box/reflection/callBy/simpleConstructor.kt deleted file mode 100644 index e8739d2b0ec..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/simpleConstructor.kt +++ /dev/null @@ -1,8 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A(val result: String = "OK") - -fun box(): String = ::A.callBy(mapOf()).result diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/simpleMemberFunciton.kt b/backend.native/tests/external/codegen/box/reflection/callBy/simpleMemberFunciton.kt deleted file mode 100644 index afef083b80a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/simpleMemberFunciton.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A(val result: String = "OK") { - fun foo(x: Int = 42): String { - assert(x == 42) { x } - return result - } -} - -fun box(): String = A::foo.callBy(mapOf(A::foo.parameters.first() to A())) diff --git a/backend.native/tests/external/codegen/box/reflection/callBy/simpleTopLevelFunction.kt b/backend.native/tests/external/codegen/box/reflection/callBy/simpleTopLevelFunction.kt deleted file mode 100644 index 4d7e1bab754..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/callBy/simpleTopLevelFunction.kt +++ /dev/null @@ -1,8 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun foo(result: String = "OK") = result - -fun box(): String = ::foo.callBy(mapOf()) diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/annotationClassLiteral.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/annotationClassLiteral.kt deleted file mode 100644 index 28d5dd9a046..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/annotationClassLiteral.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals("Deprecated", Deprecated::class.simpleName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/arrays.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/arrays.kt deleted file mode 100644 index 89f972009a0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/arrays.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* -import kotlin.reflect.KClass - -fun box(): String { - val any = Array::class - val string = Array::class - - assertNotEquals>(any, string) - assertNotEquals>(any.java, string.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/builtinClassLiterals.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/builtinClassLiterals.kt deleted file mode 100644 index 84579d3b5e2..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/builtinClassLiterals.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals("Any", Any::class.simpleName) - assertEquals("String", String::class.simpleName) - assertEquals("CharSequence", CharSequence::class.simpleName) - assertEquals("Number", Number::class.simpleName) - assertEquals("Int", Int::class.simpleName) - assertEquals("Long", Long::class.simpleName) - - assertEquals("Array", Array::class.simpleName) - assertEquals("Array", Array::class.simpleName) - - assertEquals("Companion", Int.Companion::class.simpleName) - assertEquals("Companion", Double.Companion::class.simpleName) - assertEquals("Companion", Char.Companion::class.simpleName) - - assertEquals("IntRange", IntRange::class.simpleName) - - assertEquals("List", List::class.simpleName) - - // TODO: this is wrong but should be fixed - assertEquals("List", MutableList::class.simpleName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/genericArrays.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/genericArrays.kt deleted file mode 100644 index 60ad96ec239..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/genericArrays.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -class Klass - -inline fun arrayClass(): KClass> = Array::class - -fun box(): String { - assertEquals("Array", arrayClass().simpleName) - assertEquals("Array", arrayClass().simpleName) - assertEquals("Array", arrayClass>().simpleName) - assertEquals("Array", arrayClass().simpleName) - assertEquals("Array", arrayClass().simpleName) - assertEquals("Array", arrayClass>().simpleName) - assertEquals("Array", arrayClass>().simpleName) - - // Should not be that way. Fix this test when backend is fixed. - assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) - assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/genericClass.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/genericClass.kt deleted file mode 100644 index 5c0fabfb976..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/genericClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_REFLECT - -import kotlin.test.assertEquals - -class Generic - -fun box(): String { - val g = Generic::class - assertEquals("Generic", g.simpleName) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt deleted file mode 100644 index 634efba9520..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -class Klass -class Other - -inline fun simpleName(): String = - T::class.simpleName!! - -inline fun twoReifiedParams(): String = - "${T1::class.simpleName!!}, ${T2::class.simpleName!!}" - -inline fun myJavaClass(): Class = - T::class.java - -fun box(): String { - assertEquals("Klass", simpleName()) - assertEquals("Int", simpleName()) - assertEquals("Array", simpleName>()) - assertEquals("Error", simpleName()) - assertEquals("Klass, Other", twoReifiedParams()) - - assertEquals(String::class.java, myJavaClass()) - assertEquals(IntArray::class.java, myJavaClass()) - assertEquals(Klass::class.java, myJavaClass()) - assertEquals(Error::class.java, myJavaClass()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classLiterals/simpleClassLiteral.kt b/backend.native/tests/external/codegen/box/reflection/classLiterals/simpleClassLiteral.kt deleted file mode 100644 index 966c774df65..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classLiterals/simpleClassLiteral.kt +++ /dev/null @@ -1,9 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_REFLECT - -class A - -fun box(): String { - val klass = A::class - return if (klass.toString() == "class A") "OK" else "Fail: $klass" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/classSimpleName.kt b/backend.native/tests/external/codegen/box/reflection/classes/classSimpleName.kt deleted file mode 100644 index fc355592cfa..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/classSimpleName.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class Klass - -fun box(): String { - assertEquals("Klass", Klass::class.simpleName) - assertEquals("Date", java.util.Date::class.simpleName) - assertEquals("ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.simpleName) - assertEquals("Void", java.lang.Void::class.simpleName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/companionObject.kt b/backend.native/tests/external/codegen/box/reflection/classes/companionObject.kt deleted file mode 100644 index b8e0c301107..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/companionObject.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.* - -class A { - companion object C -} - -enum class E { - ENTRY; - companion object {} -} - -fun box(): String { - val obj = A::class.companionObject - assertNotNull(obj) - assertEquals("C", obj!!.simpleName) - - assertEquals(A.C, A::class.companionObjectInstance) - assertEquals(A.C, obj.objectInstance) - - assertNull(A.C::class.companionObject) - assertNull(A.C::class.companionObjectInstance) - - assertEquals(E.Companion, E::class.companionObjectInstance) - - assertEquals(String, String::class.companionObjectInstance) - assertEquals(String, String.Companion::class.objectInstance) - assertEquals(Enum, Enum::class.companionObjectInstance) - assertEquals(Enum, Enum.Companion::class.objectInstance) - assertEquals(Double, Double::class.companionObjectInstance) - assertEquals(Double, Double.Companion::class.objectInstance) - assertEquals(Float, Float::class.companionObjectInstance) - assertEquals(Float, Float.Companion::class.objectInstance) - assertEquals(Int, Int::class.companionObjectInstance) - assertEquals(Int, Int.Companion::class.objectInstance) - assertEquals(Long, Long::class.companionObjectInstance) - assertEquals(Long, Long.Companion::class.objectInstance) - assertEquals(Short, Short::class.companionObjectInstance) - assertEquals(Short, Short.Companion::class.objectInstance) - assertEquals(Byte, Byte::class.companionObjectInstance) - assertEquals(Byte, Byte.Companion::class.objectInstance) - assertEquals(Char, Char::class.companionObjectInstance) - assertEquals(Char, Char.Companion::class.objectInstance) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/createInstance.kt b/backend.native/tests/external/codegen/box/reflection/classes/createInstance.kt deleted file mode 100644 index 439de318d50..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/createInstance.kt +++ /dev/null @@ -1,76 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createInstance -import kotlin.test.assertTrue -import kotlin.test.fail - -// Good classes - -class Simple -class PrimaryWithDefaults(val d1: String = "d1", val d2: Int = 2) -class Secondary(val s: String) { - constructor() : this("s") -} -class SecondaryWithDefaults(val s: String) { - constructor(x: Int = 0) : this(x.toString()) -} -class SecondaryWithDefaultsNoPrimary { - constructor(x: Int) {} - constructor(s: String = "") {} -} - -// Bad classes - -class NoNoArgConstructor(val s: String) { - constructor(x: Int) : this(x.toString()) -} -class NoArgAndDefault() { - constructor(x: Int = 0) : this() -} -class DefaultPrimaryAndDefaultSecondary(val s: String = "") { - constructor(x: Int = 0) : this(x.toString()) -} -class SeveralDefaultSecondaries { - constructor(x: Int = 0) {} - constructor(s: String = "") {} - constructor(d: Double = 3.14) {} -} -class PrivateConstructor private constructor() -object Object - -// ----------- - -inline fun test() { - val instance = T::class.createInstance() - assertTrue(instance is T) -} - -inline fun testFail() { - try { - T::class.createInstance() - fail("createInstance should have failed on ${T::class}") - } catch (e: Exception) { - // OK - } -} - -fun box(): String { - test() - test() - test() - test() - test() - test() - - testFail() - testFail() - testFail() - testFail() - testFail() - testFail() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/declaredMembers.kt b/backend.native/tests/external/codegen/box/reflection/classes/declaredMembers.kt deleted file mode 100644 index 5902aafbae9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/declaredMembers.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: I.java - -public class I { - public static void publicStaticI() {} - public void publicMemberI() {} - private static void privateStaticI() {} - private void privateMemberI() {} -} - -// FILE: J.java - -public class J extends I { - public static void publicStaticJ() {} - public void publicMemberJ() {} - private static void privateStaticJ() {} - private void privateMemberJ() {} -} - -// FILE: K.kt - -import kotlin.reflect.full.declaredMembers -import kotlin.test.assertEquals - -open class K : J() { - open fun publicKFun() {} - private fun privateKFun() {} - var publicKProp = Unit - private val privateKProp = Unit -} - -class L : K() { - fun publicLFun() {} - private fun privateLFun() {} - val publicLProp = Unit - private var privateLProp = Unit -} - -inline fun test(vararg names: String) { - assertEquals(names.toSet(), T::class.declaredMembers.map { it.name }.toSet()) -} - -fun box(): String { - test("publicStaticI", "publicMemberI", "privateStaticI", "privateMemberI") - test("publicStaticJ", "publicMemberJ", "privateStaticJ", "privateMemberJ") - test("publicKFun", "privateKFun", "publicKProp", "privateKProp") - test("publicLFun", "privateLFun", "publicLProp", "privateLProp") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/jvmName.kt b/backend.native/tests/external/codegen/box/reflection/classes/jvmName.kt deleted file mode 100644 index 36f86129b84..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/jvmName.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.reflect.jvm.jvmName - -class Klass { - class Nested - companion object -} - -fun box(): String { - assertEquals("Klass", Klass::class.jvmName) - assertEquals("Klass\$Nested", Klass.Nested::class.jvmName) - assertEquals("Klass\$Companion", Klass.Companion::class.jvmName) - - assertEquals("java.lang.Object", Any::class.jvmName) - assertEquals("int", Int::class.jvmName) - assertEquals("[I", IntArray::class.jvmName) - assertEquals("java.util.List", List::class.jvmName) - assertEquals("java.util.List", MutableList::class.jvmName) - assertEquals("java.lang.String", String::class.jvmName) - assertEquals("java.lang.String", java.lang.String::class.jvmName) - - assertEquals("[Ljava.lang.Object;", Array::class.jvmName) - assertEquals("[Ljava.lang.Integer;", Array::class.jvmName) - assertEquals("[[Ljava.lang.String;", Array>::class.jvmName) - - assertEquals("java.util.Date", java.util.Date::class.jvmName) - assertEquals("kotlin.jvm.internal.Ref\$ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.jvmName) - assertEquals("java.lang.Void", java.lang.Void::class.jvmName) - - class Local - val l = Local::class.jvmName - assertTrue(l != null && l.startsWith("JvmNameKt\$") && "\$box\$" in l && l.endsWith("\$Local")) - - val obj = object {} - val o = obj.javaClass.kotlin.jvmName - assertTrue(o != null && o.startsWith("JvmNameKt\$") && "\$box\$" in o && o.endsWith("\$1")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/localClassSimpleName.kt b/backend.native/tests/external/codegen/box/reflection/classes/localClassSimpleName.kt deleted file mode 100644 index c3dd9ed83ee..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/localClassSimpleName.kt +++ /dev/null @@ -1,42 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -fun check(klass: KClass<*>, expectedName: String) { - assertEquals(expectedName, klass.simpleName) -} - -fun localInMethod() { - fun localInMethod(unused: Any?) { - class Local - check(Local::class, "Local") - - class `Local$With$Dollars` - check(`Local$With$Dollars`::class, "Local\$With\$Dollars") - } - localInMethod(null) - - class Local - check(Local::class, "Local") - - class `Local$With$Dollars` - check(`Local$With$Dollars`::class, "Local\$With\$Dollars") -} - -class LocalInConstructor { - init { - class Local - check(Local::class, "Local") - - class `Local$With$Dollars` - check(`Local$With$Dollars`::class, "Local\$With\$Dollars") - } -} - -fun box(): String { - localInMethod() - LocalInConstructor() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/nestedClasses.kt b/backend.native/tests/external/codegen/box/reflection/classes/nestedClasses.kt deleted file mode 100644 index 603c4b0433b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/nestedClasses.kt +++ /dev/null @@ -1,64 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import kotlin.reflect.KClass -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class A { - companion object {} - inner class Inner - class Nested - private class PrivateNested -} - -fun nestedNames(c: KClass<*>) = c.nestedClasses.map { it.simpleName ?: throw AssertionError("Unnamed class: ${it.java}") }.sorted() - -fun box(): String { - // Kotlin class without nested classes - assertEquals(emptyList(), nestedNames(A.Inner::class)) - // Kotlin class with nested classes - assertEquals(listOf("Companion", "Inner", "Nested", "PrivateNested"), nestedNames(A::class)) - - // Java class without nested classes - assertEquals(emptyList(), nestedNames(Error::class)) - // Java interface with nested classes - assertEquals(listOf("Entry"), nestedNames(java.util.Map::class)) - // Java class with nested classes - assertEquals(listOf("SimpleEntry", "SimpleImmutableEntry"), nestedNames(java.util.AbstractMap::class)) - - // Built-ins - assertEquals(emptyList(), nestedNames(Array::class)) - assertEquals(emptyList(), nestedNames(CharSequence::class)) - assertEquals(listOf("Companion"), nestedNames(String::class)) - - assertEquals(emptyList(), nestedNames(Collection::class)) - assertEquals(emptyList(), nestedNames(MutableCollection::class)) - assertEquals(emptyList(), nestedNames(List::class)) - assertEquals(emptyList(), nestedNames(MutableList::class)) - assertEquals(listOf("Entry"), nestedNames(Map::class)) - assertEquals(emptyList(), nestedNames(Map.Entry::class)) - assertEquals(emptyList(), nestedNames(MutableMap.MutableEntry::class)) - - // TODO: should be MutableEntry. Currently we do not distinguish between Map and MutableMap. - assertEquals(listOf("Entry"), nestedNames(MutableMap::class)) - - // Primitives - for (primitive in listOf(Byte::class, Double::class, Float::class, Int::class, Long::class, Short::class, Char::class)) { - assertEquals(listOf("Companion"), nestedNames(primitive)) - } - assertEquals(emptyList(), nestedNames(Boolean::class)) - - // Primitive arrays - for (primitiveArray in listOf( - ByteArray::class, DoubleArray::class, FloatArray::class, IntArray::class, - LongArray::class, ShortArray::class, CharArray::class, BooleanArray::class - )) { - assertEquals(emptyList(), nestedNames(primitiveArray)) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/nestedClassesJava.kt b/backend.native/tests/external/codegen/box/reflection/classes/nestedClassesJava.kt deleted file mode 100644 index 1758075a74b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/nestedClassesJava.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public class Inner {} - - public static class Nested {} - - private static class PrivateNested {} - - // This anonymous class should not appear in 'nestedClasses' - private final Object o = new Object() {}; -} - -// FILE: K.kt - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(listOf("Inner", "Nested", "PrivateNested"), J::class.nestedClasses.map { it.simpleName!! }.sorted()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/objectInstance.kt b/backend.native/tests/external/codegen/box/reflection/classes/objectInstance.kt deleted file mode 100644 index 91b4da09e92..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/objectInstance.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -object Obj { - fun foo() = 1 -} - -class A { - companion object { - fun foo() = 2 - } -} - -class B { - companion object Factory { - fun foo() = 3 - } -} - -class C - -fun box(): String { - assertEquals(1, Obj::class.objectInstance!!.foo()) - assertEquals(2, A.Companion::class.objectInstance!!.foo()) - assertEquals(3, B.Factory::class.objectInstance!!.foo()) - - assertEquals(null, C::class.objectInstance) - assertEquals(null, String::class.objectInstance) - assertEquals(Unit, Unit::class.objectInstance) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/box/reflection/classes/primitiveKClassEquality.kt deleted file mode 100644 index 23f86775d68..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/primitiveKClassEquality.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals -import kotlin.test.assertFalse - -fun box(): String { - val x = Int::class.javaPrimitiveType!!.kotlin - val y = Int::class.javaObjectType.kotlin - - assertEquals(x, y) - assertEquals(x.hashCode(), y.hashCode()) - assertFalse(x === y) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/qualifiedName.kt b/backend.native/tests/external/codegen/box/reflection/classes/qualifiedName.kt deleted file mode 100644 index 824214142a5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/qualifiedName.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class Klass { - class Nested - companion object -} - -fun box(): String { - assertEquals("Klass", Klass::class.qualifiedName) - assertEquals("Klass.Nested", Klass.Nested::class.qualifiedName) - assertEquals("Klass.Companion", Klass.Companion::class.qualifiedName) - - assertEquals("kotlin.Any", Any::class.qualifiedName) - assertEquals("kotlin.Int", Int::class.qualifiedName) - assertEquals("kotlin.Int.Companion", Int.Companion::class.qualifiedName) - assertEquals("kotlin.IntArray", IntArray::class.qualifiedName) - assertEquals("kotlin.collections.List", List::class.qualifiedName) - assertEquals("kotlin.String", String::class.qualifiedName) - assertEquals("kotlin.String", java.lang.String::class.qualifiedName) - - assertEquals("kotlin.Array", Array::class.qualifiedName) - assertEquals("kotlin.Array", Array::class.qualifiedName) - assertEquals("kotlin.Array", Array>::class.qualifiedName) - - assertEquals("java.util.Date", java.util.Date::class.qualifiedName) - assertEquals("kotlin.jvm.internal.Ref.ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.qualifiedName) - assertEquals("java.lang.Void", java.lang.Void::class.qualifiedName) - - class Local - assertEquals(null, Local::class.qualifiedName) - - val o = object {} - assertEquals(null, o.javaClass.kotlin.qualifiedName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/classes/starProjectedType.kt b/backend.native/tests/external/codegen/box/reflection/classes/starProjectedType.kt deleted file mode 100644 index 2acc65853e5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/classes/starProjectedType.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KTypeProjection -import kotlin.reflect.full.createType -import kotlin.reflect.full.starProjectedType -import kotlin.test.assertEquals - -class Foo - -fun box(): String { - val foo = Foo::class.starProjectedType - assertEquals(Foo::class, foo.classifier) - assertEquals(listOf(KTypeProjection.STAR, KTypeProjection.STAR), foo.arguments) - assertEquals(foo, Foo::class.createType(listOf(KTypeProjection.STAR, KTypeProjection.STAR))) - - assertEquals(String::class, String::class.starProjectedType.classifier) - assertEquals(listOf(), String::class.starProjectedType.arguments) - - val tp = Foo::class.typeParameters.first() - assertEquals(tp.createType(), tp.starProjectedType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/constructors/annotationClass.kt b/backend.native/tests/external/codegen/box/reflection/constructors/annotationClass.kt deleted file mode 100644 index cfbe91532cf..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/constructors/annotationClass.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -annotation class A1 - -annotation class A2(val k: KClass<*>, val s: A1) - -fun box(): String { - assertEquals(1, A1::class.constructors.size) - assertEquals(A1::class.primaryConstructor, A1::class.constructors.single()) - - val cs = A2::class.constructors - assertEquals(1, cs.size) - assertEquals(A2::class.primaryConstructor, cs.single()) - val params = cs.single().parameters - assertEquals(listOf("k", "s"), params.map { it.name }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/constructors/classesWithoutConstructors.kt b/backend.native/tests/external/codegen/box/reflection/constructors/classesWithoutConstructors.kt deleted file mode 100644 index 5f78791ff90..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/constructors/classesWithoutConstructors.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue - -interface Interface -object Obj - -class C { - companion object -} - -fun box(): String { - assertTrue(Interface::class.constructors.isEmpty()) - assertTrue(Obj::class.constructors.isEmpty()) - assertTrue(C.Companion::class.constructors.isEmpty()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/constructors/constructorName.kt b/backend.native/tests/external/codegen/box/reflection/constructors/constructorName.kt deleted file mode 100644 index 2b1ddf08566..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/constructors/constructorName.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class A - -fun box(): String { - assertEquals("", ::A.name) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/constructors/primaryConstructor.kt b/backend.native/tests/external/codegen/box/reflection/constructors/primaryConstructor.kt deleted file mode 100644 index 53c84fd86a1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/constructors/primaryConstructor.kt +++ /dev/null @@ -1,57 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertNull -import kotlin.test.assertNotNull -import kotlin.reflect.full.* - -class OnlyPrimary - -class PrimaryWithSecondary(val s: String) { - constructor(x: Int) : this(x.toString()) - - override fun toString() = s -} - -class OnlySecondary { - constructor(s: String) -} - -class TwoSecondaries { - constructor(s: String) - constructor(d: Double) -} - -enum class En - -interface I -object O -class C { - companion object -} - -fun box(): String { - val p1 = OnlyPrimary::class.primaryConstructor - assertNotNull(p1) - assert(p1!!.call() is OnlyPrimary) - - val p2 = PrimaryWithSecondary::class.primaryConstructor - assertNotNull(p2) - assert(p2!!.call("beer").toString() == "beer") - - val p3 = OnlySecondary::class.primaryConstructor - assertNull(p3) - - val p4 = TwoSecondaries::class.primaryConstructor - assertNull(p4) - - assertNotNull(En::class.primaryConstructor) // TODO: maybe primaryConstructor should be null for enum classes - - assertNull(I::class.primaryConstructor) - assertNull(O::class.primaryConstructor) - assertNull(C.Companion::class.primaryConstructor) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/constructors/simpleGetConstructors.kt b/backend.native/tests/external/codegen/box/reflection/constructors/simpleGetConstructors.kt deleted file mode 100644 index 0d50c329b73..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/constructors/simpleGetConstructors.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import java.util.Collections -import kotlin.reflect.* -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -open class A private constructor(x: Int) { - public constructor(s: String): this(s.length) - constructor(): this("") -} - -class B : A("") - -class C { - class Nested - inner class Inner -} - -fun box(): String { - assertEquals(3, A::class.constructors.size) - assertEquals(1, B::class.constructors.size) - - assertTrue(Collections.disjoint(A::class.members, A::class.constructors)) - assertTrue(Collections.disjoint(B::class.members, B::class.constructors)) - - assertEquals(1, C.Nested::class.constructors.size) - assertEquals(1, C.Inner::class.constructors.size) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/annotationType.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/annotationType.kt deleted file mode 100644 index ca87362f349..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/annotationType.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -annotation class Foo - -fun box(): String { - val foo = Foo::class.constructors.single().call() - assertEquals(Foo::class, foo.annotationClass) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/arrayOfKClasses.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/arrayOfKClasses.kt deleted file mode 100644 index 5a25b437b24..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/arrayOfKClasses.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -annotation class Anno(val klasses: Array> = arrayOf(String::class, Int::class)) - -fun box(): String { - val anno = Anno::class.constructors.single().callBy(emptyMap()) - assertEquals(listOf(String::class, Int::class), anno.klasses.toList()) - assertEquals("@Anno(klasses=[class java.lang.String, int])", anno.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByJava.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByJava.kt deleted file mode 100644 index 400d9cd5253..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByJava.kt +++ /dev/null @@ -1,81 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public interface J { - @interface NoParams {} - - @interface OneDefault { - String s() default "OK"; - } - - @interface OneNonDefault { - String s(); - } - - @interface TwoParamsOneDefault { - String s(); - int x() default 42; - } - - @interface TwoNonDefaults { - String string(); - Class clazz(); - } - - @interface ManyDefaultParams { - int i() default 0; - String s() default ""; - double d() default 3.14; - } -} - -// FILE: K.kt - -import J.* -import kotlin.reflect.KClass -import kotlin.reflect.full.primaryConstructor -import kotlin.test.assertEquals -import kotlin.test.assertFails - -inline fun create(args: Map): T { - val ctor = T::class.constructors.single() - return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } }) -} - -inline fun create(): T = create(emptyMap()) - -fun box(): String { - create() - - val t1 = create() - assertEquals("OK", t1.s) - assertFails { create(mapOf("s" to 42)) } - - val t2 = create(mapOf("s" to "OK")) - assertEquals("OK", t2.s) - assertFails { create() } - - val t3 = create(mapOf("s" to "OK")) - assertEquals("OK", t3.s) - assertEquals(42, t3.x) - val t4 = create(mapOf("s" to "OK", "x" to 239)) - assertEquals(239, t4.x) - assertFails { create(mapOf("s" to "Fail", "x" to "Fail")) } - - assertFails("KClass (not Class) instances should be passed as arguments") { - create(mapOf("clazz" to String::class.java, "string" to "Fail")) - } - - val t5 = create(mapOf("clazz" to String::class, "string" to "OK")) - assertEquals("OK", t5.string) - - val t6 = create() - assertEquals(0, t6.i) - assertEquals("", t6.s) - assertEquals(3.14, t6.d) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByKotlin.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByKotlin.kt deleted file mode 100644 index aca0876ceed..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callByKotlin.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.full.primaryConstructor -import kotlin.test.assertEquals -import kotlin.test.assertFails - -annotation class NoParams -annotation class OneDefault(val s: String = "OK") -annotation class OneNonDefault(val s: String) -annotation class TwoParamsOneDefault(val s: String, val x: Int = 42) -annotation class TwoParamsOneDefaultKClass(val string: String, val klass: KClass<*> = Number::class) -annotation class TwoNonDefaults(val string: String, val klass: KClass<*>) - - -inline fun create(args: Map): T { - val ctor = T::class.constructors.single() - return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } }) -} - -inline fun create(): T = create(emptyMap()) - -fun box(): String { - create() - - val t1 = create() - assertEquals("OK", t1.s) - assertFails { create(mapOf("s" to 42)) } - - val t2 = create(mapOf("s" to "OK")) - assertEquals("OK", t2.s) - assertFails { create() } - - val t3 = create(mapOf("s" to "OK")) - assertEquals("OK", t3.s) - assertEquals(42, t3.x) - val t4 = create(mapOf("s" to "OK", "x" to 239)) - assertEquals(239, t4.x) - assertFails { create(mapOf("s" to "Fail", "x" to "Fail")) } - - val t5 = create(mapOf("string" to "OK")) - assertEquals(Number::class, t5.klass) - - assertFails("KClass (not Class) instances should be passed as arguments") { - create(mapOf("klass" to String::class.java, "string" to "Fail")) - } - - val t6 = create(mapOf("klass" to String::class, "string" to "OK")) - return t6.string -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callJava.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/callJava.kt deleted file mode 100644 index 3e3a193f0d4..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callJava.kt +++ /dev/null @@ -1,93 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public interface J { - @interface NoParams {} - - @interface OneDefault { - String foo() default "foo"; - } - - @interface OneDefaultValue { - String value() default "value"; - } - - @interface OneNonDefault { - String foo(); - } - - @interface OneNonDefaultValue { - String value(); - } - - @interface TwoParamsOneDefault { - String string(); - Class clazz() default Object.class; - } - - @interface TwoParamsOneValueOneDefault { - String value(); - Class clazz() default Object.class; - } - - @interface TwoNonDefaults { - String string(); - Class clazz(); - } - - @interface ManyDefaults { - int i() default 0; - String s() default ""; - double d() default 3.14; - } -} - -// FILE: K.kt - -import J.* -import kotlin.reflect.KClass -import kotlin.reflect.full.primaryConstructor -import kotlin.test.assertEquals -import kotlin.test.assertFails - -inline fun create(vararg args: Any?): T = - T::class.constructors.single().call(*args) - -fun box(): String { - create() - - assertFails { create() } - assertFails { create("") } - assertFails { create("", "") } - - assertFails { create() } - create("") - assertFails { create("", "") } - - assertFails { create() } - assertFails { create("") } - - assertFails { create() } - create("") - - assertFails { create() } - assertFails { create("") } - assertFails { create("", Any::class) } - assertFails { create(Any::class, "") } - - assertFails { create() } - assertFails { create("") } - assertFails { create("", Any::class) } - assertFails { create(Any::class, "") } - - assertFails { create("", Any::class) } - assertFails { create(Any::class, "") } - - assertFails { create() } - assertFails { create(42, "Fail", 2.72) } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callKotlin.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/callKotlin.kt deleted file mode 100644 index cf79af63878..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/callKotlin.kt +++ /dev/null @@ -1,38 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.full.primaryConstructor -import kotlin.test.assertEquals -import kotlin.test.assertFails - -annotation class NoParams -annotation class OneDefault(val s: String = "Fail") -annotation class TwoNonDefaults(val string: String, val klass: KClass<*>) - -inline fun create(vararg args: Any?): T = - T::class.constructors.single().call(*args) - -fun box(): String { - create() - assertFails { create("Fail") } - - assertFails { create() } - assertFails { create(42) } - val o = create("OK") - assertEquals("OK", o.s) - - assertFails("call() should fail because arguments were passed in an incorrect order") { - create(Any::class, "Fail") - } - assertFails("call() should fail because KClass (not Class) instances should be passed as arguments") { - create("Fail", Any::class.java) - } - - val k = create("OK", Int::class) - assertEquals(Int::class, k.klass) - - return k.string -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/createJdkAnnotationInstance.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/createJdkAnnotationInstance.kt deleted file mode 100644 index 14441c3449b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/createJdkAnnotationInstance.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy -import kotlin.test.assertEquals - -fun box(): String { - val ctor = Retention::class.constructors.single() - val r = ctor.callBy(mapOf( - ctor.parameters.single { it.name == "value" } to RetentionPolicy.RUNTIME - )) - assertEquals(RetentionPolicy.RUNTIME, r.value as RetentionPolicy) - assertEquals(Retention::class.java.classLoader, r.javaClass.classLoader) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/enumKClassAnnotation.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/enumKClassAnnotation.kt deleted file mode 100644 index 7dcb9223716..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/enumKClassAnnotation.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -annotation class Foo(val value: String) - -annotation class Anno( - val level: DeprecationLevel, - val klass: KClass<*>, - val foo: Foo, - val levels: Array, - val klasses: Array>, - val foos: Array -) - -@Anno( - DeprecationLevel.WARNING, - Number::class, - Foo("OK"), - arrayOf(DeprecationLevel.WARNING), - arrayOf(Number::class), - arrayOf(Foo("OK")) -) -fun foo() {} - -fun box(): String { - // Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code - val a1 = Anno::class.constructors.single().call( - DeprecationLevel.WARNING, - Number::class, - Foo::class.constructors.single().call("OK"), - arrayOf(DeprecationLevel.WARNING), - arrayOf(Number::class), - arrayOf(Foo::class.constructors.single().call("OK")) - ) - val a2 = ::foo.annotations.single() as Anno - - assertEquals(a1, a2) - assertEquals(a2, a1) - assertEquals(a1.hashCode(), a2.hashCode()) - - assertEquals("@Anno(level=WARNING, klass=class java.lang.Number, foo=@Foo(value=OK), " + - "levels=[WARNING], klasses=[class java.lang.Number], foos=[@Foo(value=OK)])", a1.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/equalsHashCodeToString.kt deleted file mode 100644 index 7ffbee7dfb3..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/equalsHashCodeToString.kt +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -annotation class A -annotation class B(val s: String) - -@A -@B("2") -fun javaReflectionAnnotationInstances() {} - -fun box(): String { - val createA = A::class.constructors.single() - - val a1 = createA.call() - if (a1.toString() != "@test.A()") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $a1" - - val a2 = createA.call() - if (a1 === a2) return "Fail: instances created by the constructor should be different" - if (a1 != a2) return "Fail: any instance of A should be equal to any other instance of A" - if (a1.hashCode() != a2.hashCode()) return "Fail: hash codes of equal instances should be equal" - if (a1.hashCode() != 0) return "Fail: hashCode does not correspond to the documentation of java.lang.annotation.Annotation#hashCode: ${a1.hashCode()}" - - val createB = B::class.constructors.single() - val b1 = createB.call("1") - if (b1.toString() != "@test.B(s=1)") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $b1" - if (b1 != b1) return "Fail: instance should be equal to itself" - - val b2 = createB.call("2") - if (b1 == b2) return "Fail: instances with different data should not be equal" - if (b1.hashCode() == b2.hashCode()) return "Fail: hash codes of different instances should very likely be also different" - - val a3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance().single() - if (a1 === a3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different" - if (a1 != a3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection" - if (a3 != a1) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor" - if (a1.hashCode() != a3.hashCode()) return "Fail: hash codes of equal instances should be equal" - - val b3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance().single() - if (b2 === b3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different" - if (b2 != b3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection" - if (b3 != b2) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor" - if (b2.hashCode() != b3.hashCode()) return "Fail: hash codes of equal instances should be equal" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/floatingPointParameters.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/floatingPointParameters.kt deleted file mode 100644 index a3fff2faa64..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/floatingPointParameters.kt +++ /dev/null @@ -1,66 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals - -annotation class D(val d: Double) -annotation class F(val f: Float) - -/* -// TODO: uncomment once KT-13887 is implemented -@D(Double.NaN) -fun dnan() {} - -@F(Float.NaN) -fun fnan() {} -*/ - -@D(-0.0) -fun dMinusZero() {} -@D(+0.0) -fun dPlusZero() {} - -@F(-0.0f) -fun fMinusZero() {} -@F(+0.0f) -fun fPlusZero() {} - -fun check(x: Any, y: Any) { - assertEquals(x, y) - assertEquals(y, x) - assertEquals(x.hashCode(), y.hashCode()) - assertEquals(x.toString(), y.toString()) -} - -fun checkNot(x: Any, y: Any) { - assertNotEquals(x, y) - assertNotEquals(y, x) - assertNotEquals(x.hashCode(), y.hashCode()) - assertNotEquals(x.toString(), y.toString()) -} - -fun box(): String { -/* - check(::dnan.annotations.single() as D, D::class.constructors.single().call(Double.NaN)) - check(::fnan.annotations.single() as F, F::class.constructors.single().call(Float.NaN)) -*/ - - val dmz = D::class.constructors.single().call(-0.0) - val dpz = D::class.constructors.single().call(+0.0) - val fmz = F::class.constructors.single().call(-0.0f) - val fpz = F::class.constructors.single().call(+0.0f) - check(::dMinusZero.annotations.single() as D, dmz) - check(::dPlusZero.annotations.single() as D, dpz) - check(::fMinusZero.annotations.single() as F, fmz) - check(::fPlusZero.annotations.single() as F, fpz) - - checkNot(dmz, dpz) - checkNot(fmz, fpz) - checkNot(dmz, fmz) - checkNot(dpz, fpz) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/parameterNamedEquals.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/parameterNamedEquals.kt deleted file mode 100644 index 3058ac7238b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/parameterNamedEquals.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals - -annotation class Anno(val equals: Boolean) - -fun box(): String { - val t = Anno::class.constructors.single().call(true) - val f = Anno::class.constructors.single().call(false) - assertEquals(true, t.equals) - assertEquals(false, f.equals) - assertNotEquals(t, f) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/createAnnotation/primitivesAndArrays.kt b/backend.native/tests/external/codegen/box/reflection/createAnnotation/primitivesAndArrays.kt deleted file mode 100644 index b33fcee14a2..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/createAnnotation/primitivesAndArrays.kt +++ /dev/null @@ -1,85 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -annotation class Anno( - val b: Byte, - val c: Char, - val d: Double, - val f: Float, - val i: Int, - val j: Long, - val s: Short, - val z: Boolean, - val ba: ByteArray, - val ca: CharArray, - val da: DoubleArray, - val fa: FloatArray, - val ia: IntArray, - val ja: LongArray, - val sa: ShortArray, - val za: BooleanArray, - val str: String, - val stra: Array -) - -@Anno( - 1.toByte(), - 'x', - 3.14, - -2.72f, - 42424242, - 239239239239239L, - 42.toShort(), - true, - byteArrayOf((-1).toByte()), - charArrayOf('y'), - doubleArrayOf(-3.14159), - floatArrayOf(2.7218f), - intArrayOf(424242), - longArrayOf(239239239239L), - shortArrayOf((-43).toShort()), - booleanArrayOf(false, true), - "lol", - arrayOf("rofl") -) -fun foo() {} - -fun box(): String { - // Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code - val a1 = Anno::class.constructors.single().call( - 1.toByte(), - 'x', - 3.14, - -2.72f, - 42424242, - 239239239239239L, - 42.toShort(), - true, - byteArrayOf((-1).toByte()), - charArrayOf('y'), - doubleArrayOf(-3.14159), - floatArrayOf(2.7218f), - intArrayOf(424242), - longArrayOf(239239239239L), - shortArrayOf((-43).toShort()), - booleanArrayOf(false, true), - "lol", - arrayOf("rofl") - ) - - val a2 = ::foo.annotations.single() as Anno - - assertEquals(a1, a2) - assertEquals(a2, a1) - assertEquals(a1.hashCode(), a2.hashCode()) - - assertEquals("@Anno(b=1, c=x, d=3.14, f=-2.72, i=42424242, j=239239239239239, s=42, z=true, " + - "ba=[-1], ca=[y], da=[-3.14159], fa=[2.7218], ia=[424242], ja=[239239239239], sa=[-43], za=[false, true], " + - "str=lol, stra=[rofl])", a1.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/anonymousObjectInInlinedLambda.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/anonymousObjectInInlinedLambda.kt deleted file mode 100644 index c94bfe8536b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/anonymousObjectInInlinedLambda.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -interface A { - fun f(): String -} - -inline fun foo(): A { - return object : A { - override fun f(): String { - return "OK" - } - } -} - -fun box(): String { - val y = foo() - - val enclosing = y.javaClass.getEnclosingMethod() - if (enclosing?.getName() != "foo") return "method: $enclosing" - - return y.f() -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/classInLambda.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/classInLambda.kt deleted file mode 100644 index aebe9683946..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/classInLambda.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - - val classInLambda = { - class Z {} - Z() - }() - - val enclosingMethod = classInLambda.javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" - - val enclosingClass = classInLambda.javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "ClassInLambdaKt\$box\$classInLambda\$1") return "enclosing class: $enclosingClass" - - val declaringClass = classInLambda.javaClass.getDeclaringClass() - if (declaringClass != null) return "class has a declaring class" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/functionExpressionInProperty.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/functionExpressionInProperty.kt deleted file mode 100644 index 78fe21efa72..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/functionExpressionInProperty.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -val property = fun () {} - -fun box(): String { - val javaClass = property.javaClass - - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod != null) return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "FunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/kt11969.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/kt11969.kt deleted file mode 100644 index 25c55218a4f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/kt11969.kt +++ /dev/null @@ -1,63 +0,0 @@ -// WITH_RUNTIME -// IGNORE_BACKEND: JS, NATIVE - -interface Z { - private fun privateFun() = { "OK" } - - fun callPrivateFun() = privateFun() - - fun publicFun() = { "OK" } - - fun funWithDefaultArgs(s: () -> Unit = {}): () -> Unit - - val property: () -> Unit - get() = {} - - class Nested -} - -class Test : Z { - override fun funWithDefaultArgs(s: () -> Unit): () -> Unit { - return s - } - - fun funWithDefaultArgsInClass(s: () -> Unit = {}): () -> Unit { - return s - } -} - -fun box(): String { - - val privateFun = Test().callPrivateFun() - var enclosing = privateFun.javaClass.enclosingMethod!! - if (enclosing.name != "privateFun") return "fail 1: ${enclosing.name}" - if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 2: ${enclosing.getDeclaringClass().simpleName}" - - val publicFun = Test().publicFun() - enclosing = publicFun.javaClass.enclosingMethod!! - if (enclosing.name != "publicFun") return "fail 3: ${enclosing.name}" - if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 4: ${enclosing.getDeclaringClass().simpleName}" - - val property = Test().property - enclosing = property.javaClass.enclosingMethod!! - if (enclosing.name != "getProperty") return "fail 4: ${enclosing.name}" - if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 5: ${enclosing.getDeclaringClass().simpleName}" - - val defaultArgs = Test().funWithDefaultArgs() - enclosing = defaultArgs.javaClass.enclosingMethod!! - if (enclosing.name != "funWithDefaultArgs\$default") return "fail 6: ${enclosing.name}" - if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}" - if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 8: ${enclosing.getDeclaringClass().simpleName}" - - val defaultArgsInClass = Test().funWithDefaultArgsInClass() - enclosing = defaultArgsInClass.javaClass.enclosingMethod!! - if (enclosing.name != "funWithDefaultArgsInClass\$default") return "fail 6: ${enclosing.name}" - if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}" - if (enclosing.getDeclaringClass().simpleName != "Test") return "fail 8: ${enclosing.getDeclaringClass().simpleName}" - - val nested = Z.Nested::class.java - val enclosingClass = nested.enclosingClass!! - if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/kt6368.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/kt6368.kt deleted file mode 100644 index 8d98e81d56c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/kt6368.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import java.util.HashMap - -interface R { - fun result(): String -} - -val a by lazy { - with(HashMap()) { - put("result", object : R { - override fun result(): String = "OK" - }) - this - } -} - -fun box(): String { - val r = a["result"]!! - - // Check that reflection won't fail - r.javaClass.getEnclosingMethod().toString() - - return r.result() -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/kt6691_lambdaInSamConstructor.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/kt6691_lambdaInSamConstructor.kt deleted file mode 100644 index a7192acd479..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/kt6691_lambdaInSamConstructor.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -var lambda = {} - -class A { - val prop = Runnable { - lambda = { println("") } - } -} - -fun box(): String { - A().prop.run() - - val javaClass = lambda.javaClass - - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "run") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "A\$prop\$1") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInClassObject.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInClassObject.kt deleted file mode 100644 index 1fd22c3f3a0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInClassObject.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class O { - companion object { - // Currently we consider in class O as the enclosing method of this lambda, - // so we write outer class = O and enclosing method = null - val f = {} - } -} - -fun box(): String { - val javaClass = O.f.javaClass - - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod != null) return "method: $enclosingMethod" - - val enclosingConstructor = javaClass.getEnclosingConstructor() - if (enclosingConstructor != null) return "constructor: $enclosingConstructor" - - val enclosingClass = javaClass.getEnclosingClass() - if (enclosingClass?.getName() != "O") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInConstructor.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInConstructor.kt deleted file mode 100644 index 9743cdf3e41..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInConstructor.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class C { - val l: Any = {} -} - -fun box(): String { - val javaClass = C().l.javaClass - val enclosingConstructor = javaClass.getEnclosingConstructor() - if (enclosingConstructor?.getDeclaringClass()?.getName() != "C") return "ctor: $enclosingConstructor" - - val enclosingClass = javaClass.getEnclosingClass() - if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInFunction.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInFunction.kt deleted file mode 100644 index f04e3e95611..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInFunction.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - val l: Any = {} - - val javaClass = l.javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "box") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInFunctionKt") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLambda.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLambda.kt deleted file mode 100644 index b6fb1f42c0f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLambda.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - val l = { - {} - } - - val javaClass = l().javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInLambdaKt\$box\$l\$1") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassConstructor.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassConstructor.kt deleted file mode 100644 index 1a38dfda515..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassConstructor.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -open class C - -fun box(): String { - class L : C() { - val a: Any - - init { - a = {} - } - } - val l = L() - - val javaClass = l.a.javaClass - val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (enclosingMethod != "LambdaInLocalClassConstructorKt\$box\$L") return "ctor: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInLocalClassConstructorKt\$box\$L") return "enclosing class: $enclosingClass" - - if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassSuperCall.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassSuperCall.kt deleted file mode 100644 index 78aa1870a79..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalClassSuperCall.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -open class C(val a: Any) - -fun box(): String { - class L : C({}) { - } - val l = L() - - val javaClass = l.a.javaClass - val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (enclosingMethod != "LambdaInLocalClassSuperCallKt\$box\$L") return "ctor: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInLocalClassSuperCallKt\$box\$L") return "enclosing class: $enclosingClass" - - if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalFunction.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalFunction.kt deleted file mode 100644 index 04109f92754..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInLocalFunction.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - fun foo(): Any { - return {} - } - - val javaClass = foo().javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInLocalFunctionKt\$box$1") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunction.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunction.kt deleted file mode 100644 index 91d1cee05d2..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunction.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class C { - fun foo(): Any { - return {} - } -} - - -fun box(): String { - val javaClass = C().foo().javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass() - if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt deleted file mode 100644 index 883f10ba9a8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - class C { - fun foo(): Any { - return {} - } - } - - val javaClass = C().foo().javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInMemberFunctionInLocalClassKt\$box\$C") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt deleted file mode 100644 index caa749c8d3a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class C { - class D { - fun foo(): Any { - return {} - } - } -} - -fun box(): String { - val javaClass = C.D().foo().javaClass - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass() - if (enclosingClass?.getSimpleName() != "D") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectDeclaration.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectDeclaration.kt deleted file mode 100644 index 9025828aa11..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectDeclaration.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -object O { - val f = {} -} - -fun box(): String { - val javaClass = O.f.javaClass - - val enclosingMethod = javaClass.getEnclosingMethod() - if (enclosingMethod != null) return "method: $enclosingMethod" - - val enclosingConstructor = javaClass.getEnclosingConstructor() - if (enclosingConstructor != null) return "field should be initialized in clInit" - - val enclosingClass = javaClass.getEnclosingClass() - if (enclosingClass?.getName() != "O") return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectExpression.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectExpression.kt deleted file mode 100644 index 16dd43b0f6f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectExpression.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -interface C { - val a: Any -} - -fun box(): String { - val l = object : C { - override val a: Any - - init { - a = {} - } - } - - val javaClass = l.a.javaClass - val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (enclosingMethod != "LambdaInObjectExpressionKt\$box\$l\$1") return "ctor: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInObjectExpressionKt\$box\$l\$1") return "enclosing class: $enclosingClass" - - if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt deleted file mode 100644 index 1d9a7c51dae..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -open class C(val a: Any) - -fun box(): String { - val l = object : C({}) { - } - - val javaClass = l.a.javaClass - if (javaClass.getEnclosingConstructor() != null) return "ctor should be null" - - val enclosingMethod = javaClass.getEnclosingMethod()!!.getName() - if (enclosingMethod != "box") return "method: $enclosingMethod" - - val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInObjectLiteralSuperCallKt" || enclosingClass != l.javaClass.getEnclosingClass()!!.getName()) - return "enclosing class: $enclosingClass" - - val declaringClass = javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPackage.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPackage.kt deleted file mode 100644 index 5997c2f1103..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPackage.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -val l: Any = {} - -fun box(): String { - val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInPackageKt") return "enclosing class: $enclosingClass" - - val enclosingConstructor = l.javaClass.getEnclosingConstructor() - if (enclosingConstructor != null) return "enclosing constructor found: $enclosingConstructor" - - val enclosingMethod = l.javaClass.getEnclosingMethod() - if (enclosingMethod != null) return "enclosing method found: $enclosingMethod" - - val declaringClass = l.javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertyGetter.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertyGetter.kt deleted file mode 100644 index b31664eaa62..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertyGetter.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -val l: Any - get() = {} - -fun box(): String { - - val enclosingMethod = l.javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "getL") return "method: $enclosingMethod" - - val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInPropertyGetterKt") return "enclosing class: $enclosingClass" - - val declaringClass = l.javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertySetter.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertySetter.kt deleted file mode 100644 index fc0f7032d01..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/lambdaInPropertySetter.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -var _l: Any = "" - -var l: Any - get() = _l - set(v) { - _l = {} - } - -fun box(): String { - l = "" // to invoke the setter - - val enclosingMethod = l.javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "setL") return "method: $enclosingMethod" - - val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "LambdaInPropertySetterKt") return "enclosing class: $enclosingClass" - - val declaringClass = l.javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt deleted file mode 100644 index c89a0eb159f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// KT-4234 - -fun box(): String { - class C - - val name = C::class.java.getSimpleName() - if (name != "box\$C") return "Fail: $name" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/enclosing/objectInLambda.kt b/backend.native/tests/external/codegen/box/reflection/enclosing/objectInLambda.kt deleted file mode 100644 index d75d2aff8c8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/enclosing/objectInLambda.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -fun box(): String { - - val objectInLambda = { - object : Any () {} - }() - - val enclosingMethod = objectInLambda.javaClass.getEnclosingMethod() - if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" - - val enclosingClass = objectInLambda.javaClass.getEnclosingClass()!!.getName() - if (enclosingClass != "ObjectInLambdaKt\$box\$objectInLambda\$1") return "enclosing class: $enclosingClass" - - val declaringClass = objectInLambda.javaClass.getDeclaringClass() - if (declaringClass != null) return "anonymous object has a declaring class" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/declaredVsInheritedFunctions.kt b/backend.native/tests/external/codegen/box/reflection/functions/declaredVsInheritedFunctions.kt deleted file mode 100644 index 4cb47e16f94..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/declaredVsInheritedFunctions.kt +++ /dev/null @@ -1,81 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public void publicMemberJ() {} - private void privateMemberJ() {} - public static void publicStaticJ() {} - private static void privateStaticJ() {} -} - -// FILE: K.kt - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -open class K : J() { - public fun publicMemberK() {} - private fun privateMemberK() {} - public fun Any.publicMemberExtensionK() {} - private fun Any.privateMemberExtensionK() {} -} - -class L : K() - -fun Collection>.names(): Set = - this.map { it.name }.toSet() - -fun check(c: Collection>, names: Set) { - assertEquals(names, c.names()) -} - -fun box(): String { - val any = setOf("equals", "hashCode", "toString") - - val j = J::class - - check(j.staticFunctions, - setOf("publicStaticJ", "privateStaticJ")) - check(j.declaredFunctions, - setOf("publicMemberJ", "privateMemberJ", "publicStaticJ", "privateStaticJ")) - check(j.declaredMemberFunctions, - setOf("publicMemberJ", "privateMemberJ")) - check(j.declaredMemberExtensionFunctions, - emptySet()) - - check(j.functions, any + j.declaredFunctions.names()) - check(j.memberFunctions, any + j.declaredMemberFunctions.names()) - check(j.memberExtensionFunctions, emptySet()) - - val k = K::class - - check(k.staticFunctions, - emptySet()) - check(k.declaredFunctions, - setOf("publicMemberK", "privateMemberK", "publicMemberExtensionK", "privateMemberExtensionK")) - check(k.declaredMemberFunctions, - setOf("publicMemberK", "privateMemberK")) - check(k.declaredMemberExtensionFunctions, - setOf("publicMemberExtensionK", "privateMemberExtensionK")) - - check(k.memberFunctions, any + setOf("publicMemberJ") + k.declaredMemberFunctions.names()) - check(k.memberExtensionFunctions, k.declaredMemberExtensionFunctions.names()) - check(k.functions, any + (k.memberFunctions + k.memberExtensionFunctions).names()) - - - val l = L::class - - check(l.staticFunctions, emptySet()) - check(l.declaredFunctions, emptySet()) - check(l.declaredMemberFunctions, emptySet()) - check(l.declaredMemberExtensionFunctions, emptySet()) - check(l.memberFunctions, any + setOf("publicMemberJ", "publicMemberK")) - check(l.memberExtensionFunctions, setOf("publicMemberExtensionK")) - check(l.functions, any + (l.memberFunctions + l.memberExtensionFunctions).names()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/functionFromStdlib.kt b/backend.native/tests/external/codegen/box/reflection/functions/functionFromStdlib.kt deleted file mode 100644 index 1a48f5ed11a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/functionFromStdlib.kt +++ /dev/null @@ -1,11 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KFunction1 -import kotlin.reflect.jvm.isAccessible - -fun doStuff(fn: KFunction1) = fn.call("oK") - -fun box(): String { - return doStuff(String::capitalize.apply { isAccessible = true }) -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/functionReferenceErasedToKFunction.kt b/backend.native/tests/external/codegen/box/reflection/functions/functionReferenceErasedToKFunction.kt deleted file mode 100644 index ec5fbcf7a32..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/functionReferenceErasedToKFunction.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -import kotlin.jvm.functions.Function2; -import kotlin.reflect.KFunction; - -public class J { - public static String go() { - KFunction fun = K.Companion.getRef(); - Object result = ((Function2) fun).invoke(new K(), "KO"); - return (String) result; - } -} - -// FILE: K.kt - -class K { - fun reverse(s: String): String { - return s.reversed() - } - - companion object { - fun getRef() = K::reverse - } -} - -fun box(): String { - return J.go() -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/genericOverriddenFunction.kt b/backend.native/tests/external/codegen/box/reflection/functions/genericOverriddenFunction.kt deleted file mode 100644 index 983a28a487d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/genericOverriddenFunction.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -interface H { - fun foo(): T? -} - -interface A : H - -fun box(): String { - assertEquals("A?", A::foo.returnType.toString()) - assertEquals("T?", H::foo.returnType.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/instanceOfFunction.kt b/backend.native/tests/external/codegen/box/reflection/functions/instanceOfFunction.kt deleted file mode 100644 index 8f8c97a9d59..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/instanceOfFunction.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: FromJava.java - -import kotlin.reflect.KCallable; -import kotlin.jvm.functions.Function1; -import kotlin.jvm.functions.Function2; -import kotlin.jvm.functions.Function3; - -public class FromJava { - public static String test(KCallable x) { - if (!(x instanceof Function1)) return "Fail 6"; - if (!(x instanceof Function2)) return "Fail 7"; - if (!(x instanceof Function3)) return "Fail 8"; - return "OK"; - } -} - -// FILE: test.kt - -class Foo { - fun bar(x: Int): Int = x + 1 -} - -fun box(): String { - val bar = Foo::class.members.single { it.name == "bar" } - - if (bar is Function1<*, *>) return "Fail 1" - if (bar !is Function2<*, *, *>) return "Fail 2" - if (bar is Function3<*, *, *, *>) return "Fail 3" - - bar as? Function2 ?: return "Fail 4" - - if (bar(Foo(), 42) != 43) return "Fail 5" - - return FromJava.test(bar) -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/javaClassGetFunctions.kt b/backend.native/tests/external/codegen/box/reflection/functions/javaClassGetFunctions.kt deleted file mode 100644 index 497c5199848..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/javaClassGetFunctions.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public J() { - } - - public void member(String s) { - } - - public static void staticMethod(int x) { - } -} - -// FILE: K.kt - -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(listOf("equals", "hashCode", "member", "staticMethod", "toString"), J::class.members.map { it.name }.sorted()) - assertEquals(listOf("equals", "hashCode", "member", "staticMethod", "toString"), J::class.functions.map { it.name }.sorted()) - assertEquals(listOf("member", "staticMethod"), J::class.declaredFunctions.map { it.name }.sorted()) - - assertEquals(1, J::class.constructors.size) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/javaMethodsSmokeTest.kt b/backend.native/tests/external/codegen/box/reflection/functions/javaMethodsSmokeTest.kt deleted file mode 100644 index 513242ff191..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/javaMethodsSmokeTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_REFLECT -// FILE: J.java - -import java.util.List; - -public class J { - void simple() {} - - void objectTypes( - Object o, String s, Object[] oo, String[] ss - ) {} - - void primitives( - boolean z, char c, byte b, short s, int i, float f, long j, double d - ) {} - - void primitiveArrays( - boolean[] z, char[] c, byte[] b, short[] s, int[] i, float[] f, long[] j, double[] d - ) {} - - void multiDimensionalArrays( - int[][][] i, Cloneable[][][][] c - ) {} - - void wildcards( - List l, List m - ) {} -} - -// FILE: K.kt - -import kotlin.reflect.KFunction - -// Initiate descriptor computation in reflection to ensure that nothing fails -fun test(f: KFunction<*>) { - f.parameters -} - -fun box(): String { - test(J::simple) - test(J::objectTypes) - test(J::primitives) - test(J::primitiveArrays) - test(J::multiDimensionalArrays) - test(J::wildcards) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/platformName.kt b/backend.native/tests/external/codegen/box/reflection/functions/platformName.kt deleted file mode 100644 index 8968a5b1a51..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/platformName.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -@JvmName("Fail") -fun OK() {} - -fun box() = ::OK.name diff --git a/backend.native/tests/external/codegen/box/reflection/functions/privateMemberFunction.kt b/backend.native/tests/external/codegen/box/reflection/functions/privateMemberFunction.kt deleted file mode 100644 index 4d168f76788..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/privateMemberFunction.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KFunction -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class A { - private fun foo() = "A" -} - -fun box(): String { - val f = A::class.declaredFunctions.single() as KFunction - - try { - f.call(A()) - return "Fail: no exception was thrown" - } catch (e: IllegalCallableAccessException) {} - - f.isAccessible = true - - assertEquals("A", f.call(A())) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/simpleGetFunctions.kt b/backend.native/tests/external/codegen/box/reflection/functions/simpleGetFunctions.kt deleted file mode 100644 index 2d510742ebf..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/simpleGetFunctions.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* - -open class A { - fun mem() {} - fun Int.memExt() {} -} - -class B : A() - -fun box(): String { - val all = A::class.functions.map { it.name }.sorted() - assert(all == listOf("equals", "hashCode", "mem", "memExt", "toString")) { "Fail A functions: ${A::class.functions}" } - - val declared = A::class.declaredFunctions.map { it.name }.sorted() - assert(declared == listOf("mem", "memExt")) { "Fail A declaredFunctions: ${A::class.declaredFunctions}" } - - val declaredSubclass = B::class.declaredFunctions.map { it.name }.sorted() - assert(declaredSubclass.isEmpty()) { "Fail B declaredFunctions: ${B::class.declaredFunctions}" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/functions/simpleNames.kt b/backend.native/tests/external/codegen/box/reflection/functions/simpleNames.kt deleted file mode 100644 index 9df53d8ee51..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/functions/simpleNames.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo() {} - -class A { - fun bar() = "" -} - -fun Int.baz() = this - -fun box(): String { - assertEquals("foo", ::foo.name) - assertEquals("bar", A::bar.name) - assertEquals("baz", Int::baz.name) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/covariantOverride.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/covariantOverride.kt deleted file mode 100644 index ba746a3107a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/covariantOverride.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -interface A { - fun foo(): Collection -} - -abstract class B : A { - override fun foo(): Collection = null!! -} - -fun box(): String { - val clazz = B::class.java - if (clazz.declaredMethods.first().genericReturnType.toString() != "java.util.Collection") return "fail 1" - - if (clazz.methods.filter { it.name == "foo" }.size != 1) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/defaultImplsGenericSignature.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/defaultImplsGenericSignature.kt deleted file mode 100644 index 5a32312795a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/defaultImplsGenericSignature.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - - public static int test1() { - A> x = new X>("O", new B("K")); - return A.DefaultImpls.test1(x, 1, 1.0); - } - - - public static A> test2(){ - X> x = new X>("O", new B("K")); - return A.DefaultImpls.test2(x, 1); - } -} - -// FILE: K.kt - -class B(val value: T) - -interface A> { - - fun test1(p: T, z: L): T { - return p - } - - fun test2(p: L): A { - return this - } -} - - -class X>(val p1: T, val p2: Y) : A { - -} - -fun box(): String { - val test1 = J.test1() - if (test1 != 1) return "fail 1: $test1 != 1" - - val test2: X> = J.test2() as X> - - return test2.p1 + test2.p2.value -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/functionLiteralGenericSignature.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/functionLiteralGenericSignature.kt deleted file mode 100644 index 419f423375e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/functionLiteralGenericSignature.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.util.Date - -fun assertGenericSuper(expected: String, function: Any?) { - val clazz = (function as java.lang.Object).getClass()!! - val genericSuper = clazz.getGenericInterfaces()[0]!! - if ("$genericSuper" != expected) - throw AssertionError("Fail, expected: $expected, actual: $genericSuper") -} - - -val unitFun = { } -val intFun = { 42 } -val stringParamFun = { x: String -> } -val listFun = { l: List -> l } -val mutableListFun = fun (l: MutableList): MutableList = null!! -val funWithIn = fun (x: Comparable) {} - -val extensionFun = fun Any.() {} -val extensionWithArgFun = fun Long.(x: Any): Date = Date() - -fun box(): String { - assertGenericSuper("kotlin.jvm.functions.Function0", unitFun) - assertGenericSuper("kotlin.jvm.functions.Function0", intFun) - assertGenericSuper("kotlin.jvm.functions.Function1", stringParamFun) - assertGenericSuper("kotlin.jvm.functions.Function1, java.util.List>", listFun) - assertGenericSuper("kotlin.jvm.functions.Function1, java.util.List>", mutableListFun) - assertGenericSuper("kotlin.jvm.functions.Function1, kotlin.Unit>", funWithIn) - - assertGenericSuper("kotlin.jvm.functions.Function1", extensionFun) - assertGenericSuper("kotlin.jvm.functions.Function2", extensionWithArgFun) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/genericBackingFieldSignature.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/genericBackingFieldSignature.kt deleted file mode 100644 index aabad1225b1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/genericBackingFieldSignature.kt +++ /dev/null @@ -1,86 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -//test for KT-3722 Write correct generic type information for generated fields -import kotlin.properties.Delegates - -class Z { - -} - -class TParam { - -} - -class Zout { - -} - -class Zin { - -} - - -class Test(val constructorProperty: T) { - - val classField1 : Z? = null - - val classField2 : Z? = null - - val classField3 : Zout? = null - - val classField4 : Zin? = null - - val delegateLazy: Z? by lazy {Z()} - - val delegateNotNull: Z? by Delegates.notNull() - - -} - -fun box(): String { - val clz = Test::class.java - - val constructorProperty = clz.getDeclaredField("constructorProperty"); - - if (constructorProperty.getGenericType().toString() != "T") - return "fail0: " + constructorProperty.getGenericType(); - - - val classField = clz.getDeclaredField("classField1"); - - if (classField.getGenericType().toString() != "Z") - return "fail1: " + classField.getGenericType(); - - - val classField2 = clz.getDeclaredField("classField2"); - - if (classField2.getGenericType().toString() != "Z") - return "fail2: " + classField2.getGenericType(); - - - val classField3 = clz.getDeclaredField("classField3"); - - if (classField3.getGenericType().toString() != "Zout") - return "fail3: " + classField3.getGenericType(); - - - val classField4 = clz.getDeclaredField("classField4"); - - if (classField4.getGenericType().toString() != "Zin") - return "fail4: " + classField4.getGenericType(); - - val classField5 = clz.getDeclaredField("delegateLazy\$delegate"); - - if (classField5.getGenericType().toString() != "interface kotlin.Lazy") - return "fail5: " + classField5.getGenericType(); - - val classField6 = clz.getDeclaredField("delegateNotNull\$delegate"); - - if (classField6.getGenericType().toString() != "interface kotlin.properties.ReadWriteProperty") - return "fail6: " + classField6.getGenericType(); - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/genericMethodSignature.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/genericMethodSignature.kt deleted file mode 100644 index 14457a3adef..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/genericMethodSignature.kt +++ /dev/null @@ -1,65 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class Z {} - -class TParam {} - -class Zout {} - -class Zin {} - -class Params(val methodIndex: Int, val paramClass: Class<*>, val expectedReturnType: String, val expecedParamType: String) - -class Test() { - - fun test1(p: T): T? = null - - fun test2(p: Z): Z? = null - - fun test3(p: Z): Z? = null - - fun test4(p: X): Zout? = null - - fun test5(p: Y): Zin? = null -} - -fun box(): String { - val clz = Test::class.java - - val params = listOf( - Params(1, Any::class.java, "T", "T"), - Params(2, Z::class.java, "Z", "Z"), - Params(3, Z::class.java, "Z", "Z"), - Params(4, Any::class.java, "Zout", "X"), - Params(5, Any::class.java, "Zin", "Y") - ) - - - var result: String = "" - for(p in params) { - val fail = test(clz, p.methodIndex, p.paramClass, p.expectedReturnType, p.expecedParamType) - if (fail != "OK") { - result += fail + "\n"; - } - } - - return if (result.isEmpty()) "OK" else result; - -} - -fun test(clazz: Class<*>, methodIndex: Int, paramClass: Class<*>, expectedReturn : String, expectedParam : String): String { - val method = clazz.getDeclaredMethod("test$methodIndex", paramClass)!!; - - if (method.getGenericReturnType().toString() != expectedReturn) - return "fail$methodIndex: " + method.getGenericReturnType(); - - val test1Param = method.getGenericParameterTypes()!![0]; - - if (test1Param.toString() != expectedParam) - return "fail${methodIndex}_param: " + test1Param; - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt11121.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/kt11121.kt deleted file mode 100644 index 5df300b174d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt11121.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class B - -interface A> { - - fun p(p: T): T { - return p - } - - val T.z : T? - get() = null -} - - -fun box(): String { - val defaultImpls = Class.forName("A\$DefaultImpls") - val declaredMethod = defaultImpls.getDeclaredMethod("p", A::class.java, Any::class.java) - if (declaredMethod.toGenericString() != "public static T A\$DefaultImpls.p(A,T)") return "fail 1: ${declaredMethod.toGenericString()}" - - val declaredProperty = defaultImpls.getDeclaredMethod("getZ", A::class.java, Any::class.java) - if (declaredProperty.toGenericString() != "public static T A\$DefaultImpls.getZ(A,T)") return "fail 2: ${declaredProperty.toGenericString()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt5112.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/kt5112.kt deleted file mode 100644 index 9c8184c2f67..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt5112.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -class G(val s: T) { - -} - -public interface ErrorsJvmTrait { - companion object { - public val param : G = G("STRING") - } -} - -public class ErrorsJvmClass { - companion object { - @JvmField public val param : G = G("STRING") - } -} - -fun box(): String { - val genericTypeInClassObject = ErrorsJvmTrait.javaClass.getDeclaredField("param").getGenericType() - if (genericTypeInClassObject.toString() != "test.G") return "fail1: $genericTypeInClassObject" - - val genericTypeInClass = ErrorsJvmClass::class.java.getField("param").getGenericType() - if (genericTypeInClass.toString() != "test.G") return "fail1: genericTypeInClass" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt6106.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/kt6106.kt deleted file mode 100644 index bac5e9c08a8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/kt6106.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -open class B - -class A { - - companion object { - @JvmStatic - fun a(s: T) : T { - return s - } - } -} - -fun box(): String { - val method = A::class.java.getDeclaredMethod("a", B::class.java) - val genericParameterTypes = method.getGenericParameterTypes() - - if (genericParameterTypes.size != 1) return "Wrong number of generic parameters" - - if (genericParameterTypes[0].toString() != "T") return "Wrong parameter type ${genericParameterTypes[0].toString()}" - - if (method.getGenericReturnType().toString() != "T") return "Wrong return type ${method.getGenericReturnType()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt deleted file mode 100644 index 810db7f3fd9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - - inner class FirstInner { - inner class SecondInner { - inner class ThirdInnner { - inner class FourthInner - - fun foo(): FourthInner = TODO() - } - } - } -} - -fun box(): String { - kotlin.test.assertEquals( - "Outer\$FirstInner.Outer\$FirstInner\$SecondInner.ThirdInnner.FourthInner", - Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt deleted file mode 100644 index 30400feef74..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - - inner class FirstInner { - inner class SecondInner { - inner class ThirdInnner { - inner class FourthInner - - fun foo(): FourthInner = TODO() - } - } - } -} - -fun box(): String { - kotlin.test.assertEquals( - "Outer\$FirstInner.Outer\$FirstInner\$SecondInner.ThirdInnner.FourthInner", - Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt deleted file mode 100644 index 3515cafd88c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - - inner class FirstInner { - inner class SecondInner { - inner class ThirdInnner { - inner class FourthInner - - fun foo(): FourthInner = TODO() - } - } - } -} - -fun box(): String { - kotlin.test.assertEquals( - "Outer\$FirstInner\$SecondInner\$ThirdInnner.Outer\$FirstInner\$SecondInner\$ThirdInnner\$FourthInner", - Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt deleted file mode 100644 index 5e1c8338697..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - inner class Inner - fun foo(): Inner? = null -} - -fun box(): String { - kotlin.test.assertEquals( - "Outer.Inner", - Outer::class.java.declaredMethods.single().genericReturnType.toString()) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt deleted file mode 100644 index a43c48307fc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - inner class Inner - fun foo(): Inner? = null -} - -fun box(): String { - kotlin.test.assertEquals( - "Outer.Outer\$Inner", - Outer::class.java.declaredMethods.single().genericReturnType.toString()) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt deleted file mode 100644 index 76a39f00bdc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -abstract class Outer { - inner class Inner - fun foo(): Inner? = null -} - -fun box(): String { - kotlin.test.assertEquals( - "class Outer\$Inner", - Outer::class.java.declaredMethods.single().genericReturnType.toString()) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/isInstance/isInstanceCastAndSafeCast.kt b/backend.native/tests/external/codegen/box/reflection/isInstance/isInstanceCastAndSafeCast.kt deleted file mode 100644 index 3df1d699d1e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/isInstance/isInstanceCastAndSafeCast.kt +++ /dev/null @@ -1,61 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.full.cast -import kotlin.reflect.full.safeCast -import kotlin.test.* - -fun testInstance(value: Any?, klass: KClass<*>) { - assertTrue(klass.isInstance(value)) - assertEquals(value, klass.safeCast(value)) - assertEquals(value, klass.cast(value)) -} - -fun testNotInstance(value: Any?, klass: KClass<*>) { - assertFalse(klass.isInstance(value)) - assertNull(klass.safeCast(value)) - try { - klass.cast(value) - fail("Value should not be an instance of $klass: $value") - } - catch (e: Exception) { /* OK */ } -} - -fun box(): String { - testInstance(Any(), Any::class) - testInstance("", String::class) - testInstance("", Any::class) - testNotInstance(Any(), String::class) - testNotInstance(null, Any::class) - testNotInstance(null, String::class) - - testInstance(arrayOf(""), Array::class) - testInstance(arrayOf(""), Array::class) - testNotInstance(arrayOf(Any()), Array::class) - - testInstance(listOf(""), List::class) - testInstance(listOf(""), Collection::class) - // TODO: support MutableList::class (KT-11754) - // testNotInstance(listOf(""), MutableList::class) - - testInstance(42, Int::class) - testInstance(42, Int::class.javaPrimitiveType!!.kotlin) - testInstance(42, Int::class.javaObjectType!!.kotlin) - - testNotInstance(3.14, Int::class) - - // Function types - - testInstance(fun() {}, Function0::class) - testNotInstance(fun() {}, Function1::class) - testNotInstance(fun() {}, Function2::class) - - testNotInstance(::testInstance, Function0::class) - testNotInstance(::testInstance, Function1::class) - testInstance(::testInstance, Function2::class) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/array.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/array.kt deleted file mode 100644 index 3656f3780c5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/array.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val args: Array>) - -class O -class K - -@Ann(arrayOf(O::class, K::class)) class MyClass - -fun box(): String { - val args = MyClass::class.java.getAnnotation(Ann::class.java).args - val argName1 = args[0].simpleName ?: "fail 1" - val argName2 = args[1].simpleName ?: "fail 2" - return argName1 + argName2 -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/arrayInJava.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/arrayInJava.kt deleted file mode 100644 index 7fd8ce000ef..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/arrayInJava.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class O {} -class K {} - -@Ann(args={O.class, K.class}) -class Test { -} - -// FILE: array.kt - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val args: Array>) - -fun box(): String { - val args = Test::class.java.getAnnotation(Ann::class.java).args - val argName1 = args[0].java.simpleName ?: "fail 1" - val argName2 = args[1].java.simpleName ?: "fail 2" - return argName1 + argName2 -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basic.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basic.kt deleted file mode 100644 index 1b65dbb8618..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basic.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val arg: KClass<*>) - -class OK - -@Ann(OK::class) class MyClass - -fun box(): String { - val argName = MyClass::class.java.getAnnotation(Ann::class.java).arg.simpleName ?: "fail 1" - return argName -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basicInJava.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basicInJava.kt deleted file mode 100644 index c44cc614bf0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/basicInJava.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class OK {} - -@Ann(arg=OK.class) -class Test { -} - -// FILE: basic.kt - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(val arg: KClass<*>) - -fun box(): String { - val argName = Test::class.java.getAnnotation(Ann::class.java).arg.java.simpleName ?: "fail 1" - return argName -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/checkcast.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/checkcast.kt deleted file mode 100644 index 9e10e8386a9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/checkcast.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass - -fun box(): String { - try { - String::class.java as KClass - } catch (e: Exception) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/forceWrapping.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/forceWrapping.kt deleted file mode 100644 index 200df71516c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/forceWrapping.kt +++ /dev/null @@ -1,22 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -annotation class Anno( - val klass: KClass<*>, - val kClasses: Array>, - vararg val kClassesVararg: KClass<*> -) - -@Anno(String::class, arrayOf(Int::class), Double::class) -fun foo() {} - -fun box(): String { - val k = ::foo.annotations.single() as Anno - assertEquals(String::class, k.klass) - assertEquals(Int::class, k.kClasses[0]) - assertEquals(Double::class, k.kClassesVararg[0]) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/vararg.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/vararg.kt deleted file mode 100644 index 95cfd6a34ac..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/vararg.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(vararg val args: KClass<*>) - -class O -class K - -@Ann(O::class, K::class) class MyClass - -fun box(): String { - val args = MyClass::class.java.getAnnotation(Ann::class.java).args - val argName1 = args[0].simpleName ?: "fail 1" - val argName2 = args[1].simpleName ?: "fail 2" - return argName1 + argName2 -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/varargInJava.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/varargInJava.kt deleted file mode 100644 index 9756184f351..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/varargInJava.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: Test.java - -class O {} -class K {} - -@Ann(args={O.class, K.class}) -class Test { -} - -// FILE: vararg.kt - -import kotlin.reflect.KClass - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann(vararg val args: KClass<*>) - -fun box(): String { - val args = Test::class.java.getAnnotation(Ann::class.java).args - val argName1 = args[0].java.simpleName ?: "fail 1" - val argName2 = args[1].java.simpleName ?: "fail 2" - return argName1 + argName2 -} diff --git a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/wrappingForCallableReferences.kt b/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/wrappingForCallableReferences.kt deleted file mode 100644 index 2734320a103..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/kClassInAnnotation/wrappingForCallableReferences.kt +++ /dev/null @@ -1,41 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -annotation class Anno( - val klass: KClass<*>, - val kClasses: Array>, - vararg val kClassesVararg: KClass<*> -) - -@Anno(String::class, arrayOf(Int::class), Double::class) -fun foo() {} - -fun Anno.checkReference(expected: Any?, x: Anno.() -> Any?) { - assertEquals(expected, x()) -} - -fun Anno.checkReferenceArray(expected: Any?, x: Anno.() -> Array) { - assertEquals(expected, x()[0]) -} - -fun checkBoundReference(expected: Any?, x: () -> Any?) { - assertEquals(expected, x()) -} - -fun checkBoundReferenceArray(expected: Any?, x: () -> Array) { - assertEquals(expected, x()[0]) -} - -fun box(): String { - val k = ::foo.annotations.single() as Anno - k.checkReference(String::class, Anno::klass) - k.checkReferenceArray(Int::class, Anno::kClasses) - k.checkReferenceArray(Double::class, Anno::kClassesVararg) - - checkBoundReference(String::class, k::klass) - checkBoundReferenceArray(Int::class, k::kClasses) - checkBoundReferenceArray(Double::class, k::kClassesVararg) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/lambdaClasses/parameterNamesAndNullability.kt b/backend.native/tests/external/codegen/box/reflection/lambdaClasses/parameterNamesAndNullability.kt deleted file mode 100644 index f5fe5282c06..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/lambdaClasses/parameterNamesAndNullability.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals -import kotlin.test.assertNull - -fun lambda() { - val f = { x: Int, y: String? -> } - - val g = f.reflect()!! - - // TODO: maybe change this name - assertEquals("", g.name) - assertEquals(listOf("x", "y"), g.parameters.map { it.name }) - assertEquals(listOf(false, true), g.parameters.map { it.type.isMarkedNullable }) -} - -fun funExpr() { - val f = fun(x: Int, y: String?) {} - - val g = f.reflect()!! - - // TODO: maybe change this name - assertEquals("", g.name) - assertEquals(listOf("x", "y"), g.parameters.map { it.name }) - assertEquals(listOf(false, true), g.parameters.map { it.type.isMarkedNullable }) -} - -fun extensionFunExpr() { - val f = fun String.(): String = this - - val g = f.reflect()!! - - assertEquals(KParameter.Kind.EXTENSION_RECEIVER, g.parameters.single().kind) - assertEquals(null, g.parameters.single().name) -} - -fun box(): String { - lambda() - funExpr() - extensionFunExpr() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/constructor.kt b/backend.native/tests/external/codegen/box/reflection/mapping/constructor.kt deleted file mode 100644 index dd319ae2ff9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/constructor.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -class K { - class Nested - inner class Inner -} - -class Secondary { - constructor(x: Int) {} -} - -fun check(f: KFunction) { - assert(f.javaMethod == null) { "Fail f method" } - assert(f.javaConstructor != null) { "Fail f constructor" } - val c = f.javaConstructor!! - - assert(c.kotlinFunction != null) { "Fail m function" } - val ff = c.kotlinFunction!! - - assert(f == ff) { "Fail f != ff" } -} - -fun box(): String { - check(::K) - - // Workaround KT-8596 - val nested = K::Nested - check(nested) - - check(K::Inner) - check(::Secondary) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/extensionProperty.kt b/backend.native/tests/external/codegen/box/reflection/mapping/extensionProperty.kt deleted file mode 100644 index 6af2c80d95c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/extensionProperty.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class K(var value: Long) - -var K.ext: Double - get() = value.toDouble() - set(value) { - this.value = value.toLong() - } - -fun box(): String { - val p = K::ext - - val getter = p.javaGetter!! - val setter = p.javaSetter!! - - assertEquals(getter, Class.forName("ExtensionPropertyKt").getMethod("getExt", K::class.java)) - assertEquals(setter, Class.forName("ExtensionPropertyKt").getMethod("setExt", K::class.java, Double::class.java)) - - val k = K(42L) - assert(getter.invoke(null, k) == 42.0) { "Fail k getter" } - setter.invoke(null, k, -239.0) - assert(getter.invoke(null, k) == -239.0) { "Fail k setter" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt b/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt deleted file mode 100644 index fb8a7c19a2f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// KT-8131 Cannot find backing field in ancestor class via reflection - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -open class TestBase { - var id = 0L -} - -class TestChild : TestBase() - -fun box(): String { - val property = TestChild::class.memberProperties.first { it.name == "id" } as KMutableProperty<*> - if (property.javaField == null) - return "Fail: no field" - if (property.javaGetter == null) - return "Fail: no getter" - if (property.javaSetter == null) - return "Fail: no setter" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaMethod.kt b/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaMethod.kt deleted file mode 100644 index 53306eb488e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/fakeOverrides/javaMethod.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -open class TestBase { - fun id() = 0L -} - -class TestChild : TestBase() - -fun box(): String { - if (TestChild::class.memberFunctions.first { it.name == "id" }.javaMethod == null) - return "No method for TestChild.id()" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/functions.kt b/backend.native/tests/external/codegen/box/reflection/mapping/functions.kt deleted file mode 100644 index c74a643244d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/functions.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -class K { - fun foo(s: String): Int = s.length -} -fun bar(s: String): Int = s.length -fun String.baz(): Int = this.length - -fun check(f: KFunction) { - assert(f.javaConstructor == null) { "Fail f constructor" } - assert(f.javaMethod != null) { "Fail f method" } - val m = f.javaMethod!! - - assert(m.kotlinFunction != null) { "Fail m function" } - val ff = m.kotlinFunction!! - - assert(f == ff) { "Fail f != ff" } -} - -fun box(): String { - check(K::foo) - check(::bar) - check(String::baz) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/inlineReifiedFun.kt b/backend.native/tests/external/codegen/box/reflection/mapping/inlineReifiedFun.kt deleted file mode 100644 index 656fbbd97d0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/inlineReifiedFun.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -inline fun f() = 1 - -fun g() {} - -class Foo { - inline fun h(t: T) = 1 -} - -fun box(): String { - assertEquals(::g as Any?, ::g.javaMethod!!.kotlinFunction) - - val h = Foo::class.members.single { it.name == "h" } as KFunction<*> - assertEquals(h, h.javaMethod!!.kotlinFunction as Any?) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt b/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt deleted file mode 100644 index ea9f9deac27..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt +++ /dev/null @@ -1,38 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KFunction -import kotlin.reflect.jvm.* -import kotlin.test.* - -class C { - companion object { - @JvmStatic - fun foo(s: String): Int = s.length - } -} - -fun box(): String { - val foo = C.Companion::class.members.single { it.name == "foo" } as KFunction<*> - - val j = foo.javaMethod ?: return "Fail: no Java method found for C::foo" - assertEquals(3, j.invoke(C, "abc")) - - val k = j.kotlinFunction ?: return "Fail: no Kotlin function found for Java method C::foo" - assertEquals(3, k.call(C, "def")) - - - val staticMethod = C::class.java.getDeclaredMethod("foo", String::class.java) - val k2 = staticMethod.kotlinFunction ?: - return "Fail: no Kotlin function found for static bridge for @JvmStatic method in companion object C::foo" - assertEquals(3, k2.call(C, "ghi")) - - assertFailsWith(NullPointerException::class) { k2.call(null, "")!! } - - val j2 = k2.javaMethod - assertEquals(j, j2) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/objectFunction.kt b/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/objectFunction.kt deleted file mode 100644 index 7e9f2408065..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/jvmStatic/objectFunction.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KFunction -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -object O { - @JvmStatic - fun foo(s: String): Int = s.length -} - -fun box(): String { - val foo = O::class.members.single { it.name == "foo" } as KFunction<*> - - val j = foo.javaMethod ?: return "Fail: no Java method found for O::foo" - assertEquals(3, j.invoke(null, "abc")) - - val k = j.kotlinFunction ?: return "Fail: no Kotlin function found for Java method O::foo" - assertEquals(3, k.call(O, "def")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/mappedClassIsEqualToClassLiteral.kt b/backend.native/tests/external/codegen/box/reflection/mapping/mappedClassIsEqualToClassLiteral.kt deleted file mode 100644 index 8b701470811..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/mappedClassIsEqualToClassLiteral.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -class A - -fun box(): String { - val a1 = A::class.java.kotlin - val a2 = A::class - - if (a1 != a2) return "Fail equals" - if (a1.hashCode() != a2.hashCode()) return "Fail hashCode" - if (a1.toString() != a2.toString()) return "Fail toString" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/memberProperty.kt b/backend.native/tests/external/codegen/box/reflection/mapping/memberProperty.kt deleted file mode 100644 index dd2063422df..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/memberProperty.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class K(var value: Long) - -fun box(): String { - val p = K::value - - assert(p.javaField != null) { "Fail p field" } - - val getter = p.javaGetter!! - val setter = p.javaSetter!! - - assertEquals(getter, K::class.java.getMethod("getValue")) - assertEquals(setter, K::class.java.getMethod("setValue", Long::class.java)) - - val k = K(42L) - assert(getter.invoke(k) == 42L) { "Fail k getter" } - setter.invoke(k, -239L) - assert(getter.invoke(k) == -239L) { "Fail k setter" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/openSuspendFun.kt b/backend.native/tests/external/codegen/box/reflection/mapping/openSuspendFun.kt deleted file mode 100644 index 1cdf1b68181..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/openSuspendFun.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_REFLECT -// IGNORE_BACKEND: JS, NATIVE - -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.jvm.javaMethod -import kotlin.test.assertEquals - -open class Aaa { - suspend open fun aaa() {} -} - -class Bbb { - suspend fun bbb() {} -} - -fun box(): String { - val bbb = Bbb::class.declaredMemberFunctions.first { it.name == "bbb" }.javaMethod - assertEquals("bbb", bbb!!.name) - val aaa = Aaa::class.declaredMemberFunctions.first { it.name == "aaa" }.javaMethod - assertEquals("aaa", aaa!!.name) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessors.kt deleted file mode 100644 index 6a6c5002b55..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessors.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.* - -var foo = "foo" - -class A { - var bar = "bar" -} - -fun box(): String { - val fooGetter = ::foo.getter.javaMethod ?: return "Fail fooGetter" - assertEquals("foo", fooGetter.invoke(null)) - - val fooSetter = ::foo.setter.javaMethod ?: return "Fail fooSetter" - fooSetter.invoke(null, "foof") - assertEquals("foof", foo) - - assertNull(::foo.getter.javaConstructor) - assertNull(::foo.setter.javaConstructor) - - - val a = A() - val barGetter = A::bar.getter.javaMethod ?: return "Fail barGetter" - assertEquals("bar", barGetter.invoke(a)) - - val barSetter = A::bar.setter.javaMethod ?: return "Fail barSetter" - barSetter.invoke(a, "barb") - assertEquals("barb", a.bar) - - assertNull(A::bar.getter.javaConstructor) - assertNull(A::bar.setter.javaConstructor) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessorsWithJvmName.kt b/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessorsWithJvmName.kt deleted file mode 100644 index 6fe9db0471e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/propertyAccessorsWithJvmName.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* - -var state: String = "value" - @JvmName("getter") - get - @JvmName("setter") - set - -fun box(): String { - val p = ::state - - if (p.name != "state") return "Fail name: ${p.name}" - if (p.get() != "value") return "Fail get: ${p.get()}" - p.set("OK") - - val getterName = p.javaGetter!!.getName() - if (getterName != "getter") return "Fail getter name: $getterName" - - val setterName = p.javaSetter!!.getName() - if (setterName != "setter") return "Fail setter name: $setterName" - - return p.get() -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/syntheticFields.kt b/backend.native/tests/external/codegen/box/reflection/mapping/syntheticFields.kt deleted file mode 100644 index fc43888da85..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/syntheticFields.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.kotlinProperty - -enum class A { - // There's a synthetic field "$VALUES" here -} - -fun box(): String { - for (field in A::class.java.getDeclaredFields()) { - val prop = field.kotlinProperty - if (prop != null) return "Fail, property found: $prop" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/topLevelFunctionOtherFile.kt b/backend.native/tests/external/codegen/box/reflection/mapping/topLevelFunctionOtherFile.kt deleted file mode 100644 index a7dfc1caab1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/topLevelFunctionOtherFile.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: test.kt - -fun test2() { -} - -// FILE: main.kt -// See KT-10690 Exception in kotlin.reflect when trying to get kotlinFunction from javaMethod - -import kotlin.reflect.jvm.javaMethod -import kotlin.reflect.jvm.kotlinFunction - -fun box(): String { - if (::box.javaMethod?.kotlinFunction == null) - return "Fail box" - if (::test1.javaMethod?.kotlinFunction == null) - return "Fail test1" - if (::test2.javaMethod?.kotlinFunction == null) - return "Fail test2" - - return "OK" -} - -fun test1() { -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/topLevelProperty.kt b/backend.native/tests/external/codegen/box/reflection/mapping/topLevelProperty.kt deleted file mode 100644 index 9acdafea053..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/topLevelProperty.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -var topLevel = "123" - -fun box(): String { - val p = ::topLevel - - assert(p.javaField != null) { "Fail p field" } - val field = p.javaField!! - val className = field.getDeclaringClass().getName() - assertEquals("TopLevelPropertyKt", className) - - val getter = p.javaGetter!! - val setter = p.javaSetter!! - - assertEquals(getter, Class.forName("TopLevelPropertyKt").getMethod("getTopLevel")) - assertEquals(setter, Class.forName("TopLevelPropertyKt").getMethod("setTopLevel", String::class.java)) - - assert(getter.invoke(null) == "123") { "Fail k getter" } - setter.invoke(null, "456") - assert(getter.invoke(null) == "456") { "Fail k setter" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt deleted file mode 100644 index 9a7d17c593c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt +++ /dev/null @@ -1,51 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.GenericArrayType -import java.lang.reflect.ParameterizedType -import kotlin.reflect.KClass -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -annotation class Z -enum class E - -annotation class Anno( - val b: Byte, - val s: String, - val ss: Array, - val z: Z, - val zs: Array, - val e: E, - val es: Array, - val k: KClass<*>, - val ka: Array> -) - -fun tmp(): Array> = null!! - -fun box(): String { - val t = Anno::class.constructors.single().parameters.map { it.type.javaType } - - assertEquals(Byte::class.java, t[0]) - assertEquals(String::class.java, t[1]) - assertEquals(Array::class.java, t[2]) - assertEquals(Z::class.java, t[3]) - assertEquals(Array::class.java, t[4]) - assertEquals(E::class.java, t[5]) - assertEquals(Array::class.java, t[6]) - - assertTrue(t[7] is ParameterizedType) - assertEquals(Class::class.java, (t[7] as ParameterizedType).rawType) - - assertTrue(t[8] is GenericArrayType) - val e = (t[8] as GenericArrayType).genericComponentType - assertTrue(e is ParameterizedType) - assertEquals(Class::class.java, (e as ParameterizedType).rawType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/array.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/array.kt deleted file mode 100644 index a977b6b1eea..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/array.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.GenericArrayType -import java.lang.reflect.TypeVariable -import java.lang.reflect.ParameterizedType -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun foo(strings: Array, integers: Array, objectArrays: Array>) {} - -fun bar(): Array> = null!! -class A { - fun baz(): Array = null!! -} - -fun box(): String { - assertEquals(Array::class.java, ::foo.parameters[0].type.javaType) - assertEquals(Array::class.java, ::foo.parameters[1].type.javaType) - assertEquals(Array>::class.java, ::foo.parameters[2].type.javaType) - - val g = ::bar.returnType.javaType - if (g !is GenericArrayType || g.genericComponentType !is ParameterizedType) - return "Fail: should be array of parameterized type, but was $g (${g.javaClass})" - - val h = A::baz.returnType.javaType - if (h !is GenericArrayType || h.genericComponentType !is TypeVariable<*>) - return "Fail: should be array of type variable, but was $h (${h.javaClass})" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/constructors.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/constructors.kt deleted file mode 100644 index 086b5396745..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/constructors.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class A(d: Double, s: String, parent: A?) { - class Nested(a: A) - inner class Inner(nested: Nested) -} - -fun box(): String { - assertEquals(listOf(java.lang.Double.TYPE, String::class.java, A::class.java), ::A.parameters.map { it.type.javaType }) - assertEquals(listOf(A::class.java), A::Nested.parameters.map { it.type.javaType }) - assertEquals(listOf(A::class.java, A.Nested::class.java), A::Inner.parameters.map { it.type.javaType }) - - assertEquals(A::class.java, ::A.returnType.javaType) - assertEquals(A.Nested::class.java, A::Nested.returnType.javaType) - assertEquals(A.Inner::class.java, A::Inner.returnType.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/genericArrayElementType.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/genericArrayElementType.kt deleted file mode 100644 index 98550ab6684..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/genericArrayElementType.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.ParameterizedType -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -class Bar -fun arrayOfInvBar(): Array = null!! -fun arrayOfInBar(): Array = null!! -fun arrayOfOutBar(): Array = null!! - -fun arrayOfInvList(): Array> = null!! -fun arrayOfInList(): Array> = null!! -fun arrayOfOutList(): Array> = null!! - -fun box(): String { - // NB: in "Array", Java type of X is always Any::class.java because this is the JVM signature generated by the compiler - - assertEquals(Bar::class.java, ::arrayOfInvBar.returnType.arguments.single().type!!.javaType) - assertEquals(Any::class.java, ::arrayOfInBar.returnType.arguments.single().type!!.javaType) - assertEquals(Bar::class.java, ::arrayOfOutBar.returnType.arguments.single().type!!.javaType) - - val invList = ::arrayOfInvList.returnType.arguments.single().type!!.javaType - assertTrue(invList is ParameterizedType && invList.rawType == List::class.java, invList.toString()) - - assertEquals(Any::class.java, ::arrayOfInList.returnType.arguments.single().type!!.javaType) - - val outList = ::arrayOfOutList.returnType.arguments.single().type!!.javaType - assertTrue(outList is ParameterizedType && outList.rawType == List::class.java, outList.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/innerGenericTypeArgument.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/innerGenericTypeArgument.kt deleted file mode 100644 index 70cd78b671f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/innerGenericTypeArgument.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -class Outer { - inner class Inner { - inner class Innermost - } -} - -fun foo(): Outer.Inner.Innermost = null!! - -fun box(): String { - assertEquals( - listOf( - Any::class.java, - Any::class.java, - String::class.java, - Float::class.javaObjectType, - Int::class.javaObjectType, - Number::class.java - ), - ::foo.returnType.arguments.map { it.type!!.javaType } - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/memberFunctions.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/memberFunctions.kt deleted file mode 100644 index ed54958ed69..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/memberFunctions.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -class A { - fun foo(t: Long?): Long = t!! -} - -object O { - @JvmStatic - fun bar(a: A): String = "" -} - -fun box(): String { - val foo = A::foo - assertEquals(listOf(A::class.java, java.lang.Long::class.java), foo.parameters.map { it.type.javaType }) - assertEquals(java.lang.Long.TYPE, foo.returnType.javaType) - - val bar = O::class.members.single { it.name == "bar" } - assertEquals(listOf(O::class.java, A::class.java), bar.parameters.map { it.type.javaType }) - assertEquals(String::class.java, bar.returnType.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/overrideAnyWithPrimitive.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/overrideAnyWithPrimitive.kt deleted file mode 100644 index e8c9abf1f09..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/overrideAnyWithPrimitive.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.* - -interface I { - fun foo(): Any -} - -class A : I { - override fun foo(): Int = 0 - fun bar(x: Long): Int = x.toInt() -} - -fun box(): String { - assertEquals(Integer::class.java, A::foo.returnType.javaType) - assertNotEquals(Integer.TYPE, A::foo.returnType.javaType) - - assertNotEquals(Integer::class.java, A::bar.returnType.javaType) - assertEquals(Integer.TYPE, A::bar.returnType.javaType) - - assertEquals(java.lang.Long.TYPE, A::bar.parameters.last().type.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypeArgument.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypeArgument.kt deleted file mode 100644 index e8fbcd5ecd5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypeArgument.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -fun listOfStrings(): List = null!! - -class Foo -class Bar -fun fooOfInvBar(): Foo = null!! -fun fooOfInBar(): Foo = null!! -fun fooOfOutBar(): Foo = null!! - -fun box(): String { - assertEquals(String::class.java, ::listOfStrings.returnType.arguments.single().type!!.javaType) - - assertEquals(Bar::class.java, ::fooOfInvBar.returnType.arguments.single().type!!.javaType) - assertEquals(Bar::class.java, ::fooOfInBar.returnType.arguments.single().type!!.javaType) - assertEquals(Bar::class.java, ::fooOfOutBar.returnType.arguments.single().type!!.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypes.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypes.kt deleted file mode 100644 index 73eb30e1239..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/parameterizedTypes.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.ParameterizedType -import kotlin.reflect.* -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -class A(private var foo: List) - -object O { - @JvmStatic - private var bar: List = listOf() -} - -fun topLevel(): List = listOf() -fun Any.extension(): List = listOf() - -fun assertGenericType(type: KType) { - val javaType = type.javaType - if (javaType !is ParameterizedType) { - throw AssertionError("Type should be a parameterized type, but was $javaType (${javaType.javaClass})") - } -} - -fun box(): String { - val foo = A::class.members.single { it.name == "foo" } as KMutableProperty<*> - assertGenericType(foo.returnType) - assertGenericType(foo.getter.returnType) - assertGenericType(foo.setter.parameters.last().type) - - val bar = O::class.members.single { it.name == "bar" } as KMutableProperty<*> - assertGenericType(bar.returnType) - assertGenericType(bar.getter.returnType) - assertGenericType(bar.setter.parameters.last().type) - - assertGenericType(::topLevel.returnType) - assertGenericType(Any::extension.returnType) - assertGenericType(::A.parameters.single().type) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/propertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/propertyAccessors.kt deleted file mode 100644 index b99ffe69cd3..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/propertyAccessors.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KMutableProperty -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -class A(private var foo: String) - -object O { - @JvmStatic - private var bar: String = "" -} - -fun box(): String { - val foo = A::class.members.single { it.name == "foo" } as KMutableProperty<*> - assertEquals(listOf(A::class.java), foo.parameters.map { it.type.javaType }) - assertEquals(listOf(A::class.java), foo.getter.parameters.map { it.type.javaType }) - assertEquals(listOf(A::class.java, String::class.java), foo.setter.parameters.map { it.type.javaType }) - - val bar = O::class.members.single { it.name == "bar" } as KMutableProperty<*> - assertEquals(listOf(O::class.java), bar.parameters.map { it.type.javaType }) - assertEquals(listOf(O::class.java), bar.getter.parameters.map { it.type.javaType }) - assertEquals(listOf(O::class.java, String::class.java), bar.setter.parameters.map { it.type.javaType }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/rawTypeArgument.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/rawTypeArgument.kt deleted file mode 100644 index dff36ee7e4e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/rawTypeArgument.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_REFLECT -// FILE: J.java - -import java.util.List; - -public interface J { - List foo(); -} - -// FILE: K.kt - -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(Any::class.java, J::foo.returnType.arguments.single().type!!.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/supertypes.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/supertypes.kt deleted file mode 100644 index 89e71b9389e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/supertypes.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.ParameterizedType -import java.lang.reflect.TypeVariable -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.test.fail - -open class Klass -interface Interface -interface Interface2 - -class A : Interface, Klass(), Interface2 - -fun box(): String { - val (i, k, i2) = A::class.supertypes.map { it.javaType } - - i as? ParameterizedType ?: fail("Not a parameterized type: $i") - assertEquals(Interface::class.java, i.rawType) - val args = i.actualTypeArguments - assertEquals(String::class.java, args[0], "Not String: ${args[0]}") - assertTrue(args[1].let { it is TypeVariable<*> && it.name == "Z" && it.genericDeclaration == A::class.java }, "Not Z: ${args[1]}") - - assertEquals(Klass::class.java, k) - - assertEquals(Interface2::class.java, i2) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/topLevelFunctions.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/topLevelFunctions.kt deleted file mode 100644 index fe4dbc71e2b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/topLevelFunctions.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun free(s: String): Int = s.length - -fun Any.extension() {} - -fun box(): String { - assertEquals(java.lang.Integer.TYPE, ::free.returnType.javaType) - assertEquals(String::class.java, ::free.parameters.single().type.javaType) - - assertEquals(Any::class.java, Any::extension.parameters.single().type.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/typeParameters.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/typeParameters.kt deleted file mode 100644 index 7ca39047f7c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/typeParameters.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK - -import java.lang.reflect.TypeVariable -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -class A { - fun foo(t: T) {} -} - -fun box(): String { - val f = A::foo - val t = f.parameters.last().type.javaType - if (t !is TypeVariable<*>) return "Fail, t should be a type variable: $t" - - assertEquals("T", t.name) - assertEquals("A", (t.genericDeclaration as Class<*>).name) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/unit.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/unit.kt deleted file mode 100644 index 2b4d8327986..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/unit.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun foo(unitParam: Unit, nullableUnitParam: Unit?): Unit {} - -var bar: Unit = Unit - -fun box(): String { - assert(Unit::class.java != java.lang.Void.TYPE) - - assertEquals(Unit::class.java, ::foo.parameters[0].type.javaType) - assertEquals(Unit::class.java, ::foo.parameters[1].type.javaType) - assertEquals(java.lang.Void.TYPE, ::foo.returnType.javaType) - - assertEquals(Unit::class.java, ::bar.returnType.javaType) - assertEquals(Unit::class.java, ::bar.getter.returnType.javaType) - assertEquals(Unit::class.java, ::bar.setter.parameters.single().type.javaType) - assertEquals(java.lang.Void.TYPE, ::bar.setter.returnType.javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/mapping/types/withNullability.kt b/backend.native/tests/external/codegen/box/reflection/mapping/types/withNullability.kt deleted file mode 100644 index a51b0843471..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/mapping/types/withNullability.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.withNullability -import kotlin.reflect.jvm.javaType -import kotlin.test.assertEquals - -fun nonNull(): String = "" -fun nullable(): String? = "" - -fun box(): String { - val nonNull = ::nonNull.returnType - val nullable = ::nullable.returnType - - assertEquals(nullable.javaType, nullable.withNullability(false).javaType) - assertEquals(nullable.javaType, nullable.withNullability(true).javaType) - assertEquals(nonNull.javaType, nonNull.withNullability(false).javaType) - assertEquals(nullable.javaType, nonNull.withNullability(true).javaType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt deleted file mode 100644 index 6aed0593328..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -class A { - fun foo() = "foo" - val bar = "bar" -} - -fun checkEqual(x: Any, y: Any) { - assertEquals(x, y) - assertEquals(y, x) - assertEquals(x.hashCode(), y.hashCode()) -} - -fun box(): String { - checkEqual(A::foo, A::class.members.single { it.name == "foo" }) - checkEqual(A::bar, A::class.members.single { it.name == "bar" }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/classToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/classToString.kt deleted file mode 100644 index 3dce944568e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/classToString.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -class A { - class Nested - - companion object -} - -fun box(): String { - assertEquals("class A", "${A::class}") - assertEquals("class A\$Nested", "${A.Nested::class}") - assertEquals("class A\$Companion", "${A.Companion::class}") - - assertEquals("class kotlin.Any", "${Any::class}") - assertEquals("class kotlin.Int", "${Int::class}") - assertEquals("class kotlin.Int\$Companion", "${Int.Companion::class}") - assertEquals("class kotlin.IntArray", "${IntArray::class}") - assertEquals("class kotlin.String", "${String::class}") - assertEquals("class kotlin.String", "${java.lang.String::class}") - - assertEquals("class kotlin.Array", "${Array::class}") - assertEquals("class kotlin.Array", "${Array::class}") - assertEquals("class kotlin.Array", "${Array>::class}") - - assertEquals("class java.lang.Runnable", "${Runnable::class}") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/extensionPropertyReceiverToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/extensionPropertyReceiverToString.kt deleted file mode 100644 index c7d0be37e3b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/extensionPropertyReceiverToString.kt +++ /dev/null @@ -1,91 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KProperty1 -import kotlin.test.assertEquals - -fun check(expected: String, p: KProperty1<*, *>) { - var s = p.toString() - - // Strip "val" or "var" - assert(s.startsWith("val ") || s.startsWith("var ")) { "Fail val/var: $s" } - s = s.substring(4) - - // Strip property type - s = s.substringBeforeLast(':') - - // Strip property name, leave only receiver class - s = s.substringBeforeLast('.') - - assertEquals(expected, s) -} - -val Boolean.x: Any get() = this -val Char.x: Any get() = this -val Byte.x: Any get() = this -val Short.x: Any get() = this -val Int.x: Any get() = this -val Float.x: Any get() = this -val Long.x: Any get() = this -val Double.x: Any get() = this - -val BooleanArray.x: Any get() = this -val CharArray.x: Any get() = this -val ByteArray.x: Any get() = this -val ShortArray.x: Any get() = this -val IntArray.x: Any get() = this -val FloatArray.x: Any get() = this -val LongArray.x: Any get() = this -val DoubleArray.x: Any get() = this - -val Array.a1: Any get() = this -val Array.a2: Any get() = this -val Array>.a3: Any get() = this -val Array.a4: Any get() = this - -val Any?.n1: Any get() = Any() -val Int?.n2: Any get() = Any() -val Array?.n3: Any get() = Any() -val Array.n4: Any get() = Any() -val Array?.n5: Any get() = Any() - -val Map.m: Any get() = this -val List>>.l: Any get() = this - -fun box(): String { - check("kotlin.Boolean", Boolean::x) - check("kotlin.Char", Char::x) - check("kotlin.Byte", Byte::x) - check("kotlin.Short", Short::x) - check("kotlin.Int", Int::x) - check("kotlin.Float", Float::x) - check("kotlin.Long", Long::x) - check("kotlin.Double", Double::x) - - check("kotlin.BooleanArray", BooleanArray::x) - check("kotlin.CharArray", CharArray::x) - check("kotlin.ByteArray", ByteArray::x) - check("kotlin.ShortArray", ShortArray::x) - check("kotlin.IntArray", IntArray::x) - check("kotlin.FloatArray", FloatArray::x) - check("kotlin.LongArray", LongArray::x) - check("kotlin.DoubleArray", DoubleArray::x) - - check("kotlin.Any?", Any?::n1) - check("kotlin.Int?", Int?::n2) - check("kotlin.Array?", Array?::n3) - check("kotlin.Array", Array::n4) - check("kotlin.Array?", Array?::n5) - - check("kotlin.Array", Array::a1) - check("kotlin.Array", Array::a2) - check("kotlin.Array>", Array>::a3) - check("kotlin.Array", Array::a4) - - check("kotlin.collections.Map", Map::m) - check("kotlin.collections.List>>", List>>::l) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionEqualsHashCode.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionEqualsHashCode.kt deleted file mode 100644 index 72b169fe9fb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionEqualsHashCode.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -fun top() = 42 - -fun Int.intExt(): Int = this - -class A { - fun mem() {} -} - -class B { - fun mem() {} -} - - -fun checkEqual(x: Any, y: Any) { - assertEquals(x, y) - assertEquals(x.hashCode(), y.hashCode(), "Elements are equal but their hash codes are not: ${x.hashCode()} != ${y.hashCode()}") -} - -fun box(): String { - checkEqual(::top, ::top) - checkEqual(Int::intExt, Int::intExt) - checkEqual(A::mem, A::mem) - - assertFalse(::top == Int::intExt) - assertFalse(::top == A::mem) - assertFalse(A::mem == B::mem) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibMultiFileFacade.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibMultiFileFacade.kt deleted file mode 100644 index 567bce31a49..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibMultiFileFacade.kt +++ /dev/null @@ -1,13 +0,0 @@ -// KT-12630 KotlinReflectionInternalError on referencing some functions from stdlib - -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.test.* - -fun box(): String { - val asIterable = List::asIterable - assertEquals("fun kotlin.collections.Iterable.asIterable(): kotlin.collections.Iterable", asIterable.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt deleted file mode 100644 index 70430a07e3b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt +++ /dev/null @@ -1,13 +0,0 @@ -// KT-12630 KotlinReflectionInternalError on referencing some functions from stdlib - -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.test.* - -fun box(): String { - val lazyOf: (String) -> Lazy = ::lazyOf - assertEquals("fun lazyOf(T): kotlin.Lazy", lazyOf.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionToString.kt deleted file mode 100644 index dec835773dc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/functionToString.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -import kotlin.test.assertEquals - -fun top() = 42 - -fun String.ext(): Int = 0 -fun IntRange?.ext2(): Array = arrayOfNulls(0) - -class A { - fun mem(): String = "" -} - -fun assertToString(s: String, x: Any) { - assertEquals(s, x.toString()) -} - -fun box(): String { - assertToString("fun top(): kotlin.Int", ::top) - assertToString("fun kotlin.String.ext(): kotlin.Int", String::ext) - assertToString("fun kotlin.ranges.IntRange?.ext2(): kotlin.Array", IntRange::ext2) - assertToString("fun test.A.mem(): kotlin.String", A::mem) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/memberExtensionToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/memberExtensionToString.kt deleted file mode 100644 index 81059aecea8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/memberExtensionToString.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* - -class A { - var String.id: String - get() = this - set(value) {} - - fun Int.foo(): Double = toDouble() -} - -fun box(): String { - val p = A::class.memberExtensionProperties.single() - return if ("$p" == "var A.(kotlin.String.)id: kotlin.String") "OK" else "Fail $p" - - val q = A::class.declaredFunctions.single() - if ("$q" != "fun A.(kotlin.Int.)foo(): kotlin.Double") return "Fail q $q" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersEqualsHashCode.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersEqualsHashCode.kt deleted file mode 100644 index 79ea783e548..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersEqualsHashCode.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -class A { - fun foo(s: String, x: Int) {} - fun bar(x: Int) {} - val baz = 42 -} - -fun box(): String { - // Dispatch receiver parameters of different callables are not equal - assertNotEquals(A::foo.parameters[0], A::bar.parameters[0]) - assertNotEquals(A::foo.parameters[0], A::baz.parameters[0]) - - assertNotEquals(A::foo.parameters[1], A::bar.parameters[1]) - assertNotEquals(A::foo.parameters[1], A::foo.parameters[2]) - assertNotEquals(A::bar.parameters[1], A::foo.parameters[2]) - - assertEquals(A::foo.parameters[0], A::foo.parameters[0]) - assertEquals(A::foo.parameters[0].hashCode(), A::foo.parameters[0].hashCode()) - assertEquals(A::foo.parameters[1], A::foo.parameters[1]) - assertEquals(A::foo.parameters[1].hashCode(), A::foo.parameters[1].hashCode()) - assertEquals(A::bar.parameters[0], A::bar.parameters[0]) - assertEquals(A::bar.parameters[0].hashCode(), A::bar.parameters[0].hashCode()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersToString.kt deleted file mode 100644 index fa186eef7b5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/parametersToString.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -fun Int.foo(s: String) {} - -class A { - fun bar() {} -} - -fun baz(name: String) {} - -fun box(): String { - assertEquals( - listOf("extension receiver of ${Int::foo}", "parameter #1 s of ${Int::foo}"), - Int::foo.parameters.map(Any::toString) - ) - - assertEquals( - listOf("instance of ${A::bar}"), - A::bar.parameters.map(Any::toString) - ) - - assertEquals( - listOf("parameter #0 name of ${::baz}"), - ::baz.parameters.map(Any::toString) - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyEqualsHashCode.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyEqualsHashCode.kt deleted file mode 100644 index 4d2affbd96b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyEqualsHashCode.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -val top = 42 -var top2 = -23 - -val Int.intExt: Int get() = this -val Char.charExt: Int get() = this.toInt() - -class A(var mem: String) -class B(var mem: String) - - -fun checkEqual(x: Any, y: Any) { - assertEquals(x, y) - assertEquals(x.hashCode(), y.hashCode(), "Elements are equal but their hash codes are not: ${x.hashCode()} != ${y.hashCode()}") -} - -fun box(): String { - checkEqual(::top, ::top) - checkEqual(::top2, ::top2) - checkEqual(Int::intExt, Int::intExt) - checkEqual(A::mem, A::mem) - - assertFalse(::top == ::top2) - assertFalse(Int::intExt == Char::charExt) - assertFalse(A::mem == B::mem) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyToString.kt deleted file mode 100644 index 4290f008a42..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/propertyToString.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -package test - -import kotlin.test.assertEquals - -val top = 42 -var top2 = -23 - -val String.ext: Int get() = 0 -var IntRange?.ext2: Int get() = 0; set(value) {} - -class A(val mem: String) -class B(var mem: String) - -fun assertToString(s: String, x: Any) { - assertEquals(s, x.toString()) -} - -fun box(): String { - assertToString("val top: kotlin.Int", ::top) - assertToString("var top2: kotlin.Int", ::top2) - assertToString("val kotlin.String.ext: kotlin.Int", String::ext) - assertToString("var kotlin.ranges.IntRange?.ext2: kotlin.Int", IntRange::ext2) - assertToString("val test.A.mem: kotlin.String", A::mem) - assertToString("var test.B.mem: kotlin.String", B::mem) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeEqualsHashCode.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeEqualsHashCode.kt deleted file mode 100644 index 34d8104179e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeEqualsHashCode.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KType -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals - -fun unit(p: Unit): Unit {} - -fun nullable(s: String): String? = s - -class A { - fun typeParam(t: T): T = t -} - - -fun box(): String { - fun check(t1: KType, t2: KType) { - assertEquals(t1, t2) - assertEquals(t1.hashCode(), t2.hashCode()) - } - - check(::unit.parameters.single().type, ::unit.returnType) - - assertNotEquals(::nullable.parameters.single().type, ::nullable.returnType) - - val typeParam = A::class.members.single { it.name == "typeParam" } - check(typeParam.parameters.last().type, typeParam.returnType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersEqualsHashCode.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersEqualsHashCode.kt deleted file mode 100644 index 5c8207fe492..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersEqualsHashCode.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals - -class A -class B - -class Fun { - fun foo(): T = null!! -} - -class Fourple - -fun box(): String { - assertEquals(A::class.typeParameters, A::class.typeParameters) - assertEquals(A::class.typeParameters.single().hashCode(), A::class.typeParameters.single().hashCode()) - - fun getFoo() = Fun::class.members.single { it.name == "foo" } - assertEquals(getFoo().typeParameters, getFoo().typeParameters) - assertEquals(getFoo().typeParameters.single().hashCode(), getFoo().typeParameters.single().hashCode()) - - assertNotEquals(A::class.typeParameters.single(), B::class.typeParameters.single()) - - val fi = Fourple::class.typeParameters - val fj = Fourple::class.typeParameters - for (i in 0..fi.size - 1) { - for (j in 0..fj.size - 1) { - if (i == j) { - assertEquals(fi[i], fj[j]) - assertEquals(fi[i].hashCode(), fj[j].hashCode()) - } else { - assertNotEquals(fi[i], fj[j]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersToString.kt deleted file mode 100644 index 69adf928177..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeParametersToString.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -interface Variance -class OneBound> -class SeveralBounds where T : Enum, T : Variance - -fun box(): String { - assertEquals("[A, in B, out C, D]", Variance::class.typeParameters.toString()) - assertEquals("[T]", OneBound::class.typeParameters.toString()) - assertEquals("[T]", SeveralBounds::class.typeParameters.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToString.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToString.kt deleted file mode 100644 index 805f4d8438b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToString.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun String?.foo(x: Int, y: Array, z: IntArray, w: List>>) {} - -class A { - fun bar(t: T, u: U): T? = null -} - -fun baz(inProjection: A, outProjection: A) {} - -fun box(): String { - assertEquals( - listOf( - "kotlin.String?", - "kotlin.Int", - "kotlin.Array", - "kotlin.IntArray", - "kotlin.collections.List>>" - ), - String?::foo.parameters.map { it.type.toString() } - ) - - assertEquals("kotlin.Unit", String?::foo.returnType.toString()) - - val bar = A::class.members.single { it.name == "bar" } - assertEquals(listOf("A", "T", "U"), bar.parameters.map { it.type.toString() }) - assertEquals("T?", bar.returnType.toString()) - - assertEquals( - listOf("A", "A"), - ::baz.parameters.map { it.type.toString() } - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToStringInnerGeneric.kt b/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToStringInnerGeneric.kt deleted file mode 100644 index da6d846e8f5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/methodsFromAny/typeToStringInnerGeneric.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class A { - inner class B { - inner class C - } -} - -fun foo(): A.B.C = null!! - -fun box(): String { - assertEquals("A.B.C", ::foo.returnType.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/callableModality.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/callableModality.kt deleted file mode 100644 index e75ac5d3149..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/callableModality.kt +++ /dev/null @@ -1,54 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -interface Interface { - open fun openFun() {} - abstract fun abstractFun() -} - -abstract class AbstractClass { - final val finalVal = Unit - open val openVal = Unit - abstract var abstractVar: Unit -} - -fun box(): String { - assertFalse(Interface::openFun.isFinal) - assertTrue(Interface::openFun.isOpen) - assertFalse(Interface::openFun.isAbstract) - - assertFalse(Interface::abstractFun.isFinal) - assertFalse(Interface::abstractFun.isOpen) - assertTrue(Interface::abstractFun.isAbstract) - - assertTrue(AbstractClass::finalVal.isFinal) - assertFalse(AbstractClass::finalVal.isOpen) - assertFalse(AbstractClass::finalVal.isAbstract) - assertTrue(AbstractClass::finalVal.getter.isFinal) - assertFalse(AbstractClass::finalVal.getter.isOpen) - assertFalse(AbstractClass::finalVal.getter.isAbstract) - - assertFalse(AbstractClass::openVal.isFinal) - assertTrue(AbstractClass::openVal.isOpen) - assertFalse(AbstractClass::openVal.isAbstract) - assertFalse(AbstractClass::openVal.getter.isFinal) - assertTrue(AbstractClass::openVal.getter.isOpen) - assertFalse(AbstractClass::openVal.getter.isAbstract) - - assertFalse(AbstractClass::abstractVar.isFinal) - assertFalse(AbstractClass::abstractVar.isOpen) - assertTrue(AbstractClass::abstractVar.isAbstract) - assertFalse(AbstractClass::abstractVar.getter.isFinal) - assertFalse(AbstractClass::abstractVar.getter.isOpen) - assertTrue(AbstractClass::abstractVar.getter.isAbstract) - assertFalse(AbstractClass::abstractVar.setter.isFinal) - assertFalse(AbstractClass::abstractVar.setter.isOpen) - assertTrue(AbstractClass::abstractVar.setter.isAbstract) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/callableVisibility.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/callableVisibility.kt deleted file mode 100644 index 40dd01f4b03..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/callableVisibility.kt +++ /dev/null @@ -1,58 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KFunction -import kotlin.reflect.KProperty -import kotlin.reflect.KVisibility -import kotlin.test.assertEquals - -open class Foo { - public fun publicFun() {} - protected fun protectedFun() {} - internal fun internalFun() {} - private fun privateFun() {} - private fun privateToThisFun(): T = null!! - - fun getProtectedFun() = this::protectedFun - fun getPrivateFun() = this::privateFun - fun getPrivateToThisFun(): KFunction<*> = this::privateToThisFun - - public val publicVal = Unit - protected val protectedVar = Unit - internal val internalVal = Unit - private val privateVal = Unit - private val privateToThisVal: T? = null - - fun getProtectedVar() = this::protectedVar - fun getPrivateVal() = this::privateVal - fun getPrivateToThisVal(): KProperty<*> = this::privateToThisVal - - public var publicVarPrivateSetter = Unit - private set - - fun getPublicVarPrivateSetter() = this::publicVarPrivateSetter -} - -fun box(): String { - val f = Foo() - - assertEquals(KVisibility.PUBLIC, f::publicFun.visibility) - assertEquals(KVisibility.PROTECTED, f.getProtectedFun().visibility) - assertEquals(KVisibility.INTERNAL, f::internalFun.visibility) - assertEquals(KVisibility.PRIVATE, f.getPrivateFun().visibility) - assertEquals(KVisibility.PRIVATE, f.getPrivateToThisFun().visibility) - - assertEquals(KVisibility.PUBLIC, f::publicVal.visibility) - assertEquals(KVisibility.PROTECTED, f.getProtectedVar().visibility) - assertEquals(KVisibility.INTERNAL, f::internalVal.visibility) - assertEquals(KVisibility.PRIVATE, f.getPrivateVal().visibility) - assertEquals(KVisibility.PRIVATE, f.getPrivateToThisVal().visibility) - - assertEquals(KVisibility.PUBLIC, f.getPublicVarPrivateSetter().visibility) - assertEquals(KVisibility.PUBLIC, f.getPublicVarPrivateSetter().getter.visibility) - assertEquals(KVisibility.PRIVATE, f.getPublicVarPrivateSetter().setter.visibility) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/classModality.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/classModality.kt deleted file mode 100644 index d3e2dd721dd..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/classModality.kt +++ /dev/null @@ -1,59 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -class FinalClass { - companion object Companion -} -open class OpenClass -abstract class AbstractClass -interface Interface -enum class EnumClass -enum class EnumClassWithAbstractMember { ; abstract fun foo() } -annotation class AnnotationClass -object Object - -fun box(): String { - assertTrue(FinalClass::class.isFinal) - assertFalse(FinalClass::class.isOpen) - assertFalse(FinalClass::class.isAbstract) - - assertTrue(FinalClass.Companion::class.isFinal) - assertFalse(FinalClass.Companion::class.isOpen) - assertFalse(FinalClass.Companion::class.isAbstract) - - assertFalse(OpenClass::class.isFinal) - assertTrue(OpenClass::class.isOpen) - assertFalse(OpenClass::class.isAbstract) - - assertFalse(AbstractClass::class.isFinal) - assertFalse(AbstractClass::class.isOpen) - assertTrue(AbstractClass::class.isAbstract) - - assertFalse(Interface::class.isFinal) - assertFalse(Interface::class.isOpen) - assertTrue(Interface::class.isAbstract) - - assertTrue(EnumClass::class.isFinal) - assertFalse(EnumClass::class.isOpen) - assertFalse(EnumClass::class.isAbstract) - - assertTrue(EnumClassWithAbstractMember::class.isFinal) - assertFalse(EnumClassWithAbstractMember::class.isOpen) - assertFalse(EnumClassWithAbstractMember::class.isAbstract) - - // Note that unlike in JVM, annotation classes are final in Kotlin - assertTrue(AnnotationClass::class.isFinal) - assertFalse(AnnotationClass::class.isOpen) - assertFalse(AnnotationClass::class.isAbstract) - - assertTrue(Object::class.isFinal) - assertFalse(Object::class.isOpen) - assertFalse(Object::class.isAbstract) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/classVisibility.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/classVisibility.kt deleted file mode 100644 index 661d5081478..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/classVisibility.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.KVisibility -import kotlin.test.assertEquals - -class DefaultVisibilityClass -public class PublicClass { - protected class ProtectedClass - fun getProtectedClass(): KClass<*> = ProtectedClass::class -} -internal class InternalClass -private class PrivateClass - -fun box(): String { - assertEquals(KVisibility.PUBLIC, DefaultVisibilityClass::class.visibility) - assertEquals(KVisibility.PUBLIC, PublicClass::class.visibility) - assertEquals(KVisibility.PROTECTED, PublicClass().getProtectedClass().visibility) - assertEquals(KVisibility.INTERNAL, InternalClass::class.visibility) - assertEquals(KVisibility.PRIVATE, PrivateClass::class.visibility) - - class Local - assertEquals(null, Local::class.visibility) - - val anonymous = object {} - assertEquals(null, anonymous::class.visibility) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/classes.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/classes.kt deleted file mode 100644 index 1febcc0ce33..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/classes.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -sealed class S { - data class DataClass(val x: Int) : S() - inner class InnerClass - companion object - object NonCompanionObject -} - -fun box(): String { - assertTrue(S::class.isSealed) - assertFalse(S::class.isFinal) - assertFalse(S::class.isOpen) - assertFalse(S::class.isAbstract) - assertFalse(S::class.isData) - assertFalse(S::class.isInner) - assertFalse(S::class.isCompanion) - - assertFalse(S.DataClass::class.isSealed) - assertTrue(S.DataClass::class.isData) - assertFalse(S.DataClass::class.isInner) - assertFalse(S.DataClass::class.isCompanion) - - assertFalse(S.InnerClass::class.isSealed) - assertFalse(S.InnerClass::class.isData) - assertTrue(S.InnerClass::class.isInner) - assertFalse(S.InnerClass::class.isCompanion) - - assertFalse(S.Companion::class.isSealed) - assertFalse(S.Companion::class.isData) - assertFalse(S.Companion::class.isInner) - assertTrue(S.Companion::class.isCompanion) - - assertFalse(S.NonCompanionObject::class.isSealed) - assertFalse(S.NonCompanionObject::class.isData) - assertFalse(S.NonCompanionObject::class.isInner) - assertFalse(S.NonCompanionObject::class.isCompanion) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/functions.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/functions.kt deleted file mode 100644 index 8a9372217f5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/functions.kt +++ /dev/null @@ -1,62 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -inline fun inline() {} -class External { external fun external() } -operator fun Unit.invoke() {} -infix fun Unit.infix(unit: Unit) {} -// TODO: support or prohibit references to suspend functions -// class Suspend { suspend fun suspend(c: Continuation) {} } - -val externalGetter = Unit - external get - -inline var inlineProperty: Unit - get() = Unit - set(value) {} - -fun box(): String { - assertTrue(::inline.isInline) - assertFalse(::inline.isExternal) - assertFalse(::inline.isOperator) - assertFalse(::inline.isInfix) - assertFalse(::inline.isSuspend) - - assertFalse(External::external.isInline) - assertTrue(External::external.isExternal) - assertFalse(External::external.isOperator) - assertFalse(External::external.isInfix) - assertFalse(External::external.isSuspend) - - assertFalse(Unit::invoke.isInline) - assertFalse(Unit::invoke.isExternal) - assertTrue(Unit::invoke.isOperator) - assertFalse(Unit::invoke.isInfix) - assertFalse(Unit::invoke.isSuspend) - - assertFalse(Unit::infix.isInline) - assertFalse(Unit::infix.isExternal) - assertFalse(Unit::infix.isOperator) - assertTrue(Unit::infix.isInfix) - assertFalse(Unit::infix.isSuspend) - -// assertFalse(Suspend::suspend.isInline) -// assertFalse(Suspend::suspend.isExternal) -// assertFalse(Suspend::suspend.isOperator) -// assertFalse(Suspend::suspend.isInfix) -// assertTrue(Suspend::suspend.isSuspend) - - assertTrue(::externalGetter.getter.isExternal) - assertFalse(::externalGetter.getter.isInline) - - assertFalse(::inlineProperty.getter.isExternal) - assertTrue(::inlineProperty.getter.isInline) - assertTrue(::inlineProperty.setter.isInline) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/javaVisibility.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/javaVisibility.kt deleted file mode 100644 index d0508d4d841..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/javaVisibility.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -class J { - protected class C {} - protected static class D {} - - void foo() {} - protected void bar() {} - protected static void baz() {} -} - -// FILE: K.kt - -import kotlin.test.assertEquals - -fun box(): String { - // Package-private class - assertEquals(null, J::class.visibility) - // Protected+package class - assertEquals(null, J.C::class.visibility) - // Protected static class - assertEquals(null, J.D::class.visibility) - - // Package-private method - assertEquals(null, J::foo.visibility) - // Protected+package method - assertEquals(null, J::bar.visibility) - // Protected static method - assertEquals(null, J::baz.visibility) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/properties.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/properties.kt deleted file mode 100644 index 24711c80d9a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/properties.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -const val const = "const" -val nonConst = "nonConst" - -class A { - lateinit var lateinit: Unit - var nonLateinit = Unit -} - -fun box(): String { - assertTrue(::const.isConst) - assertFalse(::nonConst.isConst) - - assertTrue(A::lateinit.isLateinit) - assertFalse(A::nonLateinit.isLateinit) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/modifiers/typeParameters.kt b/backend.native/tests/external/codegen/box/reflection/modifiers/typeParameters.kt deleted file mode 100644 index 486fed08f81..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/modifiers/typeParameters.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -class A { - fun nonReified(): T = null!! - inline fun reified(): U = null!! -} - -fun box(): String { - assertFalse(A::class.members.single { it.name == "nonReified" }.typeParameters.single().isReified) - assertTrue(A::class.members.single { it.name == "reified" }.typeParameters.single().isReified) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/multifileClasses/callFunctionsInMultifileClass.kt b/backend.native/tests/external/codegen/box/reflection/multifileClasses/callFunctionsInMultifileClass.kt deleted file mode 100644 index 682f33e92f1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/multifileClasses/callFunctionsInMultifileClass.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: Test1.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -import kotlin.test.assertEquals - -fun getX() = 1 - -fun box(): String { - assertEquals("getX", ::getX.name) - assertEquals("getY", ::getY.name) - assertEquals("getZ", ::getZ.name) - - assertEquals(1, ::getX.call()) - assertEquals(239, ::getY.call()) - assertEquals(42, ::getZ.callBy(emptyMap())) - - return "OK" -} - -// FILE: Test2.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -fun getY() = 239 - -fun getZ(value: Int = 42) = value diff --git a/backend.native/tests/external/codegen/box/reflection/multifileClasses/callPropertiesInMultifileClass.kt b/backend.native/tests/external/codegen/box/reflection/multifileClasses/callPropertiesInMultifileClass.kt deleted file mode 100644 index 44e0b439f7f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/multifileClasses/callPropertiesInMultifileClass.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// KT-11447 Multifile declaration causes IAE: Method can not access a member of class -// WITH_REFLECT -// FILE: Test1.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -import kotlin.test.assertEquals - -var x = 1 - -fun box(): String { - assertEquals("x", ::x.name) - assertEquals("y", ::y.name) - assertEquals("MAGIC_NUMBER", ::MAGIC_NUMBER.name) - - assertEquals(1, ::x.call()) - assertEquals(1, ::x.getter.call()) - - assertEquals(239, ::y.call()) - assertEquals(239, ::y.getter.call()) - - assertEquals(42, ::MAGIC_NUMBER.call()) - assertEquals(42, ::MAGIC_NUMBER.getter.call()) - - assertEquals(Unit, ::x.setter.call(2)) - assertEquals(2, ::x.call()) - assertEquals(2, ::x.getter.call()) - - return "OK" -} - -// FILE: Test2.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -val y = 239 - -const val MAGIC_NUMBER = 42 diff --git a/backend.native/tests/external/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt b/backend.native/tests/external/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt deleted file mode 100644 index b992742377c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt +++ /dev/null @@ -1,75 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK -// FILE: 1.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -fun testX() { - val field = ::x.javaField ?: throw AssertionError("No java field for ${::x.name}") - - try { - field.get(null) - throw AssertionError("Fail: field.get should fail because the field is private") - } - catch (e: IllegalAccessException) { - // OK - } - - field.setAccessible(true) - assertEquals("I am x", field.get(null)) - field.set(null, "OK") -} - -fun testY() { - val field = ::y.javaField ?: throw AssertionError("No java field for ${::y.name}") - - assertEquals("I am const y", field.get(null)) - - // Accessible = false should have no effect because the field is public - field.setAccessible(false) - - assertEquals("I am const y", field.get(null)) -} - -fun testZ() { - val field = refZ.javaField ?: throw AssertionError("No java field for ${refZ.name}") - - - try { - field.get(null) - throw AssertionError("IllegalAccessError expected") - } - catch (e: IllegalAccessException) { - // OK - } - - field.setAccessible(true) - assertEquals("I am private const val Z", field.get(null)) -} - -fun box(): String { - testX() - testY() - testZ() - return x -} - -// FILE: 2.kt - -@file:kotlin.jvm.JvmName("Test") -@file:kotlin.jvm.JvmMultifileClass -package test - -var x = "I am x" -const val y = "I am const y" -private const val z = "I am private const val Z" - -val refZ = ::z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/javaClass.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/javaClass.kt deleted file mode 100644 index 6284db2f30f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/javaClass.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.* - -class Klass - -fun box(): String { - val kClass = Klass::class - val jClass = kClass.java - val kjClass = Klass::class.java - val kkClass = jClass.kotlin - val jjClass = kkClass.java - - assertEquals("Klass", jClass.getSimpleName()) - assertEquals("Klass", kjClass.getSimpleName()) - assertEquals("Klass", kkClass.java.simpleName) - assertEquals(kjClass, jjClass) - - try { kClass.simpleName; return "Fail 1" } catch (e: Error) {} - try { kClass.qualifiedName; return "Fail 2" } catch (e: Error) {} - try { kClass.members; return "Fail 3" } catch (e: Error) {} - - val jlError = Error::class.java - val kljError = Error::class - val jljError = kljError.java - val jlkError = jlError.kotlin - - assertEquals("Error", jlError.getSimpleName()) - assertEquals("Error", jljError.getSimpleName()) - assertEquals("Error", jlkError.java.simpleName) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt deleted file mode 100644 index 9be0af350e1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -import kotlin.reflect.KCallable -import kotlin.test.* - -class M { - fun foo() {} - val bar = 1 -} - -fun topLevelFun() {} -val topLevelProp = "" - -fun checkEquals(x: KCallable, y: KCallable) { - assertEquals(x, y) - assertEquals(y, x) - assertEquals(x.hashCode(), y.hashCode()) -} - -fun checkToString(x: KCallable<*>, expected: String) { - assertEquals(expected + " (Kotlin reflection is not available)", x.toString()) -} - -fun box(): String { - checkEquals(M::foo, M::foo) - checkEquals(M::bar, M::bar) - checkEquals(::M, ::M) - - checkEquals(::topLevelFun, ::topLevelFun) - checkEquals(::topLevelProp, ::topLevelProp) - - checkToString(M::foo, "function foo") - checkToString(M::bar, "property bar") - checkToString(::M, "constructor") - - checkToString(::topLevelFun, "function topLevelFun") - checkToString(::topLevelProp, "property topLevelProp") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt deleted file mode 100644 index 4ed13798050..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass -import kotlin.test.* - -class M - -fun check(x: KClass<*>) { - assertEquals(x, x.java.kotlin) - assertEquals(x.hashCode(), x.java.kotlin.hashCode()) - assertEquals(x.java.toString() + " (Kotlin reflection is not available)", x.toString()) -} - -fun box(): String { - check(M::class) - check(String::class) - check(Error::class) - check(Int::class) - check(java.lang.Integer::class) - check(MutableList::class) - check(Array::class) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/delegatedProperty.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/delegatedProperty.kt deleted file mode 100644 index dfc8c6b0065..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/delegatedProperty.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: JS -// WITH_RUNTIME - -import kotlin.reflect.KProperty -import kotlin.test.assertEquals - -@kotlin.native.ThreadLocal -object Delegate { - lateinit var prop: KProperty<*> - - operator fun provideDelegate(thiz: Any?, p: KProperty<*>): Delegate { - prop = p - return this - } - - operator fun getValue(x: Any?, p: KProperty<*>) { - assertEquals(prop as Any, p) - assertEquals(p as Any, prop) - assertEquals(p.hashCode(), prop.hashCode()) - assertEquals("property x (Kotlin reflection is not available)", p.toString()) - } -} - -val x: Unit by Delegate - -fun box(): String { - x - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/primitiveJavaClass.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/primitiveJavaClass.kt deleted file mode 100644 index bf9dcabbfbb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/primitiveJavaClass.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun check(name: String, c: Class<*>) { - assertEquals(name, c.simpleName) -} - -fun box(): String { - check("boolean", Boolean::class.java) - check("byte", Byte::class.java) - check("char", Char::class.java) - check("short", Short::class.java) - check("int", Int::class.java) - check("float", Float::class.java) - check("long", Long::class.java) - check("double", Double::class.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyGetSetName.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyGetSetName.kt deleted file mode 100644 index f485e0554fe..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyGetSetName.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.reflect.* - -data class Box(val value: String) - -var pr = Box("first") - -fun box(): String { - val p = ::pr - if (p.get().value != "first") return "Fail value 1: ${p.get()}" - if (p.name != "pr") return "Fail name: ${p.name}" - p.set(Box("second")) - if (p.get().value != "second") return "Fail value 2: ${p.get()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt deleted file mode 100644 index bbd34af42b9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME - -import kotlin.reflect.* -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -class A { - val readonly: String = "" - var mutable: String = "" -} - -val readonly: String = "" -var mutable: String = "" - -fun box(): String { - assertTrue(::readonly is KProperty0<*>) - assertFalse(::readonly is KMutableProperty0<*>) - assertFalse(::readonly is KProperty1<*, *>) - assertFalse(::readonly is KProperty2<*, *, *>) - - assertTrue(::mutable is KProperty0<*>) - assertTrue(::mutable is KMutableProperty0<*>) - assertFalse(::mutable is KProperty1<*, *>) - assertFalse(::mutable is KProperty2<*, *, *>) - - assertFalse(A::readonly is KProperty0<*>) - assertTrue(A::readonly is KProperty1<*, *>) - assertFalse(A::readonly is KMutableProperty1<*, *>) - assertFalse(A::readonly is KProperty2<*, *, *>) - - assertFalse(A::mutable is KProperty0<*>) - assertTrue(A::mutable is KProperty1<*, *>) - assertTrue(A::mutable is KMutableProperty1<*, *>) - assertFalse(A::mutable is KProperty2<*, *, *>) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt deleted file mode 100644 index 67e138a1036..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -class Klass - -inline fun simpleName(): String = - T::class.java.getSimpleName() - -inline fun simpleName2(): String { - val kClass = T::class // Intrinsic for T::class.java is not used - return kClass.java.getSimpleName() -} - - -fun box(): String { - assertEquals("Integer", simpleName()) - assertEquals("Integer", simpleName2()) - assertEquals("Klass", simpleName()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt b/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt deleted file mode 100644 index dffd69ffd7e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt +++ /dev/null @@ -1,16 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertNotNull - -class Klass - -fun box(): String { - assertNotNull(Int::class) - assertNotNull(String::class) - assertNotNull(Klass::class) - assertNotNull(Error::class) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/boundInnerClassConstructor.kt b/backend.native/tests/external/codegen/box/reflection/parameters/boundInnerClassConstructor.kt deleted file mode 100644 index 03cd195f1cc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/boundInnerClassConstructor.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -import kotlin.reflect.KParameter -import kotlin.test.assertEquals - -class Outer(val s1: String) { - inner class Inner(val s2: String, val s3: String = "K") { - val result = s1 + s2 + s3 - } -} - -fun KParameter.check(name: String) { - assertEquals(name, this.name!!) - assertEquals(KParameter.Kind.VALUE, this.kind) -} - -fun box(): String { - val ctor = Outer("O")::Inner - val ctorPararms = ctor.parameters - - ctorPararms[0].check("s2") - ctorPararms[1].check("s3") - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/boundObjectMemberReferences.kt b/backend.native/tests/external/codegen/box/reflection/parameters/boundObjectMemberReferences.kt deleted file mode 100644 index 7a98551c5da..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/boundObjectMemberReferences.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.assertEquals - -object Host { - fun foo(i: Int, s: String) {} -} - -fun box(): String { - val fooParams = Host::foo.parameters - - assertEquals(2, fooParams.size) - - assertEquals("i", fooParams[0].name) - assertEquals(Int::class.java, fooParams[0].type.javaType) - - assertEquals("s", fooParams[1].name) - assertEquals(String::class.java, fooParams[1].type.javaType) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/boundReferences.kt b/backend.native/tests/external/codegen/box/reflection/parameters/boundReferences.kt deleted file mode 100644 index bbea4bf670b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/boundReferences.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* -import kotlin.test.* - -class C { - fun foo() {} - var bar = "OK" -} - -fun C.extFun(i: Int) {} - -fun KParameter.check(name: String) { - assertEquals(name, this.name!!) - assertEquals(KParameter.Kind.VALUE, this.kind) -} - -fun box(): String { - val cFoo = C()::foo - val cBar = C()::bar - val cExtFun = C()::extFun - - assertEquals(0, cFoo.parameters.size) - assertEquals(0, cBar.getter.parameters.size) - assertEquals(1, cBar.setter.parameters.size) - - assertEquals(1, cExtFun.parameters.size) - cExtFun.parameters[0].check("i") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/findParameterByName.kt b/backend.native/tests/external/codegen/box/reflection/parameters/findParameterByName.kt deleted file mode 100644 index f2f150edf7a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/findParameterByName.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public void bar(int x) {} -} - -// FILE: K.kt - -import kotlin.reflect.full.findParameterByName -import kotlin.test.assertEquals -import kotlin.test.assertNull - -fun foo(x: Int) = x - -fun box(): String { - assertEquals(::foo.parameters.single(), ::foo.findParameterByName("x")) - assertNull(::foo.findParameterByName("y")) - - assertNull(J::bar.findParameterByName("x")) - assertNull(J::bar.findParameterByName("y")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/functionParameterNameAndIndex.kt b/backend.native/tests/external/codegen/box/reflection/parameters/functionParameterNameAndIndex.kt deleted file mode 100644 index c19a768bd6a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/functionParameterNameAndIndex.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -fun foo(bar: String): Int = bar.length - -class A(val c: String) { - fun foz(baz: Int) {} - - fun Double.mext(mez: Long) {} -} - -fun Int.qux(zux: String) {} - -fun checkParameters(f: KFunction<*>, names: List) { - val params = f.parameters - assertEquals(names, params.map { it.name }) - assertEquals(params.indices.toList(), params.map { it.index }) -} - -fun box(): String { - checkParameters(::box, listOf()) - checkParameters(::foo, listOf("bar")) - checkParameters(A::foz, listOf(null, "baz")) - checkParameters(Int::qux, listOf(null, "zux")) - - checkParameters(A::class.functions.single { it.name == "mext" }, listOf(null, null, "mez")) - - checkParameters(::A, listOf("c")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt b/backend.native/tests/external/codegen/box/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt deleted file mode 100644 index 5965ee88ef4..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.assertEquals -import kotlin.test.assertNotNull -import kotlin.test.assertNull - -class A { - fun String.memExt(param: Int) {} -} - -fun topLevel() {} - -fun Int.ext(vararg o: Any) {} - -fun box(): String { - A::class.members.single { it.name == "memExt" }.let { - assertNotNull(it.instanceParameter) - assertNotNull(it.extensionReceiverParameter) - assertEquals(1, it.valueParameters.size) - } - - ::topLevel.let { - assertNull(it.instanceParameter) - assertNull(it.extensionReceiverParameter) - assertEquals(0, it.valueParameters.size) - } - - Int::ext.let { - assertNull(it.instanceParameter) - assertNotNull(it.extensionReceiverParameter) - assertEquals(1, it.valueParameters.size) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/isMarkedNullable.kt b/backend.native/tests/external/codegen/box/reflection/parameters/isMarkedNullable.kt deleted file mode 100644 index a9b3abe131e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/isMarkedNullable.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -class A { - fun foo(p1: String, p2: String?, p3: T, p4: U, p5: U?) { } -} - -fun Any?.ext() {} - -fun box(): String { - val ps = A::class.declaredFunctions.single().parameters.map { it.type.isMarkedNullable } - assertEquals(listOf(false, false, true, false, false, true), ps) - - assertTrue(Any?::ext.parameters.single().type.isMarkedNullable) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/isOptional.kt b/backend.native/tests/external/codegen/box/reflection/parameters/isOptional.kt deleted file mode 100644 index d3cf38ffc2c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/isOptional.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -open class A { - open fun foo(x: Int, y: Int = 1) {} -} - -class B : A() { - override fun foo(x: Int, y: Int) {} -} - -class C : A() - - -fun Int.extFun() {} - -fun box(): String { - assertEquals(listOf(false, false, true), A::foo.parameters.map { it.isOptional }) - assertEquals(listOf(false, false, true), B::foo.parameters.map { it.isOptional }) - assertEquals(listOf(false, false, true), C::foo.parameters.map { it.isOptional }) - - assertFalse(Int::extFun.parameters.single().isOptional) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/javaAnnotationConstructor.kt b/backend.native/tests/external/codegen/box/reflection/parameters/javaAnnotationConstructor.kt deleted file mode 100644 index 99446536ed4..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/javaAnnotationConstructor.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public @interface J { - short s(); - long j(); - boolean z(); - int i(); - float f(); - char c(); - double d(); -} - -// FILE: K.kt - -import kotlin.reflect.KParameter -import kotlin.test.assertEquals - -fun box(): String { - val ctor = J::class.constructors.single() - - // We sort parameters by name for consistency - assertEquals(listOf("c", "d", "f", "i", "j", "s", "z"), ctor.parameters.map { it.name }) - assert(ctor.parameters.all { it.kind == KParameter.Kind.VALUE }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/kinds.kt b/backend.native/tests/external/codegen/box/reflection/parameters/kinds.kt deleted file mode 100644 index 59170b332d7..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/kinds.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.reflect.KParameter.Kind.* -import kotlin.test.assertEquals - -class A { - fun Int.foo(x: String) {} - - inner class Inner(s: String) {} -} - -fun box(): String { - val foo = A::class.memberExtensionFunctions.single() - - assertEquals(listOf(INSTANCE, EXTENSION_RECEIVER, VALUE), foo.parameters.map { it.kind }) - assertEquals(listOf(INSTANCE, VALUE), A::Inner.parameters.map { it.kind }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/parameters/propertySetter.kt b/backend.native/tests/external/codegen/box/reflection/parameters/propertySetter.kt deleted file mode 100644 index 9b50df6eb51..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/parameters/propertySetter.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -var default: Int = 0 - -var defaultAnnotated: Int = 0 - public set - -var custom: Int = 0 - set(myName: Int) {} - -fun checkPropertySetterParam(property: KMutableProperty<*>, name: String?) { - val parameter = property.setter.parameters.single() - assertEquals(0, parameter.index) - assertEquals(name, parameter.name) -} - -fun box(): String { - checkPropertySetterParam(::default, null) - checkPropertySetterParam(::defaultAnnotated, null) - checkPropertySetterParam(::custom, "myName") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/accessors/accessorNames.kt b/backend.native/tests/external/codegen/box/reflection/properties/accessors/accessorNames.kt deleted file mode 100644 index a8c61831838..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/accessors/accessorNames.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -var foo = "" -var String.bar: String - get() = this - set(value) {} - -class A(var baz: Int) { - var String.quux: String - get() = this - set(value) {} -} - -fun box(): String { - assertEquals("", ::foo.getter.name) - assertEquals("", ::foo.setter.name) - - assertEquals("", String::bar.getter.name) - assertEquals("", String::bar.setter.name) - - assertEquals("", A::baz.getter.name) - assertEquals("", A::baz.setter.name) - - val me = A::class.memberExtensionProperties.single() as KMutableProperty2 - assertEquals("", me.getter.name) - assertEquals("", me.setter.name) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/accessors/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/properties/accessors/extensionPropertyAccessors.kt deleted file mode 100644 index db64040fe10..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/accessors/extensionPropertyAccessors.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -var state: String = "" - -var String.prop: String - get() = length.toString() - set(value) { state = this + value } - -fun box(): String { - val prop = String::prop - - assertEquals("3", prop.getter.invoke("abc")) - assertEquals("5", prop.getter("defgh")) - - prop.setter("O", "K") - - return state -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberExtensions.kt b/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberExtensions.kt deleted file mode 100644 index 26235ff59bc..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberExtensions.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -class C(var state: String) { - var String.prop: String - get() = length.toString() - set(value) { state = this + value } -} - -fun box(): String { - val prop = C::class.memberExtensionProperties.single() as KMutableProperty2 - - val c = C("") - assertEquals("3", prop.getter.invoke(c, "abc")) - assertEquals("1", prop.getter(c, "d")) - - prop.setter(c, "O", "K") - - return c.state -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberPropertyAccessors.kt deleted file mode 100644 index 9a3d6d97b39..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/accessors/memberPropertyAccessors.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class C(var state: String) - -fun box(): String { - val prop = C::state - - val c = C("1") - assertEquals("1", prop.getter.invoke(c)) - assertEquals("1", prop.getter(c)) - - prop.setter(c, "OK") - - return prop.get(c) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/accessors/topLevelPropertyAccessors.kt b/backend.native/tests/external/codegen/box/reflection/properties/accessors/topLevelPropertyAccessors.kt deleted file mode 100644 index c896fe0882c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/accessors/topLevelPropertyAccessors.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -var state: String = "" - -fun box(): String { - val prop = ::state - - assertEquals("", prop.getter.invoke()) - assertEquals("", prop.getter()) - - prop.setter("OK") - - return prop.get() -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/allVsDeclared.kt b/backend.native/tests/external/codegen/box/reflection/properties/allVsDeclared.kt deleted file mode 100644 index fe3f7c2442f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/allVsDeclared.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.* - -open class Super { - val a: Int = 1 - val String.b: String get() = this -} - -class Sub : Super() { - val c: Double = 1.0 - val Char.d: Char get() = this -} - -fun box(): String { - val sub = Sub::class - - assertEquals(listOf("a", "c"), sub.memberProperties.map { it.name }.sorted()) - assertEquals(listOf("b", "d"), sub.memberExtensionProperties.map { it.name }.sorted()) - assertEquals(listOf("c"), sub.declaredMemberProperties.map { it.name }) - assertEquals(listOf("d"), sub.declaredMemberExtensionProperties.map { it.name }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt b/backend.native/tests/external/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt deleted file mode 100644 index 2d29ba6c514..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KProperty1 -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -class K(private val value: String) - -fun box(): String { - val p = K::class.memberProperties.single() as KProperty1 - - try { - return p.get(K("Fail: private property should not be accessible by default")) - } - catch (e: IllegalCallableAccessException) { - // OK - } - - p.isAccessible = true - - return p.get(K("OK")) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/declaredVsInheritedProperties.kt b/backend.native/tests/external/codegen/box/reflection/properties/declaredVsInheritedProperties.kt deleted file mode 100644 index 405ead5b7b4..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/declaredVsInheritedProperties.kt +++ /dev/null @@ -1,71 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public String publicMemberJ; - private String privateMemberJ; - public static String publicStaticJ; - private static String privateStaticJ; -} - -// FILE: K.kt - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -open class K : J() { - public val publicMemberK: String = "" - private val privateMemberK: String = "" - public val Any.publicMemberExtensionK: String get() = "" - private val Any.privateMemberExtensionK: String get() = "" -} - -class L : K() - -fun Collection>.names(): Set = - this.map { it.name }.toSet() - -fun check(c: Collection>, names: Set) { - assertEquals(names, c.names()) -} - -fun box(): String { - val j = J::class - - check(j.staticProperties, - setOf("publicStaticJ", "privateStaticJ")) - check(j.declaredMemberProperties, - setOf("publicMemberJ", "privateMemberJ")) - check(j.declaredMemberExtensionProperties, - emptySet()) - - check(j.memberProperties, j.declaredMemberProperties.names()) - check(j.memberExtensionProperties, emptySet()) - - val k = K::class - - check(k.staticProperties, - emptySet()) - check(k.declaredMemberProperties, - setOf("publicMemberK", "privateMemberK")) - check(k.declaredMemberExtensionProperties, - setOf("publicMemberExtensionK", "privateMemberExtensionK")) - - check(k.memberProperties, setOf("publicMemberJ") + k.declaredMemberProperties.names()) - check(k.memberExtensionProperties, k.declaredMemberExtensionProperties.names()) - - - val l = L::class - - check(l.staticProperties, emptySet()) - check(l.declaredMemberProperties, emptySet()) - check(l.declaredMemberExtensionProperties, emptySet()) - check(l.memberProperties, setOf("publicMemberJ", "publicMemberK")) - check(l.memberExtensionProperties, setOf("publicMemberExtensionK")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/fakeOverridesInSubclass.kt b/backend.native/tests/external/codegen/box/reflection/properties/fakeOverridesInSubclass.kt deleted file mode 100644 index d0cd41df918..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/fakeOverridesInSubclass.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.* - -open class Super(val r: String) - -class Sub(r: String) : Super(r) - -fun box(): String { - val props = Sub::class.declaredMemberProperties - if (!props.isEmpty()) return "Fail $props" - - val allProps = Sub::class.memberProperties - assertEquals(listOf("r"), allProps.map { it.name }) - return allProps.single().get(Sub("OK")) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt b/backend.native/tests/external/codegen/box/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt deleted file mode 100644 index bfaa19b355c..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* - -class A { - val result = "OK" -} - -fun box(): String { - val k: KProperty1, *> = A::class.memberProperties.single() - return k.get(A()) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/genericOverriddenProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/genericOverriddenProperty.kt deleted file mode 100644 index 5f31f518c65..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/genericOverriddenProperty.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// KT-13700 Exception obtaining descriptor for property reference - -import kotlin.test.assertEquals - -interface H { - val parent : T? -} - -interface A : H - -fun box(): String { - assertEquals("A?", A::parent.returnType.toString()) - assertEquals("T?", H::parent.returnType.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/genericProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/genericProperty.kt deleted file mode 100644 index e50b948af6f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/genericProperty.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -data class Box(val element: T) - -fun box(): String { - val p = Box::element - assertEquals("val Box.element: T", p.toString()) - return p.call(Box("OK")) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt deleted file mode 100644 index 1da4c341311..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - operator fun getValue(instance: Any?, property: KProperty<*>) = true -} - -class Foo { - val isOK: Boolean by Delegate -} - -fun box(): String { - val foo = Foo() - assertEquals(Delegate, Foo::isOK.apply { isAccessible = true }.getDelegate(foo)) - assertEquals(Delegate, foo::isOK.apply { isAccessible = true }.getDelegate()) - return if (foo.isOK) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt deleted file mode 100644 index 263aa101cdb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -class Foo - -var Foo.result: String by Delegate - -fun box(): String { - val foo = Foo() - foo.result = "Fail" - val d = (foo::result).apply { isAccessible = true }.getDelegate() as Delegate - foo.result = "OK" - assertEquals(d, (foo::result).apply { isAccessible = true }.getDelegate()) - assertEquals(d, (Foo()::result).apply { isAccessible = true }.getDelegate()) - return d.getValue(foo, Foo::result) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt deleted file mode 100644 index 0324af72ba3..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -class Foo { - var result: String by Delegate -} - -fun box(): String { - val foo = Foo() - foo.result = "Fail" - val d = (foo::result).apply { isAccessible = true }.getDelegate() as Delegate - foo.result = "OK" - assertEquals(d, (foo::result).apply { isAccessible = true }.getDelegate()) - assertEquals(d, (Foo()::result).apply { isAccessible = true }.getDelegate()) - return d.getValue(foo, Foo::result) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/extensionProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/extensionProperty.kt deleted file mode 100644 index 6c4997888b2..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/extensionProperty.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -class Foo - -var Foo.result: String by Delegate - -fun box(): String { - val foo = Foo() - foo.result = "Fail" - val d = Foo::result.apply { isAccessible = true }.getDelegate(foo) as Delegate - foo.result = "OK" - assertEquals(d, Foo::result.apply { isAccessible = true }.getDelegate(foo)) - return d.getValue(foo, Foo::result) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/fakeOverride.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/fakeOverride.kt deleted file mode 100644 index c60317a052b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/fakeOverride.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - operator fun getValue(instance: Any?, property: KProperty<*>) = "OK" -} - -open class Base { - val x: String by Delegate -} - -class Derived : Base() - -fun box(): String { - val d = Derived() - assertEquals( - (Base::x).apply { isAccessible = true }.getDelegate(d), - (Derived::x).apply { isAccessible = true }.getDelegate(d) - ) - return d.x -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt deleted file mode 100644 index 3c07f402756..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.KProperty2 -import kotlin.reflect.jvm.isAccessible -import kotlin.reflect.full.getExtensionDelegate -import kotlin.test.* - -object Delegate { - operator fun getValue(instance: Any?, property: KProperty<*>) = true -} - -class Foo { - val member: Boolean by Delegate - val String.memberExtension: Boolean by Delegate -} - -val Foo.extension: Boolean by Delegate - -fun box(): String { - // Top level extension - assertEquals(Delegate, Foo::extension.apply { isAccessible = true }.getExtensionDelegate()) - - // Member extension - val me = Foo::class.members.single { it.name == "memberExtension" } as KProperty2 - assertEquals(Delegate, me.apply { isAccessible = true }.getExtensionDelegate(Foo())) - - // Member (should fail) - try { - Foo::member.apply { isAccessible = true }.getExtensionDelegate() - return "Fail: getExtensionDelegate() should fail on a non-extension property" - } catch (e: Exception) { - // OK - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt deleted file mode 100644 index 3780053e976..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt +++ /dev/null @@ -1,32 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.KProperty0 -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -var ref: KProperty<*>? = null - -class Delegate { - var storage = "" - operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate { - ref = property - return this - } - operator fun getValue(instance: Any?, property: KProperty<*>): String = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -var result: String by Delegate() - -fun box(): String { - result - val prop = ref as KProperty0<*> - - result = "Fail" - val d = prop.apply { isAccessible = true }.getDelegate() as Delegate - result = "OK" - assertEquals(d, prop.apply { isAccessible = true }.getDelegate()) - return result -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt deleted file mode 100644 index aa5d231a103..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -class Bar - -class Foo { - var Bar.result: String by Delegate -} - -fun box(): String { - val foo = Foo() - val bar = Bar() - with(foo) { bar.result = "Fail" } - val prop = Foo::class.members.single { it.name == "result" } as KMutableProperty2 - val d = prop.apply { isAccessible = true }.getDelegate(foo, bar) as Delegate - with(foo) { bar.result = "OK" } - assertEquals(d, prop.apply { isAccessible = true }.getDelegate(foo, bar)) - return d.getValue(foo, prop) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberProperty.kt deleted file mode 100644 index c3988a780a0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/memberProperty.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -class Foo { - var result: String by Delegate -} - -fun box(): String { - val foo = Foo() - foo.result = "Fail" - val d = (Foo::result).apply { isAccessible = true }.getDelegate(foo) as Delegate - foo.result = "OK" - assertEquals(d, (Foo::result).apply { isAccessible = true }.getDelegate(foo)) - return d.getValue(foo, Foo::result) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt deleted file mode 100644 index 0335e77ff66..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -class Delegate(val value: String) { - operator fun getValue(instance: Any?, property: KProperty<*>) = value -} - -class Foo { - val x: String by Delegate("class") - - companion object { - val x: String by Delegate("companion") - } -} - -fun box(): String { - val foo = Foo() - assertEquals("class", ((foo::x).apply { isAccessible = true }.getDelegate() as Delegate).value) - assertEquals("class", ((Foo::x).apply { isAccessible = true }.getDelegate(foo) as Delegate).value) - assertEquals("companion", ((Foo.Companion::x).apply { isAccessible = true }.getDelegate() as Delegate).value) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt deleted file mode 100644 index 70f021ba564..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt +++ /dev/null @@ -1,42 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.extensionReceiverParameter -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -class Delegate(val value: String) { - operator fun getValue(instance: Any?, property: KProperty<*>) = value -} - -class Foo - -val Foo.bar: String by Delegate("Foo") -val String.bar: String by Delegate("String") -val Unit.bar: String by Delegate("Unit") - -class MemberExtensions { - val Foo?.bar: String by Delegate("Foo") - val String?.bar: String by Delegate("String") - val Unit?.bar: String by Delegate("Unit") -} - -fun box(): String { - val foo = Foo() - - assertEquals("Foo", ((foo::bar).apply { isAccessible = true }.getDelegate() as Delegate).value) - assertEquals("Foo", ((Foo::bar).apply { isAccessible = true }.getDelegate(foo) as Delegate).value) - assertEquals("String", ((""::bar).apply { isAccessible = true }.getDelegate() as Delegate).value) - assertEquals("String", ((String::bar).apply { isAccessible = true }.getDelegate("") as Delegate).value) - assertEquals("Unit", ((Unit::bar).apply { isAccessible = true }.getDelegate() as Delegate).value) - - val me = MemberExtensions::class.members.filter { it.name == "bar" } as List> - assertEquals(listOf("Foo", "String", "Unit"), me.sortedBy { - it.extensionReceiverParameter!!.type.toString() - }.map { - (it.apply { isAccessible = true }.getDelegate(MemberExtensions(), null) as Delegate).value - }) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt deleted file mode 100644 index d65e382efb2..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt +++ /dev/null @@ -1,44 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.KProperty2 -import kotlin.reflect.full.IllegalPropertyDelegateAccessException -import kotlin.test.* - -object Delegate { - operator fun getValue(instance: Any?, property: KProperty<*>) = true -} - -val topLevel: Boolean by Delegate -val String.extension: Boolean by Delegate - -class Foo { - val member: Boolean by Delegate - val String.memberExtension: Boolean by Delegate -} - -inline fun check(block: () -> Unit) { - try { - block() - throw AssertionError("No IllegalPropertyDelegateAccessException has been thrown") - } catch (e: IllegalPropertyDelegateAccessException) { - // OK - } -} - -fun box(): String { - check { ::topLevel.getDelegate() } - - check { String::extension.getDelegate("") } - check { ""::extension.getDelegate() } - - val foo = Foo() - check { Foo::member.getDelegate(foo) } - check { foo::member.getDelegate() } - - val me = Foo::class.members.single { it.name == "memberExtension" } as KProperty2 - check { me.getDelegate(foo, "") } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt deleted file mode 100644 index f5450107076..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty2 -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -val topLevel: Boolean = true -val String.extension: Boolean get() = true - -class Foo { - val member: Boolean = true - val String.memberExtension: Boolean get() = true -} - -fun box(): String { - assertNull(::topLevel.apply { isAccessible = true }.getDelegate()) - - assertNull(String::extension.apply { isAccessible = true }.getDelegate("")) - assertNull(""::extension.apply { isAccessible = true }.getDelegate()) - - assertNull(Foo::member.apply { isAccessible = true }.getDelegate(Foo())) - assertNull(Foo()::member.apply { isAccessible = true }.getDelegate()) - - val me = Foo::class.members.single { it.name == "memberExtension" } as KProperty2 - assertNull(me.apply { isAccessible = true }.getDelegate(Foo(), "")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt deleted file mode 100644 index d8c8a7b2f95..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt +++ /dev/null @@ -1,37 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -class Delegate(val value: String) { - operator fun getValue(instance: Any?, property: KProperty<*>) = value -} - -open class Base { - open val x: String by Delegate("Base") -} - -class Derived : Base() { - override val x: String by Delegate("Derived") -} - -fun check(expected: String, delegate: Any?) { - if (delegate == null) throw AssertionError("getDelegate returned null") - assertEquals(expected, (delegate as Delegate).value) -} - -fun box(): String { - val base = Base() - val derived = Derived() - - check("Base", (Base::x).apply { isAccessible = true }.getDelegate(base)) - check("Base", (base::x).apply { isAccessible = true }.getDelegate()) - check("Derived", (Derived::x).apply { isAccessible = true }.getDelegate(derived)) - check("Derived", (derived::x).apply { isAccessible = true }.getDelegate()) - - check("Base", (Base::x).apply { isAccessible = true }.getDelegate(derived)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt deleted file mode 100644 index d42785763fe..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.reflect.jvm.isAccessible -import kotlin.test.* - -object Delegate { - var storage = "" - operator fun getValue(instance: Any?, property: KProperty<*>) = storage - operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value } -} - -var result: String by Delegate - -fun box(): String { - result = "Fail" - val p = (::result).apply { isAccessible = true } - val d = p.getDelegate() as Delegate - result = "OK" - assertEquals(d, (::result).apply { isAccessible = true }.getDelegate()) - return d.getValue(null, p) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/box/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt deleted file mode 100644 index 4a78cc3fd18..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* - -var storage = "before" - -class A { - val String.readonly: String - get() = this - - var String.mutable: String - get() = storage - set(value) { storage = value } -} - -fun box(): String { - val props = A::class.memberExtensionProperties - val readonly = props.single { it.name == "readonly" } - assert(readonly !is KMutableProperty2) { "Fail 1: $readonly" } - val mutable = props.single { it.name == "mutable" } - assert(mutable is KMutableProperty2) { "Fail 2: $mutable" } - - val a = A() - mutable as KMutableProperty2 - assert(mutable.get(a, "") == "before") { "Fail 3: ${mutable.get(a, "")}" } - mutable.set(a, "", "OK") - return mutable.get(a, "") -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/getPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/box/reflection/properties/getPropertiesMutableVsReadonly.kt deleted file mode 100644 index dfb4ee51291..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/getPropertiesMutableVsReadonly.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* - -class A(val readonly: String) { - var mutable: String = "before" -} - -fun box(): String { - val props = A::class.memberProperties - val readonly = props.single { it.name == "readonly" } - assert(readonly !is KMutableProperty1) { "Fail 1: $readonly" } - val mutable = props.single { it.name == "mutable" } - assert(mutable is KMutableProperty1) { "Fail 2: $mutable" } - - val a = A("") - mutable as KMutableProperty1 - assert(mutable.get(a) == "before") { "Fail 3: ${mutable.get(a)}" } - mutable.set(a, "OK") - return mutable.get(a) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/invokeKProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/invokeKProperty.kt deleted file mode 100644 index d762d7172b0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/invokeKProperty.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.declaredMemberProperties - -class A(val foo: String) - -fun box(): String { - return (A::class.declaredMemberProperties.single()).invoke(A("OK")) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/javaPropertyInheritedInKotlin.kt b/backend.native/tests/external/codegen/box/reflection/properties/javaPropertyInheritedInKotlin.kt deleted file mode 100644 index 2c246b57836..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/javaPropertyInheritedInKotlin.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - public String result = null; -} - -// FILE: K.kt - -class K : J() - -fun box(): String { - val k = K() - val p = K::result - if (p.get(k) != null) return "Fail" - p.set(k, "OK") - return p.get(k) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/javaStaticField.kt b/backend.native/tests/external/codegen/box/reflection/properties/javaStaticField.kt deleted file mode 100644 index 77e92fbb187..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/javaStaticField.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public static String x; - - static String packageLocalField; -} - -// FILE: K.kt - -import kotlin.test.assertEquals - -fun box(): String { - val f = J::x - assertEquals("x", f.name) - - assertEquals(f, J::class.members.single { it.name == "x" }) - - f.set("OK") - assertEquals("OK", J.x) - assertEquals("OK", f.getter()) - - val pl = J::packageLocalField.getter - try { - pl() - return "Fail: package local field must be inaccessible" - } catch (e: Exception) { - // OK - } - - return f.get() -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt b/backend.native/tests/external/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt deleted file mode 100644 index a3f9ae40aca..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J extends K { -} - -// FILE: K.kt - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -public open class K { - var prop: String = ":(" - - val Int.ext: Int get() = this -} - -fun box(): String { - val j = J() - - val prop = J::prop - if (prop !is KMutableProperty1<*, *>) return "Fail instanceof" - if (prop.name != "prop") return "Fail name: ${prop.name}" - if (prop.get(j) != ":(") return "Fail get before: ${prop.get(j)}" - prop.set(j, ":)") - if (prop.get(j) != ":)") return "Fail get after: ${prop.get(j)}" - - - if (prop == K::prop) return "Fail J::prop == K::prop (these are different properties)" - - - val klass = J::class - if (klass.declaredMemberProperties.isNotEmpty()) return "Fail: declaredMemberProperties should be empty" - if (klass.declaredMemberExtensionProperties.isNotEmpty()) return "Fail: declaredMemberExtensionProperties should be empty" - - val prop2 = klass.memberProperties.firstOrNull { it.name == "prop" } ?: "Fail: no 'prop' property in memberProperties" - if (prop != prop2) return "Fail: property references from :: and from properties differ: $prop != $prop2" - if (prop2 !is KMutableProperty1<*, *>) return "Fail instanceof 2" - (prop2 as KMutableProperty1).set(j, "::)") - if (prop.get(j) != "::)") return "Fail get after 2: ${prop.get(j)}" - - - val ext = klass.memberExtensionProperties.firstOrNull { it.name == "ext" } ?: "Fail: no 'ext' property in memberExtensionProperties" - ext as KProperty2 - val fortyTwo = ext.get(j, 42) - if (fortyTwo != 42) return "Fail ext get: $fortyTwo" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/defaultImpls.kt b/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/defaultImpls.kt deleted file mode 100644 index 421e7402f1b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/defaultImpls.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT - -import kotlin.reflect.KProperty -import kotlin.test.assertEquals - -object Delegate { - operator fun getValue(z: Any?, p: KProperty<*>): String? { - assertEquals("val x: kotlin.String?", p.toString()) - return "OK" - } -} - -interface Foo { - fun bar(): String { - val x by Delegate - return x!! - } -} - -object O : Foo - -fun box(): String = O.bar() diff --git a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/inlineFun.kt b/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/inlineFun.kt deleted file mode 100644 index 74716048087..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/inlineFun.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.assertEquals - -object Delegate { - lateinit var property: KProperty<*> - - operator fun getValue(instance: Any?, kProperty: KProperty<*>) { - property = kProperty - } -} - -class Foo { - inline fun foo() { - val x by Delegate - x - } -} - -fun box(): String { - Foo().foo() - assertEquals("val x: kotlin.Unit", Delegate.property.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/localDelegatedProperty.kt b/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/localDelegatedProperty.kt deleted file mode 100644 index 81d767b6cd8..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/localDelegatedProperty.kt +++ /dev/null @@ -1,75 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.* - -object Delegate { - lateinit var property: KProperty<*> - - operator fun getValue(instance: Any?, kProperty: KProperty<*>): List { - property = kProperty - return emptyList() - } - - operator fun setValue(instance: Any?, kProperty: KProperty<*>, value: List) { - throw AssertionError() - } -} - -fun check(expectedName: String, p: KProperty0<*>): String? { - assertEquals(expectedName, p.name) - assertEquals(emptyList(), p.parameters) - assertEquals(emptyList(), p.typeParameters) - assertEquals(null, p.visibility) // "local" visibility is not representable with reflection API - assertEquals("kotlin.collections.List", p.returnType.toString()) - assertTrue(p.isFinal) - assertFalse(p.isOpen) - assertFalse(p.isAbstract) - assertFalse(p.isLateinit) - assertFalse(p.isConst) - - // TODO: support getDelegate for local delegated properties - assertEquals(null, (p as KProperty0<*>).getDelegate()) - - assertEquals(emptyList(), p.getter.parameters) - assertEquals("kotlin.collections.List", p.getter.returnType.toString()) - - // TODO: support annotations - assertEquals(emptyList(), p.annotations) - - try { - p.call() - return "Fail: reflective call of a local delegated property should fail because it's not supported" - } catch (e: UnsupportedOperationException) { /* ok */ } - - if (p is KMutableProperty0<*>) { - assertEquals(listOf("kotlin.collections.List"), p.setter.parameters.map { it.type.toString() }) - assertEquals("kotlin.Unit", p.setter.returnType.toString()) - - try { - p.setter.call() - return "Fail: reflective call of a local delegated property setter should fail because it's not supported" - } catch (e: UnsupportedOperationException) { /* ok */ } - } - - return null -} - -annotation class Anno - -fun box(): String { - @Anno - val localVal by Delegate - localVal - - check("localVal", Delegate.property as KProperty0<*>)?.let { error -> return error } - - @Anno - var localVar by Delegate - localVar - - check("localVar", Delegate.property as KProperty0<*>)?.let { error -> return error } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/multiFileClass.kt b/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/multiFileClass.kt deleted file mode 100644 index 26178e76e8b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/multiFileClass.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT - -// FILE: 1.kt - -@file:JvmMultifileClass -@file:JvmName("Test") - -package test - -import kotlin.reflect.* - -object Delegate { - lateinit var property: KProperty<*> - - operator fun getValue(instance: Any?, kProperty: KProperty<*>): List { - property = kProperty - return emptyList() - } -} - -// FILE: 2.kt - -@file:JvmMultifileClass -@file:JvmName("Test") - -package test - -fun foo() { - val x by Delegate - x -} - -// FILE: test.kt - -import test.* -import kotlin.test.assertEquals - -fun box(): String { - foo() - assertEquals("val x: kotlin.collections.List", Delegate.property.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/variableOfGenericType.kt b/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/variableOfGenericType.kt deleted file mode 100644 index 71e0440f6eb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/localDelegated/variableOfGenericType.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.test.* - -class Delegate(val value: T) { - lateinit var property: KProperty<*> - - operator fun getValue(instance: Any?, kProperty: KProperty<*>): T { - property = kProperty - return value - } -} - -class A { - inner class B { - fun foo() { - val delegate = Delegate, Z>>(emptyMap()) - val c: Map, Z> by delegate - c - - assertEquals("kotlin.collections.Map, Z>", delegate.property.returnType.toString()) - } - } -} - -fun box(): String { - A().B().foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/memberAndMemberExtensionWithSameName.kt b/backend.native/tests/external/codegen/box/reflection/properties/memberAndMemberExtensionWithSameName.kt deleted file mode 100644 index 4f506da387f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/memberAndMemberExtensionWithSameName.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* - -class A { - val foo: String = "member" - val Unit.foo: String get() = "extension" -} - -fun box(): String { - run { - val foo: KProperty1 = A::class.memberProperties.single() - assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" } - assert(foo.get(A()) == "member") { "Fail value: ${foo.get(A())}" } - } - - run { - val foo: KProperty2 = A::class.memberExtensionProperties.single() - assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" } - foo as KProperty2 - assert(foo.get(A(), Unit) == "extension") { "Fail value: ${foo.get(A(), Unit)}" } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaInstanceField.kt b/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaInstanceField.kt deleted file mode 100644 index 9522b302d13..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaInstanceField.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - private String result = "Fail"; -} - -// FILE: K.kt - -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -fun box(): String { - val a = J() - val p = J::class.members.single { it.name == "result" } as KMutableProperty1 - p.isAccessible = true - p.set(a, "OK") - return p.get(a) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaStaticField.kt b/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaStaticField.kt deleted file mode 100644 index 541df83fb82..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/mutatePrivateJavaStaticField.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - private static String result = "Fail"; -} - -// FILE: K.kt - -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -fun box(): String { - val a = J() - val p = J::class.members.single { it.name == "result" } as KMutableProperty0 - p.isAccessible = true - p.set("OK") - return p.get() -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt b/backend.native/tests/external/codegen/box/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt deleted file mode 100644 index 09a15935bc9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public String foo = ""; -} - -// FILE: K.kt - -import kotlin.test.* - -class K : J() { - fun getFoo(): String = "K" -} - -fun box(): String { - val j = J() - val x = J::foo - x.set(j, "J") - assertEquals("J", x.get(j)) - - val k = K() - val y = K::foo - y.set(k, "K") - assertEquals("K", y.get(k)) - assertEquals("K", x.get(k)) - - val z = K::getFoo - assertEquals("K", z.invoke(k)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/overrideKotlinPropertyByJavaMethod.kt b/backend.native/tests/external/codegen/box/reflection/properties/overrideKotlinPropertyByJavaMethod.kt deleted file mode 100644 index ea3b816568d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/overrideKotlinPropertyByJavaMethod.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J implements K { - private String foo; - - @Override - public String getFoo() { - return foo; - } - - @Override - public void setFoo(String s) { - foo = s; - } -} - -// FILE: K.kt - -import kotlin.test.assertEquals -import kotlin.reflect.KParameter - -interface K { - var foo: String -} - -fun box(): String { - val p = J::foo - assertEquals("foo", p.name) - - if (p.parameters.size != 1) return "Should have only 1 parameter" - if (p.parameters.single().kind != KParameter.Kind.INSTANCE) return "Should have an instance parameter" - - if (J::class.members.none { it == p }) return "No foo in members" - - val j = J() - p.setter.call(j, "OK") - return p.getter.call(j) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privateClassVal.kt b/backend.native/tests/external/codegen/box/reflection/properties/privateClassVal.kt deleted file mode 100644 index 6fe480086ce..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privateClassVal.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KProperty1 -import kotlin.reflect.full.* -import kotlin.reflect.jvm.isAccessible - -class Result { - private val value = "OK" - - fun ref() = Result::class.memberProperties.single() as KProperty1 -} - -fun box(): String { - val p = Result().ref() - try { - p.get(Result()) - return "Fail: private property is accessible by default" - } catch(e: IllegalCallableAccessException) { } - - p.isAccessible = true - - val r = p.get(Result()) - - p.isAccessible = false - try { - p.get(Result()) - return "Fail: setAccessible(false) had no effect" - } catch(e: IllegalCallableAccessException) { } - - return r -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privateClassVar.kt b/backend.native/tests/external/codegen/box/reflection/properties/privateClassVar.kt deleted file mode 100644 index fa1dd21e8bb..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privateClassVar.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.full.* -import kotlin.reflect.jvm.isAccessible - -class A { - private var value = 0 - - fun ref() = A::class.memberProperties.single() as KMutableProperty1 -} - -fun box(): String { - val a = A() - val p = a.ref() - try { - p.set(a, 1) - return "Fail: private property is accessible by default" - } catch(e: IllegalCallableAccessException) { } - - p.isAccessible = true - - p.set(a, 2) - p.get(a) - - p.isAccessible = false - try { - p.set(a, 3) - return "Fail: setAccessible(false) had no effect" - } catch(e: IllegalCallableAccessException) { } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privateFakeOverrideFromSuperclass.kt b/backend.native/tests/external/codegen/box/reflection/properties/privateFakeOverrideFromSuperclass.kt deleted file mode 100644 index c6736b0e36d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privateFakeOverrideFromSuperclass.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* - -open class A(private val p: Int) -class B : A(42) - -fun box() = - if (B::class.memberProperties.isEmpty()) "OK" - else "Fail: invisible fake overrides should not appear in KClass.memberProperties" diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt b/backend.native/tests/external/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt deleted file mode 100644 index 9aabee699a0..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.jvm.* - -object Obj { - @JvmStatic - private var result: String = "Fail" -} - -fun box(): String { - val p = Obj::class.members.single { it.name == "result" } as KMutableProperty1 - p.isAccessible = true - - try { - p.set(null, "OK") - return "Fail: set should check that first argument is Obj" - } catch (e: IllegalArgumentException) {} - - try { - p.get(null) - return "Fail: get should check that first argument is Obj" - } catch (e: IllegalArgumentException) {} - - p.set(Obj, "OK") - return p.get(Obj) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt b/backend.native/tests/external/codegen/box/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt deleted file mode 100644 index cd4d9e23841..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* -import kotlin.test.* - -class A(private var foo: String) - -fun box(): String { - val a = A("") - val foo = A::class.memberProperties.single() as KMutableProperty1 - - assertTrue(!foo.isAccessible) - assertTrue(!foo.getter.isAccessible) - assertTrue(!foo.setter.isAccessible) - - val setter = foo.setter - setter.isAccessible = true - assertTrue(setter.isAccessible) - assertTrue(foo.setter.isAccessible) - - // After we invoked isAccessible on a setter, the underlying field and thus the getter are also accessible - assertTrue(foo.isAccessible) - assertTrue(foo.getter.isAccessible) - setter.call(a, "A") - assertEquals("A", foo.getter.call(a)) - - setter.isAccessible = false - assertFalse(setter.isAccessible) - assertFalse(foo.setter.isAccessible) - assertFalse(foo.getter.isAccessible) - assertFalse(foo.isAccessible) - - val getter = foo.getter - getter.isAccessible = true - assertTrue(setter.isAccessible) - assertTrue(foo.setter.isAccessible) - assertTrue(foo.isAccessible) - assertTrue(foo.getter.isAccessible) - assertTrue(getter.isAccessible) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/privateToThisAccessors.kt b/backend.native/tests/external/codegen/box/reflection/properties/privateToThisAccessors.kt deleted file mode 100644 index 7fbe2bdbc9b..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/privateToThisAccessors.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.* -import kotlin.reflect.full.* -import kotlin.reflect.jvm.* - -class K { - private var t: T - get() = "OK" as T - set(value) {} - - fun run(): String { - val p = K::class.memberProperties.single() as KMutableProperty1, String> - p.isAccessible = true - p.set(this as K, "") - return p.get(this) as String - } -} - -fun box() = K().run() diff --git a/backend.native/tests/external/codegen/box/reflection/properties/propertyOfNestedClassAndArrayType.kt b/backend.native/tests/external/codegen/box/reflection/properties/propertyOfNestedClassAndArrayType.kt deleted file mode 100644 index cca3ef60307..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/propertyOfNestedClassAndArrayType.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KMutableProperty1 - -class A { - class B(val result: String) - - var p: A.B? = null - var q: Array>? = null -} - -fun box(): String { - val a = A() - - val aq = A::class.members.single { it.name == "q" } as KMutableProperty1>> - aq.set(a, arrayOf(arrayOf(A.B("array")))) - if (a.q!![0][0].result != "array") return "Fail array" - - val ap = A::class.members.single { it.name == "p" } as KMutableProperty1 - ap.set(a, A.B("OK")) - return a.p!!.result -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/protectedClassVar.kt b/backend.native/tests/external/codegen/box/reflection/properties/protectedClassVar.kt deleted file mode 100644 index 2e539726fb7..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/protectedClassVar.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.full.* -import kotlin.reflect.jvm.isAccessible - -class A(param: String) { - protected var v: String = param - - fun ref() = A::class.memberProperties.single() as KMutableProperty1 -} - -fun box(): String { - val a = A(":(") - val f = a.ref() - - try { - f.get(a) - return "Fail: protected property getter is accessible by default" - } catch (e: IllegalCallableAccessException) { } - - try { - f.set(a, ":D") - return "Fail: protected property setter is accessible by default" - } catch (e: IllegalCallableAccessException) { } - - f.isAccessible = true - - f.set(a, ":)") - - return if (f.get(a) != ":)") "Fail: ${f.get(a)}" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/publicClassValAccessible.kt b/backend.native/tests/external/codegen/box/reflection/properties/publicClassValAccessible.kt deleted file mode 100644 index 1e2837c17ef..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/publicClassValAccessible.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.isAccessible - -class Result { - public val value: String = "OK" -} - -fun box(): String { - val p = Result::value - p.isAccessible = false - // setAccessible(false) should have no effect on the accessibility of a public reflection object - return p.get(Result()) -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt b/backend.native/tests/external/codegen/box/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt deleted file mode 100644 index f634dab9d71..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J extends K { - public final int value = 42; -} - -// FILE: K.kt - -open class K - -fun box(): String { - val f = J::value - val a = J() - return if (f.get(a) == 42) "OK" else "Fail: ${f.get(a)}" -} diff --git a/backend.native/tests/external/codegen/box/reflection/properties/simpleGetProperties.kt b/backend.native/tests/external/codegen/box/reflection/properties/simpleGetProperties.kt deleted file mode 100644 index 223907cc3ea..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/properties/simpleGetProperties.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* - -class A(param: String) { - val int: Int get() = 42 - val string: String = param - var anyVar: Any? = null - - val List.extensionToList: Unit get() {} - - fun notAProperty() {} -} - -fun box(): String { - val props = A::class.memberProperties - - val names = props.map { it.name }.sorted() - assert(names == listOf("anyVar", "int", "string")) { "Fail names: $props" } - - val stringProp = props.firstOrNull { it.name == "string" } ?: return "Fail, string not found: $props" - return stringProp.get(A("OK")) as String -} diff --git a/backend.native/tests/external/codegen/box/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt b/backend.native/tests/external/codegen/box/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt deleted file mode 100644 index 0927f54846d..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FULL_JDK -// See KT-11258 Incorrect resolution sequence for Java field - -// TODO: enable this test on JVM, see KT-16616 -// IGNORE_BACKEND_WITHOUT_CHECK: JVM - -import java.util.* - -fun box(): String { - listOf( - ArrayList::class, - LinkedList::class, - AbstractList::class, - HashSet::class, - TreeSet::class, - HashMap::class, - TreeMap::class, - AbstractMap::class, - AbstractMap.SimpleEntry::class - ).map { - it.members.map(Any::toString) - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/supertypes/builtInClassSupertypes.kt b/backend.native/tests/external/codegen/box/reflection/supertypes/builtInClassSupertypes.kt deleted file mode 100644 index c357f42d24e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/supertypes/builtInClassSupertypes.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import java.io.Serializable -import kotlin.reflect.KClass -import kotlin.reflect.KCallable -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -inline fun check(vararg callables: KCallable<*>) { - val types = callables.map { it.returnType } - assertEquals(types, T::class.supertypes) - assertEquals(types.map { it.classifier as KClass<*> }, T::class.superclasses) -} - -inline fun checkAll(vararg callables: KCallable<*>) { - val types = callables.map { it.returnType } - // Calling toSet because the order of returned types/classes is not specified - assertEquals(types.toSet(), T::class.allSupertypes.toSet()) - assertEquals(types.map { it.classifier as KClass<*> }.toSet(), T::class.allSuperclasses.toSet()) -} - -fun comparableOfString(): Comparable = null!! -fun charSequence(): CharSequence = null!! -fun serializable(): Serializable = null!! -fun any(): Any = null!! -fun number(): Number = null!! -fun comparableOfInt(): Comparable = null!! -fun cloneable(): Cloneable = null!! - -fun box(): String { - check() - checkAll() - - check(::comparableOfString, ::charSequence, ::serializable, ::any) - checkAll(::comparableOfString, ::charSequence, ::serializable, ::any) - - check(::number, ::comparableOfInt, ::serializable) - checkAll(::number, ::comparableOfInt, ::serializable, ::any) - - check>(::any, ::cloneable, ::serializable) - checkAll>(::any, ::cloneable, ::serializable) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/supertypes/genericSubstitution.kt b/backend.native/tests/external/codegen/box/reflection/supertypes/genericSubstitution.kt deleted file mode 100644 index 618ac48b2f3..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/supertypes/genericSubstitution.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.allSupertypes -import kotlin.test.assertEquals - -interface A -interface B : A -interface C : B -interface D : C - -interface StringList : List - -fun box(): String { - assertEquals( - listOf(String::class, Int::class), - D::class.allSupertypes.single { it.classifier == A::class }.arguments.map { it.type!!.classifier } - ) - - val collectionType = StringList::class.allSupertypes.single { it.classifier == Collection::class } - val arg = collectionType.arguments.single().type!! - // TODO: this does not work currently because for some reason two different instances of TypeParameterDescriptor are created for List - // assertEquals(String::class, arg.classifier) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt b/backend.native/tests/external/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt deleted file mode 100644 index efbc87e30e5..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/supertypes/isSubclassOfIsSuperclassOf.kt +++ /dev/null @@ -1,52 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.full.* -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -open class Klass -interface Interface -class Bar : Interface, Klass() - -fun check(subclass: KClass<*>, superclass: KClass<*>, shouldBeSubclass: Boolean) { - if (shouldBeSubclass) { - assertTrue(subclass.isSubclassOf(superclass)) - assertTrue(superclass.isSuperclassOf(subclass)) - } else { - assertFalse(subclass.isSubclassOf(superclass)) - assertFalse(superclass.isSuperclassOf(subclass)) - } -} - -fun box(): String { - check(Any::class, Any::class, true) - check(String::class, Any::class, true) - check(Any::class, String::class, false) - check(String::class, String::class, true) - - check(Int::class, Int::class, true) - check(Int::class, Any::class, true) - - check(List::class, Collection::class, true) - check(List::class, Iterable::class, true) - check(Collection::class, Iterable::class, true) - check(Set::class, List::class, false) - - check(Array::class, Array::class, false) - check(Array::class, Array::class, false) - - check(Function3::class, Function4::class, false) - check(Function4::class, Function3::class, false) - - check(Bar::class, Klass::class, true) - check(Bar::class, Interface::class, true) - check(Klass::class, Bar::class, false) - check(Interface::class, Bar::class, false) - check(Klass::class, Interface::class, false) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/supertypes/primitives.kt b/backend.native/tests/external/codegen/box/reflection/supertypes/primitives.kt deleted file mode 100644 index 9cf5410c504..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/supertypes/primitives.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.isSubclassOf -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -fun box(): String { - // KClass instances for primitive int and wrapper java.lang.Integer are different - val primitiveInt = Int::class.javaPrimitiveType!!.kotlin - val wrapperInt = Int::class.javaObjectType.kotlin - assertTrue(primitiveInt.isSubclassOf(primitiveInt)) - assertTrue(wrapperInt.isSubclassOf(wrapperInt)) - - // KClass for int equals KClass for java.lang.Integer, so they are also a subclass of each other - assertTrue(primitiveInt.isSubclassOf(wrapperInt)) - assertTrue(wrapperInt.isSubclassOf(primitiveInt)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/supertypes/simpleSupertypes.kt b/backend.native/tests/external/codegen/box/reflection/supertypes/simpleSupertypes.kt deleted file mode 100644 index b019ab3059e..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/supertypes/simpleSupertypes.kt +++ /dev/null @@ -1,71 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.assertEquals - -open class Simple -class OneClass : Simple() - -interface Interface -interface Interface2 -class ClassAndTwoInterfaces : Interface, Simple(), Interface2 - -class ClassWithSuperInterfaceOnly : Interface - -annotation class AnnotationClass - -fun any(): Any = null!! -fun simple(): Simple = null!! -fun interface_(): Interface = null!! -fun interface2(): Interface2 = null!! -fun annotation(): Annotation = null!! - -fun box(): String { - with(Simple::class) { - assertEquals(listOf(::any.returnType), supertypes) - assertEquals(listOf(Any::class), superclasses) - // Calling toSet because the order of returned types/classes is not specified - assertEquals(setOf(::any.returnType), allSupertypes.toSet()) - assertEquals(setOf(Any::class), allSuperclasses.toSet()) - } - - with (OneClass::class) { - assertEquals(listOf(::simple.returnType), supertypes) - assertEquals(listOf(Simple::class), superclasses) - assertEquals(setOf(::simple.returnType, ::any.returnType), allSupertypes.toSet()) - assertEquals(setOf(Simple::class, Any::class), allSuperclasses.toSet()) - } - - with (Interface::class) { - assertEquals(listOf(::any.returnType), supertypes) - assertEquals(listOf(Any::class), superclasses) - assertEquals(setOf(::any.returnType), allSupertypes.toSet()) - assertEquals(setOf(Any::class), allSuperclasses.toSet()) - } - - with (ClassAndTwoInterfaces::class) { - assertEquals(listOf(::interface_.returnType, ::simple.returnType, ::interface2.returnType), supertypes) - assertEquals(listOf(Interface::class, Simple::class, Interface2::class), superclasses) - assertEquals(setOf(::interface_.returnType, ::simple.returnType, ::interface2.returnType, ::any.returnType), allSupertypes.toSet()) - assertEquals(setOf(Interface::class, Simple::class, Interface2::class, Any::class), allSuperclasses.toSet()) - } - - with (ClassWithSuperInterfaceOnly::class) { - assertEquals(listOf(::interface_.returnType, ::any.returnType), supertypes) - assertEquals(listOf(Interface::class, Any::class), superclasses) - assertEquals(setOf(::interface_.returnType, ::any.returnType), allSupertypes.toSet()) - assertEquals(setOf(Interface::class, Any::class), allSuperclasses.toSet()) - } - - with (AnnotationClass::class) { - assertEquals(listOf(::annotation.returnType, ::any.returnType), supertypes) - assertEquals(listOf(Annotation::class, Any::class), superclasses) - assertEquals(listOf(::annotation.returnType, ::any.returnType), allSupertypes) - assertEquals(listOf(Annotation::class, Any::class), allSuperclasses) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/typeParameters/declarationSiteVariance.kt b/backend.native/tests/external/codegen/box/reflection/typeParameters/declarationSiteVariance.kt deleted file mode 100644 index 51262ffdbad..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/typeParameters/declarationSiteVariance.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KVariance -import kotlin.test.assertEquals - -class Triple { - fun foo(): T = null!! -} - -fun box(): String { - assertEquals( - listOf( - KVariance.IN, - KVariance.INVARIANT, - KVariance.OUT - ), - Triple::class.typeParameters.map { it.variance } - ) - - assertEquals(KVariance.INVARIANT, Triple::class.members.single { it.name == "foo" }.typeParameters.single().variance) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/typeParameters/typeParametersAndNames.kt b/backend.native/tests/external/codegen/box/reflection/typeParameters/typeParametersAndNames.kt deleted file mode 100644 index 2ad93a4d12a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/typeParameters/typeParametersAndNames.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -class F { - fun foo() {} - val B.bar: B get() = this -} - -class C { - fun baz() {} - fun quux() {} -} - -fun get(klass: KClass<*>, memberName: String? = null): List = - (if (memberName != null) - klass.members.single { it.name == memberName }.typeParameters - else - klass.typeParameters) - .map { it.name } - -fun box(): String { - assertEquals(listOf(), get(F::class)) - assertEquals(listOf("A"), get(F::class, "foo")) - assertEquals(listOf("B"), get(F::class, "bar")) - - assertEquals(listOf("D"), get(C::class)) - assertEquals(listOf(), get(C::class, "baz")) - assertEquals(listOf("E", "G"), get(C::class, "quux")) - - assertEquals(listOf("T"), get(Comparable::class)) - assertEquals(listOf(), get(String::class)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/typeParameters/upperBounds.kt b/backend.native/tests/external/codegen/box/reflection/typeParameters/upperBounds.kt deleted file mode 100644 index 37f2c4ae2a4..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/typeParameters/upperBounds.kt +++ /dev/null @@ -1,62 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KTypeProjection -import kotlin.reflect.KVariance -import kotlin.test.assertEquals - -class DefaultBound -class NullableAnyBound -class NotNullAnyBound -class TwoBounds where T : Comparable - -class OtherParameterBound - -class RecursiveGeneric> - -class FunctionTypeParameter { - fun foo(): Cloneable = null!! -} - -// helper functions to obtain KType instances -fun nullableAny(): Any? = null -fun notNullAny(): Any = null!! - -fun box(): String { - assertEquals(listOf(::nullableAny.returnType), DefaultBound::class.typeParameters.single().upperBounds) - assertEquals(listOf(::nullableAny.returnType), NullableAnyBound::class.typeParameters.single().upperBounds) - assertEquals(listOf(::notNullAny.returnType), NotNullAnyBound::class.typeParameters.single().upperBounds) - - TwoBounds::class.typeParameters.single().let { - val (cl, cm) = it.upperBounds - assertEquals(Cloneable::class, cl.classifier) - assertEquals(listOf(), cl.arguments) - - assertEquals(Comparable::class, cm.classifier) - val cmt = cm.arguments.single() - assertEquals(KVariance.INVARIANT, cmt.variance) - assertEquals(it, cmt.type!!.classifier) - } - - OtherParameterBound::class.typeParameters.let { - val (t, u) = it - assertEquals(u, t.upperBounds.single().classifier) - assertEquals(Number::class, u.upperBounds.single().classifier) - } - - FunctionTypeParameter::class.members.single { it.name == "foo" }.let { foo -> - assertEquals(foo.returnType, foo.typeParameters.single().upperBounds.single()) - } - - val recursiveGenericTypeParameter = RecursiveGeneric::class.typeParameters.single() - val recursiveGenericBound = recursiveGenericTypeParameter.upperBounds.single() - assertEquals(Enum::class, recursiveGenericBound.classifier) - recursiveGenericBound.arguments.single().let { projection -> - assertEquals(KVariance.INVARIANT, projection.variance) - assertEquals(recursiveGenericTypeParameter, projection.type!!.classifier) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/classifierIsClass.kt b/backend.native/tests/external/codegen/box/reflection/types/classifierIsClass.kt deleted file mode 100644 index 13f0031e6aa..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/classifierIsClass.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.assertEquals - -class Outer { - class Nested - - inner class Inner -} - -fun outer(): Outer = null!! -fun nested(): Outer.Nested = null!! -fun inner(): Outer.Inner = null!! - -fun array(): Array = null!! - -fun box(): String { - assertEquals(Outer::class, ::outer.returnType.classifier) - assertEquals(Outer.Nested::class, ::nested.returnType.classifier) - assertEquals(Outer.Inner::class, ::inner.returnType.classifier) - - assertEquals(Array::class, ::array.returnType.classifier) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/classifierIsTypeParameter.kt b/backend.native/tests/external/codegen/box/reflection/types/classifierIsTypeParameter.kt deleted file mode 100644 index 03f3fc828e1..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/classifierIsTypeParameter.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KTypeParameter -import kotlin.test.* - -class A { - fun foo(): T = null!! - fun bar(): Array? = null!! -} - -fun box(): String { - val t = A::class.members.single { it.name == "foo" }.returnType - assertFalse(t.isMarkedNullable) - val tc = t.classifier - if (tc !is KTypeParameter) fail(tc.toString()) - assertEquals("T", tc.name) - - val u = A::class.members.single { it.name == "bar" }.returnType - assertTrue(u.isMarkedNullable) - assertEquals(Array::class, u.classifier) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/classifiersOfBuiltInTypes.kt b/backend.native/tests/external/codegen/box/reflection/types/classifiersOfBuiltInTypes.kt deleted file mode 100644 index e05bd80dc9f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/classifiersOfBuiltInTypes.kt +++ /dev/null @@ -1,115 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KClass -import kotlin.reflect.KFunction -import kotlin.test.assertEquals - -fun primitives( - p01: Boolean, - p02: Byte, - p03: Char, - p04: Double, - p05: Float, - p06: Int, - p07: Long, - p08: Short -) {} - -fun nullablePrimitives( - p01: Boolean?, - p02: Byte?, - p03: Char?, - p04: Double?, - p05: Float?, - p06: Int?, - p07: Long?, - p08: Short? -) {} - -fun primitiveArrays( - p01: BooleanArray, - p02: ByteArray, - p03: CharArray, - p04: DoubleArray, - p05: FloatArray, - p06: IntArray, - p07: LongArray, - p08: ShortArray -) {} - -fun others( - p1: Array<*>, - p2: Array, - p3: Array?>, - p4: List<*>, - p5: List?, - p6: Map.Entry, - p7: Unit?, - p8: String, - p9: Nothing -) {} - -inline fun wrapper(): KClass = T::class - -fun check(f: KFunction<*>, vararg expected: KClass<*>) { - val actual = f.parameters.map { it.type.classifier as KClass<*> } - for ((e, a) in expected.toList().zip(actual)) { - assertEquals(e, a, "$e (${e.java}) != $a (${a.java})") - } -} - -fun box(): String { - check( - ::primitives, - Boolean::class, - Byte::class, - Char::class, - Double::class, - Float::class, - Int::class, - Long::class, - Short::class - ) - - check( - ::nullablePrimitives, - wrapper(), - wrapper(), - wrapper(), - wrapper(), - wrapper(), - wrapper(), - wrapper(), - wrapper() - ) - - check( - ::primitiveArrays, - BooleanArray::class, - ByteArray::class, - CharArray::class, - DoubleArray::class, - FloatArray::class, - IntArray::class, - LongArray::class, - ShortArray::class - ) - - check( - ::others, - Array::class, - Array::class, - Array?>::class, - List::class, - List::class, - Map.Entry::class, - Unit::class, - String::class, - Nothing::class - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/createType/equality.kt b/backend.native/tests/external/codegen/box/reflection/types/createType/equality.kt deleted file mode 100644 index b2ed998ab0a..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/createType/equality.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createType -import kotlin.reflect.KTypeProjection -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals - -class Foo - -fun box(): String { - assertEquals(String::class.createType(), String::class.createType()) - - assertEquals( - Foo::class.createType(listOf(KTypeProjection.STAR)), - Foo::class.createType(listOf(KTypeProjection.STAR)) - ) - - val i = Int::class.createType() - assertEquals( - Foo::class.createType(listOf(KTypeProjection.invariant(i))), - Foo::class.createType(listOf(KTypeProjection.invariant(i))) - ) - - assertNotEquals( - Foo::class.createType(listOf(KTypeProjection.contravariant(i))), - Foo::class.createType(listOf(KTypeProjection.covariant(i))) - ) - - assertNotEquals( - Foo::class.createType(listOf(KTypeProjection.covariant(Any::class.createType(nullable = true)))), - Foo::class.createType(listOf(KTypeProjection.STAR)) - ) - - assertNotEquals( - Foo::class.createType(listOf(KTypeProjection.STAR), nullable = false), - Foo::class.createType(listOf(KTypeProjection.STAR), nullable = true) - ) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/createType/innerGeneric.kt b/backend.native/tests/external/codegen/box/reflection/types/createType/innerGeneric.kt deleted file mode 100644 index 3ec4b16ca33..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/createType/innerGeneric.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createType -import kotlin.reflect.KClass -import kotlin.reflect.KTypeProjection -import kotlin.test.assertEquals - -class A { - inner class B { - inner class C - } - class D -} - -fun foo(): A.B.C = null!! - -fun box(): String { - fun KClass<*>.inv() = KTypeProjection.invariant(this.createType()) - - val type = A.B.C::class.createType(listOf(Long::class.inv(), Double::class.inv(), Float::class.inv(), Int::class.inv())) - assertEquals("A.B.C", type.toString()) - - assertEquals("A.D", A.D::class.createType().toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/createType/simpleCreateType.kt b/backend.native/tests/external/codegen/box/reflection/types/createType/simpleCreateType.kt deleted file mode 100644 index a31ee1d2f9f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/createType/simpleCreateType.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createType -import kotlin.reflect.KTypeProjection -import kotlin.test.assertEquals - -class Foo -class Bar - -fun box(): String { - assertEquals("Foo", Foo::class.createType().toString()) - assertEquals("Foo?", Foo::class.createType(nullable = true).toString()) - - assertEquals("Bar", Bar::class.createType(listOf(KTypeProjection.invariant(String::class.createType()))).toString()) - assertEquals("Bar?", Bar::class.createType(listOf(KTypeProjection.invariant(Int::class.createType())), nullable = true).toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/createType/typeParameter.kt b/backend.native/tests/external/codegen/box/reflection/types/createType/typeParameter.kt deleted file mode 100644 index db0fc185655..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/createType/typeParameter.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createType -import kotlin.test.assertEquals - -class Foo { - fun nonNull(): T = null!! - fun nullable(): T? = null -} - -fun box(): String { - val tp = Foo::class.typeParameters.single() - assertEquals( - Foo::class.members.single { it.name == "nonNull" }.returnType, - tp.createType() - ) - assertEquals( - Foo::class.members.single { it.name == "nullable" }.returnType, - tp.createType(nullable = true) - ) - - assertEquals(tp.createType(), tp.createType()) - assertEquals(tp.createType(nullable = true), tp.createType(nullable = true)) - - assertEquals("T", tp.createType().toString()) - assertEquals("T?", tp.createType(nullable = true).toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/createType/wrongNumberOfArguments.kt b/backend.native/tests/external/codegen/box/reflection/types/createType/wrongNumberOfArguments.kt deleted file mode 100644 index 834f04c1bdf..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/createType/wrongNumberOfArguments.kt +++ /dev/null @@ -1,52 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.createType -import kotlin.reflect.KClassifier -import kotlin.reflect.KTypeProjection - -fun test(classifier: KClassifier, arguments: List) { - try { - classifier.createType(arguments) - throw AssertionError("createType should have thrown IllegalArgumentException") - } - catch (e: IllegalArgumentException) { - // OK - } -} - -class Outer { - inner class Inner - class Nested -} - -fun box(): String { - val p = KTypeProjection.STAR - - test(String::class, listOf(p)) - test(String::class, listOf(p, p)) - test(List::class, listOf()) - test(List::class, listOf(p, p)) - test(Map::class, listOf()) - test(Map::class, listOf(p)) - test(Map::class, listOf(p, p, p)) - test(Array::class, listOf()) - - test(Outer::class, listOf()) - test(Outer::class, listOf(p, p)) - - // Outer.Inner takes two arguments: first for O, second for I - test(Outer.Inner::class, listOf()) - test(Outer.Inner::class, listOf(p)) - test(Outer.Inner::class, listOf(p, p, p)) - - // Outer.Nested takes one argument for N - test(Outer.Nested::class, listOf()) - test(Outer.Nested::class, listOf(p, p)) - - test(Outer::class.typeParameters.single(), listOf(p)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/innerGenericArguments.kt b/backend.native/tests/external/codegen/box/reflection/types/innerGenericArguments.kt deleted file mode 100644 index 66f84b13eae..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/innerGenericArguments.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.test.* - -class Outer { - inner class Inner { - inner class Innermost - } -} - -fun foo(): Outer.Inner.Innermost = null!! - -fun box(): String { - val types = ::foo.returnType.arguments.map { it.type!! } - - assertEquals( - listOf( - Any::class, - Any::class, - String::class, - Float::class, - Int::class, - Number::class - ), - types.map { it.classifier } - ) - - assertFalse(types[0].isMarkedNullable) - assertTrue(types[1].isMarkedNullable) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfClass.kt b/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfClass.kt deleted file mode 100644 index 87c35586db6..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfClass.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.jvmErasure -import kotlin.test.assertEquals - -fun string(): String = null!! -fun array(): Array = null!! - -fun collection(): Collection = null!! -fun mutableCollection(): MutableCollection = null!! - -fun box(): String { - assertEquals(String::class, ::string.returnType.jvmErasure) - assertEquals(Array::class, ::array.returnType.jvmErasure) - - assertEquals(Collection::class, ::collection.returnType.jvmErasure) - assertEquals(MutableCollection::class, ::mutableCollection.returnType.jvmErasure) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfTypeParameter.kt b/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfTypeParameter.kt deleted file mode 100644 index 5112e8e0b6f..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/jvmErasureOfTypeParameter.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.jvm.jvmErasure -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -open class O - -class A { - fun simple(): T = null!! - fun string(): T = null!! - fun nullableString(): T = null!! - fun otherTypeParameter(): T = null!! - fun > otherTypeParameterWithBound(): T = null!! - - fun twoInterfaces1(): T where T : Comparable<*> = null!! - fun > twoInterfaces2(): T where T : Cloneable = null!! - fun interfaceAndClass1(): T where T : O = null!! - fun interfaceAndClass2(): T where T : Cloneable = null!! - - fun arrayOfAny(): Array = null!! - fun arrayOfNumber(): Array = null!! - fun arrayOfArrayOfCloneable(): Array> where T : Cloneable, T : Comparable<*> = null!! -} - -fun get(name: String): KClass<*> = A::class.members.single { it.name == name }.returnType.jvmErasure - -fun box(): String { - assertEquals(Any::class, get("simple")) - assertEquals(String::class, get("string")) - assertEquals(String::class, get("nullableString")) - assertEquals(Any::class, get("otherTypeParameter")) - assertEquals(List::class, get("otherTypeParameterWithBound")) - - assertEquals(Cloneable::class, get("twoInterfaces1")) - assertEquals(Comparable::class, get("twoInterfaces2")) - assertEquals(O::class, get("interfaceAndClass1")) - assertEquals(O::class, get("interfaceAndClass2")) - - assertEquals(Array::class, get("arrayOfAny")) - assertEquals(Array::class, get("arrayOfNumber")) - assertEquals(Array>::class, get("arrayOfArrayOfCloneable")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/platformTypeClassifier.kt b/backend.native/tests/external/codegen/box/reflection/types/platformTypeClassifier.kt deleted file mode 100644 index 8487647d634..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/platformTypeClassifier.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_REFLECT -// FILE: J.java - -import java.util.List; - -public class J { - public static String string() { - return ""; - } - - public static List list() { - return null; - } - - public static int primitiveInt() { - return 0; - } - - public static Integer wrapperInt() { - return 0; - } -} - -// FILE: K.kt - -import kotlin.reflect.KClass -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(String::class, J::string.returnType.classifier) - assertEquals(List::class, J::list.returnType.classifier) - - assertEquals(Int::class.javaPrimitiveType!!, (J::primitiveInt.returnType.classifier as KClass<*>).java) - assertEquals(Int::class.javaObjectType, (J::wrapperInt.returnType.classifier as KClass<*>).java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/platformTypeNotEqualToKotlinType.kt b/backend.native/tests/external/codegen/box/reflection/types/platformTypeNotEqualToKotlinType.kt deleted file mode 100644 index 556607a12de..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/platformTypeNotEqualToKotlinType.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public class J { - public static String foo() { - return ""; - } -} - -// FILE: K.kt - -import kotlin.test.assertNotEquals - -fun nonNullString(): String = "" -fun nullableString(): String? = "" - -fun box(): String { - assertNotEquals(J::foo.returnType, ::nonNullString.returnType) - assertNotEquals(J::foo.returnType, ::nullableString.returnType) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/platformTypeToString.kt b/backend.native/tests/external/codegen/box/reflection/types/platformTypeToString.kt deleted file mode 100644 index e339364b397..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/platformTypeToString.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_REFLECT -// FILE: J.java - -import java.util.List; - -public class J { - public static String string() { - return ""; - } - - public static List list() { - return null; - } -} - -// FILE: K.kt - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals("kotlin.String!", J::string.returnType.toString()) - assertEquals("kotlin.collections.(Mutable)List!", J::list.returnType.toString()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/subtyping/platformType.kt b/backend.native/tests/external/codegen/box/reflection/types/subtyping/platformType.kt deleted file mode 100644 index 0242d6febfd..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/subtyping/platformType.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public interface J { - String platformString(); -} - -// FILE: K.kt - -import kotlin.reflect.KCallable -import kotlin.reflect.full.* -import kotlin.test.assertTrue - -fun string(): String = null!! -fun nullableString(): String? = null!! - -fun check(subCallable: KCallable<*>, superCallable: KCallable<*>) { - val subtype = subCallable.returnType - val supertype = superCallable.returnType - assertTrue(subtype.isSubtypeOf(supertype)) - assertTrue(supertype.isSupertypeOf(subtype)) -} - -fun box(): String { - check(::string, J::platformString) - check(J::platformString, ::string) - check(::nullableString, J::platformString) - check(J::platformString, ::nullableString) - check(J::platformString, J::platformString) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleGenericTypes.kt b/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleGenericTypes.kt deleted file mode 100644 index ff0e3b290d6..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleGenericTypes.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.* -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -open class G -class A : G() - -fun gOfString(): G = null!! -fun gOfInt(): G = null!! - -fun box(): String { - val gs = ::gOfString.returnType - val gi = ::gOfInt.returnType - val a = ::A.returnType - - assertTrue(a.isSubtypeOf(gs)) - assertTrue(gs.isSupertypeOf(a)) - - assertFalse(a.isSubtypeOf(gi)) - assertFalse(gi.isSupertypeOf(a)) - - assertFalse(gs.isSubtypeOf(gi)) - assertFalse(gs.isSupertypeOf(gi)) - assertFalse(gi.isSubtypeOf(gs)) - assertFalse(gi.isSupertypeOf(gs)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleSubtypeSupertype.kt b/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleSubtypeSupertype.kt deleted file mode 100644 index ac0b42bd669..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/subtyping/simpleSubtypeSupertype.kt +++ /dev/null @@ -1,68 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KCallable -import kotlin.reflect.full.* -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -fun check(subCallable: KCallable<*>, superCallable: KCallable<*>, shouldBeSubtype: Boolean) { - val subtype = subCallable.returnType - val supertype = superCallable.returnType - if (shouldBeSubtype) { - assertTrue(subtype.isSubtypeOf(supertype)) - assertTrue(supertype.isSupertypeOf(subtype)) - } else { - assertFalse(subtype.isSubtypeOf(supertype)) - assertFalse(supertype.isSupertypeOf(subtype)) - } -} - -open class O -class X : O() - -fun any(): Any = null!! -fun string(): String = null!! -fun nullableString(): String? = null!! -fun int(): Int = null!! -fun nothing(): Nothing = null!! -fun nullableNothing(): Nothing? = null!! -fun function2(): (Any, Any) -> Any = null!! -fun function3(): (Any, Any, Any) -> Any = null!! - -fun box(): String { - check(::any, ::any, true) - check(::int, ::int, true) - check(::nothing, ::nothing, true) - check(::nullableNothing, ::nullableNothing, true) - - check(::string, ::any, true) - check(::nullableString, ::any, false) - check(::int, ::any, true) - check(::O, ::any, true) - check(::X, ::any, true) - - check(::nothing, ::any, true) - check(::nothing, ::string, true) - check(::nothing, ::nullableString, true) - check(::nullableNothing, ::nullableString, true) - check(::nullableNothing, ::string, false) - - check(::string, ::nullableString, true) - check(::nullableString, ::string, false) - - check(::X, ::O, true) - check(::O, ::X, false) - - check(::int, ::string, false) - check(::string, ::int, false) - check(::any, ::string, false) - check(::any, ::nullableString, false) - - check(::function2, ::function3, false) - check(::function3, ::function2, false) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/subtyping/typeProjection.kt b/backend.native/tests/external/codegen/box/reflection/types/subtyping/typeProjection.kt deleted file mode 100644 index 586b6d6b036..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/subtyping/typeProjection.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.full.isSubtypeOf -import kotlin.test.assertTrue -import kotlin.test.assertFalse - -class G - -fun number(): G = null!! -fun outNumber(): G = null!! -fun inNumber(): G = null!! -fun star(): G<*> = null!! - -fun box(): String { - val n = ::number.returnType - val o = ::outNumber.returnType - val i = ::inNumber.returnType - val st = ::star.returnType - - // G <: G - assertTrue(n.isSubtypeOf(o)) - assertFalse(o.isSubtypeOf(n)) - - // G <: G - assertTrue(n.isSubtypeOf(i)) - assertFalse(i.isSubtypeOf(n)) - - // G <: G<*> - assertTrue(n.isSubtypeOf(st)) - assertFalse(st.isSubtypeOf(n)) - - // G <: G<*> - assertTrue(o.isSubtypeOf(st)) - assertFalse(st.isSubtypeOf(o)) - - // G <: G<*> - assertTrue(i.isSubtypeOf(st)) - assertFalse(st.isSubtypeOf(i)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/typeArguments.kt b/backend.native/tests/external/codegen/box/reflection/types/typeArguments.kt deleted file mode 100644 index c07bd52d723..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/typeArguments.kt +++ /dev/null @@ -1,45 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KTypeProjection -import kotlin.reflect.KVariance -import kotlin.test.assertEquals - -fun string(): String = null!! - -class Fourple -fun projections(): Fourple = null!! - -fun array(): Array = null!! - -fun list(): List = null!! - -fun box(): String { - val string = ::string.returnType - assertEquals(listOf(), string.arguments) - - assertEquals( - listOf( - KTypeProjection.invariant(string), - KTypeProjection.contravariant(string), - KTypeProjection.covariant(string), - KTypeProjection.STAR - ), - ::projections.returnType.arguments - ) - assertEquals( - listOf(string, string, string, null), - ::projections.returnType.arguments.map(KTypeProjection::type) - ) - - val outNumber = ::array.returnType.arguments.single() - assertEquals(KVariance.OUT, outNumber.variance) - assertEquals(Number::class, outNumber.type?.classifier) - - // There should be no use-site variance, despite the fact that the corresponding parameter has 'out' variance - assertEquals(KVariance.INVARIANT, ::list.returnType.arguments.single().variance) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/useSiteVariance.kt b/backend.native/tests/external/codegen/box/reflection/types/useSiteVariance.kt deleted file mode 100644 index be511cd44db..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/useSiteVariance.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT - -import kotlin.reflect.KVariance -import kotlin.test.assertEquals - -class Fourple -fun foo(): Fourple = null!! - -fun listOfStrings(): List = null!! - -fun box(): String { - assertEquals( - listOf( - KVariance.INVARIANT, - KVariance.IN, - KVariance.OUT, - null - ), - ::foo.returnType.arguments.map { it.variance } - ) - - // Declaration-site variance should have no effect on the variance of the type projection: - assertEquals(KVariance.INVARIANT, ::listOfStrings.returnType.arguments.first().variance) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reflection/types/withNullability.kt b/backend.native/tests/external/codegen/box/reflection/types/withNullability.kt deleted file mode 100644 index 34cd04295a9..00000000000 --- a/backend.native/tests/external/codegen/box/reflection/types/withNullability.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_REFLECT -// FILE: J.java - -public interface J { - String platform(); -} - -// FILE: K.kt - -import kotlin.reflect.full.withNullability -import kotlin.test.assertEquals - -fun nonNull(): String = "" -fun nullable(): String? = "" - -fun box(): String { - val nonNull = ::nonNull.returnType - val nullable = ::nullable.returnType - val platform = J::platform.returnType - - assertEquals(nonNull, nullable.withNullability(false)) - assertEquals(nullable, nullable.withNullability(true)) - assertEquals(nonNull, nonNull.withNullability(false)) - assertEquals(nullable, nonNull.withNullability(true)) - - assertEquals(nonNull, platform.withNullability(false)) - assertEquals(nullable, platform.withNullability(true)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/Kt1149.kt b/backend.native/tests/external/codegen/box/regressions/Kt1149.kt deleted file mode 100644 index f1581c61cf7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/Kt1149.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -package test.regressions.kt1149 - -public interface SomeTrait { - fun foo() -} - -fun box(): String { - val list = ArrayList() - var res = ArrayList() - list.add(object : SomeTrait { - override fun foo() { - res.add("anonymous.foo()") - } - }) - list.forEach{ it.foo() } - return if ("anonymous.foo()" == res[0]) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/Kt1619Test.kt b/backend.native/tests/external/codegen/box/regressions/Kt1619Test.kt deleted file mode 100644 index d8f38f37765..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/Kt1619Test.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -package regressions - -class Kt1619Test { - - fun doSomething(list: List): Int { - return list.size - } - - fun testCollectionNotNullCanBeUsedForNullables(): Int { - val list: List = arrayListOf("foo", "bar") - return doSomething(list) - } -} - -fun box(): String { - return if (Kt1619Test().testCollectionNotNullCanBeUsedForNullables() == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/Kt2495Test.kt b/backend.native/tests/external/codegen/box/regressions/Kt2495Test.kt deleted file mode 100644 index 072eba9a2f8..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/Kt2495Test.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -package regressions - -fun f(xs: Iterator): Int { - var answer = 0 - for (x in xs) { - answer += x - } - return answer -} - -fun box(): String { - val list = arrayListOf(1, 2, 3) - val result = f(list.iterator()) - return if (6 == result) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/approximateIntersectionType.kt b/backend.native/tests/external/codegen/box/regressions/approximateIntersectionType.kt deleted file mode 100644 index 0b7b38cab3c..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/approximateIntersectionType.kt +++ /dev/null @@ -1,30 +0,0 @@ -// WITH_RUNTIME -// IGNORE_BACKEND: JS, NATIVE - -// FILE: First.java - -import java.util.List; -import java.util.Iterator; - -public class First { - public static List from(List var0) { - return null; - } -} - -// FILE: second.kt - -fun List.listFromJava() = First.from(this) -fun List.listFromKotlin() = fromKotlin(this) - -fun fromKotlin(var0: List): List = var0 - -fun test(a: List) { - val b: List? = a.listFromJava() - val c: List = a.listFromKotlin() -} - -fun box(): String { - test(listOf(1)) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/arrayLengthNPE.kt b/backend.native/tests/external/codegen/box/regressions/arrayLengthNPE.kt deleted file mode 100644 index e3c91e64aaf..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/arrayLengthNPE.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See KT-14242 -var x = 1 -fun box(): String { - val testArray: Array? = when (1) { - x -> null - else -> arrayOfNulls(0) - } - - // Must not be NPE here - val size = testArray?.size - - return size?.toString() ?: "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/collections.kt b/backend.native/tests/external/codegen/box/regressions/collections.kt deleted file mode 100644 index 91779c31220..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/collections.kt +++ /dev/null @@ -1,154 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package collections - -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertTrue -import java.security.KeyPair - - -fun testCollectionSize(c: Collection) = assertEquals(0, c.size) -fun testCollectionIsEmpty(c: Collection) = assertTrue(c.isEmpty()) -fun testCollectionContains(c: Collection) = assertTrue(c.contains(1 as Any?)) -fun testCollectionIterator(c: Collection) { - val it = c.iterator() - while (it.hasNext()) { - assertEquals(1, it.next() as Any?) - } -} -fun testCollectionContainsAll(c: Collection) = assertTrue(c.containsAll(c)) -fun testMutableCollectionAdd(c: MutableCollection, t: T) { - c.add(t) - assertEquals(1, c.size) - assertTrue(c.contains(t)) -} -fun testMutableCollectionRemove(c: MutableCollection, t: T) { - c.remove(t) - assertEquals(0, c.size) - assertFalse(c.contains(t)) -} -fun testMutableCollectionIterator(c: MutableCollection, t: T) { - c.add(t) - val it = c.iterator() - while (it.hasNext()) { - it.next() - it.remove() - } - assertEquals(0, c.size) -} -fun testMutableCollectionAddAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayListOf(t1, t2)) - assertEquals(arrayListOf(t1, t2), c) -} -fun testMutableCollectionRemoveAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayListOf(t1, t2)) - c.removeAll(arrayListOf(t1)) - assertEquals(arrayListOf(t2), c) -} -fun testMutableCollectionRetainAll(c: MutableCollection, t1: T, t2: T) { - c.addAll(arrayListOf(t1, t2)) - c.retainAll(arrayListOf(t1)) - assertEquals(arrayListOf(t1), c) -} -fun testMutableCollectionClear(c: MutableCollection) { - c.clear() - assertTrue(c.isEmpty()) -} - -fun testCollection() { - testCollectionSize(arrayListOf()) - testCollectionIsEmpty(arrayListOf()) - testCollectionContains(arrayListOf(1)) - testCollectionIterator(arrayListOf(1)) - testCollectionContainsAll(arrayListOf("a", "b")) - - testMutableCollectionAdd(arrayListOf(), "") - testMutableCollectionRemove(arrayListOf("a"), "a") - testMutableCollectionIterator(arrayListOf(), 1) - testMutableCollectionAddAll(arrayListOf(), 1, 2) - testMutableCollectionRemoveAll(arrayListOf(), 1, 2) - testMutableCollectionRetainAll(arrayListOf(), 1, 2) - testMutableCollectionClear(arrayListOf(1, 2)) -} - - -fun testListGet(l: List, t: T) = assertEquals(t, l.get(0)) -fun testListIndexOf(l: List, t: T) = assertEquals(0, l.indexOf(t)) -fun testListIterator(l: List, t1 : T, t2 : T) { - val indexes = arrayListOf() - val result = arrayListOf() - val it = l.listIterator() - while (it.hasNext()) { - indexes.add(it.nextIndex()) - result.add(it.next()) - } - while (it.hasPrevious()) { - indexes.add(it.previousIndex()) - result.add(it.previous()) - } - assertEquals(arrayListOf(0, 1, 1, 0), indexes) - assertEquals(arrayListOf(t1, t2, t2, t1), result) -} -fun testListSublist(l: List, t: T) = assertEquals(arrayListOf(t), l.subList(0, 1)) - -fun testMutableListSet(l: MutableList, t: T) { - l.set(0, t) - assertEquals(arrayListOf(t), l) -} -fun testMutableListIterator(l: MutableList, t1: T, t2: T, t3: T) { - val it = l.listIterator() - while (it.hasNext()) { - it.next() - it.add(t3) - } - assertEquals(arrayListOf(t1, t3, t2, t3), l) -} - -fun testList() { - testListGet(arrayListOf(1), 1) - testListIndexOf(arrayListOf(1), 1) - testListIterator(arrayListOf("a", "b"), "a", "b") - testListSublist(arrayListOf(1, 2), 1) - - testMutableListSet(arrayListOf(2), 4) - testMutableListIterator(arrayListOf(1, 2), 1, 2, 3) -} - -fun testMapContainsKey(map: Map, k: K) = assertTrue(map.containsKey(k)) -fun testMapKeys(map: Map, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keys) -fun testMapValues(map: Map, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values) -fun testMapEntrySet(map: Map, k : K, v: V) { - for (entry in map.entries) { - assertEquals(k, entry.key) - assertEquals(v, entry.value) - } -} -fun testMutableMapEntry(map: MutableMap, k1 : K, v: V) { - for (entry in map.entries) { - entry.setValue(v) - } - assertEquals(hashMapOf(k1 to v), map) -} - - -fun testMap() { - testMapContainsKey(hashMapOf(1 to 'a', 2 to 'b'), 2) - testMapKeys(hashMapOf(1 to 'a', 2 to 'b'), 1, 2) - testMapValues(hashMapOf(1 to 'a', 2 to 'b'), 'a', 'b') - testMapEntrySet(hashMapOf(1 to 'a'), 1, 'a') - testMutableMapEntry(hashMapOf(1 to 'a'), 1, 'b') -} - -fun box() : String { - testCollection() - testList() - testMap() - return "OK" -} - -fun assertEqualCollections(c1: Collection, c2: Collection) = assertEquals(c1.toCollection(hashSetOf()), c2.toCollection(hashSetOf())) diff --git a/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant.kt b/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant.kt deleted file mode 100644 index 8fb7e750367..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface In - -class En : In -class A : In -fun select(x: T, y: T): T = x ?: y - -// This test just checks that no internal error happens in backend -// Return type should be In<*> nor In -fun foobar(e: En<*>) = select(A(), e) - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant2.kt b/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant2.kt deleted file mode 100644 index 959eaf527aa..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/commonSupertypeContravariant2.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface In -class A : In -class B : In -fun select(x: T, y: T) = x ?: y - -// This test just checks that no internal error happens in backend -fun foobar(a: A, b: B) = select(a, b) - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/regressions/dontCaptureTypesWithTypeVariables.kt b/backend.native/tests/external/codegen/box/regressions/dontCaptureTypesWithTypeVariables.kt deleted file mode 100644 index f14ecd2a694..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/dontCaptureTypesWithTypeVariables.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun test(i: Inv) { - foo(i.superclass()) -} - -fun foo(x: T) {} - -class Inv - -fun Inv.superclass(): Inv = Inv() - -fun box(): String { - test(Inv()) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/doubleMerge.kt b/backend.native/tests/external/codegen/box/regressions/doubleMerge.kt deleted file mode 100644 index 92e282fab33..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/doubleMerge.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(): Double { - var d = 2.0 - if (d > 0.0) { - d++ - } - d++ - return d -} - -fun box() = if (foo() > 3.5) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/regressions/floatMerge.kt b/backend.native/tests/external/codegen/box/regressions/floatMerge.kt deleted file mode 100644 index 22033fa3950..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/floatMerge.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(): Float { - var f = 2.0f - if (f > 0.0f) { - f++ - } - f++ - return f -} - -fun box() = if (foo() > 3.5f) "OK" else "Fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/functionLiteralAsLastExpressionInBlock.kt b/backend.native/tests/external/codegen/box/regressions/functionLiteralAsLastExpressionInBlock.kt deleted file mode 100644 index 13ed03338d2..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/functionLiteralAsLastExpressionInBlock.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val p: (String) -> Boolean = if (true) { - { true } - } else { - { true } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/generic.kt b/backend.native/tests/external/codegen/box/regressions/generic.kt deleted file mode 100644 index c5cf2b2efff..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/generic.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME - -fun ArrayList.findAll(predicate: (T) -> Boolean): ArrayList { - val result = ArrayList() - for(t in this) { - if (predicate(t)) result.add(t) - } - return result -} - - -fun box(): String { - val list: ArrayList = ArrayList() - list.add("Prague") - list.add("St.Petersburg") - list.add("Moscow") - list.add("Munich") - - val m: ArrayList = list.findAll({ name: String -> name.startsWith("M")}) - return if (m.size == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/getGenericInterfaces.kt b/backend.native/tests/external/codegen/box/regressions/getGenericInterfaces.kt deleted file mode 100644 index a0c9fe398e7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/getGenericInterfaces.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes - -class SimpleClass - -class ClassWithNonGenericSuperInterface: Cloneable - -class ClassWithGenericSuperInterface: java.util.Comparator { - override fun compare(a: String, b: String): Int = 0 -} - -fun check(klass: Class<*>) { - val interfaces = klass.getInterfaces().toList() - val genericInterfaces = klass.getGenericInterfaces().toList() - if (interfaces.size != genericInterfaces.size) { - throw AssertionError("interfaces=$interfaces, genericInterfaces=$genericInterfaces") - } -} - -fun box(): String { - check(SimpleClass::class.java) - check(ClassWithNonGenericSuperInterface::class.java) - check(ClassWithGenericSuperInterface::class.java) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/hashCodeNPE.kt b/backend.native/tests/external/codegen/box/regressions/hashCodeNPE.kt deleted file mode 100644 index d362db21e77..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/hashCodeNPE.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See KT-14242 -var x = 1 -fun box(): String { - val any: Any? = when (1) { - x -> null - else -> Any() - } - - // Must not be NPE here - val hashCode = any?.hashCode() - - return hashCode?.toString() ?: "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/internalTopLevelOtherPackage.kt b/backend.native/tests/external/codegen/box/regressions/internalTopLevelOtherPackage.kt deleted file mode 100644 index 8c51a9a2cf9..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/internalTopLevelOtherPackage.kt +++ /dev/null @@ -1,9 +0,0 @@ -// FILE: 1.kt - -fun box() = a.x - -// FILE: 2.kt - -package a - -internal val x: String = "OK" diff --git a/backend.native/tests/external/codegen/box/regressions/intersectionAsLastLambda.kt b/backend.native/tests/external/codegen/box/regressions/intersectionAsLastLambda.kt deleted file mode 100644 index e0667b4f106..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/intersectionAsLastLambda.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// FILE: First.java - -public class First { - public static First first(K key) { - return null; - } -} - -// FILE: second.kt - -class Inv(val key: T) - -fun lastLambda(x: T, block: (T) -> R): R = block(x) - -fun myTest(m: Inv) { - lastLambda(m) { First.first(it.key) } -} - -fun box(): String { - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/intersectionOfEqualTypes.kt b/backend.native/tests/external/codegen/box/regressions/intersectionOfEqualTypes.kt deleted file mode 100644 index 220d3759335..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/intersectionOfEqualTypes.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -// FILE: test.kt - -fun foo() { - takeClass(run { - val outer: Sample? = null - if (outer != null) outer else null - }) -} - -fun takeClass(instanceClass: Sample<*>?) {} -class Sample - -fun box(): String { - foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt10143.kt b/backend.native/tests/external/codegen/box/regressions/kt10143.kt deleted file mode 100644 index 33a0cbbce16..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt10143.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: Outer.kt - -package another -open class Outer { - protected class Stage(val run: () -> Unit) - protected class My(var stage: Stage? = null) { - fun initStage(f: () -> Unit): Stage { - stage = Stage(f) - return stage!! - } - } - protected fun my(init: My.() -> Unit): My { - val result = My() - result.init() - return result - } -} - -// FILE: Main.kt - -package other -class Derived : another.Outer() { - init { - my { - initStage { } - } - } -} - -fun box(): String { - Derived() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt10934.kt b/backend.native/tests/external/codegen/box/regressions/kt10934.kt deleted file mode 100644 index bbc549b99c4..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt10934.kt +++ /dev/null @@ -1,38 +0,0 @@ -//KT-10934 compiler throws UninferredParameterTypeConstructor in when block that covers all types - -class Parser(val f: (TInput) -> Result) { - - operator fun invoke(input: TInput): Result = f(input) - - fun mapJoin( - selector: (TValue) -> Parser, - projector: (TValue, TIntermediate) -> TValue2 - ): Parser { - return Parser({ input -> - val res = this(input) - when (res) { - is Result.ParseError -> Result.ParseError(res.productionLabel, res.child, res.rest) - is Result.Value -> { - val v = res.value - val res2 = selector(v)(res.rest) - when (res2) { - is Result.ParseError -> Result.ParseError(res2.productionLabel, res2.child, res2.rest) - is Result.Value -> Result.Value(projector(v, res2.value), res2.rest) - } - } - } - }) - } -} - -/** A parser can return one of two Results */ -sealed class Result { - - class Value(val value: TValue, val rest: TInput) : Result() {} - - class ParseError(val productionLabel: String, - val child: ParseError?, - val rest: TInput) : Result() {} -} - -fun box() = "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt1172.kt b/backend.native/tests/external/codegen/box/regressions/kt1172.kt deleted file mode 100644 index feaa0290dad..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1172.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE -// not sure if it's ok to change Object to Any - -// WITH_RUNTIME - -package test.regressions.kt1172 - -public fun scheduleRefresh(vararg files : Object) { - ArrayList(files.map { it }) -} - -fun box(): String { - scheduleRefresh() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1202.kt b/backend.native/tests/external/codegen/box/regressions/kt1202.kt deleted file mode 100644 index 139bfc770bf..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1202.kt +++ /dev/null @@ -1,122 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME -// FULL_JDK - -package testeval - -import java.util.LinkedList -import java.util.Deque - -interface Expression -class Num(val value : Int) : Expression -class Sum(val left : Expression, val right : Expression) : Expression -class Mult(val left : Expression, val right : Expression) : Expression - -fun eval(e : Expression) : Int { - return when (e) { - is Num -> e.value - is Sum -> eval(e.left) + eval (e.right) - is Mult -> eval(e.left) * eval (e.right) - else -> throw AssertionError("Unknown expression") - } -} - -interface ParseResult { - val success : Boolean - val value : T -} - -class Success(override val value : T) : ParseResult { - public override val success : Boolean = true -} - -class Failure(val message : String) : ParseResult { - override val success = false - override val value : Nothing = throw UnsupportedOperationException("Don't call value on a Failure") -} - -open class Token(val text : String) { - override fun toString() = text -} -object LPAR : Token("(") -object RPAR : Token(")") -object PLUS : Token("+") -object TIMES : Token("*") -object EOF : Token("EOF") -class Number(text : String) : Token(text) -class Error(text : String) : Token("[Error: $text]") - - -fun tokenize(text : String) : Deque { - val result = LinkedList() - for (c in text) { - result.add(when (c) { - '(' -> LPAR - ')' -> RPAR - '+' -> PLUS - '*' -> TIMES - in '0'..'9' -> Number(c.toString()) - else -> Error(c.toString()) - }) - } - result.add(EOF) - return result -} - -fun parseSum(tokens : Deque) : ParseResult { - val left = parseMult(tokens) - if (!left.success) return left - - if (tokens.peek() == PLUS) { - tokens.pop() - val right = parseSum(tokens) - if (!right.success) return right - return Success(Sum(left.value, right.value)) - } - - return left -} - -fun parseMult(tokens : Deque) : ParseResult { - val left = parseAtomic(tokens) - if (!left.success) return left - - if (tokens.peek() == PLUS) { - tokens.pop() - val right = parseMult(tokens) - if (!right.success) return right - return Success(Mult(left.value, right.value)) - } - - return left -} - -fun parseAtomic(tokens : Deque) : ParseResult { - val token = tokens.poll() - return when (token) { - LPAR -> { - val result = parseSum(tokens) - val rpar = tokens.poll() - if (rpar == RPAR) - result - else - Failure("Expecting ')'") - } - is Number -> Success(Num(Integer.parseInt((token as Token).text))) - else -> Failure("Unexpected EOF") - } -} - -fun parse(text : String) : ParseResult = parseSum(tokenize(text)) - -fun box(): String { - if (1 != eval(Num(1))) return "fail 1" - if (2 != eval(Sum(Num(1), Num(1)))) return "fail 2" - if (3 != eval(Mult(Num(3), Num(1)))) return "fail 3" - if (6 != eval(Mult(Num(3), Sum(Num(1), Num(1))))) return "fail 4" - - if (1 != eval(parse("1").value)) return "fail 5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt13381.kt b/backend.native/tests/external/codegen/box/regressions/kt13381.kt deleted file mode 100644 index b424d596455..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt13381.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A { - // There must be no delegation methods for 'log' and 'bar' in C as they are private - private val log: String get() = "O" - private fun bar() = "K" - - fun foo() = log + bar() -} - -interface B : A -class C : B - -fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/box/regressions/kt1406.kt b/backend.native/tests/external/codegen/box/regressions/kt1406.kt deleted file mode 100644 index 171a734bec8..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1406.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME -// FULL_JDK - -package pack - -import java.util.regex.Pattern - -class C{ - public fun foo(){ - val items : Collection = listOf(Item()) - val result = ArrayList() - val pattern: Pattern? = Pattern.compile("...") - items.filterTo(result) { - pattern!!.matcher(it.name())!!.matches() - } - } - - private fun Item.name() : String = "" -} - -class Item{ -} - -fun box() : String { - C().foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt14447.kt b/backend.native/tests/external/codegen/box/regressions/kt14447.kt deleted file mode 100644 index 7aab4c5003b..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt14447.kt +++ /dev/null @@ -1,22 +0,0 @@ -class ImpulsMigration -{ - fun migrate(oldVersion: Long) - { - var _oldVersion = oldVersion - - if (4 > 3) - { - _oldVersion = 1 - } - - if (1 > 3) - { - _oldVersion++ - } - } -} - -fun box(): String { - ImpulsMigration().migrate(1L) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1515.kt b/backend.native/tests/external/codegen/box/regressions/kt1515.kt deleted file mode 100644 index 038e7120483..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1515.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: 1.kt - -package thispackage - -import otherpackage.* - -fun box(): String { - if (!localUse()) { - return "local use failed" - } - if (!fromOtherPackage()) { - return "use from other package failed" - } - return "OK" -} - -fun localUse(): Boolean { - val c = Runnable::class.java - return (c.getName()!! == "java.lang.Runnable") -} - -// FILE: 2.kt - -package otherpackage - -fun fromOtherPackage(): Boolean { - val c = Runnable::class.java - return (c.getName()!! == "java.lang.Runnable") -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt15196.kt b/backend.native/tests/external/codegen/box/regressions/kt15196.kt deleted file mode 100644 index debf64aeb70..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt15196.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME -fun foo() { - val array = Array(0, { IntArray(0) } ) - array.forEach { println(it.asList()) } -} - -fun box(): String { - foo() // just to be sure, that no exception happens - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1528.kt b/backend.native/tests/external/codegen/box/regressions/kt1528.kt deleted file mode 100644 index 99352a01acb..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1528.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt - -fun box() = foo() - -// FILE: 2.kt - -private val a = "OK" -fun foo() : String { - return "${a}" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1568.kt b/backend.native/tests/external/codegen/box/regressions/kt1568.kt deleted file mode 100644 index e9f44796815..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1568.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box() : String { - val i = 1 - return if(i.javaClass.getSimpleName() == "int") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1779.kt b/backend.native/tests/external/codegen/box/regressions/kt1779.kt deleted file mode 100644 index ffcb7d79844..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1779.kt +++ /dev/null @@ -1,20 +0,0 @@ -// WITH_RUNTIME - -import kotlin.collections.AbstractIterator - -class MyIterator : AbstractIterator() { - var i = 0 - public override fun computeNext() { - if(i < 5) - setNext((i++).toString()) - } - -} - -fun box() : String { - var k = "" - for (x in MyIterator()) { - k+=x - } - return if(k=="01234") "OK" else k -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1800.kt b/backend.native/tests/external/codegen/box/regressions/kt1800.kt deleted file mode 100644 index 85b88bbac74..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1800.kt +++ /dev/null @@ -1,30 +0,0 @@ -// WITH_RUNTIME -//KT-1800 error/NonExistentClass generated on runtime -package i - -public class User(val firstName: String, - val lastName: String, - val age: Int) { - override fun toString() = "$firstName $lastName, age $age" -} - -public fun > Collection.testMin(): T? { - var minValue: T? = null - for(value in this) { - if (minValue == null || value.compareTo(minValue!!) < 0) { - minValue = value - } - } - return minValue -} - -fun box() : String { - val users = arrayListOf( - User("John", "Doe", 30), - User("Jane", "Doe", 27)) - - val ages = users.map { it.age } - - val minAge = ages.testMin() - return if (minAge == 27) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt1845.kt b/backend.native/tests/external/codegen/box/regressions/kt1845.kt deleted file mode 100644 index 1451484226a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1845.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: 1.kt - -public var v1: String = "V1" - -fun box(): String { - val s = "v1: $v1, v2: $v2" - return "OK" -} - -// FILE: 2.kt - -public var v2: String = "V2" diff --git a/backend.native/tests/external/codegen/box/regressions/kt18779.kt b/backend.native/tests/external/codegen/box/regressions/kt18779.kt deleted file mode 100644 index 986fc495998..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt18779.kt +++ /dev/null @@ -1,19 +0,0 @@ -sealed class Result { - class Failure(val exception: Exception) : Result() - class Success(val message: String) : Result() -} - -fun box(): String { - var result: Result - try { - result = Result.Success("OK") - } - catch (e: Exception) { - result = Result.Failure(Exception()) - } - - when (result) { - is Result.Failure -> throw result.exception - is Result.Success -> return result.message - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt1932.kt b/backend.native/tests/external/codegen/box/regressions/kt1932.kt deleted file mode 100644 index 1404fde6962..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt1932.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.lang.annotation.Annotation - -@Retention(AnnotationRetention.RUNTIME) -annotation class foo(val name : String) - -class Test() { - @foo("OK") fun hello(input : String) { - } -} - -fun box(): String { - val test = Test() - for (method in Test::class.java.getMethods()!!) { - val anns = method?.getAnnotations() as Array - if (!anns.isEmpty()) { - for (ann in anns) { - val fooAnn = ann as foo - return fooAnn.name - } - } - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2017.kt b/backend.native/tests/external/codegen/box/regressions/kt2017.kt deleted file mode 100644 index 3b1b64b5dc1..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2017.kt +++ /dev/null @@ -1,6 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val sorted = arrayListOf("1", "3", "2").sorted() - return if (sorted != arrayListOf("1", "2", "3")) "$sorted" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2060.kt b/backend.native/tests/external/codegen/box/regressions/kt2060.kt deleted file mode 100644 index 374e73111fb..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2060.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -import testing.ClassWithInternals - -public class HelloServer() : ClassWithInternals() { - public override fun start() { - val test = foo() + someGetter //+ some - } -} - -fun box() : String { - HelloServer().start() - return "OK" -} - -// FILE: 2.kt - -package testing; // There is no error if both files are in default package - -public abstract class ClassWithInternals { - protected var some: Int = 0; - protected var someGetter: Int = 0 - get() = 5 - - protected fun foo() : Int = 0 - - public abstract fun start() : Unit; -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2210.kt b/backend.native/tests/external/codegen/box/regressions/kt2210.kt deleted file mode 100644 index 95f4d64882a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2210.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A(t: Array>) { - val a:Array> = t -} - -fun box(): String { - A(arrayOf()) // <- java.lang.VerifyError: (class: A, method: getA signature: ()[[Ljava/lang/Object;) Wrong return type in function - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2246.kt b/backend.native/tests/external/codegen/box/regressions/kt2246.kt deleted file mode 100644 index 28bbc2321b2..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2246.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun box(): String { - kotlin.assert(true) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2318.kt b/backend.native/tests/external/codegen/box/regressions/kt2318.kt deleted file mode 100644 index 21d87c5e022..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2318.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - Boolean::class.java - Byte::class.java - Short::class.java - Char::class.java - Int::class.java - Long::class.java - Float::class.java - Double::class.java - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2509.kt b/backend.native/tests/external/codegen/box/regressions/kt2509.kt deleted file mode 100644 index 10529d6d497..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2509.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - A() - return "OK" -} - -class A: B() { - override var foo = arrayOf(12, 13) -} - -abstract class B { - abstract var foo: Array -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt2593.kt b/backend.native/tests/external/codegen/box/regressions/kt2593.kt deleted file mode 100644 index cee437b0d37..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt2593.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun foo() { - if (1==1) { - 1.javaClass - } else { - } -} - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/regressions/kt274.kt b/backend.native/tests/external/codegen/box/regressions/kt274.kt deleted file mode 100644 index d6393b5578a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt274.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -fun box() : String { - val vector = java.util.Vector() - vector.add(1) - vector.add(2) - vector.add(3) - - var sum = 0 - for(e in vector.elements()) { - sum += e - } - return if(sum == 6) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt3046.kt b/backend.native/tests/external/codegen/box/regressions/kt3046.kt deleted file mode 100644 index ffdc39f27de..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3046.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val bool = true - if (bool.javaClass != Boolean::class.java) return "javaClass function on boolean fails" - val b = 1.toByte() - if (b.javaClass != Byte::class.java) return "javaClass function on byte fails" - val s = 1.toShort() - if (s.javaClass != Short::class.java) return "javaClass function on short fails" - val c = 'c' - if (c.javaClass != Char::class.java) return "javaClass function on char fails" - val i = 1 - if (i.javaClass != Int::class.java) return "javaClass function on int fails" - val l = 1.toLong() - if (l.javaClass != Long::class.java) return "javaClass function on long fails" - val f = 1.toFloat() - if (f.javaClass != Float::class.java) return "javaClass function on float fails" - val d = 1.0 - if (d.javaClass != Double::class.java) return "javaClass function on double fails" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt3107.kt b/backend.native/tests/external/codegen/box/regressions/kt3107.kt deleted file mode 100644 index 851d6931058..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3107.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun foo(): String { - val s = try { - "OK" - } catch (e: Exception) { - try { - "" - } catch (ee: Exception) { - "" - } - } - - return s -} - -fun box(): String { - return foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt3421.kt b/backend.native/tests/external/codegen/box/regressions/kt3421.kt deleted file mode 100644 index a3f0590d621..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3421.kt +++ /dev/null @@ -1,9 +0,0 @@ -public object Globals{ - operator fun get(key: String, remove: Boolean = true): String { - return "OK" - } -} - -fun box(): String { - return Globals["test"] -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt344.kt b/backend.native/tests/external/codegen/box/regressions/kt344.kt deleted file mode 100644 index 196a5f38daf..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt344.kt +++ /dev/null @@ -1,200 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun s0() : Boolean { - val y = "222" - val foo = { - val bar = { y } - bar () - } - return foo() == "222" -} - -fun s1() : Boolean { - var x = "222" - val foo = { - val bar = { - x = "aaa" - } - bar () - } - foo() - return x == "aaa" -} - -fun t1() : Boolean { - var x = "111" - - val y = x + "22" - val foo = { - x = x + "45" + y - x = x.substring(3) - x += "aaa" - Unit - } - foo() - - x += "bbb" - System.out?.println(x) - return x == "4511122aaabbb" -} - -fun t2() : Boolean { - var x = 111 - val y = x + 22 - val foo = { - x = x + 5 + y - x += 5 - x++ - Unit - } - foo() - x -= 55 - System.out?.println(x) - return x == 200 -} - -fun t3() : Boolean { - var x = true - val foo = { - x = false - Unit - } - foo() - return !x -} - -fun t4() : Boolean { - var x = 100.toFloat() - val y = x + 22 - val foo = { - x = x + 200.toFloat() + y - x += 18 - Unit - } - foo() - System.out?.println(x) - return x == 440.toFloat() -} - -fun t5() : Boolean { - var x = 100.toDouble() - val y = x + 22 - val foo = { - x = x + 200.toDouble() + y - x -= 22 - Unit - } - foo() - System.out?.println(x) - return x == 400.toDouble() -} - -fun t6() : Boolean { - var x = 20.toByte() - val y = x + 22 - val foo = { - x = (x + 20.toByte() + y).toByte() - x = (x + 2).toByte() - x-- - Unit - } - foo() - System.out?.println(x) - return x == 83.toByte() -} - -fun t7() : Boolean { - var x : Char = 'a' - val foo = { - x = 'b' - Unit - } - foo() - System.out?.println(x) - return x == 'b' -} - -fun t8() : Boolean { - var x = 20.toShort() - val foo = { - val bar = { - x = 30.toShort() - Unit - } - bar() - Unit - } - foo() - return x == 30.toShort() -} - -fun t9(x0: Int) : Boolean { - var x = x0 - while(x < 100) { - x++ - } - return x == 100 -} - -fun t10() : Boolean { - var y = 1 - val foo = { - val bar = { - y = y + 1 - } - bar() - } - foo() - return y == 2 -} - -fun t11(x0: Int) : Int { - var x = x0 - val foo = { - x = x + 1 - val bar = { - x = x + 1 - x += 3 - } - bar() - } - while(x < 100) { - foo() - } - return x -} - -fun t12(x: Int) : Int { - var y = x - val runnable = object : Runnable { - override fun run () { - y = y + 1 - } - } - while(y < 100) { - runnable.run() - } - return y -} - -fun box(): String { - if (!s0()) return "s0 fail" - if (!s1()) return "s1 fail" - if (!t1()) return "t1 fail" - if (!t2()) return "t2 fail" - if (!t3()) return "t3 fail" - if (!t4()) return "t4 fail" - if (!t5()) return "t5 fail" - if (!t6()) return "t6 fail" - if (!t7()) return "t7 fail" - if (!t8()) return "t8 fail" - if (!t9(0)) return "t9 fail" - if (!t10()) return "t10 fail" - if (t11(1) != 101) return "t11 fail" - if (t12(0) != 100) return "t12 fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt3442.kt b/backend.native/tests/external/codegen/box/regressions/kt3442.kt deleted file mode 100644 index 0a28219ff5f..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3442.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val m = hashMapOf() - m.put("b", null) - val oldValue = m.getOrPut("b", { "Foo" }) - return if (oldValue == "Foo") "OK" else "fail: $oldValue" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt3587.kt b/backend.native/tests/external/codegen/box/regressions/kt3587.kt deleted file mode 100644 index 3e1d47b1cd9..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3587.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class Variable { - val lightVar: LightVariable = if (this is LightVariable) this else LightVariable() -} - -class LightVariable() : Variable() - -fun box(): String { - Variable() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt3850.kt b/backend.native/tests/external/codegen/box/regressions/kt3850.kt deleted file mode 100644 index 03acfce7df7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3850.kt +++ /dev/null @@ -1,7 +0,0 @@ -private class One { - val a1 = arrayOf( - object { val fy = "text"} - ) -} - -fun box() = if (One().a1[0].fy == "text") "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt3903.kt b/backend.native/tests/external/codegen/box/regressions/kt3903.kt deleted file mode 100644 index 1d08051cded..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt3903.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Foo { - fun bar(): String { - fun foo(t:() -> T) : T = t() - foo { } - return "OK" - } -} - -fun box(): String { - return Foo().bar() -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt4142.kt b/backend.native/tests/external/codegen/box/regressions/kt4142.kt deleted file mode 100644 index d7fe122fda7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt4142.kt +++ /dev/null @@ -1,16 +0,0 @@ -open class B { - val name: String - get() = "OK" -} - -interface A { - val name: String -} - -class C : B(), A { - -} - -fun box(): String { - return C().name -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt4259.kt b/backend.native/tests/external/codegen/box/regressions/kt4259.kt deleted file mode 100644 index 2f5ff42b84a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt4259.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val s: String? = "a" - val o: Char? = s?.get(0) - val c: Any? = o?.javaClass - return if (c != null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt4262.kt b/backend.native/tests/external/codegen/box/regressions/kt4262.kt deleted file mode 100644 index d170254879f..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt4262.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun > Byte.toEnum(clazz : Class) : E = - (clazz.getMethod("values").invoke(null) as Array)[this.toInt()] - -enum class Letters { A, B, C } - -fun box(): String { - val clazz = Letters::class.java - val r = 1.toByte().toEnum(clazz) - return if (r == Letters.B) "OK" else "Fail: $r" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt4281.kt b/backend.native/tests/external/codegen/box/regressions/kt4281.kt deleted file mode 100644 index a1e84ddff49..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt4281.kt +++ /dev/null @@ -1,16 +0,0 @@ -abstract class C { - fun test(x: Int) { - if (x == 0) return - if (this is D) { - val d: D = this - d.test(x - 1) - } - } -} - -class D: C() - -fun box(): String { - D().test(10) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt5056.kt b/backend.native/tests/external/codegen/box/regressions/kt5056.kt deleted file mode 100644 index eb6855473ee..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5056.kt +++ /dev/null @@ -1,6 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val list = arrayOf("a", "c", "b").sorted() - return if (list.toString() == "[a, b, c]") "OK" else "Fail: $list" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt528.kt b/backend.native/tests/external/codegen/box/regressions/kt528.kt deleted file mode 100644 index cf19709bf50..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt528.kt +++ /dev/null @@ -1,132 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package mask - -import java.io.* -import java.util.* - -fun box() : String { - val input = StringReader("/aaa/bbb/ccc/ddd") - - val luhny = Luhny() - input.forEachChar { - luhny.charIn(it) - } - luhny.printAll() - return "OK" -} - -class Luhny() { - val buffer = LinkedList() - val digits = LinkedList() - - var toBeMasked = 0 - - fun charIn(it : Char) { - buffer.addLast(it) - - // Commented for KT-621 - // when (it) { - // .isDigit() => digits.addLast(it.toInt() - '0'.toInt()) - // ' ', '-' => {} - // else => { - // printAll() - // digits.clear() - // } - // } - - if (it.isDigit()) { - digits.addLast(it - '0') - } else if (it == ' ' || it == '-') { - } else { - printAll() - digits.clear() - } - - if (digits.size > 16) - printOneDigit() - check() - } - - fun check() { - if (digits.size < 14) return - print("check") - val sum = digits.sum { i, d -> -// println("$i -> $d") - if (i % 2 == digits.size) { - val f = d * 2 / 10 - val s = d * 2 % 10 -// println("$d: f = $f, s = $s") - (f + s).pr { -// println("to be doubled: $i -> $d : $it") - } - } else d - } -// println(sum) - if (sum % 10 == 0) {print("s"); toBeMasked = digits.size} - } - - fun printOneDigit() { - while (!buffer.isEmpty()) { - val c = buffer.removeFirst() - out(c) - if (c.isDigit()) { - digits.removeFirst() - return - } - } - } - - fun printAll() { - while (!buffer.isEmpty()) - out(buffer.removeFirst()) - } - - fun out(c : Char) { - if (toBeMasked > 0) { - print('X') - toBeMasked-- - } - else { - // print(c) - } - } -} - -fun T.pr(f : (T) -> Unit) : T { - f(this) - return this -} - -fun LinkedList.sum(f : (Int, Int )-> Int): Int { - var sum = 0 - for (i in 1..size) { - val j = size - i - sum += f(j, get(j)) - } - return sum -} - -//fun List.backwards() : Itl = object : Itl { -// override fun iterator() : It = -// object : It { -// var current = size() -// override fun next() : T = get(--current) -// override fun hasNext() : Boolean = current > 0 -// override fun remove() {throw UnsupportedOperationException()} -// } -//} - -// fun Char.isDigit() = Character.isDigit(this) - -fun Reader.forEachChar(body : (Char) -> Unit) { - do { - var i = read(); - if (i == -1) break - body(i.toChar()) - } while(true) -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt529.kt b/backend.native/tests/external/codegen/box/regressions/kt529.kt deleted file mode 100644 index ca20d00ea2a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt529.kt +++ /dev/null @@ -1,113 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package mask - -import java.io.* -import java.util.* - -fun box() : String { - val input = StringReader("/aaa/bbb/ccc/ddd") - - val luhny = Luhny() - input.forEachChar { - luhny.process(it) - } - luhny.printAll() - return "OK" -} - -class Luhny() { - private val buffer = ArrayDeque() - private val digits = ArrayDeque(16) - - private var toBeMasked = 0 - - fun process(it : Char) { - buffer.addLast(it) - - // Commented for KT-621 - // when (it) { - // .isDigit() => digits.addLast(it.toInt() - '0'.toInt()) - // ' ', '-' => {} - // else => printAll() - // } - - if (it.isDigit()) { - digits.addLast(it - '0') - } else if (it == ' ' || it == '-') { - } else { - printAll() - } - - if (digits.size > 16) - printOneDigit() - check() - } - - private fun check() { - val size = digits.size - if (size < 14) return - val sum = digits.sum {i, d -> - if (i % 2 == size % 2) double(d) else d - } -// var sum = 0 -// var i = 0 -// for (d in digits) { -// sum += if (i % 2 == size % 2) double(d) else d -// i++ -// } - if (sum % 10 == 0) toBeMasked = digits.size - } - - private fun double(d : Int) = d * 2 / 10 + d * 2 % 10 - - private fun printOneDigit() { - while (!buffer.isEmpty()) { - val c = buffer.removeFirst()!! - print(c) - if (c.isDigit()) { - digits.removeFirst() - return - } - } - } - - fun printAll() { - while (!buffer.isEmpty()) - print(buffer.removeFirst()) - digits.clear() - } - - private fun print(c : Char) { - if (c.isDigit() && toBeMasked > 0) { - kotlin.io.print('X') - toBeMasked-- - } else { - // kotlin.io.print(c) - } - } -} - -// fun Char.isDigit() = Character.isDigit(this) - -fun Iterable.sum(f : (index : Int, value : Int) -> Int) : Int { - var sum = 0 - var i = 0 - for (d in this) { - sum += f(i, d) - i++ - } - return sum -} - -fun Reader.forEachChar(body : (Char) -> Unit) { - do { - var i = read(); - if (i == -1) break - body(i.toChar()) - } while(true) -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt533.kt b/backend.native/tests/external/codegen/box/regressions/kt533.kt deleted file mode 100644 index 8a728eae40b..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt533.kt +++ /dev/null @@ -1,150 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -package mask - -import java.io.* -import java.util.* - -fun box() : String { - val input = StringReader("/aaa/bbb/ccc/ddd") - - val luhny = Luhny() - input.forEachChar { - luhny.charIn(it) - } - luhny.printAll() - return "OK" - -} - -class Luhny() { - val buffer = LinkedList() - val digits = LinkedList() - - var toBeMasked = 0 - - fun charIn(it : Char) { - buffer.push(it) - - // Commented for KT-621 - // when (it) { - // .isDigit() => digits.push(it.toInt() - '0'.toInt()) - // ' ', '-' => {} - // else => { - // printAll() - // digits.clear() - // } - // } - - if (it.isDigit()) { - digits.push(it - '0') - } else if (it == ' ' || it == '-') { - } else { - printAll() - digits.clear() - } - - if (digits.size > 16) - printOneDigit() - check() - } - - fun check() { - if (digits.size < 14) return - val sum = digits.sum { i, d -> - if (i % 2 != 0) - d * 2 / 10 + d * 2 % 10 - else d - } - if (sum % 10 == 0) toBeMasked = digits.size - } - - fun printOneDigit() { - while (!buffer.isEmpty()) { - val c = buffer.pop() - out(c) - if (c.isDigit()) { - digits.pop() - return - } - } - } - - fun printAll() { - while (!buffer.isEmpty()) - out(buffer.pop()) - } - - fun out(c : Char) { - if (toBeMasked > 0) { - print('X') - toBeMasked-- - } - else { - // print(c) - } - } -} - -fun LinkedList.sum(f : (Int, Int) -> Int) : Int { - var sum = 0 - var i = 0 - for (d in backwards()) { - sum += f(i, d) - i++ - } - return sum -} - -fun List.backwards() : Iterable = object : Iterable { - override fun iterator() : Iterator = - object : Iterator { - var current = size - override fun next() : T = get(--current) - override fun hasNext() : Boolean = current > 0 - } -} - -// fun Char.isDigit() = Character.isDigit(this) - -//class Queue(initialBufSize : Int) { -// -// private var bufSize = initialBufSize -// private val buf = Array(initialBufSize) -// private var head = 0 -// private var tail = 0 -// private var size = 0 -// -// val empty : Boolean get() = size == 0 -// -// private fun prev(i : Int) = (bufSize + i - 1) % bufSize -// private fun next(i : Int) = (i + 1) % bufSize -// -// fun push(c : T) { -// buf[tail] = c -// tail = prev(tail) -// size++ -// } -// -// fun pop() : T { -// if (size == 0) throw IllegalStateException() -// size-- -// val result = buf[head] -// head = prev(head) -// return result -// } -// -// fun clear() {} -//} - -fun Reader.forEachChar(body : (Char) -> Unit) { - do { - var i = read(); - if (i == -1) break - body(i.toChar()) - } while(true) -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt5395.kt b/backend.native/tests/external/codegen/box/regressions/kt5395.kt deleted file mode 100644 index 11bb02ddf09..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5395.kt +++ /dev/null @@ -1,13 +0,0 @@ -class D { - companion object { - protected val F: String = "OK" - } - - inner class E { - fun foo() = F - } -} - -fun box(): String { - return D().E().foo() -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt5445.kt b/backend.native/tests/external/codegen/box/regressions/kt5445.kt deleted file mode 100644 index 808a90f35e6..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5445.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: 1.kt - -package test2 - -import test.A - -public fun box(): String { - return B().test(B()) -} - -public class B : A() { - public fun test(other:Any): String { - if (other is B && other.s == 2) { - return "OK" - } - return "fail" - } -} - -// FILE: 2.kt - -package test - -open class A { - @JvmField protected val s = 2; -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt5445_2.kt b/backend.native/tests/external/codegen/box/regressions/kt5445_2.kt deleted file mode 100644 index 97b4274cab5..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5445_2.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: 1.kt - -package test2 - -import test.A - -class C : A() { - fun a(): String { - return this.s - } -} - -public fun box(): String { - return C().a() -} - -// FILE: 2.kt - -package test - -open class A { - @JvmField protected val s = "OK"; -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt5786_privateWithDefault.kt b/backend.native/tests/external/codegen/box/regressions/kt5786_privateWithDefault.kt deleted file mode 100644 index 916ed482c60..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5786_privateWithDefault.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - run { - test("ok") - test("ok", 200) - } - test("ok") - test("ok", 300) - - return "OK" -} - -private fun test(arg1: String, default: Int = 0) = Unit diff --git a/backend.native/tests/external/codegen/box/regressions/kt5953.kt b/backend.native/tests/external/codegen/box/regressions/kt5953.kt deleted file mode 100644 index 3a7cdb1f7e5..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt5953.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val res = (1..3).map { it -> - if (it == 1) - 2 - }; - - var result = "" - for (i in res) - result += " " - return if (result == " ") "OK" else result -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt6153.kt b/backend.native/tests/external/codegen/box/regressions/kt6153.kt deleted file mode 100644 index cc21778d197..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt6153.kt +++ /dev/null @@ -1,15 +0,0 @@ -// KT-6153 java.lang.IllegalStateException while building -object Bug { - fun title(id:Int) = when (id) { - 0 -> "OK" - else -> throw Exception("unsupported $id") - } - - private fun T.header(id: Int) = StringBuilder().append(title(id)) - - fun run() = header(0) -} - -fun box(): String { - return Bug.run().toString() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt6434.kt b/backend.native/tests/external/codegen/box/regressions/kt6434.kt deleted file mode 100644 index 49036644c7a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt6434.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -enum class E { - VALUE, - VALUE2 -} - -class C(val nums: Map) { - val normalizedNums = loadNormalizedNums() - - private fun loadNormalizedNums(): Map { - val vals = nums.values - val min = vals.min()!! - val max = vals.max()!! - val rangeDiff = (max - min).toFloat() - val normalizedNums = nums.map { kvp -> - val (e, num) = kvp - //val e = kvp.key - //val num = kvp.value - val normalized = (num - min) / rangeDiff - Pair(e, normalized) - }.toMap() - return normalizedNums - } -} - -fun box(): String { - val res = C(hashMapOf(E.VALUE to 11, E.VALUE2 to 12)).normalizedNums.values.sorted().joinToString() - return if ("0.0, 1.0" == res) "OK" else "fail $res" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt6434_2.kt b/backend.native/tests/external/codegen/box/regressions/kt6434_2.kt deleted file mode 100644 index 19cd842906a..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt6434_2.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val p = 1 to 1 - val (e, num) = p - val a = 1f - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt6485.kt b/backend.native/tests/external/codegen/box/regressions/kt6485.kt deleted file mode 100644 index 0304fd25b83..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt6485.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import kotlin.test.assertEquals -import java.lang.reflect.ParameterizedType -import java.lang.reflect.Type - -open class TypeLiteral { - val type: Type - get() = (javaClass.getGenericSuperclass() as ParameterizedType).getActualTypeArguments()[0] -} - -inline fun typeLiteral(): TypeLiteral = object : TypeLiteral() {} - -fun box(): String { - assertEquals("java.lang.String", (typeLiteral().type as Class<*>).canonicalName) - assertEquals("java.util.List", typeLiteral>().type.toString()) - - //note that 'type' implementation for next cases is different on jdk 6 and 8: GenericArrayType and Class - assertEquals("java.lang.String[]", typeLiteral>().type.canonicalName) - assertEquals("java.lang.Integer[]", typeLiteral>().type.canonicalName) - assertEquals("java.lang.String[][]", typeLiteral>>().type.canonicalName) - return "OK" -} - -val Type.canonicalName: String - get() = when (this) { - is Class<*> -> this.canonicalName - is java.lang.reflect.GenericArrayType -> this.getGenericComponentType().canonicalName + "[]" - else -> null!! - } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/kt715.kt b/backend.native/tests/external/codegen/box/regressions/kt715.kt deleted file mode 100644 index 63e80a20157..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt715.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.* - -@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE") -inline fun javaClass(): Class = T::class.java - -val test = "lala".javaClass - -val test2 = javaClass> () - -fun box(): String { - if(test.getCanonicalName() != "java.lang.String") return "fail" - if(test2.getCanonicalName() != "java.util.Iterator") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt7401.kt b/backend.native/tests/external/codegen/box/regressions/kt7401.kt deleted file mode 100644 index 16294c5031b..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt7401.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(): Long { - var n = 2L - if (n > 0L) { - n++ - } - n++ - return n -} - -fun box() = if (foo() == 4L) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/regressions/kt789.kt b/backend.native/tests/external/codegen/box/regressions/kt789.kt deleted file mode 100644 index 9849559160b..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt789.kt +++ /dev/null @@ -1,8 +0,0 @@ -package foo - -fun box() : String { - val a = ArrayList(); - a.add(1) - a.add(2) - return if((a.size == 2) && (a.get(1) == 2) && (a.get(0) == 1)) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/regressions/kt864.kt b/backend.native/tests/external/codegen/box/regressions/kt864.kt deleted file mode 100644 index df346f2cc36..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt864.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import java.io.* -import java.util.* - -fun sample() : Reader { - return StringReader("""Hello -World"""); - } - - fun box() : String { - // NOTE: Also tested in stdlib: LineIteratorTest.useLines - - // TODO compiler error - // both these expressions causes java.lang.NoClassDefFoundError: collections/CollectionPackage - val list1 = sample().useLines { it.toList() } - val list2 = sample().useLines>{ it.toCollection(arrayListOf()) } - - if(arrayListOf("Hello", "World") != list1) return "fail" - if(arrayListOf("Hello", "World") != list2) return "fail" - return "OK" - } diff --git a/backend.native/tests/external/codegen/box/regressions/kt998.kt b/backend.native/tests/external/codegen/box/regressions/kt998.kt deleted file mode 100644 index 7fef173ff74..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/kt998.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_RUNTIME - -fun findPairless(a : IntArray) : Int { - loop@ for (i in a.indices) { - for (j in a.indices) { - if (i != j && a[i] == a[j]) continue@loop - } - return a[i] - } - return -1 -} - -fun hasDuplicates(a : IntArray) : Boolean { - var duplicate = false - loop@ for (i in a.indices) { - for (j in a.indices) { - if (i != j && a[i] == a[j]) { - duplicate = true - break@loop - } - } - } - return duplicate -} - -fun box() : String { - val a = IntArray(5) - a[0] = 0 - a[1] = 0 - a[2] = 1 - a[3] = 1 - a[4] = 5 - if(findPairless(a) != 5) return "fail" - return if(hasDuplicates(a)) "OK" else "fail" - -} diff --git a/backend.native/tests/external/codegen/box/regressions/lambdaAsLastExpressionInLambda.kt b/backend.native/tests/external/codegen/box/regressions/lambdaAsLastExpressionInLambda.kt deleted file mode 100644 index 05336badb47..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/lambdaAsLastExpressionInLambda.kt +++ /dev/null @@ -1,5 +0,0 @@ -val foo: ((String) -> String) = run { - { it } -} - -fun box() = foo("OK") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/lambdaPostponeConstruction.kt b/backend.native/tests/external/codegen/box/regressions/lambdaPostponeConstruction.kt deleted file mode 100644 index 8da1e337a0c..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/lambdaPostponeConstruction.kt +++ /dev/null @@ -1,14 +0,0 @@ -class MyList - -operator fun MyList.plusAssign(element: T) {} - -val listOfFunctions = MyList<(Int) -> Int>() - -fun foo() { - listOfFunctions.plusAssign({ it -> it }) - listOfFunctions += { it -> it } -} - -fun box(): String { - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/lambdaWrongReturnType.kt b/backend.native/tests/external/codegen/box/regressions/lambdaWrongReturnType.kt deleted file mode 100644 index b60e314e0fb..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/lambdaWrongReturnType.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun test() = foo({ line: String -> line }) - -fun foo(x: T): T = TODO() - -fun box(): String { - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/nestedIntersection.kt b/backend.native/tests/external/codegen/box/regressions/nestedIntersection.kt deleted file mode 100644 index fa19aa885e7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/nestedIntersection.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -interface In -open class A : In -open class B : In - -inline fun select(x: T, y: T) = T::class.java.simpleName - -// This test checks mostly that no StackOverflow happens while mapping type argument of select-call (In) -// See KT-10972 -fun foo(): String = select(A(), B()) - -fun box(): String { - if (foo() != "In") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/noCapturingForTypesWithTypeVariables.kt b/backend.native/tests/external/codegen/box/regressions/noCapturingForTypesWithTypeVariables.kt deleted file mode 100644 index 993d8ad63cd..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/noCapturingForTypesWithTypeVariables.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(useScriptArgs: Array?) { - val constructorArgs: Array = arrayOf(useScriptArgs.orEmpty()) -} - -inline fun Array?.orEmpty(): Array = this ?: emptyArray() - -fun box(): String { - foo(arrayOf(1)) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/noResolutionRecursion.kt b/backend.native/tests/external/codegen/box/regressions/noResolutionRecursion.kt deleted file mode 100644 index 098e9879f99..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/noResolutionRecursion.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun T.at(element: Int) = this.at() - -fun T.at(): T = this - -fun box(): String = "OK".at() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/nullabilityForCommonCapturedSupertypes.kt b/backend.native/tests/external/codegen/box/regressions/nullabilityForCommonCapturedSupertypes.kt deleted file mode 100644 index 336e9fa73a7..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/nullabilityForCommonCapturedSupertypes.kt +++ /dev/null @@ -1,14 +0,0 @@ -val targetArgument = id2(star(), star()) // error - -fun id2(x: T, y: T): T = x - -fun star(): Sample<*> { - return Sample() -} - -class Sample - -fun box(): String { - targetArgument - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/nullableAfterExclExcl.kt b/backend.native/tests/external/codegen/box/regressions/nullableAfterExclExcl.kt deleted file mode 100644 index 781ff87ee01..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/nullableAfterExclExcl.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface Sample { - val callMe: Int -} - -class Caller(val member: M) { - fun test() { - member!!.callMe - } -} - -fun box(): String { - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/objectCaptureOuterConstructorProperty.kt b/backend.native/tests/external/codegen/box/regressions/objectCaptureOuterConstructorProperty.kt deleted file mode 100644 index b9011debfe9..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/objectCaptureOuterConstructorProperty.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -interface Stream { - fun iterator(): Iterator -} - -class ZippingStream(val stream1: Stream, val stream2: Stream) : Stream> { - override fun iterator(): Iterator> = object : AbstractIterator>() { - val iterator1 = stream1.iterator() - val iterator2 = stream2.iterator() - override fun computeNext() { - if (iterator1.hasNext() && iterator2.hasNext()) { - setNext(iterator1.next() to iterator2.next()) - } else { - done() - } - } - } -} - - -object EmptyStream : Stream { - override fun iterator() = listOf().iterator() -} - -fun box(): String { - ZippingStream(EmptyStream, EmptyStream).iterator().hasNext() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/regressions/objectInsideDelegation.kt b/backend.native/tests/external/codegen/box/regressions/objectInsideDelegation.kt deleted file mode 100644 index f2f9caf960d..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/objectInsideDelegation.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_RUNTIME - -val b: First by lazy { - object : First { } -} - -private val withoutType by lazy { - object : First { } -} - -private val withTwoSupertypes by lazy { - object : First, Second { } -} - -interface First -interface Second - -fun box(): String { - b - withoutType - withTwoSupertypes - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/referenceToSelfInLocal.kt b/backend.native/tests/external/codegen/box/regressions/referenceToSelfInLocal.kt deleted file mode 100644 index bdda90a6e92..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/referenceToSelfInLocal.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// KT-4351 Cannot resolve reference to self in init of class local to function - -fun box(): String { - var accessedFromConstructor: Class<*>? = null - - class MyClass() { - init { - accessedFromConstructor = MyClass::class.java - } - } - - MyClass() - if (accessedFromConstructor!!.getName().endsWith("MyClass")) { - return "OK" - } else { - return accessedFromConstructor.toString() - } -} diff --git a/backend.native/tests/external/codegen/box/regressions/resolvedCallForGetOperator.kt b/backend.native/tests/external/codegen/box/regressions/resolvedCallForGetOperator.kt deleted file mode 100644 index 8b0e9bd07b0..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/resolvedCallForGetOperator.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -val targetNameLists: Map = mapOf("1" to "OK") - -fun id(t: T) = t -fun foo(argumentName: String?): String? = id(targetNameLists[argumentName]) - -fun box() = foo("1") diff --git a/backend.native/tests/external/codegen/box/regressions/supertypeDepth.kt b/backend.native/tests/external/codegen/box/regressions/supertypeDepth.kt deleted file mode 100644 index bb74263ee89..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/supertypeDepth.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A : FirstOwner> -class B : SecondOwner> - -interface FirstOwner> : SecondOwner -interface SecondOwner> - -interface StubElement - -interface Holder : StubElement - -fun test(a: A?, b: B) { - val c = a ?: b -} - -fun box(): String { - test(A(), B()) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/regressions/typeCastException.kt b/backend.native/tests/external/codegen/box/regressions/typeCastException.kt deleted file mode 100644 index 669cfc04943..00000000000 --- a/backend.native/tests/external/codegen/box/regressions/typeCastException.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import java.util.ArrayList - -// KT-2823 TypeCastException has no message -// KT-5121 Better error message in on casting null to non-null type - -fun box(): String { - try { - val a: Any? = null - a as Array - } - catch (e: TypeCastException) { - if (e.message != "null cannot be cast to non-null type kotlin.Array") { - return "Fail 1: $e" - } - } - - try { - val x: String? = null - x as String - } - catch (e: TypeCastException) { - if (e.message != "null cannot be cast to non-null type kotlin.String") { - return "Fail 2: $e" - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/DIExample.kt b/backend.native/tests/external/codegen/box/reified/DIExample.kt deleted file mode 100644 index 9ec149f89f2..00000000000 --- a/backend.native/tests/external/codegen/box/reified/DIExample.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals -import kotlin.reflect.KProperty - -class Project { - fun getInstance(cls: Class): T = - when (cls.getName()) { - "java.lang.Integer" -> 1 as T - "java.lang.String" -> "OK" as T - else -> null!! - } -} - -inline operator fun Project.getValue(t: Any?, p: KProperty<*>): T = getInstance(T::class.java) - -val project = Project() -val x1: Int by project -val x2: String by project - -fun box(): String { - assertEquals(1, x1) - assertEquals("OK", x2) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/anonymousObject.kt b/backend.native/tests/external/codegen/box/reified/anonymousObject.kt deleted file mode 100644 index 2517f1cc929..00000000000 --- a/backend.native/tests/external/codegen/box/reified/anonymousObject.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -abstract class A { - abstract fun f(): String -} - -inline fun foo(): A { - return object : A() { - override fun f(): String { - return T::class.java.getName() - } - } -} - -fun box(): String { - val y = foo(); - assertEquals("java.lang.String", y.f()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/anonymousObjectNoPropagate.kt b/backend.native/tests/external/codegen/box/reified/anonymousObjectNoPropagate.kt deleted file mode 100644 index 24ef70e04eb..00000000000 --- a/backend.native/tests/external/codegen/box/reified/anonymousObjectNoPropagate.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -interface A { - fun f1(): String - fun f2(): String - fun f3(): String -} - -fun doWork(block: () -> String) = block() -inline fun doWorkInline(block: () -> String) = block() - -fun box(): String { - val x = object { - inline fun bar1(): A = object : A { - override fun f1(): String = T::class.java.getName() - override fun f2(): String = doWork { T::class.java.getName() } - override fun f3(): String = doWorkInline { T::class.java.getName() } - } - - inline fun bar2() = T::class.java.getName() - inline fun bar3() = doWork { T::class.java.getName() } - inline fun bar4() = doWorkInline { T::class.java.getName() } - } - - val y: A = x.bar1() - assertEquals("java.lang.String", y.f1()) - assertEquals("java.lang.String", y.f2()) - assertEquals("java.lang.String", y.f3()) - - - assertEquals("java.lang.Integer", x.bar2()) - assertEquals("java.lang.Double", x.bar3()) - assertEquals("java.lang.Long", x.bar4()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/anonymousObjectReifiedSupertype.kt b/backend.native/tests/external/codegen/box/reified/anonymousObjectReifiedSupertype.kt deleted file mode 100644 index 8c173baea8c..00000000000 --- a/backend.native/tests/external/codegen/box/reified/anonymousObjectReifiedSupertype.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -abstract class A { - abstract fun f(): String -} - -inline fun foo(): A { - return object : A() { - override fun f(): String { - return "OK" - } - } -} - -fun box(): String { - val y = foo(); - assertEquals("OK", y.f()) - assertEquals("A", y.javaClass.getGenericSuperclass()?.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/approximateCapturedTypes.kt b/backend.native/tests/external/codegen/box/reified/approximateCapturedTypes.kt deleted file mode 100644 index 0e19fd0d5bd..00000000000 --- a/backend.native/tests/external/codegen/box/reified/approximateCapturedTypes.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// Basically this test checks that no captured type used as argument for signature mapping -class SwOperator: Operator, T> - -interface Operator - -open class Inv - -class Obs { - inline fun lift(lift: Operator) = object : Inv() {} -} - -fun box(): String { - val o: Obs = Obs() - - val inv = o.lift(SwOperator()) - val signature = inv.javaClass.genericSuperclass.toString() - - if (signature != "Inv>") return "fail 1: $signature" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOf.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOf.kt deleted file mode 100644 index eb8f592b691..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOf.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun foo(x: Any?) = Pair(x is T, x is T?) - -fun box(): String { - val x1 = foo>(arrayOf("")) - if (x1.toString() != "(true, true)") return "fail 1" - - val x2 = foo?>(arrayOf("")) - if (x2.toString() != "(true, true)") return "fail 2" - - val x3 = foo>(null) - if (x3.toString() != "(false, true)") return "fail 3" - - val x4 = foo?>(null) - if (x4.toString() != "(true, true)") return "fail 4" - - val x5 = foo?>(arrayOf("")) - if (x5.toString() != "(false, false)") return "fail 5" - - val x6 = foo?>(null) - if (x6.toString() != "(true, true)") return "fail 6" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOfArrays.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOfArrays.kt deleted file mode 100644 index 1ea7f096e4b..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/instanceOfArrays.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun foo(x: Any?) = Pair(x is T, x is T?) -inline fun bar(y: Any?) = foo>(y) -inline fun barNullable(y: Any?) = foo?>(y) - -fun box(): String { - val x1 = bar(arrayOf("")) - if (x1.toString() != "(true, true)") return "fail 1" - - val x3 = bar(null) - if (x3.toString() != "(false, true)") return "fail 3" - - val x4 = bar(null) - if (x4.toString() != "(false, true)") return "fail 4" - - val x5 = bar(arrayOf("")) - if (x5.toString() != "(false, false)") return "fail 5" - - val x6 = bar(null) - if (x6.toString() != "(false, true)") return "fail 6" - - // barNullable - - val x7 = barNullable(arrayOf("")) - if (x7.toString() != "(true, true)") return "fail 7" - - val x9 = barNullable(null) - if (x9.toString() != "(true, true)") return "fail 9" - - val x10 = barNullable(arrayOf("")) - if (x10.toString() != "(false, false)") return "fail 11" - - val x12 = barNullable(null) - if (x12.toString() != "(true, true)") return "fail 12" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/jClass.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/jClass.kt deleted file mode 100644 index 08514a0359d..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/jClass.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun jClass() = T::class.java -inline fun jClassArray() = jClass>() - -fun box(): String { - if (jClass>().simpleName != "String[]") return "fail 1" - if (jClass().simpleName != "int[]") return "fail 2" - - if (jClassArray().simpleName != "String[]") return "fail 3" - if (jClassArray>().simpleName != "String[][]") return "fail 4" - if (jClassArray().simpleName != "int[][]") return "fail 5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArray.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArray.kt deleted file mode 100644 index 1a2bee24db9..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArray.kt +++ /dev/null @@ -1,15 +0,0 @@ -inline fun jaggedArray(x: (Int, Int) -> T): Array> = Array(1) { i -> - Array(1) { j -> x(i, j) } -} - -fun box(): String { - val x1: Array> = jaggedArray() { x, y -> "$x-$y" } - if (x1[0][0] != "0-0") return "fail 1" - - val x2: Array>> = jaggedArray() { x, y -> arrayOf("$x-$y") } - if (x2[0][0][0] != "0-0") return "fail 2" - - val x3: Array> = jaggedArray() { x, y -> intArrayOf(x + y + 1) } - if (x3[0][0][0] != 1) return "fail 3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArrayOfNulls.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArrayOfNulls.kt deleted file mode 100644 index 07143130bfe..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedArrayOfNulls.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun jaggedArrayOfNulls(): Array?> = arrayOfNulls>(1) - -fun box(): String { - val x1 = jaggedArrayOfNulls().javaClass.simpleName - if (x1 != "String[][]") return "fail1: $x1" - - val x2 = jaggedArrayOfNulls>().javaClass.simpleName - if (x2 != "String[][][]") return "fail2: $x2" - - val x3 = jaggedArrayOfNulls().javaClass.simpleName - if (x3 != "int[][][]") return "fail3: $x3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedDeep.kt b/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedDeep.kt deleted file mode 100644 index aa8f36fc23e..00000000000 --- a/backend.native/tests/external/codegen/box/reified/arraysReification/jaggedDeep.kt +++ /dev/null @@ -1,17 +0,0 @@ -inline fun jaggedArray(x: (Int, Int, Int) -> T): Array>> = Array(1) { i -> - Array(1) { - j -> Array(1) { k -> x(i, j, k) } - } -} - -fun box(): String { - val x1: Array>> = jaggedArray() { x, y, z -> "$x-$y-$z" } - if (x1[0][0][0] != "0-0-0") return "fail 1" - - val x2: Array>>> = jaggedArray() { x, y, z -> arrayOf("$x-$y-$z") } - if (x2[0][0][0][0] != "0-0-0") return "fail 2" - - val x3: Array>> = jaggedArray() { x, y, z -> intArrayOf(x + y + z + 1) } - if (x3[0][0][0][0] != 1) return "fail 3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/asOnPlatformType.kt b/backend.native/tests/external/codegen/box/reified/asOnPlatformType.kt deleted file mode 100644 index 1a3964f06a7..00000000000 --- a/backend.native/tests/external/codegen/box/reified/asOnPlatformType.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - public static String nullString() { - return null; - } - - public static String nonnullString() { - return "OK"; - } - -} - -// FILE: kotlin.kt - -fun box(): String { - val nullStr = JavaClass.nullString() - val nonnullStr = JavaClass.nonnullString() - - if (nullStr.foo() != null) return "fail 1" - if (nonnullStr.foo() != nonnullStr) return "fail 2" - - if (nullStr.fooN() != null) return "fail 3" - if (nonnullStr.fooN() != nonnullStr) return "fail 4" - - return "OK" -} - -inline fun T.foo(): T = this as T - -inline fun T.fooN(): T? = this as T? diff --git a/backend.native/tests/external/codegen/box/reified/checkcast.kt b/backend.native/tests/external/codegen/box/reified/checkcast.kt deleted file mode 100644 index 3b10a4bd5f8..00000000000 --- a/backend.native/tests/external/codegen/box/reified/checkcast.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun checkcast(x: Any?): T { - return x as T -} - -fun box(): String { - val x = checkcast("abc") - assertEquals("abc", x) - val y = checkcast(1) - assertEquals(1, y) - - try { - val z = checkcast("abc") - } catch (e: Exception) { - return "OK" - } - - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/reified/copyToArray.kt b/backend.native/tests/external/codegen/box/reified/copyToArray.kt deleted file mode 100644 index 4cbf10bdec5..00000000000 --- a/backend.native/tests/external/codegen/box/reified/copyToArray.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun copy(c: Collection): Array { - return c.toTypedArray() -} - -fun box(): String { - val a: Array = copy(listOf("a", "b", "c")) - assertEquals("abc", a.joinToString("")) - - val b: Array = copy(listOf(1,2,3)) - assertEquals("123", b.map { it.toString() }.joinToString("")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/defaultJavaClass.kt b/backend.native/tests/external/codegen/box/reified/defaultJavaClass.kt deleted file mode 100644 index ff05c5b2551..00000000000 --- a/backend.native/tests/external/codegen/box/reified/defaultJavaClass.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(x: Class = T::class.java): String = x.getName() - -inline fun bar(x: R): String = foo() - -fun box(): String { - assertEquals("java.lang.String", foo()) - assertEquals("java.lang.Integer", foo()) - assertEquals("java.lang.Object", foo()) - - assertEquals("java.lang.String", bar("abc")) - assertEquals("java.lang.Integer", bar(1)) - assertEquals("java.lang.Object", bar(Any())) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/expectedTypeFromCast.kt b/backend.native/tests/external/codegen/box/reified/expectedTypeFromCast.kt deleted file mode 100644 index d77cad0dcd6..00000000000 --- a/backend.native/tests/external/codegen/box/reified/expectedTypeFromCast.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// LANGUAGE_VERSION: 1.2 -// WITH_RUNTIME -import kotlin.test.assertEquals - -inline fun foo(): T { - return T::class.java.getName() as T -} - -fun box(): String { - val fooCall = foo() as String - assertEquals("java.lang.String", fooCall) - - val safeFooCall = foo() as? String - assertEquals("java.lang.String", safeFooCall) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/filterIsInstance.kt b/backend.native/tests/external/codegen/box/reified/filterIsInstance.kt deleted file mode 100644 index f346e09fb54..00000000000 --- a/backend.native/tests/external/codegen/box/reified/filterIsInstance.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun Array.filterIsInstance(): List { - return this.filter { it is T }.map { it as T } -} - -fun box(): String { - val src: Array = arrayOf(1,2,3.toDouble(), "abc", "cde") - - assertEquals(arrayListOf(1,2), src.filterIsInstance()) - assertEquals(arrayListOf(3.0), src.filterIsInstance()) - assertEquals(arrayListOf("abc", "cde"), src.filterIsInstance()) - assertEquals(src.toList(), src.filterIsInstance()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/innerAnonymousObject.kt b/backend.native/tests/external/codegen/box/reified/innerAnonymousObject.kt deleted file mode 100644 index c6c995c85a2..00000000000 --- a/backend.native/tests/external/codegen/box/reified/innerAnonymousObject.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -abstract class A { - abstract fun f(): String - override fun toString() = f() -} - -abstract class G { - abstract fun bar(): Any -} - -inline fun foo(): G { - return object : G() { - override fun bar(): Any { - return object : A() { - override fun f(): String = "OK" - } - } - } -} - -fun box(): String { - val y = foo().bar(); - assertEquals("OK", y.toString()) - assertEquals("A", y.javaClass.getGenericSuperclass()?.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/instanceof.kt b/backend.native/tests/external/codegen/box/reified/instanceof.kt deleted file mode 100644 index e3b8f5ce6c8..00000000000 --- a/backend.native/tests/external/codegen/box/reified/instanceof.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -inline fun isinstance(x: Any?): Boolean { - return x is T -} - -fun box(): String { - assert(isinstance("abc")) - assert(isinstance(1)) - assert(!isinstance("abc")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/isOnPlatformType.kt b/backend.native/tests/external/codegen/box/reified/isOnPlatformType.kt deleted file mode 100644 index a60989dd637..00000000000 --- a/backend.native/tests/external/codegen/box/reified/isOnPlatformType.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - public static String nullString() { - return null; - } - - public static String nonnullString() { - return "OK"; - } - -} - -// FILE: kotlin.kt - -fun box(): String { - val nullStr = JavaClass.nullString() - val nonnullStr = JavaClass.nonnullString() - - if (nullStr.foo() != true) return "fail 1" - if (nonnullStr.foo() != true) return "fail 2" - - if (nullStr.fooN() != true) return "fail 3" - if (nonnullStr.fooN() != true) return "fail 4" - - return "OK" -} - -inline fun T.foo(): Boolean = this is T - -inline fun T.fooN(): Boolean = this is T? diff --git a/backend.native/tests/external/codegen/box/reified/javaClass.kt b/backend.native/tests/external/codegen/box/reified/javaClass.kt deleted file mode 100644 index 2e7559b4e78..00000000000 --- a/backend.native/tests/external/codegen/box/reified/javaClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun javaClassName(): String { - return T::class.java.getName() -} - -fun box(): String { - assertEquals("java.lang.String", javaClassName()) - assertEquals("java.lang.Integer", javaClassName()) - assertEquals("java.lang.Object", javaClassName()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/nestedReified.kt b/backend.native/tests/external/codegen/box/reified/nestedReified.kt deleted file mode 100644 index 6787fb86885..00000000000 --- a/backend.native/tests/external/codegen/box/reified/nestedReified.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun foo(): Array { - val x = object { - inline fun bar(): Array = arrayOf( - T1::class.java.getName(), T::class.java.getName(), R::class.java.getName() - ) - fun f1() = bar() - fun f2() = bar() - fun f3() = bar() - fun f4() = bar() - } - - val x1 = x.f1() - val x2 = x.f2() - val x3 = x.f3() - val x4 = x.f4() - - return arrayOf( - x1[0], x1[1], x1[2], - x2[0], x2[1], x2[2], - x3[0], x3[1], x3[2], - x4[0], x4[1], x4[2] - ) -} - -fun box(): String { - val result = foo() - - val expected = arrayOf( - "java.lang.Double", "java.lang.Integer", "java.lang.Integer", - "java.lang.Integer", "java.lang.Double", "java.lang.Integer", - "java.lang.Boolean", "java.lang.Double", "java.lang.Integer", - "java.lang.Double", "java.lang.Boolean", "java.lang.Integer" - ) - - for (i in expected.indices) { - assertEquals(expected[i], result[i], "$i-th element") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/nestedReifiedSignature.kt b/backend.native/tests/external/codegen/box/reified/nestedReifiedSignature.kt deleted file mode 100644 index ea4fe763e54..00000000000 --- a/backend.native/tests/external/codegen/box/reified/nestedReifiedSignature.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -open class A - -inline fun foo(): Array> { - val x = object { - inline fun bar(): A<*,*,*> = object : A() {} - fun f1() = bar() - fun f2() = bar() - fun f3() = bar() - fun f4() = bar() - } - - return arrayOf(x.f1(), x.f2(), x.f3(), x.f4()) -} - -fun box(): String { - val result = foo() - - val expected = arrayOf( - Triple("java.lang.Double", "java.lang.Integer", "java.lang.Integer"), - Triple("java.lang.Integer", "java.lang.Double", "java.lang.Integer"), - Triple("java.lang.Boolean", "java.lang.Double", "java.lang.Integer"), - Triple("java.lang.Double", "java.lang.Boolean", "java.lang.Integer") - ).map { "A<${it.first}, ${it.second}, ${it.third}>" } - - for (i in expected.indices) { - assertEquals(expected[i], result[i].javaClass.getGenericSuperclass()?.toString(), "$i-th element") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/newArrayInt.kt b/backend.native/tests/external/codegen/box/reified/newArrayInt.kt deleted file mode 100644 index b1d92cfbef9..00000000000 --- a/backend.native/tests/external/codegen/box/reified/newArrayInt.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -inline fun createArray(n: Int, crossinline block: () -> T): Array { - return Array(n) { block() } -} - -fun box(): String { - - val x = createArray(5) { 3 } - - assert(x.all { it == 3 }) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/nonInlineableLambdaInReifiedFunction.kt b/backend.native/tests/external/codegen/box/reified/nonInlineableLambdaInReifiedFunction.kt deleted file mode 100644 index c243cb1206b..00000000000 --- a/backend.native/tests/external/codegen/box/reified/nonInlineableLambdaInReifiedFunction.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(block: () -> String) = block() -inline fun bar1(x: T): String = foo() { - T::class.java.getName() -} -inline fun bar2(x: T, y: String): String = foo() { - T::class.java.getName() + "#" + y -} - -fun box(): String { - - assertEquals("java.lang.Integer", bar1(1)) - assertEquals("java.lang.String#OK", bar2("abc", "OK")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/recursiveInnerAnonymousObject.kt b/backend.native/tests/external/codegen/box/reified/recursiveInnerAnonymousObject.kt deleted file mode 100644 index e75f5c80b5e..00000000000 --- a/backend.native/tests/external/codegen/box/reified/recursiveInnerAnonymousObject.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -abstract class A { - abstract fun f(): String - override fun toString() = f() -} - -abstract class G { - abstract fun bar(): Any -} - -inline fun baz(): G { - return object : G() { - override fun bar(): Any { - return object : A() { - override fun f(): String = "OK" - } - } - } -} - -inline fun foo(): Pair { - return Pair(baz(), baz()) -} - -fun box(): String { - val res = foo(); - val x1 = res.first.bar() - val x2 = res.second.bar() - assertEquals("OK", x1.toString()) - assertEquals("OK", x2.toString()) - assertEquals("A", x1.javaClass.getGenericSuperclass()?.toString()) - assertEquals("A", x2.javaClass.getGenericSuperclass()?.toString()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/recursiveNewArray.kt b/backend.native/tests/external/codegen/box/reified/recursiveNewArray.kt deleted file mode 100644 index edd797547fd..00000000000 --- a/backend.native/tests/external/codegen/box/reified/recursiveNewArray.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -inline fun createArray(n: Int, crossinline block: () -> T): Array { - return Array(n) { block() } -} - -inline fun recursive( - crossinline block: () -> R -): Array { - return createArray(5) { block() } -} - -fun box(): String { - val x = recursive(){ "abc" } - - assert(x.all { it == "abc" }) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/recursiveNonInlineableLambda.kt b/backend.native/tests/external/codegen/box/reified/recursiveNonInlineableLambda.kt deleted file mode 100644 index 364262bcee2..00000000000 --- a/backend.native/tests/external/codegen/box/reified/recursiveNonInlineableLambda.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(block: () -> String) = block() - -inline fun bar1(): String = foo() { - T::class.java.getName() -} -inline fun bar2(y: String): String = foo() { - T::class.java.getName() + "#" + y -} - -inline fun bar3(y: String) = - Pair(bar1(), bar2(y)) - -fun box(): String { - val x = bar3("OK") - - assertEquals("java.lang.Integer", x.first) - assertEquals("java.lang.String#OK", x.second) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/reifiedChain.kt b/backend.native/tests/external/codegen/box/reified/reifiedChain.kt deleted file mode 100644 index 476197c805c..00000000000 --- a/backend.native/tests/external/codegen/box/reified/reifiedChain.kt +++ /dev/null @@ -1,36 +0,0 @@ -inline fun Any?.check(): Boolean { - return this is T -} - -inline fun Any?.check2(): Boolean { - return check() -} - - -var log = "" -fun log(a: Any?) { - log += a.toString() + ";" -} - -fun test(a: Any?) { - log(a.check()) - log(a.check()) -} - -fun test2(a: Any?) { - log(a.check2()) - log(a.check2()) -} - -fun box(): String { - test("") - test(null) - test2("") - test2(null) - - if (log != "true;true;false;true;true;true;false;true;") { - return "fail" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObject.kt b/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObject.kt deleted file mode 100644 index 75387478a8a..00000000000 --- a/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObject.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(block: () -> String) = block() - -interface A { - fun f(): String - fun g(): String -} - -fun box(): String { - val x: A = object : A { - private inline fun localClassName(): String = T::class.java.getName() - override fun f(): String = foo { localClassName() } - override fun g(): String = foo { localClassName() } - } - - assertEquals("java.lang.String", x.f()) - assertEquals("java.lang.Integer", x.g()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObjectWithinReified.kt b/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObjectWithinReified.kt deleted file mode 100644 index e211f6e52b8..00000000000 --- a/backend.native/tests/external/codegen/box/reified/reifiedInlineFunOfObjectWithinReified.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(block: () -> String) = block() - -inline fun className(): String = T::class.java.getName() - -inline fun lambdaShouldBeReified(): String = foo { className() } - -interface A { - fun f(): String - fun g(): String -} -inline fun AFactory(): A = object : A { - override fun f(): String = className() - override fun g(): String = foo { className() } -} - -fun box(): String { - assertEquals("java.lang.String", lambdaShouldBeReified()) - assertEquals("java.lang.Integer", lambdaShouldBeReified()) - - val x: A = AFactory() - - assertEquals("java.lang.String", x.f()) - assertEquals("java.lang.Integer", x.g()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/reifiedInlineIntoNonInlineableLambda.kt b/backend.native/tests/external/codegen/box/reified/reifiedInlineIntoNonInlineableLambda.kt deleted file mode 100644 index 6636a564543..00000000000 --- a/backend.native/tests/external/codegen/box/reified/reifiedInlineIntoNonInlineableLambda.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(block: () -> String) = block() - -inline fun className(): String = T::class.java.getName() - -interface A { - fun f(): String - fun g(): String -} - -fun box(): String { - val x = foo() { - className() - } - - assertEquals("java.lang.String", x) - - val y: A = object : A { - override fun f(): String = foo { className() } - override fun g(): String = foo { className() } - } - - assertEquals("java.lang.String", y.f()) - assertEquals("java.lang.Integer", y.g()) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/safecast.kt b/backend.native/tests/external/codegen/box/reified/safecast.kt deleted file mode 100644 index 10171dd33fe..00000000000 --- a/backend.native/tests/external/codegen/box/reified/safecast.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun safecast(x: Any?): T? { - return x as? T -} - -fun box(): String { - val x = safecast("abc") - assertEquals("abc", x) - val y = safecast(1) - assertEquals(1, y) - - val z = safecast("abc") - assertEquals(null, z) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/sameIndexRecursive.kt b/backend.native/tests/external/codegen/box/reified/sameIndexRecursive.kt deleted file mode 100644 index 0b5bde0eaef..00000000000 --- a/backend.native/tests/external/codegen/box/reified/sameIndexRecursive.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -inline fun createArray(n: Int, crossinline block: () -> Pair): Pair, Array> { - return Pair(Array(n) { block().first }, Array(n) { block().second }) -} - -inline fun recursive( - crossinline block: () -> R -): Pair, Array> { - return createArray(5) { Pair(block(), block()) } -} - -fun box(): String { - val y = createArray(5) { Pair(1, "test") } - val x = recursive(){ "abc" } - - assert(y.first.all { it == 1 } ) - assert(y.second.all { it == "test" }) - assert(x.first.all { it == "abc" }) - assert(x.second.all { it == "abc" }) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/spreads.kt b/backend.native/tests/external/codegen/box/reified/spreads.kt deleted file mode 100644 index d0861109cbb..00000000000 --- a/backend.native/tests/external/codegen/box/reified/spreads.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(vararg a: T) = a.size - -inline fun bar(a: Array, block: () -> T): Array { - assertEquals(4, foo(*a, block(), block())) - - return arrayOf(*a, block(), block()) -} - -inline fun empty() = arrayOf() - -fun box(): String { - - var i = 0 - val a: Array = bar(arrayOf("1", "2")) { i++; i.toString() } - assertEquals("1234", a.joinToString("")) - - i = 0 - val b: Array = bar(arrayOf(0, 1)) { i++ } - assertEquals("0123", b.map { it.toString() }.joinToString("")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/reified/varargs.kt b/backend.native/tests/external/codegen/box/reified/varargs.kt deleted file mode 100644 index 73eaba238dc..00000000000 --- a/backend.native/tests/external/codegen/box/reified/varargs.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(vararg a: T) = a.size - -inline fun bar(block: () -> T): Array { - assertEquals(2, foo(block(), block())) - - return arrayOf(block(), block(), block()) -} - -inline fun empty() = arrayOf() - -fun box(): String { - var i = 0 - val a: Array = bar() { i++; i.toString() } - assertEquals("345", a.joinToString("")) - - i = 0 - val b: Array = bar() { i++ } - assertEquals("234", b.map { it.toString() }.joinToString("")) - - val c: Array = empty() - assertEquals(0, c.size) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/safeCall/genericNull.kt b/backend.native/tests/external/codegen/box/safeCall/genericNull.kt deleted file mode 100644 index d8ffc413616..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/genericNull.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo(t: T) { - t?.toInt() -} - -fun box(): String { - foo(null) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/safeCall/kt1572.kt b/backend.native/tests/external/codegen/box/safeCall/kt1572.kt deleted file mode 100644 index d3b3c52bde1..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt1572.kt +++ /dev/null @@ -1,23 +0,0 @@ -//KT-1572 Frontend doesn't mark all vars included in closure as refs. - -class A(val t : Int) {} - -fun testKt1572() : Boolean { - var a = A(0) - var b = A(3) - val changer = {a = b} - b = A(10) // this change has no effect on changer - changer() - return (a.t == 10) -} - -fun testPrimitives() : Boolean { - var a = 0 - var b = 3 - val changer = {a = b} - b = 10 - changer() - return (a == 10) -} - -fun box() = if (testKt1572() && testPrimitives()) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/safeCall/kt232.kt b/backend.native/tests/external/codegen/box/safeCall/kt232.kt deleted file mode 100644 index f23e75dbce1..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt232.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class A() { - fun foo() { - System.out?.println(1) - } -} - -fun box() : String { - val a : A = A() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/safeCall/kt245.kt b/backend.native/tests/external/codegen/box/safeCall/kt245.kt deleted file mode 100644 index 0678b947098..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt245.kt +++ /dev/null @@ -1,32 +0,0 @@ -fun foo() { - val l = ArrayList(2) - l.add(1) - - for (el in l) {} - - //verify error "Expecting to find integer on stack" - val iterator = l.iterator() - - //another verify error "Mismatched stack types" - while (iterator?.hasNext() ?: false) { - val i = iterator?.next() - } - - //the same - if (iterator != null) { - while (iterator.hasNext()) { - val i = iterator?.next() - } - } - - //this way it works - if (iterator != null) { - while (iterator.hasNext()) { - iterator.next() //because of the bug KT-244 i can't write "val i = iterator.next()" - } - } -} - -fun box() : String { - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/safeCall/kt247.kt b/backend.native/tests/external/codegen/box/safeCall/kt247.kt deleted file mode 100644 index 55a7fbe74f8..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt247.kt +++ /dev/null @@ -1,38 +0,0 @@ -fun t1() : Boolean { - val s1 : String? = "sff" - val s2 : String? = null - return s1?.length == 3 && s2?.length == null -} - -fun t2() : Boolean { - val c1: C? = C(1) - val c2: C? = null - return c1?.x == 1 && c2?.x == null -} - -fun t3() { - val d: D = D("s") - val x = d?.s - if (!(d?.s == "s")) throw AssertionError() -} - -fun t4() { - val e: E? = E() - if (!(e?.bar() == e)) throw AssertionError() - val x = e?.foo() -} - -fun box() : String { - if(!t1 ()) return "fail" - if(!t2 ()) return "fail" - t3() - t4() - return "OK" -} - -class C(val x: Int) -class D(val s: String) -class E() { - fun foo() = 1 - fun bar() = this -} diff --git a/backend.native/tests/external/codegen/box/safeCall/kt3430.kt b/backend.native/tests/external/codegen/box/safeCall/kt3430.kt deleted file mode 100644 index 19620029283..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt3430.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun f(b : Int.(Int)->Int) = 1?.b(1) - -fun box(): String { - val x = f { this + it } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/kt4733.kt b/backend.native/tests/external/codegen/box/safeCall/kt4733.kt deleted file mode 100644 index dde6d4af7cb..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/kt4733.kt +++ /dev/null @@ -1,27 +0,0 @@ -class Test { - val Long.foo: Long - get() = this + 1 - - val Int.foo: Int - get() = this + 1 - - fun testLong(): Long? { - var s: Long? = 10; - return s?.foo - } - - fun testInt(): Int? { - var s: Int? = 11; - return s?.foo - } -} - -fun box(): String { - val s = Test() - - if (s.testLong() != 11.toLong()) return "fail 1" - - if (s.testInt() != 12) return "fail 1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/primitive.kt b/backend.native/tests/external/codegen/box/safeCall/primitive.kt deleted file mode 100644 index 64decc4e76b..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/primitive.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun Int.foo() = 239 -fun Long.bar() = 239.toLong() - -fun box(): String { - 42?.foo() - 42.toLong()?.bar() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/safeCall/primitiveEqSafeCall.kt b/backend.native/tests/external/codegen/box/safeCall/primitiveEqSafeCall.kt deleted file mode 100644 index 6cfb10708e8..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/primitiveEqSafeCall.kt +++ /dev/null @@ -1,56 +0,0 @@ -fun Long.id() = this - -fun String.drop2() = if (length >= 2) subSequence(2, length) else null - -fun String.anyLength(): Any = length - - -fun doSimple(s: String?) = 3 == s?.length - -fun doLongReceiver(x: Long) = 3L == x?.id() - -fun doChain(s: String?) = 1 == s?.drop2()?.length - -fun doIf(s: String?) = - if (1 == s?.length) "A" else "B" - -fun doCmpWithAny(s: String?) = - 3 == s?.anyLength() - -fun doIfNot(s: String?) = - if (!(1 == s?.length)) "A" else "B" - -fun doIfNotNot(s: String?) = - if (!!(1 == s?.length)) "A" else "B" - - -fun box(): String = when { - doSimple(null) -> "failed 1" - doSimple("1") -> "failed 2" - !doSimple("123") -> "failed 3" - - doLongReceiver(2L) -> "failed 4" - !doLongReceiver(3L) -> "failed 5" - - doChain(null) -> "failed 6" - doChain("1") -> "failed 7" - !doChain("123") -> "failed 7" - - doIf("1") != "A" -> "failed 8" - doIf("123") != "B" -> "failed 9" - doIf(null) != "B" -> "failed 10" - - doCmpWithAny(null) -> "failed 11" - doCmpWithAny("1") -> "failed 12" - !doCmpWithAny("123") -> "failed 13" - - doIfNot("1") != "B" -> "failed 8" - doIfNot("123") != "A" -> "failed 9" - doIfNot(null) != "A" -> "failed 10" - - doIfNotNot("1") != "A" -> "failed 8" - doIfNotNot("123") != "B" -> "failed 9" - doIfNotNot(null) != "B" -> "failed 10" - - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/primitiveNotEqSafeCall.kt b/backend.native/tests/external/codegen/box/safeCall/primitiveNotEqSafeCall.kt deleted file mode 100644 index 1485dea2135..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/primitiveNotEqSafeCall.kt +++ /dev/null @@ -1,43 +0,0 @@ -fun Long.id() = this - -fun String.drop2() = if (length >= 2) subSequence(2, length) else null - -fun String.anyLength(): Any = length - - -fun doSimple(s: String?) = 3 != s?.length - -fun doLongReceiver(x: Long) = 3L != x?.id() - -fun doChain(s: String?) = 1 != s?.drop2()?.length - -fun doIf(s: String?) = - if (1 != s?.length) "A" else "B" - -fun doCmpWithAny(s: String?) = - 3 != s?.anyLength() - - -fun box(): String = when { - !doSimple(null) -> "failed 1" - !doSimple("1") -> "failed 2" - doSimple("123") -> "failed 3" - - !doLongReceiver(2L) -> "failed 4" - doLongReceiver(3L) -> "failed 5" - - !doChain(null) -> "failed 6" - !doChain("1") -> "failed 7" - doChain("123") -> "failed 7" - - doIf("1") == "A" -> "failed 8" - doIf("123") == "B" -> "failed 9" - doIf(null) == "B" -> "failed 10" - - !doCmpWithAny(null) -> "failed 11" - !doCmpWithAny("1") -> "failed 12" - doCmpWithAny("123") -> "failed 13" - - - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/safeCallEqPrimitive.kt b/backend.native/tests/external/codegen/box/safeCall/safeCallEqPrimitive.kt deleted file mode 100644 index fe8438abca6..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/safeCallEqPrimitive.kt +++ /dev/null @@ -1,55 +0,0 @@ -fun Long.id() = this - -fun String.drop2() = if (length >= 2) subSequence(2, length) else null - -fun String.anyLength(): Any = length - - -fun doSimple(s: String?) = s?.length == 3 - -fun doLongReceiver(x: Long) = x?.id() == 3L - -fun doChain(s: String?) = s?.drop2()?.length == 1 - -fun doIf(s: String?) = - if (s?.length == 1) "A" else "B" - -fun doCmpWithAny(s: String?) = - s?.anyLength() == 3 - -fun doIfNot(s: String?) = - if (!(s?.length == 1)) "A" else "B" - -fun doIfNotNot(s: String?) = - if (!!(s?.length == 1)) "A" else "B" - -fun box(): String = when { - doSimple(null) -> "failed 1" - doSimple("1") -> "failed 2" - !doSimple("123") -> "failed 3" - - doLongReceiver(2L) -> "failed 4" - !doLongReceiver(3L) -> "failed 5" - - doChain(null) -> "failed 6" - doChain("1") -> "failed 7" - !doChain("123") -> "failed 7" - - doIf("1") != "A" -> "failed 8" - doIf("123") != "B" -> "failed 9" - doIf(null) != "B" -> "failed 10" - - doCmpWithAny(null) -> "failed 11" - doCmpWithAny("1") -> "failed 12" - !doCmpWithAny("123") -> "failed 13" - - doIfNot("1") != "B" -> "failed 8" - doIfNot("123") != "A" -> "failed 9" - doIfNot(null) != "A" -> "failed 10" - - doIfNotNot("1") != "A" -> "failed 8" - doIfNotNot("123") != "B" -> "failed 9" - doIfNotNot(null) != "B" -> "failed 10" - - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/safeCallNotEqPrimitive.kt b/backend.native/tests/external/codegen/box/safeCall/safeCallNotEqPrimitive.kt deleted file mode 100644 index 8cac0043470..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/safeCallNotEqPrimitive.kt +++ /dev/null @@ -1,43 +0,0 @@ -fun Long.id() = this - -fun String.drop2() = if (length >= 2) subSequence(2, length) else null - -fun String.anyLength(): Any = length - - -fun doSimple(s: String?) = s?.length != 3 - -fun doLongReceiver(x: Long) = x?.id() != 3L - -fun doChain(s: String?) = s?.drop2()?.length != 1 - -fun doIf(s: String?) = - if (s?.length != 1) "A" else "B" - -fun doCmpWithAny(s: String?) = - s?.anyLength() != 3 - - -fun box(): String = when { - !doSimple(null) -> "failed 1" - !doSimple("1") -> "failed 2" - doSimple("123") -> "failed 3" - - !doLongReceiver(2L) -> "failed 4" - doLongReceiver(3L) -> "failed 5" - - !doChain(null) -> "failed 6" - !doChain("1") -> "failed 7" - doChain("123") -> "failed 7" - - doIf("1") == "A" -> "failed 8" - doIf("123") == "B" -> "failed 9" - doIf(null) == "B" -> "failed 10" - - !doCmpWithAny(null) -> "failed 11" - !doCmpWithAny("1") -> "failed 12" - doCmpWithAny("123") -> "failed 13" - - - else -> "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/safeCall/safeCallOnLong.kt b/backend.native/tests/external/codegen/box/safeCall/safeCallOnLong.kt deleted file mode 100644 index 9937adc2991..00000000000 --- a/backend.native/tests/external/codegen/box/safeCall/safeCallOnLong.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun f(b : Long.(Long)->Long) = 1L?.b(2L) - -fun box(): String { - val x = f { this + it } - return if (x == 3L) "OK" else "fail $x" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/comparator.kt b/backend.native/tests/external/codegen/box/sam/constructors/comparator.kt deleted file mode 100644 index 894b52dfe03..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/comparator.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val list = mutableListOf(3, 2, 4, 8, 1, 5) - val expected = listOf(8, 5, 4, 3, 2, 1) - list.sortWith(Comparator { a, b -> b - a }) - return if (list == expected) "OK" else list.toString() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/filenameFilter.kt b/backend.native/tests/external/codegen/box/sam/constructors/filenameFilter.kt deleted file mode 100644 index a6651307bed..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/filenameFilter.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.io.* - -fun box(): String { - val ACCEPT_NAME = "test" - val WRONG_NAME = "wrong" - - val filter = FileFilter { file -> ACCEPT_NAME == file?.getName() } - - if (!filter.accept(File(ACCEPT_NAME))) return "Wrong answer for $ACCEPT_NAME" - if (filter.accept(File(WRONG_NAME))) return "Wrong answer for $WRONG_NAME" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/kt19251.kt b/backend.native/tests/external/codegen/box/sam/constructors/kt19251.kt deleted file mode 100644 index 0b23924234f..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/kt19251.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -// FILE: test.kt -fun box(): String { - val map = mutableMapOf() - val fn = Fun { TODO() } - return map.computeIfAbsent(fn, { "OK" }) -} - -// FILE: Fun.java -public interface Fun { - String invoke(String string); -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/kt19251_child.kt b/backend.native/tests/external/codegen/box/sam/constructors/kt19251_child.kt deleted file mode 100644 index 68dcd40f89a..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/kt19251_child.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -// FILE: test.kt -fun box(): String { - val map = mutableMapOf() - val fn = DerivedFun { TODO() } - return map.computeIfAbsent(fn, { "OK" }) -} - -// FILE: Fun.java -public interface Fun { - String invoke(String string); -} - -// FILE: DerivedFun.java -public interface DerivedFun extends Fun {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralComparator.kt b/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralComparator.kt deleted file mode 100644 index 5dfa3b5926f..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralComparator.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val list = mutableListOf(3, 2, 4, 8, 1, 5) - val expected = listOf(8, 5, 4, 3, 2, 1) - val comparatorFun: (Int, Int) -> Int = { a, b -> b - a } - list.sortWith(Comparator(comparatorFun)) - return if (list == expected) "OK" else list.toString() -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralFilenameFilter.kt b/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralFilenameFilter.kt deleted file mode 100644 index d6672316a1c..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralFilenameFilter.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.io.* - -fun box(): String { - val ACCEPT_NAME = "test" - val WRONG_NAME = "wrong" - - val f : (File?) -> Boolean = { file -> ACCEPT_NAME == file?.getName() } - val filter = FileFilter(f) - - if (!filter.accept(File(ACCEPT_NAME))) return "Wrong answer for $ACCEPT_NAME" - if (filter.accept(File(WRONG_NAME))) return "Wrong answer for $WRONG_NAME" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralRunnable.kt b/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralRunnable.kt deleted file mode 100644 index 59818629db0..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/nonLiteralRunnable.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TARGET_BACKEND: JVM - -fun box(): String { - var result = "FAIL" - val f = { result = "OK" } - val r = Runnable(f) - r.run() - return result -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/nonTrivialRunnable.kt b/backend.native/tests/external/codegen/box/sam/constructors/nonTrivialRunnable.kt deleted file mode 100644 index 23dd339127c..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/nonTrivialRunnable.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TARGET_BACKEND: JVM - -var result = "FAIL" - -fun getFun(): () -> Unit { - return { result = "OK" } -} - -fun box(): String { - val r = Runnable(getFun()) - r.run() - return result -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/runnable.kt b/backend.native/tests/external/codegen/box/sam/constructors/runnable.kt deleted file mode 100644 index 7c4564f0b50..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/runnable.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TARGET_BACKEND: JVM - -var result = "FAIL" - -fun box(): String { - val r = Runnable { result = "OK" } - r.run() - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure1.kt b/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure1.kt deleted file mode 100644 index 1381931b9f1..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure1.kt +++ /dev/null @@ -1,10 +0,0 @@ -// TARGET_BACKEND: JVM - -fun box(): String { - val o = "O" - var result = "" - - val r = Runnable { result = o + "K" } //capturing local vals and local var - r.run() - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure2.kt b/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure2.kt deleted file mode 100644 index 15c2ff185e9..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/runnableAccessingClosure2.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TARGET_BACKEND: JVM - -class Box(val s: String) { - fun extract(): String { - var result = "" - Runnable { result = s }.run() // capturing this and local var - return result - } -} - -fun box(): String { - return Box("OK").extract() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sam/constructors/samWrappersDifferentFiles.kt b/backend.native/tests/external/codegen/box/sam/constructors/samWrappersDifferentFiles.kt deleted file mode 100644 index 3b1cfbc0298..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/samWrappersDifferentFiles.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: 1/wrapped.kt - -fun getWrapped1(): Runnable { - val f = { } - return Runnable(f) -} - -// FILE: 2/wrapped2.kt - -fun getWrapped2(): Runnable { - val f = { } - return Runnable(f) -} - -// FILE: box.kt - -fun box(): String { - val class1 = getWrapped1().javaClass - val class2 = getWrapped2().javaClass - - return if (class1 != class2) "OK" else "Same class: $class1" -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/sameWrapperClass.kt b/backend.native/tests/external/codegen/box/sam/constructors/sameWrapperClass.kt deleted file mode 100644 index ee39d412a0c..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/sameWrapperClass.kt +++ /dev/null @@ -1,10 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - val f = { } - val class1 = (Runnable(f) as Object).getClass() - val class2 = (Runnable(f) as Object).getClass() - - return if (class1 == class2) "OK" else "$class1 $class2" -} diff --git a/backend.native/tests/external/codegen/box/sam/constructors/syntheticVsReal.kt b/backend.native/tests/external/codegen/box/sam/constructors/syntheticVsReal.kt deleted file mode 100644 index 70ad7f5b42b..00000000000 --- a/backend.native/tests/external/codegen/box/sam/constructors/syntheticVsReal.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TARGET_BACKEND: JVM - -var global = "" - -fun Runnable(f: () -> Unit) = object : Runnable { - public override fun run() { - global = "OK" - } -} - -fun box(): String { - Runnable { global = "FAIL" } .run() - return global -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/sealed/objects.kt b/backend.native/tests/external/codegen/box/sealed/objects.kt deleted file mode 100644 index c33a71d498f..00000000000 --- a/backend.native/tests/external/codegen/box/sealed/objects.kt +++ /dev/null @@ -1,11 +0,0 @@ -sealed class Season { - object Warm: Season() - object Cold: Season() -} - -fun foo(): Season = Season.Warm - -fun box() = when(foo()) { - Season.Warm -> "OK" - Season.Cold -> "Fail: Cold, should be Warm" -} diff --git a/backend.native/tests/external/codegen/box/sealed/simple.kt b/backend.native/tests/external/codegen/box/sealed/simple.kt deleted file mode 100644 index 01ae3af2c95..00000000000 --- a/backend.native/tests/external/codegen/box/sealed/simple.kt +++ /dev/null @@ -1,11 +0,0 @@ -sealed class Season { - class Warm: Season() - class Cold: Season() -} - -fun foo(): Season = Season.Warm() - -fun box() = when(foo()) { - is Season.Warm -> "OK" - is Season.Cold -> "Fail: Cold, should be Warm" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/accessToCompanion.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/accessToCompanion.kt deleted file mode 100644 index 0c9e1d2df2e..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/accessToCompanion.kt +++ /dev/null @@ -1,15 +0,0 @@ -internal class A(val result: Int) { - companion object { - fun foo(): Int = 1 - val prop = 2 - val C = 3 - } - - constructor() : this(foo() + prop + C) -} - -fun box(): String { - val result = A().result - if (result != 6) return "fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/accessToNestedObject.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/accessToNestedObject.kt deleted file mode 100644 index 3093181e4bd..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/accessToNestedObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A(val result: Int) { - object B { - fun bar(): Int = 4 - val prop = 5 - } - object C { - } - - constructor() : this(B.bar() + B.prop) -} - -fun box(): String { - val result = A().result - if (result != 9) return "fail: $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryManySinks.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryManySinks.kt deleted file mode 100644 index 862ed7e242c..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryManySinks.kt +++ /dev/null @@ -1,35 +0,0 @@ -var sideEffects: String = "" - -class A { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor(x: String) { - prop = x - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int) { - prop += "$x#int" - sideEffects += "#fourth" - } -} - -fun box(): String { - val a1 = A("abc") - if (a1.prop != "abc") return "fail1: ${a1.prop}" - if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" - - sideEffects = "" - val a2 = A(123) - if (a2.prop != "123#int") return "fail2: ${a2.prop}" - if (sideEffects != "first#second#fourth") return "fail2-sideEffects: ${sideEffects}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryOneSink.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryOneSink.kt deleted file mode 100644 index 23f796276c0..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/basicNoPrimaryOneSink.kt +++ /dev/null @@ -1,41 +0,0 @@ -internal var sideEffects: String = "" - -internal class A { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor() {} - - constructor(x: String): this() { - prop = x - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): this(x.toString()) { - prop += "#int" - sideEffects += "#fourth" - } -} - -fun box(): String { - val a1 = A("abc") - if (a1.prop != "abc") return "fail1: ${a1.prop}" - if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" - - sideEffects = "" - val a2 = A(123) - if (a2.prop != "123#int") return "fail2: ${a2.prop}" - if (sideEffects != "first#second#third#fourth") return "fail2-sideEffects: ${sideEffects}" - - sideEffects = "" - val a3 = A() - if (a3.prop != "") return "fail2: ${a3.prop}" - if (sideEffects != "first#second") return "fail3-sideEffects: ${sideEffects}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/basicPrimary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/basicPrimary.kt deleted file mode 100644 index 6195900e1d8..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/basicPrimary.kt +++ /dev/null @@ -1,39 +0,0 @@ -var sideEffects: String = "" - -class A() { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor(x: String): this() { - prop = x - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): this(x.toString()) { - prop += "#int" - sideEffects += "#fourth" - } -} - -fun box(): String { - val a1 = A("abc") - if (a1.prop != "abc") return "fail1: ${a1.prop}" - if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" - - sideEffects = "" - val a2 = A(123) - if (a2.prop != "123#int") return "fail2: ${a2.prop}" - if (sideEffects != "first#second#third#fourth") return "fail2-sideEffects: ${sideEffects}" - - sideEffects = "" - val a3 = A() - if (a3.prop != "") return "fail2: ${a3.prop}" - if (sideEffects != "first#second") return "fail3-sideEffects: ${sideEffects}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromLocalSubClass.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/callFromLocalSubClass.kt deleted file mode 100644 index e74d65b029d..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromLocalSubClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - val z = "K" - open class A(val x: String) { - constructor() : this("O") - - val y: String - get() = z - } - - class B : A() - - val b = B() - - return b.x + b.y -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithNamedArgs.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithNamedArgs.kt deleted file mode 100644 index 30fc0208f2c..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithNamedArgs.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A(val result: String) { - constructor(x: Int = 11, y: Int = 22, z: Int = 33) : this("$x$y$z") -} - -class B() : A(y = 44) - -fun box(): String { - val result = B().result - if (result != "114433") return "fail: $result" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt deleted file mode 100644 index 71955e44537..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A(val result: String) { - constructor(x: Int, y: Int = 99) : this("$x$y") -} - -class B(x: Int) : A(x) - -fun box(): String { - val result = B(11).result - if (result != "1199") return "fail: $result" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromSubClass.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/callFromSubClass.kt deleted file mode 100644 index 7dd165dbc23..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/callFromSubClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class A(val x: String, val z: String) { - constructor(z: String) : this("O", z) -} - -class B(val y: String) : A("_") - -fun box(): String { - val b = B("K") - val result = b.z + b.x + b.y - if (result != "_OK") return "fail: $result" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/clashingDefaultConstructors.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/clashingDefaultConstructors.kt deleted file mode 100644 index bad07d0d16b..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/clashingDefaultConstructors.kt +++ /dev/null @@ -1,35 +0,0 @@ -open class A(val x: String = "abc", val y: String = "efg") { - constructor(x: String, y: String, z: Int): this(x, y + "#" + z.toString()) - - override fun toString() = "$x#$y" -} - -class B : A { - constructor(x: String, y: String, z: Int): super(x, y + z.toString()) - constructor(x: String = "xyz", y: String = "123") : super(x, y) - constructor(x: Double): super(x.toString()) -} - -fun box(): String { - val a1 = A().toString() - if (a1 != "abc#efg") return "fail1: $a1" - - val a2 = A("hij", "klm", 1).toString() - if (a2 != "hij#klm#1") return "fail2: $a2" - - val a3 = A(x="xyz").toString() - if (a3 != "xyz#efg") return "fail3: $a3" - - val b1 = B().toString() - if (b1 != "xyz#123") return "fail4: $b1" - - val b2 = B("hij", "klm", 2).toString() - if (b2 != "hij#klm2") return "fail5: $b2" - - val b3 = B(123.1).toString() - if (b3 != "123.1#efg") return "fail6: $b3" - - val b4 = B(x="test").toString() - if (b4 != "test#123") return "fail7: $b4" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/dataClasses.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/dataClasses.kt deleted file mode 100644 index 074508611b6..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/dataClasses.kt +++ /dev/null @@ -1,53 +0,0 @@ -internal data class A1(val prop1: String) { - val prop2: String = "const2" - var prop3: String = "" - - constructor(): this("default") { - prop3 = "empty" - } - constructor(x: Int): this(x.toString()) { - prop3 = "int" - } - - fun f(): String = "$prop1#$prop2#$prop3" -} - -internal class A2 private constructor() { - var prop1: String = "" - var prop2: String = "const2" - var prop3: String = "" - - constructor(arg: String): this() { - prop1 = arg - } - constructor(x: Double): this() { - prop1 = "default" - prop3 = "empty" - } - constructor(x: Int): this(x.toString()) { - prop3 = "int" - } - - fun f(): String = "$prop1#$prop2#$prop3" -} - -fun box(): String { - val a1x = A1("asd") - if (a1x.f() != "asd#const2#") return "fail1: ${a1x.f()}" - if (a1x.toString() != "A1(prop1=asd)") return "fail1s: ${a1x.toString()}" - val a1y = A1() - if (a1y.f() != "default#const2#empty") return "fail2: ${a1y.f()}" - if (a1y.toString() != "A1(prop1=default)") return "fail2s: ${a1y.toString()}" - val a1z = A1(5) - if (a1z.f() != "5#const2#int") return "fail3: ${a1z.f()}" - if (a1z.toString() != "A1(prop1=5)") return "fail3s: ${a1z.toString()}" - - val a2x = A2("asd") - if (a2x.f() != "asd#const2#") return "fail4: ${a2x.f()}" - val a2y = A2(123.0) - if (a2y.f() != "default#const2#empty") return "fail5: ${a2y.f()}" - val a2z = A2(5) - if (a2z.f() != "5#const2#int") return "fail6: ${a2z.f()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/defaultArgs.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/defaultArgs.kt deleted file mode 100644 index 3c9d312462e..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/defaultArgs.kt +++ /dev/null @@ -1,34 +0,0 @@ -val global = "OK" -class A { - val prop: String - constructor(arg1: String = global) { - prop = arg1 - } - constructor(arg1: String = global, arg2: Long) { - prop = "$arg1#$arg2" - } - constructor(arg1: String = global, argDouble: Double, arg3: Long = 1L) { - prop = "$arg1#$argDouble#$arg3" - } -} - -fun box(): String { - val a1 = A() - if (a1.prop != "OK") return "fail1: ${a1.prop}" - val a2 = A("A") - if (a2.prop != "A") return "fail2: ${a2.prop}" - - val a3 = A(arg2=123) - if (a3.prop != "OK#123") return "fail3: ${a3.prop}" - val a4 = A("A", arg2=123) - if (a4.prop != "A#123") return "fail4: ${a4.prop}" - - val a5 = A(argDouble=23.1) - if (a5.prop != "OK#23.1#1") return "fail5: ${a5.prop}" - val a6 = A("A", argDouble=23.1) - if (a6.prop != "A#23.1#1") return "fail6: ${a6.prop}" - val a7 = A("A", arg3=2L, argDouble=23.1) - if (a7.prop != "A#23.1#2") return "fail7: ${a7.prop}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/defaultParametersNotDuplicated.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/defaultParametersNotDuplicated.kt deleted file mode 100644 index 409e42f9ec0..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/defaultParametersNotDuplicated.kt +++ /dev/null @@ -1,15 +0,0 @@ -var global = 0 - -fun sideEffect() = global++ - -class A(val x: String) { - constructor(y: Int = sideEffect(), z: (Int) -> Int = { it + sideEffect() }) : this("$y:${z(y)}") {} -} - -fun box(): String { - var a = A() - if (a.x != "0:1") return "failed1: ${a.x}" - if (global != 2) return "failed2: ${global}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/delegateWithComplexExpression.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/delegateWithComplexExpression.kt deleted file mode 100644 index 999d944d7f1..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/delegateWithComplexExpression.kt +++ /dev/null @@ -1,46 +0,0 @@ -var log = "" - -open class Base(val s: String) - -class A(s: String) : Base(s) { - constructor(i: Int) : this("O" + if (i == 23) { - log += "logged1;" - "K" - } - else { - "fail" - }) - - constructor(i: Long) : this(if (i == 23L) { - log += "logged2;" - 23 - } - else { - 42 - }) -} - -class B : Base { - constructor(i: Int) : super("O" + if (i == 23) { - log += "logged3;" - "K" - } - else { - "fail" - }) -} - -fun box(): String { - var result = A(23).s - if (result != "OK") return "fail1: $result" - - result = A(23L).s - if (result != "OK") return "fail2: $result" - - result = B(23).s - if (result != "OK") return "fail3: $result" - - if (log != "logged1;logged2;logged1;logged3;") return "fail log: $log" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/delegatedThisWithLambda.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/delegatedThisWithLambda.kt deleted file mode 100644 index b48d1356430..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/delegatedThisWithLambda.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A(val f: () -> Int) { - constructor() : this({ 23 }) -} - -fun box(): String { - val result = A().f() - if (result != 23) return "fail: $result" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/delegationWithPrimary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/delegationWithPrimary.kt deleted file mode 100644 index 42690e92b97..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/delegationWithPrimary.kt +++ /dev/null @@ -1,17 +0,0 @@ -internal interface A { - fun foo(): String -} - -internal class B : A { - override fun foo() = "OK" -} - -internal val global = B() - -internal class C(x: Int) : A by global { - constructor(): this(1) -} - -fun box(): String { - return C().foo() -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/enums.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/enums.kt deleted file mode 100644 index 2d62a075bb9..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/enums.kt +++ /dev/null @@ -1,62 +0,0 @@ -enum class A1(val prop1: String) { - X("asd"), - Y() { - override fun f() = super.f() + "#Y" - }, - Z(5); - - val prop2: String = "const2" - var prop3: String = "" - - constructor(): this("default") { - prop3 = "empty" - } - constructor(x: Int): this(x.toString()) { - prop3 = "int" - } - - open fun f(): String = "$prop1#$prop2#$prop3" -} - -enum class A2 { - X("asd"), - Y() { - override fun f() = super.f() + "#Y" - }, - Z(5); - - val prop1: String - val prop2: String = "const2" - var prop3: String = "" - - constructor(arg: String) { - prop1 = arg - } - constructor() { - prop1 = "default" - prop3 = "empty" - } - constructor(x: Int): this(x.toString()) { - prop3 = "int" - } - - open fun f(): String = "$prop1#$prop2#$prop3" -} - -fun box(): String { - val a1x = A1.X - if (a1x.f() != "asd#const2#") return "fail1: ${a1x.f()}" - val a1y = A1.Y - if (a1y.f() != "default#const2#empty#Y") return "fail2: ${a1y.f()}" - val a1z = A1.Z - if (a1z.f() != "5#const2#int") return "fail3: ${a1z.f()}" - - val a2x = A2.X - if (a2x.f() != "asd#const2#") return "fail4: ${a2x.f()}" - val a2y = A2.Y - if (a2y.f() != "default#const2#empty#Y") return "fail5: ${a2y.f()}" - val a2z = A2.Z - if (a2z.f() != "5#const2#int") return "fail6: ${a2z.f()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/generics.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/generics.kt deleted file mode 100644 index a025954f6dd..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/generics.kt +++ /dev/null @@ -1,23 +0,0 @@ -internal open class B(val x: T, val y: T) { - constructor(x: T): this(x, x) - override fun toString() = "$x#$y" -} - -internal class A : B { - constructor(): super("default") - constructor(x: String): super(x, "default") -} - -fun box(): String { - val b1 = B("1", "2").toString() - if (b1 != "1#2") return "fail1: $b1" - val b2 = B("abc").toString() - if (b2 != "abc#abc") return "fail2: $b2" - - val a1 = A().toString() - if (a1 != "default#default") return "fail3: $a1" - val a2 = A("xyz").toString() - if (a2 != "xyz#default") return "fail4: $a2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/innerClasses.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/innerClasses.kt deleted file mode 100644 index 9d0851c426b..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/innerClasses.kt +++ /dev/null @@ -1,79 +0,0 @@ -class Outer { - val outerProp: String - constructor(x: String) { - outerProp = x - } - - var sideEffects = "" - - inner class A1() { - var prop: String = "" - init { - sideEffects += outerProp + "#" + prop + "first" - } - - constructor(x: String): this() { - prop = x + "#${outerProp}" - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): this(x.toString() + "#" + outerProp) { - prop += "#int" - sideEffects += "#fourth" - } - } - - inner class A2 { - var prop: String = "" - init { - sideEffects += outerProp + "#" + prop + "first" - } - - constructor(x: String) { - prop = x + "#$outerProp" - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int) { - prop += "$x#$outerProp#int" - sideEffects += "#fourth" - } - } -} - -fun box(): String { - val outer1 = Outer("propValue1") - val a1 = outer1.A1("abc") - if (a1.prop != "abc#propValue1") return "fail1: ${a1.prop}" - if (outer1.sideEffects != "propValue1#first#second#third") return "fail1-sideEffects: ${outer1.sideEffects}" - - val outer2 = Outer("propValue2") - val a2 = outer2.A1(123) - if (a2.prop != "123#propValue2#propValue2#int") return "fail2: ${a2.prop}" - if (outer2.sideEffects != "propValue2#first#second#third#fourth") return "fail2-sideEffects: ${outer2.sideEffects}" - - val outer3 = Outer("propValue3") - val a3 = outer3.A1() - if (a3.prop != "") return "fail2: ${a3.prop}" - if (outer3.sideEffects != "propValue3#first#second") return "fail3-sideEffects: ${outer3.sideEffects}" - - val outer4 = Outer("propValue4") - val a4 = outer4.A2("abc") - if (a4.prop != "abc#propValue4") return "fail4: ${a4.prop}" - if (outer4.sideEffects != "propValue4#first#second#third") return "fail4-sideEffects: ${outer4.sideEffects}" - - val outer5 = Outer("propValue5") - val a5 = outer5.A2(123) - if (a5.prop != "123#propValue5#int") return "fail5: ${a5.prop}" - if (outer5.sideEffects != "propValue5#first#second#fourth") return "fail5-sideEffects: ${outer5.sideEffects}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/innerClassesInheritance.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/innerClassesInheritance.kt deleted file mode 100644 index f68b538d5ef..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/innerClassesInheritance.kt +++ /dev/null @@ -1,66 +0,0 @@ -class Outer { - val outerProp: String - constructor(x: String) { - outerProp = x - } - - var sideEffects = "" - - abstract inner class A1 { - var parentProp: String = "" - init { - sideEffects += outerProp + "#" + parentProp + "first" - } - - protected constructor(x: String) { - parentProp = x + "#${outerProp}" - sideEffects += "#second#" - } - - init { - sideEffects += parentProp + "#third" - } - - protected constructor(x: Int): this(x.toString() + "#" + outerProp) { - parentProp += "#int" - sideEffects += "fourth#" - } - } - - inner class A2 : A1 { - var prop: String = "" - init { - sideEffects += outerProp + "#" + prop + "fifth" - } - - constructor(x: String): super(x + "#" + outerProp) { - prop = x + "#$outerProp" - sideEffects += "#sixth" - } - - init { - sideEffects += prop + "#seventh" - } - - constructor(x: Int): super(x + 1) { - prop += "$x#$outerProp#int" - sideEffects += "#eighth" - } - } -} - -fun box(): String { - val outer1 = Outer("propValue1") - val a1 = outer1.A2("abc") - if (a1.parentProp != "abc#propValue1#propValue1") return "fail1: ${a1.parentProp}" - if (a1.prop != "abc#propValue1") return "fail2: ${a1.prop}" - if (outer1.sideEffects != "propValue1#first#third#second#propValue1#fifth#seventh#sixth") return "fail1-sideEffects: ${outer1.sideEffects}" - - val outer2 = Outer("propValue2") - val a2 = outer2.A2(123) - if (a2.parentProp != "124#propValue2#propValue2#int") return "fail3: ${a2.parentProp}" - if (a2.prop != "123#propValue2#int") return "fail4: ${a2.prop}" - if (outer2.sideEffects != "propValue2#first#third#second#fourth#propValue2#fifth#seventh#eighth") return "fail2-sideEffects: ${outer2.sideEffects}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/localClasses.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/localClasses.kt deleted file mode 100644 index fb26a6ba6aa..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/localClasses.kt +++ /dev/null @@ -1,77 +0,0 @@ -open class C(val grandParentProp: String) -fun box(): String { - var sideEffects: String = "" - var parentSideEffects: String = "" - val justForUsageInClosure = 7 - val justForUsageInParentClosure = "parentCaptured" - - abstract class B : C { - val parentProp: String - init { - sideEffects += "minus-one#" - parentSideEffects += "1" - } - protected constructor(arg: Int): super(justForUsageInParentClosure) { - parentProp = (arg).toString() - sideEffects += "0.5#" - parentSideEffects += "#" + justForUsageInParentClosure - } - protected constructor(arg1: Int, arg2: Int): super(justForUsageInParentClosure) { - parentProp = (arg1 + arg2).toString() - sideEffects += "0.7#" - parentSideEffects += "#3" - } - init { - sideEffects += "zero#" - parentSideEffects += "#4" - } - } - - class A : B { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor(x1: Int, x2: Int): super(x1, x2) { - prop = x1.toString() - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): super(justForUsageInClosure + x) { - prop += "${x}#int" - sideEffects += "#fourth" - } - - constructor(): this(justForUsageInClosure) { - sideEffects += "#fifth" - } - - override fun toString() = "$prop#$parentProp#$grandParentProp" - } - - val a1 = A(5, 10).toString() - if (a1 != "5#15#parentCaptured") return "fail1: $a1" - if (sideEffects != "minus-one#zero#0.7#first#second#third") return "fail2: ${sideEffects}" - if (parentSideEffects != "1#4#3") return "fail3: ${parentSideEffects}" - - sideEffects = "" - parentSideEffects = "" - val a2 = A(123).toString() - if (a2 != "123#int#130#parentCaptured") return "fail1: $a2" - if (sideEffects != "minus-one#zero#0.5#first#second#fourth") return "fail4: ${sideEffects}" - if (parentSideEffects != "1#4#parentCaptured") return "fail5: ${parentSideEffects}" - - sideEffects = "" - parentSideEffects = "" - val a3 = A().toString() - if (a3 != "7#int#14#parentCaptured") return "fail6: $a3" - if (sideEffects != "minus-one#zero#0.5#first#second#fourth#fifth") return "fail7: ${sideEffects}" - if (parentSideEffects != "1#4#parentCaptured") return "fail8: ${parentSideEffects}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/superCallPrimary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/superCallPrimary.kt deleted file mode 100644 index 7225bc1af4f..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/superCallPrimary.kt +++ /dev/null @@ -1,53 +0,0 @@ -var sideEffects: String = "" - -abstract class B protected constructor(val arg: Int) { - val parentProp: String - init { - sideEffects += "zero#" - parentProp = arg.toString() - } -} - -class A(x: Boolean) : B(if (x) 1 else 2) { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor(x: String): this(x == "abc") { - prop = x - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): this(x < 0) { - prop += "${x}#int" - sideEffects += "#fourth" - } -} - -fun box(): String { - val a1 = A("abc") - if (a1.prop != "abc") return "fail0: ${a1.prop}" - if (a1.parentProp != "1") return "fail1: ${a1.parentProp}" - if (a1.arg != 1) return "fail1': ${a1.arg}" - if (sideEffects != "zero#first#second#third") return "fail2: ${sideEffects}" - - sideEffects = "" - val a2 = A(123) - if (a2.prop != "123#int") return "fail3: ${a2.prop}" - if (a2.parentProp != "2") return "fail4: ${a2.parentProp}" - if (a2.arg != 2) return "fail5': ${a2.arg}" - if (sideEffects != "zero#first#second#fourth") return "fail6: ${sideEffects}" - - sideEffects = "" - val a3 = A(false) - if (a3.prop != "") return "fail7: ${a3.prop}" - if (a3.parentProp != "2") return "fail8: ${a3.parentProp}" - if (a3.arg != 2) return "fail9': ${a3.arg}" - if (sideEffects != "zero#first#second") return "fail10: ${sideEffects}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/superCallSecondary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/superCallSecondary.kt deleted file mode 100644 index e5d0064aa01..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/superCallSecondary.kt +++ /dev/null @@ -1,64 +0,0 @@ -var sideEffects: String = "" - -internal abstract class B { - val parentProp: String - init { - sideEffects += "minus-one#" - } - protected constructor(arg: Int) { - parentProp = (arg).toString() - sideEffects += "0.5#" - } - protected constructor(arg1: Int, arg2: Int) { - parentProp = (arg1 + arg2).toString() - sideEffects += "0.7#" - } - init { - sideEffects += "zero#" - } -} - -internal class A : B { - var prop: String = "" - init { - sideEffects += prop + "first" - } - - constructor(x1: Int, x2: Int): super(x1, x2) { - prop = x1.toString() - sideEffects += "#third" - } - - init { - sideEffects += prop + "#second" - } - - constructor(x: Int): super(3 + x) { - prop += "${x}#int" - sideEffects += "#fourth" - } - - constructor(): this(7) { - sideEffects += "#fifth" - } -} - -fun box(): String { - val a1 = A(5, 10) - if (a1.prop != "5") return "fail0: ${a1.prop}" - if (a1.parentProp != "15") return "fail1: ${a1.parentProp}" - if (sideEffects != "minus-one#zero#0.7#first#second#third") return "fail2: ${sideEffects}" - - sideEffects = "" - val a2 = A(123) - if (a2.prop != "123#int") return "fail3: ${a2.prop}" - if (a2.parentProp != "126") return "fail4: ${a2.parentProp}" - if (sideEffects != "minus-one#zero#0.5#first#second#fourth") return "fail5: ${sideEffects}" - - sideEffects = "" - val a3 = A() - if (a3.prop != "7#int") return "fail6: ${a3.prop}" - if (a3.parentProp != "10") return "fail7: ${a3.parentProp}" - if (sideEffects != "minus-one#zero#0.5#first#second#fourth#fifth") return "fail8: ${sideEffects}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/varargs.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/varargs.kt deleted file mode 100644 index 39bfb8bf7a9..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/varargs.kt +++ /dev/null @@ -1,31 +0,0 @@ -fun join(x: Array): String { - var result = "" - for (i in x) { - result += i - result += "#" - } - - return result -} - -open class B { - val parentProp: String - constructor(vararg x: String) { - parentProp = join(x) - } -} - -class A : B { - val prop: String - constructor(vararg x: String): super("0", *x, "4") { - prop = join(x) - } -} - -fun box(): String { - val a1 = A("1", "2", "3") - if (a1.prop != "1#2#3#") return "fail1: ${a1.prop}" - if (a1.parentProp != "0#1#2#3#4#") return "fail2: ${a1.parentProp}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withGenerics.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withGenerics.kt deleted file mode 100644 index 20cd7ce3da7..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withGenerics.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: WithGenerics.java - -class WithGenerics { - public static String foo1() { - A x = new A("OK"); - return x.toString(); - } - - public static String foo2() { - A x = new A(123); - return x.toString(); - } -} - -// FILE: WithGenerics.kt - -open class A { - val prop: String - constructor(x: String) { - prop = x - } - constructor(x: T) { - prop = x.toString() - } - - override fun toString() = prop -} - -fun box(): String { - val a1 = WithGenerics.foo1() - if (a1 != "OK") return "fail1: $a1" - val a2 = WithGenerics.foo2() - if (a2 != "123") return "fail2: $a2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withNonLocalReturn.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withNonLocalReturn.kt deleted file mode 100644 index 0b0be6bbbac..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withNonLocalReturn.kt +++ /dev/null @@ -1,21 +0,0 @@ -inline fun run(block: () -> Unit) = block() - -class A { - val prop: Int - constructor(arg: Boolean) { - if (arg) { - prop = 1 - run { return } - throw RuntimeException("fail 0") - } - prop = 2 - } -} - -fun box(): String { - val a1 = A(true) - if (a1.prop != 1) return "fail1: ${a1.prop}" - val a2 = A(false) - if (a2.prop != 2) return "fail2: ${a2.prop}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withPrimary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withPrimary.kt deleted file mode 100644 index 28080ec08d1..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withPrimary.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: WithPrimary.java - -class WithPrimary { - public static A test1() { - return new A("123", "abc"); - } - public static A test2() { - return new A(); - } - public static A test3() { - return new A("123", 456); - } - public static A test4() { - return new A(1.0); - } -} - -// FILE: WithPrimary.kt - -class A(val x: String = "def_x", val y: String = "1") { - constructor(x: String, y: Int): this(x, y.toString()) {} - constructor(x: Double): this(x.toString(), "def_y") {} - override fun toString() = "$x#$y" -} - -fun box(): String { - val test1 = WithPrimary.test1().toString() - if (test1 != "123#abc") return "fail1: $test1" - - val test2 = WithPrimary.test2().toString() - if (test2 != "def_x#1") return "fail2: $test2" - - val test3 = WithPrimary.test3().toString() - if (test3 != "123#456") return "fail3: $test3" - - val test4 = WithPrimary.test4().toString() - if (test4 != "1.0#def_y") return "fail4: $test4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withReturn.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withReturn.kt deleted file mode 100644 index b6cb18cf2af..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withReturn.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A { - val prop: Int - constructor(arg: Boolean) { - if (arg) { - prop = 1 - return - } - prop = 2 - } -} - -fun box(): String { - val a1 = A(true) - if (a1.prop != 1) return "fail1: ${a1.prop}" - val a2 = A(false) - if (a2.prop != 2) return "fail2: ${a2.prop}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withReturnUnit.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withReturnUnit.kt deleted file mode 100644 index 956c6db367e..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withReturnUnit.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A { - val prop: Int - constructor(arg: Boolean) { - if (arg) { - prop = 1 - return Unit - } - prop = 2 - } -} - -fun box(): String { - val a1 = A(true) - if (a1.prop != 1) return "fail1: ${a1.prop}" - val a2 = A(false) - if (a2.prop != 2) return "fail2: ${a2.prop}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withVarargs.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withVarargs.kt deleted file mode 100644 index 84b0f3feba8..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withVarargs.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: WithVarargs.java - -public class WithVarargs { - public static String foo() { - return new A("1", "2", "3").getProp(); - } -} - -// FILE: withVarargs.kt - -fun join(x: Array): String { - var result = "" - for (i in x) { - result += i - result += "#" - } - - return result -} - -class A { - val prop: String - constructor(vararg x: String) { - prop = join(x) - } -} - -fun box(): String { - val a1 = WithVarargs.foo() - if (a1 != "1#2#3#") return "fail1: ${a1}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/secondaryConstructors/withoutPrimary.kt b/backend.native/tests/external/codegen/box/secondaryConstructors/withoutPrimary.kt deleted file mode 100644 index d455a57dba8..00000000000 --- a/backend.native/tests/external/codegen/box/secondaryConstructors/withoutPrimary.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: WithoutPrimary.java - -class WithoutPrimary { - public static A test1() { - return new A("123", "abc"); - } - public static A test3() { - return new A("123", 456); - } - public static A test4() { - return new A(1.0); - } -} - -// FILE: WithoutPrimary.kt - -class A { - val x: String - val y: String - constructor(x: String, y: String) { - this.x = x - this.y = y - } - constructor(x: String = "def_x", y: Int = 1): this(x, y.toString()) {} - constructor(x: Double): this(x.toString(), "def_y") {} - override fun toString() = "$x#$y" -} - -fun box(): String { - val test1 = WithoutPrimary.test1().toString() - if (test1 != "123#abc") return "fail1: $test1" - - val test3 = WithoutPrimary.test3().toString() - if (test3 != "123#456") return "fail3: $test3" - - val test4 = WithoutPrimary.test4().toString() - if (test4 != "1.0#def_y") return "fail4: $test4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt deleted file mode 100644 index 9bdbda176b6..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -class A { - public int first( - @ParameterName("first") @DefaultValue("42") int a, - @ParameterName("second") @DefaultValue("1") int b - ) { - return 100 * a + b; - } -} - -// FILE: main.kt -fun box(): String { - val a = A() - if (a.first() != 100 * 42 + 1) { - return "FAIL 1" - } - - if (a.first(second = 2) != 100 * 42 + 2) { - return "FAIL 2" - } - - if (a.first(first = 2) != 100 * 2 + 1) { - return "FAIL 3" - } - - if (a.first(second = 2, first = 5) != 100 * 5 + 2) { - return "FAIL 4" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultBoxTypes.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultBoxTypes.kt deleted file mode 100644 index 2ea84d948b3..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultBoxTypes.kt +++ /dev/null @@ -1,80 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - - public Integer a(@DefaultValue("42") Integer arg) { - return arg; - } - - public Float b(@DefaultValue("42.5") Float arg) { - return arg; - } - - public Boolean c(@DefaultValue("true") Boolean arg) { - return arg; - } - - public Byte d(@DefaultValue("42") Byte arg) { - return arg; - } - - public Character e(@DefaultValue("o") Character arg) { - return arg; - } - - public Double f(@DefaultValue("1e12") Double arg) { - return arg; - } - - public Long g(@DefaultValue("42424242424242") Long arg) { - return arg; - } - - public Short h(@DefaultValue("123") Short arg) { - return arg; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - - if (a.a() != 42) { - return "FAIL Int: ${a.a()}" - } - - if (a.b() != 42.5f) { - return "FAIL Float: ${a.b()}" - } - - if (!a.c()) { - return "FAIL Boolean: ${a.c()}" - } - - if (a.d() != 42.toByte()) { - return "FAIL Byte: ${a.d()}" - } - - if (a.e() != 'o') { - return "FAIL Char: ${a.e()}" - } - - if (a.f() != 1e12) { - return "FAIl Double: ${a.f()}" - } - - if (a.g() != 42424242424242) { - return "FAIL Long: ${a.g()}" - } - - if (a.h() != 123.toShort()) { - return "FAIL Short: ${a.h()}" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultEnumType.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultEnumType.kt deleted file mode 100644 index 695e3fef0d5..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultEnumType.kt +++ /dev/null @@ -1,42 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: Signs.java -// ANDROID_ANNOTATIONS - -public enum Signs { - HELLO, - WORLD; -} - -// FILE: B.kt -enum class B { - X, - Y; -} - -// FILE: A.java -import kotlin.annotations.jvm.internal.*; - -class A { - public Signs a(@DefaultValue("HELLO") Signs arg) { - return arg; - } - - public B b(@DefaultValue("Y") B arg) { - return arg; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - if (a.a() != Signs.HELLO) { - return "FAIL: enums Java" - } - - if (a.b() != B.Y) { - return "FAIL: enums Kotlin" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultLongLiteral.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultLongLiteral.kt deleted file mode 100644 index 7a7e1c7cf1e..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultLongLiteral.kt +++ /dev/null @@ -1,48 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - public Long first(@DefaultValue("0x1F") Long value) { - return value; - } - - public Long second(@DefaultValue("0X1F") Long value) { - return value; - } - - public Long third(@DefaultValue("0b1010") Long value) { - return value; - } - - public Long fourth(@DefaultValue("0B1010") Long value) { - return value; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - - if (a.first() != 0x1F.toLong()) { - return "FAIL 1" - } - - if (a.second() != 0x1F.toLong()) { - return "FAIL 2" - } - - if (a.third() != 0b1010.toLong()) { - return "FAIL 3" - } - - if (a.fourth() != 0b1010.toLong()) { - return "FAIL 4" - } - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultMultipleParams.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultMultipleParams.kt deleted file mode 100644 index 2fedface3f7..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultMultipleParams.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -class A { - public int first(@DefaultValue("1") int a, @DefaultValue("2") int b) { - return 100 * a + b; - } - - public int second(int a, @DefaultValue("42") int b) { - return 100 * a + b; - } -} - -// FILE: main.kt -fun box(): String { - val a = A() - - if (a.first() != 102) { - return "FAIL 1" - } - - if (a.first(2) != 202) { - return "FAIL 2" - } - - if (a.first(3, 4) != 304) { - return "FAIL 3" - } - - if (a.second(7, 8) != 708) { - return "FAIL 4" - } - - if (a.second(1) != 142) { - return "FAIL 5" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNull.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNull.kt deleted file mode 100644 index 428539d56fa..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNull.kt +++ /dev/null @@ -1,56 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - public Integer foo(@DefaultNull Integer x) { return x; } - public Integer bar(@DefaultNull Integer x) { return x; } - - public Integer baz(@DefaultValue("42") Integer x) { return x; } -} - -// FILE: AInt.java -import kotlin.annotations.jvm.internal.*; - -public interface AInt { - public Integer foo(@DefaultValue("42") Integer x); - public Integer bar(@DefaultNull Integer x); -} - -// FILE: B.java - -public class B extends A { - public Integer foo(Integer x) { return x; } -} - -// FILE: C.java -import kotlin.annotations.jvm.internal.*; - -public class C extends A { - public Integer foo(@DefaultValue("42") Integer x) { return x; } - - public Integer baz(@DefaultNull Integer x) { return x; } -} - -// FILE: D.java - -public class D extends A implements AInt { -} - -// FILE: test.kt -fun box(): String { - if (A().foo() != null) return "FAIL 0" - - if (B().foo() != null) return "FAIL 1" - if (B().bar() != null) return "FAIL 2" - - if (C().foo() != null) return "FAIL 3" - if (C().baz() != 42) return "FAIL 4" - - if (D().baz() != 42) return "FAIL 5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt deleted file mode 100644 index eec37d83f6b..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt +++ /dev/null @@ -1,81 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; -import org.jetbrains.annotations.*; - -public class A { - - public Integer a(@Nullable @DefaultValue("42") Integer arg) { - return arg; - } - - public Float b(@Nullable @DefaultValue("42.5") Float arg) { - return arg; - } - - public Boolean c(@Nullable @DefaultValue("true") Boolean arg) { - return arg; - } - - public Byte d(@Nullable @DefaultValue("42") Byte arg) { - return arg; - } - - public Character e(@Nullable @DefaultValue("o") Character arg) { - return arg; - } - - public Double f(@Nullable @DefaultValue("1e12") Double arg) { - return arg; - } - - public Long g(@Nullable @DefaultValue("42424242424242") Long arg) { - return arg; - } - - public Short h(@Nullable @DefaultValue("123") Short arg) { - return arg; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - - if (a.a() != 42) { - return "FAIL Int: ${a.a()}" - } - - if (a.b() != 42.5f) { - return "FAIL Float: ${a.b()}" - } - - if (!a.c()) { - return "FAIL Boolean: ${a.c()}" - } - - if (a.d() != 42.toByte()) { - return "FAIL Byte: ${a.d()}" - } - - if (a.e() != 'o') { - return "FAIL Char: ${a.e()}" - } - - if (a.f() != 1e12) { - return "FAIl Double: ${a.f()}" - } - - if (a.g() != 42424242424242) { - return "FAIL Long: ${a.g()}" - } - - if (a.h() != 123.toShort()) { - return "FAIL Short: ${a.h()}" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultOverrides.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultOverrides.kt deleted file mode 100644 index 27b5d18438e..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultOverrides.kt +++ /dev/null @@ -1,38 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -class A { - public int first(@DefaultValue("42") int a) { - return a; - } -} - -// FILE: B.java -class B extends A { - public int first(int a) { - return a; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - val b = B() - val ab: A = B() - - if (a.first() != 42) { - return "FAIL 1" - } - if (b.first() != 42) { - return "FAIL 2" - } - if (ab.first() != 42) { - return "FAIL 4" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt deleted file mode 100644 index 1f295ce7d7f..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt +++ /dev/null @@ -1,88 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - - public int a(@DefaultValue("42") int arg) { - return arg; - } - - public float b(@DefaultValue("42.5") float arg) { - return arg; - } - - public boolean c(@DefaultValue("true") boolean arg) { - return arg; - } - - public byte d(@DefaultValue("42") byte arg) { - return arg; - } - - public char e(@DefaultValue("o") char arg) { - return arg; - } - - public double f(@DefaultValue("1e12") double arg) { - return arg; - } - - public String g(@DefaultValue("hello") String arg) { - return arg; - } - - public long h(@DefaultValue("42424242424242") long arg) { - return arg; - } - - public short i(@DefaultValue("123") short arg) { - return arg; - } -} - -// FILE: test.kt -fun box(): String { - val a = A() - - if (a.a() != 42) { - return "FAIL Int: ${a.a()}" - } - - if (a.b() != 42.5f) { - return "FAIL Float: ${a.b()}" - } - - if (!a.c()) { - return "FAIL Boolean: ${a.c()}" - } - - if (a.d() != 42.toByte()) { - return "FAIL Byte: ${a.d()}" - } - - if (a.e() != 'o') { - return "FAIL Char: ${a.e()}" - } - - if (a.f() != 1e12) { - return "FAIl Double: ${a.f()}" - } - - if (a.g() != "hello") { - return "FAIL String: ${a.g()}" - } - - if (a.h() != 42424242424242) { - return "FAIL Long: ${a.h()}" - } - - if (a.i() != 123.toShort()) { - return "FAIL Short: ${a.i()}" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultValueInConstructor.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultValueInConstructor.kt deleted file mode 100644 index 026dd9f49ce..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultValueInConstructor.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - public String x; - public A(@DefaultValue("OK") String hello) { - x = hello; - } -} - -// FILE: test.kt - -fun box(): String { - val a = A() - - val b = object : A() { - } - - val c = object : A() { - fun hello() = x - } - - if (a.x != "OK") { - return "FAIL 1" - } - - if (b.x != "OK") { - return "FAIL 2" - } - - if (c.hello() != "OK") { - return "FAIL 3" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithJavaBase.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithJavaBase.kt deleted file mode 100644 index b809e2b90fa..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithJavaBase.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - public int x(@DefaultValue("42") int x) { - return x; - } -} - -// FILE: B.kt -class B : A() { - override fun x(x: Int): Int = x + 1 -} - -// FILE: box.kt -fun box(): String { - if (B().x() != 43) { - return "FAIL" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithKotlinBase.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithKotlinBase.kt deleted file mode 100644 index e1735227023..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/defaultWithKotlinBase.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.kt -open class A { - open fun x(x: Int = foo()) = x - private fun foo() = 42 -} - -// FILE: B.java -public class B extends A { - public int x(int i) { - return i + 1; - } -} - -// FILE: box.kt -fun box(): String { - if (B().x() != 43) { - return "FAIL" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/signatureAnnotations/reorderedParameterNames.kt b/backend.native/tests/external/codegen/box/signatureAnnotations/reorderedParameterNames.kt deleted file mode 100644 index 6227b07240c..00000000000 --- a/backend.native/tests/external/codegen/box/signatureAnnotations/reorderedParameterNames.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: A.java -// ANDROID_ANNOTATIONS - -import kotlin.annotations.jvm.internal.*; - -public class A { - public int connect(@ParameterName("host") int host, @ParameterName("port") int port) { - return host; - } -} - -// FILE: test.kt -fun box(): String { - val test = A() - - if (test.connect(host = 42, port = 8080) != 42) { - return "FAIL 1" - } - - if (test.connect(port = 1234, host = 5678) != 5678) { - return "FAIL 2" - } - - if (test.connect(9876, 4321) != 9876) { - return "FAIL 3" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/smap/chainCalls.kt b/backend.native/tests/external/codegen/box/smap/chainCalls.kt deleted file mode 100644 index 73da8b97720..00000000000 --- a/backend.native/tests/external/codegen/box/smap/chainCalls.kt +++ /dev/null @@ -1,86 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -package test -fun testProperLineNumber(): String { - var exceptionCount = 0; - try { - test(). - test(). - fail() - - } - catch(e: AssertionError) { - val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("chainCalls.kt:10" != actual) { - return "fail 1: ${actual}" - } - exceptionCount++ - } - - try { - call(). - test(). - fail() - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("chainCalls.kt:25" != actual) { - return "fail 2: ${actual}" - } - exceptionCount++ - } - - try { - test(). - fail() - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("chainCalls.kt:38" != actual) { - return "fail 3: ${actual}" - } - exceptionCount++ - } - - try { - test().fail() - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("chainCalls.kt:50" != actual) { - return "fail 4: ${actual}" - } - exceptionCount++ - } - - return if (exceptionCount == 4) "OK" else "fail" -} - -fun box(): String { - return testProperLineNumber() -} - -public fun checkEquals(p1: String, p2: String) { - throw AssertionError("fail") -} - -inline fun test(): String { - return "123" -} - -inline fun String.test(): String { - return "123" -} - -fun String.fail(): String { - throw AssertionError("fail") -} - -fun call(): String { - return "xxx" -} diff --git a/backend.native/tests/external/codegen/box/smap/infixCalls.kt b/backend.native/tests/external/codegen/box/smap/infixCalls.kt deleted file mode 100644 index eeab32d82e9..00000000000 --- a/backend.native/tests/external/codegen/box/smap/infixCalls.kt +++ /dev/null @@ -1,66 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -package test -fun testProperLineNumber(): String { - var exceptionCount = 0; - try { - test() fail - call() - } - catch(e: AssertionError) { - val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("infixCalls.kt:8" != actual) { - return "fail 1: ${actual}" - } - exceptionCount++ - } - - try { - call() fail - test() - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("infixCalls.kt:21" != actual) { - return "fail 1: ${actual}" - } - exceptionCount++ - } - - try { - call() fail test() - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("infixCalls.kt:34" != actual) { - return "fail 1: ${actual}" - } - exceptionCount++ - } - - return if (exceptionCount == 3) "OK" else "fail" -} - -fun box(): String { - return testProperLineNumber() -} - -public fun checkEquals(p1: String, p2: String) { - throw AssertionError("fail") -} - -inline fun test(): String { - return "123" -} - -infix fun String.fail(p: String): String { - throw AssertionError("fail") -} - -fun call(): String { - return "xxx" -} diff --git a/backend.native/tests/external/codegen/box/smap/simpleCallWithParams.kt b/backend.native/tests/external/codegen/box/smap/simpleCallWithParams.kt deleted file mode 100644 index 473fa927e1b..00000000000 --- a/backend.native/tests/external/codegen/box/smap/simpleCallWithParams.kt +++ /dev/null @@ -1,110 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FULL_JDK -package test -fun testProperLineNumberAfterInline(): String { - var exceptionCount = 0; - try { - fail(inlineFun(), - "12") - } - catch(e: AssertionError) { - val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:8" != actual) { - return "fail 1: ${actual}" - } - exceptionCount++ - } - - try { - fail("12", - inlineFun()) - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:21" != actual) { - return "fail 2: ${actual}" - } - exceptionCount++ - } - - return if (exceptionCount == 2) "OK" else "fail" -} - -fun testProperLineForOtherParameters(): String { - var exceptionCount = 0; - try { - fail(inlineFun(), - fail()) - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:40" != actual) { - return "fail 3: ${actual}" - } - exceptionCount++ - - } - - try { - fail(fail(), - inlineFun()) - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:53" != actual) { - return "fail 4: ${actual}" - } - exceptionCount++ - } - - try { - fail(fail(), inlineFun()) - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:66" != actual) { - return "fail 5: ${actual}" - } - exceptionCount++ - } - - try { - fail(fail(), inlineFun()) - } - catch(e: AssertionError) { - val entry = e.stackTrace!![1] - val actual = "${entry.getFileName()}:${entry.getLineNumber()}" - if ("simpleCallWithParams.kt:78" != actual) { - return "fail 6: ${actual}" - } - exceptionCount++ - } - - return if (exceptionCount == 4) "OK" else "fail" -} - - -fun box(): String { - val res = testProperLineNumberAfterInline() - if (res != "OK") return "$res" - - return testProperLineForOtherParameters() -} - -public fun fail(p1: String, p2: String) { - throw AssertionError("fail") -} - -inline fun inlineFun(): String { - return "123" -} - -fun fail(): String { - throw AssertionError("fail") -} diff --git a/backend.native/tests/external/codegen/box/smartCasts/falseSmartCast.kt b/backend.native/tests/external/codegen/box/smartCasts/falseSmartCast.kt deleted file mode 100644 index cfdcf7e1e7c..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/falseSmartCast.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class SuperFoo { - public fun bar(): String { - if (this is Foo) { - superFoo() // Smart cast - return baz() // Cannot be cast - } - return baz() - } - - public fun baz() = "OK" -} - -class Foo : SuperFoo() { - public fun superFoo() {} -} - -fun box(): String = Foo().bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/smartCasts/genericIntersection.kt b/backend.native/tests/external/codegen/box/smartCasts/genericIntersection.kt deleted file mode 100644 index 51c34682f0e..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/genericIntersection.kt +++ /dev/null @@ -1,9 +0,0 @@ -// See also KT-7801 -class A - -fun test(v: T): T { - val a: T = if (v !is A) v else v - return a -} - -fun box() = test("OK") diff --git a/backend.native/tests/external/codegen/box/smartCasts/genericSet.kt b/backend.native/tests/external/codegen/box/smartCasts/genericSet.kt deleted file mode 100644 index 48350f84309..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/genericSet.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Wrapper(var x: T) - -inline fun change(w: Wrapper, x: Any?) { - if (x is T) { - w.x = x - } -} - -fun box(): String { - val w = Wrapper("FAIL") - change(w, "OK") - return w.x -} diff --git a/backend.native/tests/external/codegen/box/smartCasts/implicitExtensionReceiver.kt b/backend.native/tests/external/codegen/box/smartCasts/implicitExtensionReceiver.kt deleted file mode 100644 index f315a202bdb..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/implicitExtensionReceiver.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - fun foo() = "OK" -} - -fun A?.bar() = if (this != null) foo() else "FAIL" - -fun box() = A().bar() diff --git a/backend.native/tests/external/codegen/box/smartCasts/implicitMemberReceiver.kt b/backend.native/tests/external/codegen/box/smartCasts/implicitMemberReceiver.kt deleted file mode 100644 index f38fa9fd9b5..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/implicitMemberReceiver.kt +++ /dev/null @@ -1,20 +0,0 @@ -open class A { - open val a = "OK" -} - -class B : A() { - override val a = "FAIL" - fun foo() = "CRUSH" -} - -class C { - fun A?.complex(): String { - if (this is B) return foo() - else if (this != null) return a - else return "???" - } - - fun bar() = A().complex() -} - -fun box() = C().bar() diff --git a/backend.native/tests/external/codegen/box/smartCasts/implicitReceiver.kt b/backend.native/tests/external/codegen/box/smartCasts/implicitReceiver.kt deleted file mode 100644 index 911f53248c5..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/implicitReceiver.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class A { - class B : A() { - val a = "FAIL" - } - - fun foo(): String { - if (this is B) return a - return "OK" - } -} - - -fun box(): String = A().foo() diff --git a/backend.native/tests/external/codegen/box/smartCasts/implicitReceiverInWhen.kt b/backend.native/tests/external/codegen/box/smartCasts/implicitReceiverInWhen.kt deleted file mode 100644 index ce31ad2d9f3..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/implicitReceiverInWhen.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A { - fun f(): String = - when (this) { - is B -> x - else -> "FAIL" - } -} - -class B(val x: String) : A() - -fun box() = B("OK").f() diff --git a/backend.native/tests/external/codegen/box/smartCasts/implicitToGrandSon.kt b/backend.native/tests/external/codegen/box/smartCasts/implicitToGrandSon.kt deleted file mode 100644 index 588cc9ff24d..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/implicitToGrandSon.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class A { - open fun foo() = "FAIL" - - fun bar() = if (this is C) foo() else foo() -} - -open class B : A() - -open class C : B() { - override fun foo() = "OK" -} - -fun box() = C().bar() diff --git a/backend.native/tests/external/codegen/box/smartCasts/kt17725.kt b/backend.native/tests/external/codegen/box/smartCasts/kt17725.kt deleted file mode 100644 index 71334c4f85b..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/kt17725.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Bob { - fun Bob.bar() = "OK" -} - -fun Any.foo() = when(this) { - is Bob -> bar() - else -> throw AssertionError() -} - -fun box(): String = Bob().foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/smartCasts/kt19058.kt b/backend.native/tests/external/codegen/box/smartCasts/kt19058.kt deleted file mode 100644 index 0bf2c376954..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/kt19058.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: Test.kt -open class KFoo { - fun foo(): String { - if (this is KFooBar) return bar - throw AssertionError() - } -} - -class KFooBar : KFoo(), JBar - -fun box(): String = KFooBar().foo() - -// FILE: JBar.java -public interface JBar { - default String getBar() { - return "OK"; - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/smartCasts/kt19100.kt b/backend.native/tests/external/codegen/box/smartCasts/kt19100.kt deleted file mode 100644 index 43113a91d5e..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/kt19100.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class KFoo { - fun foo(): String { - if (this is KFooQux) return qux - throw AssertionError() - } -} - -class KFooQux : KFoo() - -val KFooQux.qux get() = "OK" - -fun box() = KFooQux().foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/smartCasts/lambdaArgumentWithoutType.kt b/backend.native/tests/external/codegen/box/smartCasts/lambdaArgumentWithoutType.kt deleted file mode 100644 index a5e38e427a0..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/lambdaArgumentWithoutType.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -class Foo(val s: String) -fun foo(): Foo? = Foo("OK") - -fun run(f: () -> T): T = f() - -val foo: Foo = run { - val x = foo() - if (x == null) throw Exception() - x -} - -fun box() = foo.s diff --git a/backend.native/tests/external/codegen/box/smartCasts/nullSmartCast.kt b/backend.native/tests/external/codegen/box/smartCasts/nullSmartCast.kt deleted file mode 100644 index 1b74cbd9ea3..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/nullSmartCast.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun String?.foo() = this ?: "OK" - -fun foo(i: Int?): String { - if (i == null) return i.foo() - return "$i" -} - -fun box() = foo(null) diff --git a/backend.native/tests/external/codegen/box/smartCasts/smartCastInsideIf.kt b/backend.native/tests/external/codegen/box/smartCasts/smartCastInsideIf.kt deleted file mode 100644 index 10d4a4c76c8..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/smartCastInsideIf.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A(val s: String = "FAIL") - -private fun foo(a: A?, aOther: A?): A { - return if (a == null) { - A() - } - else { - if (aOther == null) { - return A() - } - aOther - } -} - -fun box() = foo(A("???"), A("OK")).s diff --git a/backend.native/tests/external/codegen/box/smartCasts/whenSmartCast.kt b/backend.native/tests/external/codegen/box/smartCasts/whenSmartCast.kt deleted file mode 100644 index 8069048ce00..00000000000 --- a/backend.native/tests/external/codegen/box/smartCasts/whenSmartCast.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun baz(s: String?): Int { - if (s == null) return 0 - return when(s) { - "abc" -> s - else -> "xyz" - }.length -} - -fun box() = if (baz("abc") == 3 && baz("") == 3 && baz(null) == 0) "OK" else "FAIL" diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/bridgeNotEmptyMap.kt b/backend.native/tests/external/codegen/box/specialBuiltins/bridgeNotEmptyMap.kt deleted file mode 100644 index 1b1d43a9c20..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/bridgeNotEmptyMap.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -private object NotEmptyMap : MutableMap { - override fun containsKey(key: Any): Boolean = true - override fun containsValue(value: Int): Boolean = true - - // non-special bridges get(Object)Integer -> get(Object)I - override fun get(key: Any): Int = 1 - override fun remove(key: Any): Int = 1 - - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun put(key: Any, value: Int): Int? = throw UnsupportedOperationException() - override fun putAll(from: Map): Unit = throw UnsupportedOperationException() - override fun clear(): Unit = throw UnsupportedOperationException() - override val entries: MutableSet> get() = null!! - override val keys: MutableSet get() = null!! - override val values: MutableCollection get() = null!! -} - - -fun box(): String { - val n = NotEmptyMap as MutableMap - - if (n.get(null) != null) return "fail 1" - if (n.containsKey(null)) return "fail 2" - if (n.containsValue(null)) return "fail 3" - if (n.remove(null) != null) return "fail 4" - - if (n.get(1) == null) return "fail 5" - if (!n.containsKey("")) return "fail 6" - if (!n.containsValue(3)) return "fail 7" - if (n.remove("") == null) return "fail 8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/bridges.kt b/backend.native/tests/external/codegen/box/specialBuiltins/bridges.kt deleted file mode 100644 index c4cdd45fcaa..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/bridges.kt +++ /dev/null @@ -1,105 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -interface A0 { - val size: Int get() = 56 -} - -class B0 : Collection, A0 { - override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: String) = throw UnsupportedOperationException() - override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() - override val size: Int - get() = super.size -} - -open class A1 { - val size: Int = 56 -} - -class B1 : Collection, A1() { - override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: String) = throw UnsupportedOperationException() - override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() -} - -interface I2 { - val size: Int -} - -val list = ArrayList() - -class B2 : ArrayList(list), I2 - -interface I3 { - val size: T -} - -class B3 : ArrayList(list), I3 - -interface I4 { - val size: T get() = 56 as T -} - -class B4 : Collection, I4 { - override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: String) = throw UnsupportedOperationException() - override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() - override val size: Int - get() = super.size -} - -interface I5 : Collection { - override val size: Int get() = 56 -} - -class B5 : I5 { - override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: String) = throw UnsupportedOperationException() - override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() -} - -fun box(): String { - list.add("1") - - val b0 = B0() - if (b0.size != 56) return "fail 0: ${b0.size}" - var x: Collection = B0() - if (x.size != 56) return "fail 00: ${x.size}" - val a0: A0 = b0 - if (a0.size != 56) return "fail 000: ${a0.size}" - - val b1 = B1() - if (b1.size != 56) return "fail 1: ${b1.size}" - x = B1() - if (x.size != 56) return "fail 2: ${x.size}" - - val b2 = B2() - if (b2.size != 1) return "fail 3: ${b2.size}" - x = B2() - if (x.size != 1) return "fail 4: ${x.size}" - val i2: I2 = b2 - if (i2.size != 1) return "fail 5: ${i2.size}" - - val b3 = B3() - if (b3.size != 1) return "fail 6: ${b3.size}" - x = B3() - if (x.size != 1) return "fail 7: ${x.size}" - val i3: I3 = b3 - if (i3.size != 1) return "fail 8: ${i3.size}" - - val b4 = B4() - if (b4.size != 56) return "fail 9: ${b4.size}" - x = B4() - if (x.size != 56) return "fail 10: ${x.size}" - - val b5 = B5() - if (b5.size != 56) return "fail 11: ${b5.size}" - x = B5() - if (x.size != 56) return "fail 12: ${x.size}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/collectionImpl.kt b/backend.native/tests/external/codegen/box/specialBuiltins/collectionImpl.kt deleted file mode 100644 index 0e145b90460..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/collectionImpl.kt +++ /dev/null @@ -1,97 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class A1 : MutableCollection { - override val size: Int - get() = 56 - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(o: String): Boolean { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } - - override fun containsAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun add(e: String): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(o: String): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } -} - -class A2 : java.util.AbstractCollection() { - override val size: Int - get() = 56 - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - -class A3 : java.util.ArrayList() { - override val size: Int - get() = 56 -} - -interface Sized { - val size: Int -} - -class A4 : java.util.ArrayList(), Sized { - override val size: Int - get() = 56 -} - -fun check56(x: Collection) { - if (x.size != 56) throw java.lang.RuntimeException("fail ${x.size}") -} - -fun box(): String { - val a1 = A1() - if (a1.size != 56) return "fail 1: ${a1.size}" - check56(a1) - - val a2 = A2() - if (a2.size != 56) return "fail 2: ${a2.size}" - check56(a2) - - val a3 = A3() - if (a3.size != 56) return "fail 3: ${a3.size}" - check56(a3) - - val a4 = A4() - if (a4.size != 56) return "fail 4: ${a4.size}" - check56(a4) - - val sized: Sized = a4 - if (sized.size != 56) return "fail 5: ${a4.size}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/commonBridgesTarget.kt b/backend.native/tests/external/codegen/box/specialBuiltins/commonBridgesTarget.kt deleted file mode 100644 index 2f82d227446..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/commonBridgesTarget.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -open class Base() : HashSet() { - override fun remove(element: Target): Boolean { - return true - } -} - -class Derived : Base() { - // common "synthetic bridge override fun remove(element: DatabaseEntity): Boolean" should call - // `INVOKEVIRTUAL remove(Issue)` - // instead of `INVOKEVIRTUAL remove(OBJECT)` - override fun remove(element: Issue): Boolean { - return super.remove(element) - } -} - -open class DatabaseEntity -class Issue: DatabaseEntity() - -fun box(): String { - val sprintIssues = Derived() - if (!sprintIssues.remove(Issue())) return "Fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/emptyList.kt b/backend.native/tests/external/codegen/box/specialBuiltins/emptyList.kt deleted file mode 100644 index 51ff7cd35e7..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/emptyList.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -private object EmptyList : List { - override fun contains(element: Nothing): Boolean = false - override fun containsAll(elements: Collection): Boolean = elements.isEmpty() - override fun indexOf(element: Nothing): Int = -2 - override fun lastIndexOf(element: Nothing): Int = -2 - - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - - override fun iterator(): Iterator = throw UnsupportedOperationException() - override fun get(index: Int): Nothing = throw UnsupportedOperationException() - override fun listIterator(): ListIterator = throw UnsupportedOperationException() - override fun listIterator(index: Int): ListIterator = throw UnsupportedOperationException() - override fun subList(fromIndex: Int, toIndex: Int): List = throw UnsupportedOperationException() -} - -fun box(): String { - val n = EmptyList as List - - if (n.contains("")) return "fail 1" - if (n.indexOf("") != -1) return "fail 2" - if (n.lastIndexOf("") != -1) return "fail 3" - - val nullAny = EmptyList as List - - if (nullAny.contains(null)) return "fail 4" - if (nullAny.indexOf(null) != -1) return "fail 5" - if (nullAny.lastIndexOf(null) != -1) return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/emptyMap.kt b/backend.native/tests/external/codegen/box/specialBuiltins/emptyMap.kt deleted file mode 100644 index c0770bd6b2a..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/emptyMap.kt +++ /dev/null @@ -1,22 +0,0 @@ -private object EmptyMap : Map { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - - override fun containsKey(key: Any): Boolean = false - override fun containsValue(value: Nothing): Boolean = false - override fun get(key: Any): Nothing? = null - override val entries: Set> get() = null!! - override val keys: Set get() = null!! - override val values: Collection get() = null!! -} - - -fun box(): String { - val n = EmptyMap as Map - - if (n.get(null) != null) return "fail 1" - if (n.containsKey(null)) return "fail 2" - if (n.containsValue(null)) return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/emptyStringMap.kt b/backend.native/tests/external/codegen/box/specialBuiltins/emptyStringMap.kt deleted file mode 100644 index fd4953af8ec..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/emptyStringMap.kt +++ /dev/null @@ -1,21 +0,0 @@ -private object EmptyStringMap : Map { - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - - override fun containsKey(key: String): Boolean = false - override fun containsValue(value: Nothing): Boolean = false - override fun get(key: String): Nothing? = null - override val entries: Set> get() = null!! - override val keys: Set get() = null!! - override val values: Collection get() = null!! -} - -fun box(): String { - val n = EmptyStringMap as Map - - if (n.get(null) != null) return "fail 1" - if (n.containsKey(null)) return "fail 2" - if (n.containsValue(null)) return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/entrySetSOE.kt b/backend.native/tests/external/codegen/box/specialBuiltins/entrySetSOE.kt deleted file mode 100644 index f00808d9bc5..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/entrySetSOE.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -open class Map1 : HashMap() -class Map2 : Map1() -fun box(): String { - val m = Map2() - if (m.entries.size != 0) return "fail 1" - - m.put("56", "OK") - val x = m.entries.iterator().next() - - if (x.key != "56" || x.value != "OK") return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/enumAsOrdinaled.kt b/backend.native/tests/external/codegen/box/specialBuiltins/enumAsOrdinaled.kt deleted file mode 100644 index 6b3eda01d77..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/enumAsOrdinaled.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface Ordinaled { - val ordinal: Int -} - -enum class A : Ordinaled { - X -} - - -fun box(): String { - val result = (A.X as Ordinaled).ordinal - - if (result != 0) return "fail 1: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/exceptionCause.kt b/backend.native/tests/external/codegen/box/specialBuiltins/exceptionCause.kt deleted file mode 100644 index cd0501bdf1d..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/exceptionCause.kt +++ /dev/null @@ -1,25 +0,0 @@ -class CustomException : Throwable { - constructor(message: String?, cause: Throwable?) : super(message, cause) - - constructor(message: String?) : super(message, null) - - constructor(cause: Throwable?) : super(cause) - - constructor() : super() -} - -fun box(): String { - var t = CustomException("O", Throwable("K")) - if (t.message != "O" || t.cause?.message != "K") return "fail1" - - t = CustomException(Throwable("OK")) - if (t.message == null || t.message == "OK" || t.cause?.message != "OK") return "fail2" - - t = CustomException("OK") - if (t.message != "OK" || t.cause != null) return "fail3" - - t = CustomException() - if (t.message != null || t.cause != null) return "fail4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/explicitSuperCall.kt b/backend.native/tests/external/codegen/box/specialBuiltins/explicitSuperCall.kt deleted file mode 100644 index bc281a4b112..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/explicitSuperCall.kt +++ /dev/null @@ -1,12 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -class A : ArrayList() { - override val size: Int get() = super.size + 56 -} - -fun box(): String { - val a = A() - if (a.size != 56) return "fail: ${a.size}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt b/backend.native/tests/external/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt deleted file mode 100644 index 747fb11092b..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/irrelevantRemoveAtOverride.kt +++ /dev/null @@ -1,106 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -interface Container { - fun removeAt(x: Int): String -} - -open class ContainerImpl : Container { - override fun removeAt(x: Int) = "abc" -} - -class A : ContainerImpl(), MutableList { - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun contains(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun get(index: Int): String { - throw UnsupportedOperationException() - } - - override fun indexOf(element: String): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(element: String): Int { - throw UnsupportedOperationException() - } - - override fun add(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: String): String { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: String) { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val a = A() - if (a.removeAt(0) != "abc") return "fail 1" - - val l: MutableList = a - if (l.removeAt(0) != "abc") return "fail 2" - - val anyList: MutableList = a as MutableList - if (anyList.removeAt(0) != "abc") return "fail 3" - - val container: Container = a - if (container.removeAt(0) != "abc") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/maps.kt b/backend.native/tests/external/codegen/box/specialBuiltins/maps.kt deleted file mode 100644 index e16c06cba11..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/maps.kt +++ /dev/null @@ -1,43 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -class A : Map { - override val size: Int get() = 56 - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun containsKey(key: String): Boolean { - throw UnsupportedOperationException() - } - - override fun containsValue(value: String): Boolean { - throw UnsupportedOperationException() - } - - override fun get(key: String): String? { - throw UnsupportedOperationException() - } - - override val keys: Set get() { - throw UnsupportedOperationException() - } - - override val values: Collection get() { - throw UnsupportedOperationException() - } - - override val entries: Set> get() { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val a = A() - if (a.size != 56) return "fail 1: ${a.size}" - - val x: Map = a - if (x.size != 56) return "fail 2: ${x.size}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt b/backend.native/tests/external/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt deleted file mode 100644 index 8857356fa06..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/noSpecialBridgeInSuperClass.kt +++ /dev/null @@ -1,61 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -var result = "" - -public abstract class AbstractFoo : Map { - override operator fun get(key: K): V? { - result = "AbstractFoo" - return null - } - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun containsKey(key: K): Boolean { - throw UnsupportedOperationException() - } - - override fun containsValue(value: V): Boolean { - throw UnsupportedOperationException() - } - - override val keys: Set - get() = throw UnsupportedOperationException() - override val values: Collection - get() = throw UnsupportedOperationException() - override val entries: Set> - get() = throw UnsupportedOperationException() -} - -public open class StringFoo : AbstractFoo() { - override operator fun get(key: String): E? { - result = "StringFoo" - return null - } -} - -public class IntFoo : AbstractFoo() { - override operator fun get(key: Int): E? { - result = "IntFoo" - return null - } -} - -public class AnyFoo : AbstractFoo() {} - -fun box(): String { - StringFoo().get("") - if (result != "StringFoo") return "fail 1: $result" - - IntFoo().get(1) - if (result != "IntFoo") return "fail 2: $result" - - AnyFoo().get(null) - if (result != "AbstractFoo") return "fail 3: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyListAny.kt b/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyListAny.kt deleted file mode 100644 index e289d230889..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyListAny.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -private object NotEmptyList : MutableList { - override fun contains(element: Any): Boolean = true - override fun indexOf(element: Any): Int = 0 - override fun lastIndexOf(element: Any): Int = 0 - override fun remove(element: Any): Boolean = true - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun containsAll(elements: Collection): Boolean = elements.isEmpty() - override fun isEmpty(): Boolean = throw UnsupportedOperationException() - override fun get(index: Int): Any = throw UnsupportedOperationException() - override fun add(element: Any): Boolean = throw UnsupportedOperationException() - override fun addAll(elements: Collection): Boolean = throw UnsupportedOperationException() - override fun addAll(index: Int, elements: Collection): Boolean = throw UnsupportedOperationException() - override fun removeAll(elements: Collection): Boolean = throw UnsupportedOperationException() - override fun retainAll(elements: Collection): Boolean = throw UnsupportedOperationException() - override fun clear(): Unit = throw UnsupportedOperationException() - override fun set(index: Int, element: Any): Any = throw UnsupportedOperationException() - override fun add(index: Int, element: Any): Unit = throw UnsupportedOperationException() - override fun removeAt(index: Int): Any = throw UnsupportedOperationException() - override fun listIterator(): MutableListIterator = throw UnsupportedOperationException() - override fun listIterator(index: Int): MutableListIterator = throw UnsupportedOperationException() - override fun subList(fromIndex: Int, toIndex: Int): MutableList = throw UnsupportedOperationException() - override fun iterator(): MutableIterator = throw UnsupportedOperationException() -} - -fun box(): String { - val n = NotEmptyList as MutableList - - if (n.contains(null)) return "fail 1" - if (n.indexOf(null) != -1) return "fail 2" - if (n.lastIndexOf(null) != -1) return "fail 3" - - if (!n.contains("")) return "fail 3" - if (n.indexOf("") != 0) return "fail 4" - if (n.lastIndexOf("") != 0) return "fail 5" - - if (n.remove(null)) return "fail 6" - if (!n.remove("")) return "fail 7" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyMap.kt b/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyMap.kt deleted file mode 100644 index 3e19df62282..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/notEmptyMap.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -private object NotEmptyMap : MutableMap { - override fun containsKey(key: Any): Boolean = true - override fun containsValue(value: Any): Boolean = true - override fun get(key: Any): Any? = Any() - override fun remove(key: Any): Any? = Any() - - override val size: Int get() = 0 - override fun isEmpty(): Boolean = true - override fun put(key: Any, value: Any): Any? = throw UnsupportedOperationException() - override fun putAll(from: Map): Unit = throw UnsupportedOperationException() - override fun clear(): Unit = throw UnsupportedOperationException() - override val entries: MutableSet> get() = null!! - override val keys: MutableSet get() = null!! - override val values: MutableCollection get() = null!! -} - - -fun box(): String { - val n = NotEmptyMap as MutableMap - - if (n.get(null) != null) return "fail 1" - if (n.containsKey(null)) return "fail 2" - if (n.containsValue(null)) return "fail 3" - if (n.remove(null) != null) return "fail 4" - - if (n.get("") == null) return "fail 5" - if (!n.containsKey("")) return "fail 6" - if (!n.containsValue("")) return "fail 7" - if (n.remove("") == null) return "fail 8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/redundantStubForSize.kt b/backend.native/tests/external/codegen/box/specialBuiltins/redundantStubForSize.kt deleted file mode 100644 index df0376cc9cb..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/redundantStubForSize.kt +++ /dev/null @@ -1,28 +0,0 @@ -open class A1 { - open val size: Int = 56 -} - -class A2 : A1(), Collection { - // No 'getSize()' method should be generated in A2 - - override fun contains(element: String): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun iterator(): Iterator { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. - } -} - -fun box(): String { - if (A2().size != 56) return "fail 1" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt b/backend.native/tests/external/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt deleted file mode 100644 index 7ab209eefea..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/removeAtTwoSpecialBridges.kt +++ /dev/null @@ -1,98 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -open class A0 : MutableList { - override fun add(element: E): Boolean { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: E) { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun remove(element: E): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAt(index: Int): E = "K" as E - - override fun retainAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: E): E { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun contains(element: E): Boolean { - throw UnsupportedOperationException() - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun get(index: Int): E { - throw UnsupportedOperationException() - } - - override fun indexOf(element: E): Int { - throw UnsupportedOperationException() - } - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(element: E): Int { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - -class A1() : A0() { - override fun removeAt(p0: Int): String = "O" -} - -class A2 : A0() - -// Basically this test checks that no redundant special bridges were generated (i.e. no VerifyError happens) -fun box(): String { - val a1 = A1() - val a2 = A2() - - return a1.removeAt(123) + a2.removeAt(456) -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/removeSetInt.kt b/backend.native/tests/external/codegen/box/specialBuiltins/removeSetInt.kt deleted file mode 100644 index a7c0b27d8ce..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/removeSetInt.kt +++ /dev/null @@ -1,20 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -class MySet : HashSet() { - override fun remove(element: Int): Boolean { - return super.remove(element) - } -} - -fun box(): String { - val a = MySet() - a.add(1) - a.add(2) - a.add(3) - - if (!a.remove(1)) return "fail 1" - if (a.remove(1)) return "fail 2" - if (a.contains(1)) return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/throwable.kt b/backend.native/tests/external/codegen/box/specialBuiltins/throwable.kt deleted file mode 100644 index e4040a63794..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/throwable.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - try { - throw Throwable("OK", null) - } catch (t: Throwable) { - if (t.cause != null) return "fail 1" - return t.message!! - } - - return "fail 2" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/throwableCause.kt b/backend.native/tests/external/codegen/box/specialBuiltins/throwableCause.kt deleted file mode 100644 index ade7379bb50..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/throwableCause.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - var t = Throwable("O", Throwable("K")) - if (t.message != "O" || t.cause?.message != "K") return "fail1" - - t = Throwable(Throwable("OK")) - if (t.message == null || t.message == "OK" || t.cause?.message != "OK") return "fail2" - - t = Throwable("OK") - if (t.message != "OK" || t.cause != null) return "fail3" - - t = Throwable() - if (t.message != null || t.cause != null) return "fail4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/throwableImpl.kt b/backend.native/tests/external/codegen/box/specialBuiltins/throwableImpl.kt deleted file mode 100644 index ad070a0298c..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/throwableImpl.kt +++ /dev/null @@ -1,21 +0,0 @@ -class MyThrowable(message: String? = null, cause: Throwable? = null) : Throwable(message, cause) { - - override val message: String? - get() = "My message: " + super.message - - override val cause: Throwable? - get() = super.cause ?: this - -} - -fun box(): String { - try { - throw MyThrowable("test") - } catch (t: MyThrowable) { - if (t.cause != t) return "fail t.cause" - if (t.message != "My message: test") return "fail t.message" - return "OK" - } - - return "fail: MyThrowable wasn't caught." -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/throwableImplWithSecondaryConstructor.kt b/backend.native/tests/external/codegen/box/specialBuiltins/throwableImplWithSecondaryConstructor.kt deleted file mode 100644 index afa627c4598..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/throwableImplWithSecondaryConstructor.kt +++ /dev/null @@ -1,21 +0,0 @@ -class MyThrowable : Throwable { - val x: String - - constructor(x: String, message: String, cause: Throwable? = null) : super(x + message, cause) { - this.x = x - } -} - -fun box(): String { - try { - throw MyThrowable("O", "K") - } - catch (t: MyThrowable) { - if (t.cause != null) return "fail t.cause" - if (t.message != "OK") return "fail t.message: ${t.message}" - if (t.x != "O") return "fail t.x: ${t.x}" - return "OK" - } - - return "fail: MyThrowable wasn't caught." -} diff --git a/backend.native/tests/external/codegen/box/specialBuiltins/valuesInsideEnum.kt b/backend.native/tests/external/codegen/box/specialBuiltins/valuesInsideEnum.kt deleted file mode 100644 index ee008bfcf82..00000000000 --- a/backend.native/tests/external/codegen/box/specialBuiltins/valuesInsideEnum.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class Variants { - O, K; - companion object { - val valueStr = values()[0].name + Variants.values()[1].name - } -} - -fun box() = Variants.valueStr diff --git a/backend.native/tests/external/codegen/box/statics/anonymousInitializerIObject.kt b/backend.native/tests/external/codegen/box/statics/anonymousInitializerIObject.kt deleted file mode 100644 index 72aa88ec05b..00000000000 --- a/backend.native/tests/external/codegen/box/statics/anonymousInitializerIObject.kt +++ /dev/null @@ -1,11 +0,0 @@ -object Foo { - val bar: String - - init { - bar = "OK" - } -} - -fun box(): String { - return Foo.bar -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/anonymousInitializerInClassObject.kt b/backend.native/tests/external/codegen/box/statics/anonymousInitializerInClassObject.kt deleted file mode 100644 index 3b3559b2895..00000000000 --- a/backend.native/tests/external/codegen/box/statics/anonymousInitializerInClassObject.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Foo { - companion object { - val bar: String - - init { - bar = "OK" - } - } -} - -fun box(): String { - return Foo.bar -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/fields.kt b/backend.native/tests/external/codegen/box/statics/fields.kt deleted file mode 100644 index a32fda1f232..00000000000 --- a/backend.native/tests/external/codegen/box/statics/fields.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Child.java - -class Child extends Parent { - public static int b = 3; - public static int c = 4; -} - -// FILE: Parent.java - -class Parent { - public static int a = 1; - public static int b = 2; -} - -// FILE: test.kt - -fun box(): String { - if (Parent.a != 1) return "expected Parent.a == 1" - if (Parent.b != 2) return "expected Parent.b == 2" - if (Child.a != 1) return "expected Child.a == 1" - if (Child.b != 3) return "expected Child.b == 3" - if (Child.c != 4) return "expected Child.c == 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/statics/functions.kt b/backend.native/tests/external/codegen/box/statics/functions.kt deleted file mode 100644 index 0a2e6767fdb..00000000000 --- a/backend.native/tests/external/codegen/box/statics/functions.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Child.java - -class Child extends Parent { - public static String bar() { - return "Child.bar"; - } - public static String baz() { - return "Child.baz"; - } -} - -// FILE: Parent.java - -class Parent { - public static String foo() { - return "Parent.foo"; - } - public static String baz() { - return "Parent.baz"; - } -} - -// FILE: test.kt - -fun box(): String { - if (Parent.foo() != "Parent.foo") return "expected: Parent.foo" - if (Parent.baz() != "Parent.baz") return "expected: Parent.baz" - if (Child.foo() != "Parent.foo") return "expected: Child.foo() != Parent.foo" - if (Child.baz() != "Child.baz") return "expected: Child.baz" - if (Child.bar() != "Child.bar") return "expected: Child.bar" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/statics/hidePrivateByPublic.kt b/backend.native/tests/external/codegen/box/statics/hidePrivateByPublic.kt deleted file mode 100644 index 6b6e3642663..00000000000 --- a/backend.native/tests/external/codegen/box/statics/hidePrivateByPublic.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Child.java - -class Child extends Parent { - public static String a = "2"; - public static String foo() { - return "Child.foo()"; - } - public static String foo(int i) { - return "Child.foo(int)"; - } -} - -// FILE: Parent.java - -class Parent { - private static int a = 1; - private static String foo() { - return "Parent.foo"; - } -} - -// FILE: test.kt - -fun box(): String { - if (Child.a != "2") return "Fail #1" - if (Child.foo() != "Child.foo()") return "Fail #2" - if (Child.foo(1) != "Child.foo(int)") return "Fail #3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/statics/incInClassObject.kt b/backend.native/tests/external/codegen/box/statics/incInClassObject.kt deleted file mode 100644 index 2a6db13215f..00000000000 --- a/backend.native/tests/external/codegen/box/statics/incInClassObject.kt +++ /dev/null @@ -1,74 +0,0 @@ -class A { - @kotlin.native.ThreadLocal - companion object { - private var r: Int = 1; - - fun test(): Int { - r++ - ++r - return r - } - - var holder: String = "" - - var r2: Int = 1 - get() { - holder += "getR2" - return field - } - - fun test2() : Int { - r2++ - ++r2 - return r2 - } - - var r3: Int = 1 - set(p: Int) { - holder += "setR3" - field = p - } - - fun test3() : Int { - r3++ - ++r3 - return r3 - } - - var r4: Int = 1 - get() { - holder += "getR4" - return field - } - set(p: Int) { - holder += "setR4" - field = p - } - - fun test4() : Int { - r4++ - holder += ":" - ++r4 - return r4 - } - } -} - -fun box() : String { - val p = A.test() - if (p != 3) return "fail 1: $p" - - val p2 = A.test2() - var holderValue = A.holder - if (p2 != 3 || holderValue != "getR2getR2getR2getR2") return "fail 2: $p2 ${holderValue}" - - A.holder = "" - val p3 = A.test3() - if (p3 != 3 || A.holder != "setR3setR3") return "fail 3: $p3 ${A.holder}" - - A.holder = "" - val p4 = A.test4() - if (p4 != 3 || A.holder != "getR4setR4:getR4setR4getR4getR4") return "fail 4: $p4 ${A.holder}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/incInObject.kt b/backend.native/tests/external/codegen/box/statics/incInObject.kt deleted file mode 100644 index 1e4ee07cea5..00000000000 --- a/backend.native/tests/external/codegen/box/statics/incInObject.kt +++ /dev/null @@ -1,72 +0,0 @@ -@kotlin.native.ThreadLocal -object A { - private var r: Int = 1; - - fun test() : Int { - r++ - ++r - return r - } - - var holder: String = "" - - var r2: Int = 1 - get() { - holder += "getR2" - return field - } - - fun test2() : Int { - r2++ - ++r2 - return r2 - } - - var r3: Int = 1 - set(p: Int) { - holder += "setR3" - field = p - } - - fun test3() : Int { - r3++ - ++r3 - return r3 - } - - var r4: Int = 1 - get() { - holder += "getR4" - return field - } - set(p: Int) { - holder += "setR4" - field = p - } - - fun test4() : Int { - r4++ - holder += ":" - ++r4 - return r4 - } -} - -fun box() : String { - val p = A.test() - if (p != 3) return "fail 1: $p" - - val p2 = A.test2() - val holderValue = A.holder - if (p2 != 3 || holderValue != "getR2getR2getR2getR2") return "fail 2: $p2 ${holderValue}" - - A.holder = "" - val p3 = A.test3() - if (p3 != 3 || A.holder != "setR3setR3") return "fail 3: $p3 ${A.holder}" - - A.holder = "" - val p4 = A.test4() - if (p4 != 3 || A.holder != "getR4setR4:getR4setR4getR4getR4") return "fail 4: $p4 ${A.holder}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/inheritedPropertyInClassObject.kt b/backend.native/tests/external/codegen/box/statics/inheritedPropertyInClassObject.kt deleted file mode 100644 index 2ab591a3f58..00000000000 --- a/backend.native/tests/external/codegen/box/statics/inheritedPropertyInClassObject.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class Bar(val prop: String) -class Foo { - companion object : Bar("OK") { - val p = Foo.prop - val p2 = prop - val p3 = this.prop - } - - val p4 = Foo.prop - val p5 = prop -} - -fun box(): String = Foo.prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/inheritedPropertyInObject.kt b/backend.native/tests/external/codegen/box/statics/inheritedPropertyInObject.kt deleted file mode 100644 index 4d00f209f61..00000000000 --- a/backend.native/tests/external/codegen/box/statics/inheritedPropertyInObject.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class Bar(val prop: String) -object Foo : Bar("OK") { - - val p = Foo.prop - val p2 = prop - val p3 = this.prop -} -fun box(): String = Foo.prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/inlineCallsStaticMethod.kt b/backend.native/tests/external/codegen/box/statics/inlineCallsStaticMethod.kt deleted file mode 100644 index 3e0b726b9ad..00000000000 --- a/backend.native/tests/external/codegen/box/statics/inlineCallsStaticMethod.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Test.java - -public class Test { - - protected String data = "O"; - - protected Test() { - - } - - protected static String testStatic() { - return "K"; - } - -} - -// FILE: test.kt - -public inline fun test(): String { - val p = object : Test() {} - return p.data + Test.testStatic(); -} - - -fun box(): String { - return test() -} diff --git a/backend.native/tests/external/codegen/box/statics/kt8089.kt b/backend.native/tests/external/codegen/box/statics/kt8089.kt deleted file mode 100644 index 1441b3511a6..00000000000 --- a/backend.native/tests/external/codegen/box/statics/kt8089.kt +++ /dev/null @@ -1,22 +0,0 @@ -class C { - @kotlin.native.ThreadLocal - companion object { - private val s: String - private var s2: String - - init { - s = "O" - s2 = "O" - } - - fun foo() = s - - fun foo2() = s2 - - fun bar2() { s2 = "K" } - } -} - -fun box(): String { - return C.foo() + {C.bar2(); C.foo2()}() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/statics/protectedSamConstructor.kt b/backend.native/tests/external/codegen/box/statics/protectedSamConstructor.kt deleted file mode 100644 index 41be4ad28c8..00000000000 --- a/backend.native/tests/external/codegen/box/statics/protectedSamConstructor.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JavaClass.java - -public class JavaClass { - - public String runZ(Z z) { - return z.run("O", "K"); - } - - protected interface Z { - String run(String s1, String s2); - } -} - -// FILE: Kotlin.kt - -package zzz - -import JavaClass -import JavaClass.Z - -class A : JavaClass() { - fun test() = runZ(JavaClass.Z {a, b -> a + b}) -} - -fun box(): String { - return A().test() -} diff --git a/backend.native/tests/external/codegen/box/statics/protectedStatic.kt b/backend.native/tests/external/codegen/box/statics/protectedStatic.kt deleted file mode 100644 index c8fe82f334d..00000000000 --- a/backend.native/tests/external/codegen/box/statics/protectedStatic.kt +++ /dev/null @@ -1,38 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: First.java - -public abstract class First { - protected static String TEST = "OK"; - - protected static String test() { - return TEST; - } -} - -// FILE: First.kt - -package anotherPackage - -import First - -class Second : First() { - val some = { First.TEST } - fun foo() = { First.test() } - - val some2 = { TEST } - fun foo2() = { test() } -} - -fun box(): String { - if (Second().some.invoke() != "OK") return "fail 1" - - if (Second().foo().invoke() != "OK") return "fail 2" - - if (Second().some2.invoke() != "OK") return "fail 3" - - if (Second().foo2().invoke() != "OK") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/statics/protectedStatic2.kt b/backend.native/tests/external/codegen/box/statics/protectedStatic2.kt deleted file mode 100644 index 931b1eace43..00000000000 --- a/backend.native/tests/external/codegen/box/statics/protectedStatic2.kt +++ /dev/null @@ -1,61 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Base.java - -public class Base { - - protected static String BASE_ONLY = "BASE"; - - protected static String baseOnly() { - return BASE_ONLY; - } - - protected static String TEST = "BASE"; - - protected static String test() { - return TEST; - } - - public static class Derived extends Base { - protected static String TEST = "DERIVED"; - - protected static String test() { - return TEST; - } - } -} - -// FILE: Kotlin.kt - -package anotherPackage - -import Base.Derived -import Base - -class Kotlin : Base.Derived() { - fun doTest(): String { - - if ({ TEST }() != "DERIVED") return "fail 1" - if ({ test() }() != "DERIVED") return "fail 2" - - if ({ Derived.TEST }() != "DERIVED") return "fail 3" - if ({ Derived.test() }() != "DERIVED") return "fail 4" - - if ({ Base.TEST }() != "BASE") return "fail 5" - if ({ Base.test() }() != "BASE") return "fail 6" - - - if ({ Base.BASE_ONLY }() != "BASE") return "fail 7" - if ({ Base.baseOnly() }() != "BASE") return "fail 8" - - if ({ BASE_ONLY }() != "BASE") return "fail 9" - if ({ baseOnly() }() != "BASE") return "fail 10" - - return "OK" - } -} - -fun box(): String { - return Kotlin().doTest() -} diff --git a/backend.native/tests/external/codegen/box/statics/protectedStaticAndInline.kt b/backend.native/tests/external/codegen/box/statics/protectedStaticAndInline.kt deleted file mode 100644 index 738e874d2e4..00000000000 --- a/backend.native/tests/external/codegen/box/statics/protectedStaticAndInline.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: First.java - -public abstract class First { - protected static String TEST = "O"; - - protected static String test() { - return "K"; - } -} - -// FILE: Kotlin.kt - -package anotherPackage - -import First - -class Test : First() { - - inline fun doTest(): String { - return TEST + test() - } -} - -fun box(): String { - return Test().doTest() -} diff --git a/backend.native/tests/external/codegen/box/statics/syntheticAccessor.kt b/backend.native/tests/external/codegen/box/statics/syntheticAccessor.kt deleted file mode 100644 index 2a390400701..00000000000 --- a/backend.native/tests/external/codegen/box/statics/syntheticAccessor.kt +++ /dev/null @@ -1,12 +0,0 @@ -object A { - private val p = "OK"; - - object B { - val z = p; - } - -} - -fun box(): String { - return A.B.z -} diff --git a/backend.native/tests/external/codegen/box/storeStackBeforeInline/differentTypes.kt b/backend.native/tests/external/codegen/box/storeStackBeforeInline/differentTypes.kt deleted file mode 100644 index 2d38eb00026..00000000000 --- a/backend.native/tests/external/codegen/box/storeStackBeforeInline/differentTypes.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun bar(x: Int, y: Long, z: Byte, s: String) = x.toString() + y.toString() + z.toString() + s - -fun foobar(x: Int, y: Long, s: String, z: Byte) = x.toString() + y.toString() + s + z.toString() - -fun foo() : String { - return foobar(1, 2L, bar(3, 4L, 5.toByte(), "6"), 7.toByte()) -} - -fun box() : String { - assertEquals("1234567", foo()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/storeStackBeforeInline/primitiveMerge.kt b/backend.native/tests/external/codegen/box/storeStackBeforeInline/primitiveMerge.kt deleted file mode 100644 index 7a0c44138c9..00000000000 --- a/backend.native/tests/external/codegen/box/storeStackBeforeInline/primitiveMerge.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun bar() : Boolean = true - -fun foobar1(x: Boolean, y: String, z: String) = x.toString() + y + z -fun foobar2(x: Any, y: String, z: String) = x.toString() + y + z - -inline fun foo() = "-" - -fun box(): String { - val result1 = foobar1(if (1 == 1) true else bar(), foo(), "OK") - val result2 = foobar2(if (1 == 1) "true" else arrayOf("false"), foo(), "OK") - assertEquals("true-OK", result1) - assertEquals("true-OK", result2) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/storeStackBeforeInline/simple.kt b/backend.native/tests/external/codegen/box/storeStackBeforeInline/simple.kt deleted file mode 100644 index 02c77ef3f87..00000000000 --- a/backend.native/tests/external/codegen/box/storeStackBeforeInline/simple.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun bar(x: Int) : Int { - return x -} - -fun foobar(x: Int, y: Int, z: Int) = x + y + z - -fun foo() : Int { - return foobar(1, bar(2), 3) -} - -fun box() : String { - assertEquals(6, foo()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/storeStackBeforeInline/unreachableMarker.kt b/backend.native/tests/external/codegen/box/storeStackBeforeInline/unreachableMarker.kt deleted file mode 100644 index 303293d3cd8..00000000000 --- a/backend.native/tests/external/codegen/box/storeStackBeforeInline/unreachableMarker.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun bar(block: () -> String) : String { - return block() -} - -inline fun bar2() : String { - return bar { return "def" } -} - -fun foobar(x: String, y: String, z: String) = x + y + z - -fun foo() : String { - return foobar( - "abc", - bar2(), - "ghi" - ) -} - -fun box() : String { - assertEquals("abcdefghi", foo()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/storeStackBeforeInline/withLambda.kt b/backend.native/tests/external/codegen/box/storeStackBeforeInline/withLambda.kt deleted file mode 100644 index 44e64d5a9bc..00000000000 --- a/backend.native/tests/external/codegen/box/storeStackBeforeInline/withLambda.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -inline fun bar(x: String, block: (String) -> String) = "def" + block(x) -fun foobar(x: String, y: String, z: String) = x + y + z - -fun foo() : String { - return foobar("abc", bar("ghi") { x -> x + "jkl" }, "mno") -} - -fun box() : String { - assertEquals("abcdefghijklmno", foo()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/constInStringTemplate.kt b/backend.native/tests/external/codegen/box/strings/constInStringTemplate.kt deleted file mode 100644 index 5595599889d..00000000000 --- a/backend.native/tests/external/codegen/box/strings/constInStringTemplate.kt +++ /dev/null @@ -1,25 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -const val constTrue = true -const val const42 = 42 -const val constPiF = 3.14F -const val constPi = 3.1415926358 -const val constString = "string" - -fun box(): String { - assertEquals("true", "$constTrue") - assertEquals("42", "$const42") - assertEquals("3.14", "$constPiF") - assertEquals("3.1415926358", "$constPi") - assertEquals("string", "$constString") - - assertEquals(constPi.toString(), "$constPi") - assertEquals((constPi * constPi).toString(), "${constPi * constPi}") - - assertEquals("null", "${null}") - assertEquals("42", "${42}") - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/strings/ea35743.kt b/backend.native/tests/external/codegen/box/strings/ea35743.kt deleted file mode 100644 index 31b59f2dcbb..00000000000 --- a/backend.native/tests/external/codegen/box/strings/ea35743.kt +++ /dev/null @@ -1,6 +0,0 @@ -val Int.test: String get() = "test" - -fun box(): String { - val x = "a ${1.test}" - return if (x == "a test") "OK" else "Fail $x" -} diff --git a/backend.native/tests/external/codegen/box/strings/forInString.kt b/backend.native/tests/external/codegen/box/strings/forInString.kt deleted file mode 100644 index f5bcbbde7be..00000000000 --- a/backend.native/tests/external/codegen/box/strings/forInString.kt +++ /dev/null @@ -1,13 +0,0 @@ -// WITH_RUNTIME - -fun foo(): Int { - var sum = 0 - for (c in "239") - sum += (c.toInt() - '0'.toInt()) - return sum -} - -fun box(): String { - val f = foo() - return if (f == 14) "OK" else "Fail $f" -} diff --git a/backend.native/tests/external/codegen/box/strings/interpolation.kt b/backend.native/tests/external/codegen/box/strings/interpolation.kt deleted file mode 100644 index 772cb33771a..00000000000 --- a/backend.native/tests/external/codegen/box/strings/interpolation.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun test(p: String?): String { - return "${p ?: "Default"} test" -} -fun box(): String { - if (test(null) != "Default test") return "fail 1: ${test(null)}" - if (test("Good") != "Good test") return "fail 1: ${test("OK")}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/strings/kt2592.kt b/backend.native/tests/external/codegen/box/strings/kt2592.kt deleted file mode 100644 index 013ad56f0d6..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt2592.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - String() - return String() + "OK" + String() -} diff --git a/backend.native/tests/external/codegen/box/strings/kt3571.kt b/backend.native/tests/external/codegen/box/strings/kt3571.kt deleted file mode 100644 index 960a37656a0..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt3571.kt +++ /dev/null @@ -1,6 +0,0 @@ -class Thing(delegate: CharSequence) : CharSequence by delegate - -fun box(): String { - val l = Thing("hello there").length - return if (l == 11) "OK" else "Fail $l" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt3652.kt b/backend.native/tests/external/codegen/box/strings/kt3652.kt deleted file mode 100644 index f9e678089b8..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt3652.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var a = 'a' - - if ("${a++}x" != "ax") return "fail1" - - if ("${a++}" != "b") return "fail2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt5389_stringBuilderGet.kt b/backend.native/tests/external/codegen/box/strings/kt5389_stringBuilderGet.kt deleted file mode 100644 index c6547b517a4..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt5389_stringBuilderGet.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - val sb = StringBuilder("OK") - return "${sb.get(0)}${sb[1]}" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt5956.kt b/backend.native/tests/external/codegen/box/strings/kt5956.kt deleted file mode 100644 index 037ee9ac1dc..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt5956.kt +++ /dev/null @@ -1,15 +0,0 @@ -// KT-5956 java.lang.AbstractMethodError: test.Thing.subSequence(II)Ljava/lang/CharSequence - -class Thing(val delegate: CharSequence) : CharSequence { - override fun get(index: Int): Char { - throw UnsupportedOperationException() - } - override val length: Int get() = 0 - override fun subSequence(start: Int, end: Int) = delegate.subSequence(start, end) -} - -fun box(): String { - val txt = Thing("hello there") - val s = txt.subSequence(0, 1) - return if ("$s" == "h") "OK" else "Fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt881.kt b/backend.native/tests/external/codegen/box/strings/kt881.kt deleted file mode 100644 index ba9911d887e..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt881.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box() : String { - val b = 1+1 - if ("$b" != "2") return "fail" - if ("${1+1}" != "2") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt889.kt b/backend.native/tests/external/codegen/box/strings/kt889.kt deleted file mode 100644 index c09089eefec..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt889.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -operator fun Int.plus(s: String) : String { - System.out?.println("Int.plus(s: String) called") - return s -} - -fun box() : String { - val s = "${1 + "a"}" - return if(s == "a") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/strings/kt894.kt b/backend.native/tests/external/codegen/box/strings/kt894.kt deleted file mode 100644 index e2aeb1f5bab..00000000000 --- a/backend.native/tests/external/codegen/box/strings/kt894.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun stringConcat(n : Int) : String? { - var string : String? = "" - for (i in 0..(n - 1)) - string += "LOL " - return string -} - -fun box() = if(stringConcat(3) == "LOL LOL LOL ") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/strings/multilineStringsWithTemplates.kt b/backend.native/tests/external/codegen/box/strings/multilineStringsWithTemplates.kt deleted file mode 100644 index 38e661755cd..00000000000 --- a/backend.native/tests/external/codegen/box/strings/multilineStringsWithTemplates.kt +++ /dev/null @@ -1,31 +0,0 @@ -fun box() : String { - val s = "abc" - val test1 = """$s""" - if (test1 != "abc") return "Fail 1: $test1" - - val test2 = """${s}""" - if (test2 != "abc") return "Fail 2: $test2" - - val test3 = """ "$s" """ - if (test3 != " \"abc\" ") return "Fail 3: $test3" - - val test4 = """ "${s}" """ - if (test4 != " \"abc\" ") return "Fail 4: $test4" - - val test5 = -""" - ${s.length} -""" - if (test5 != "\n 3\n") return "Fail 5: $test5" - - val test6 = """\n""" - if (test6 != "\\n") return "Fail 6: $test6" - - val test7 = """\${'$'}foo""" - if (test7 != "\\\$foo") return "Fail 7: $test7" - - val test8 = """$ foo""" - if (test8 != "$ foo") return "Fail 8: $test8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/nestedConcat.kt b/backend.native/tests/external/codegen/box/strings/nestedConcat.kt deleted file mode 100644 index 6c27ecec29e..00000000000 --- a/backend.native/tests/external/codegen/box/strings/nestedConcat.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun test1(s1: String, s2: String, s3: String) = - (s1 + s2) + s3 - -fun test2(s1: String, s2: String, s3: String) = - s1 + (s2 + s3) - -fun test3(s1: String, s2: String, s3: String) = - "s1: $s1; " + - "s2: $s2; " + - "s3: $s3" - -fun box(): String { - assertEquals("123", test1("1", "2", "3")) - assertEquals("123", test2("1", "2", "3")) - assertEquals("s1: 1; s2: 2; s3: 3", test3("1", "2", "3")) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/strings/rawStrings.kt b/backend.native/tests/external/codegen/box/strings/rawStrings.kt deleted file mode 100644 index caa5b8fc27a..00000000000 --- a/backend.native/tests/external/codegen/box/strings/rawStrings.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box() : String { - val s = """ foo \n bar """ - if (s != " foo \\n bar ") return "Fail: '$s'" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/rawStringsWithManyQuotes.kt b/backend.native/tests/external/codegen/box/strings/rawStringsWithManyQuotes.kt deleted file mode 100644 index 1fb97bd718e..00000000000 --- a/backend.native/tests/external/codegen/box/strings/rawStringsWithManyQuotes.kt +++ /dev/null @@ -1,28 +0,0 @@ -class P(val actual: String, val expected: String) -fun array(vararg s: P) = s - -fun box() : String { - val data = array( - P("""""", ""), - P(""""""", "\""), - P("""""""", "\"\""), - P(""""""""", "\"\"\""), - P("""""""""", "\"\"\"\""), - P("""" """, "\" "), - P(""""" """, "\"\" "), - P(""" """", " \""), - P(""" """"", " \"\""), - P(""" """""", " \"\"\""), - P(""" """"""", " \"\"\"\""), - P(""" """""""", " \"\"\"\"\""), - P("""" """", "\" \""), - P(""""" """"", "\"\" \"\"") - ) - - for (i in 0..data.size-1) { - val p = data[i] - if (p.actual != p.expected) return "Fail at #$i. actual='${p.actual}', expected='${p.expected}'" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/strings/stringBuilderAppend.kt b/backend.native/tests/external/codegen/box/strings/stringBuilderAppend.kt deleted file mode 100644 index c994f4c4a0a..00000000000 --- a/backend.native/tests/external/codegen/box/strings/stringBuilderAppend.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -class A() { - - override fun toString(): String { - return "A" - } -} - -fun box() : String { - - val s = "1" + "2" + 3 + 4L + 5.0 + 6F + '7' + A() - - if (s != "12345.06.07A") return "fail $s" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/strings/stringPlusOnlyWorksOnString.kt b/backend.native/tests/external/codegen/box/strings/stringPlusOnlyWorksOnString.kt deleted file mode 100644 index cf713b647c2..00000000000 --- a/backend.native/tests/external/codegen/box/strings/stringPlusOnlyWorksOnString.kt +++ /dev/null @@ -1,7 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var x: MutableCollection = ArrayList() - x + ArrayList() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/basicmethodSuperClass.kt b/backend.native/tests/external/codegen/box/super/basicmethodSuperClass.kt deleted file mode 100644 index ccd620c34fd..00000000000 --- a/backend.native/tests/external/codegen/box/super/basicmethodSuperClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -class N() : ArrayList() { - override fun add(el: Any) : Boolean { - if (!super.add(el)) { - throw Exception() - } - return false - } -} - -fun box(): String { - val n = N() - if (n.add("239")) return "fail" - if (n.get(0) == "239") return "OK"; - return "fail"; -} diff --git a/backend.native/tests/external/codegen/box/super/basicmethodSuperTrait.kt b/backend.native/tests/external/codegen/box/super/basicmethodSuperTrait.kt deleted file mode 100644 index 886987cf6f3..00000000000 --- a/backend.native/tests/external/codegen/box/super/basicmethodSuperTrait.kt +++ /dev/null @@ -1,14 +0,0 @@ - -interface Tr { - fun extra() : String = "_" -} - -class N() : Tr { - override fun extra() : String = super.extra() + super.extra() -} - -fun box(): String { - val n = N() - if (n.extra() == "__") return "OK" - return "fail"; -} diff --git a/backend.native/tests/external/codegen/box/super/basicproperty.kt b/backend.native/tests/external/codegen/box/super/basicproperty.kt deleted file mode 100644 index f1fab6ffe23..00000000000 --- a/backend.native/tests/external/codegen/box/super/basicproperty.kt +++ /dev/null @@ -1,24 +0,0 @@ -open class M() { - open var b: Int = 0 -} - -class N() : M() { - val a : Int - get() { - super.b = super.b + 1 - return super.b + 1 - } - override var b: Int = a + 1 - - val superb : Int - get() = super.b -} - -fun box(): String { - val n = N() - n.a - n.b - n.superb - if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK"; - return "fail"; -} diff --git a/backend.native/tests/external/codegen/box/super/enclosedFun.kt b/backend.native/tests/external/codegen/box/super/enclosedFun.kt deleted file mode 100644 index 5f317b46f77..00000000000 --- a/backend.native/tests/external/codegen/box/super/enclosedFun.kt +++ /dev/null @@ -1,31 +0,0 @@ -interface BK { - fun x() : Int = 50 -} - -interface K : BK { - override fun x() : Int = super.x() * 2 -} - -open class M() { - open fun x() : Int = 10 -} - -open class N() : M(), K { - - override fun x() : Int = 20 - - open inner class C() : K { - fun test1() = x() - fun test2() = super@N.x() - fun test3() = super@N.x() - fun test4() = super.x() - } -} - -fun box(): String { - if (N().C().test1() != 100) return "test1 fail"; - if (N().C().test2() != 10) return "test2 fail"; - if (N().C().test3() != 100) return "test3 fail"; - if (N().C().test4() != 100) return "test4 fail"; - return "OK"; -} diff --git a/backend.native/tests/external/codegen/box/super/enclosedVar.kt b/backend.native/tests/external/codegen/box/super/enclosedVar.kt deleted file mode 100644 index 50477570820..00000000000 --- a/backend.native/tests/external/codegen/box/super/enclosedVar.kt +++ /dev/null @@ -1,22 +0,0 @@ -open class M() { - open var y = 500 -} - -open class N() : M() { - - override var y = 200 - - open inner class C() { - fun test5() = y - fun test6() : Int { - super@N.y += 200 - return super@N.y - } - } -} - -fun box(): String { - if (N().C().test5() != 200) return "test5 fail"; - if (N().C().test6() != 700) return "test6 fail"; - return "OK"; -} diff --git a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper.kt b/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper.kt deleted file mode 100644 index cbb0a875df9..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper.kt +++ /dev/null @@ -1,38 +0,0 @@ -interface BK { - fun foo(): String - fun bar(): String -} - -interface K : BK { - override fun foo() = bar() -} - -class A : K { - override fun foo() = "A.foo" - override fun bar() = "A.bar" - - inner class B : K { - override fun foo() = "B.foo" - override fun bar() = "B.bar" - - fun test1() = super@A.foo() - fun test2() = super@B.foo() - fun test3() = super.foo() - fun test4() = super@A.foo() - fun test5() = super@B.foo() - fun test6() = super.foo() - } -} - - -fun box(): String { - val b = A().B() - if (b.test1() != "A.bar") return "test1 ${b.test1()}" - if (b.test2() != "B.bar") return "test2 ${b.test2()}" - if (b.test3() != "B.bar") return "test3 ${b.test3()}" - if (b.test4() != "A.bar") return "test4 ${b.test4()}" - if (b.test5() != "B.bar") return "test5 ${b.test5()}" - if (b.test6() != "B.bar") return "test6 ${b.test6()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper2.kt b/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper2.kt deleted file mode 100644 index 1a0bca8c437..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuper2.kt +++ /dev/null @@ -1,44 +0,0 @@ -//inspired by kt3492 -interface BK { - fun foo(): String - fun bar(): String -} - -interface KTrait: BK { - override fun foo() = bar() -} - -open abstract class K : KTrait { - -} - -class A : K() { - override fun foo() = "A.foo" - override fun bar() = "A.bar" - - inner class B : K() { - override fun foo() = "B.foo" - override fun bar() = "B.bar" - - fun test1() = super@A.foo() - fun test2() = super@B.foo() - fun test3() = super.foo() - fun test4() = super@A.foo() - fun test5() = super@B.foo() - fun test6() = super.foo() - } -} - - -fun box(): String { - val b = A().B() - if (b.test1() != "A.bar") return "test1 ${b.test1()}" - if (b.test2() != "B.bar") return "test2 ${b.test2()}" - if (b.test3() != "B.bar") return "test3 ${b.test3()}" - if (b.test4() != "A.bar") return "test4 ${b.test4()}" - if (b.test5() != "B.bar") return "test5 ${b.test5()}" - if (b.test6() != "B.bar") return "test6 ${b.test6()}" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty.kt b/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty.kt deleted file mode 100644 index bb8098564f6..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty.kt +++ /dev/null @@ -1,38 +0,0 @@ -interface Base { - val foo: String - fun bar(): String -} - -abstract class K : Base { - override val foo = bar() -} - -class A : K() { - override val foo = "A.foo" - override fun bar() = "A.bar" - - inner class B : K() { - override val foo = "B.foo" - override fun bar() = "B.bar" - - fun test1() = super@A.foo - fun test2() = super@B.foo - fun test3() = super.foo - fun test4() = super@A.foo - fun test5() = super@B.foo - fun test6() = super.foo - } -} - - -fun box(): String { - val b = A().B() - if (b.test1() != "A.bar") return "test1 ${b.test1()}" - if (b.test2() != "B.bar") return "test2 ${b.test2()}" - if (b.test3() != "B.bar") return "test3 ${b.test3()}" - if (b.test4() != "A.bar") return "test4 ${b.test4()}" - if (b.test5() != "B.bar") return "test5 ${b.test5()}" - if (b.test6() != "B.bar") return "test6 ${b.test6()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty2.kt b/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty2.kt deleted file mode 100644 index effc71e7925..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassLabeledSuperProperty2.kt +++ /dev/null @@ -1,43 +0,0 @@ -//inspired by kt3492 -interface Base { - val foo: String - fun bar(): String -} - -abstract class KWithOverride : Base { - override val foo = bar() -} - -abstract class K : KWithOverride() { - -} - -class A : K() { - override val foo = "A.foo" - override fun bar() = "A.bar" - - inner class B : K() { - override val foo = "B.foo" - override fun bar() = "B.bar" - - fun test1() = super@A.foo - fun test2() = super@B.foo - fun test3() = super.foo - fun test4() = super@A.foo - fun test5() = super@B.foo - fun test6() = super.foo - } -} - - -fun box(): String { - val b = A().B() - if (b.test1() != "A.bar") return "test1 ${b.test1()}" - if (b.test2() != "B.bar") return "test2 ${b.test2()}" - if (b.test3() != "B.bar") return "test3 ${b.test3()}" - if (b.test4() != "A.bar") return "test4 ${b.test4()}" - if (b.test5() != "B.bar") return "test5 ${b.test5()}" - if (b.test6() != "B.bar") return "test6 ${b.test6()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/innerClassQualifiedFunctionCall.kt b/backend.native/tests/external/codegen/box/super/innerClassQualifiedFunctionCall.kt deleted file mode 100644 index 557905cedbe..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassQualifiedFunctionCall.kt +++ /dev/null @@ -1,46 +0,0 @@ -interface T { - open fun baz(): String = "T.baz" -} - -open class A { - open val foo: String = "OK" - open fun bar(): String = "OK" - open fun boo(): String = "OK" -} - -open class B : A(), T { - override fun bar(): String = "B" - override fun baz(): String = "B.baz" - inner class E { - val foo: String = super@B.foo - fun bar() = super@B.bar() + super@B.bar() + super@B.baz() - } -} - -class C : B() { - override fun bar(): String = "C" - override fun boo(): String = "C" - inner class D { - val foo: String = super@C.foo - fun bar() = super@C.bar() + super@C.boo() - } -} - -fun box(): String { - var r = "" - - r = B().E().foo - if (r != "OK") return "fail 1; r = $r" - r = "" - r = B().E().bar() - if (r != "OKOKT.baz") return "fail 2; r = $r" - - r = "" - r = C().D().foo - if (r != "OK") return "fail 3; r = $r" - r = "" - r = C().D().bar() - if (r != "BOK") return "fail 4; r = $r" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/innerClassQualifiedPropertyAccess.kt b/backend.native/tests/external/codegen/box/super/innerClassQualifiedPropertyAccess.kt deleted file mode 100644 index bdcd70ce962..00000000000 --- a/backend.native/tests/external/codegen/box/super/innerClassQualifiedPropertyAccess.kt +++ /dev/null @@ -1,45 +0,0 @@ -interface T { - open val baz: String - get() = "T.baz" -} - -open class A { - open val bar: String - get() = "OK" - open val boo: String - get() = "OK" -} - -open class B : A(), T { - override val bar: String - get() = "B" - override val baz: String - get() = "B.baz" - inner class E { - val bar: String - get() = super@B.bar + super@B.bar + super@B.baz - } -} - -class C : B() { - override val bar: String - get() = "C" - override val boo: String - get() = "C" - inner class D { - val bar: String - get() = super@C.bar + super@C.boo - } -} - -fun box(): String { - var r = "" - - r = B().E().bar - if (r != "OKOKT.baz") return "fail 1; r = $r" - - r = C().D().bar - if (r != "BOK") return "fail 2; r = $r" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/kt14243.kt b/backend.native/tests/external/codegen/box/super/kt14243.kt deleted file mode 100644 index 75d5fcb7ae7..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt14243.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface Z { - fun test(p: T): T { - return p - } -} - -open class ZImpl : Z - -class ZImpl2 : ZImpl() { - - override fun test(p: String): String { - return super.test(p) - } -} - -fun box(): String { - return ZImpl2().test("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt14243_2.kt b/backend.native/tests/external/codegen/box/super/kt14243_2.kt deleted file mode 100644 index b72bf3dac7c..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt14243_2.kt +++ /dev/null @@ -1,20 +0,0 @@ -interface Z { - fun test(p: T): T { - return p - } -} - -open class ZImpl : Z - -open class ZImpl2 : Z, ZImpl() - -class ZImpl3 : ZImpl2() { - - override fun test(p: String): String { - return super.test(p) - } -} - -fun box(): String { - return ZImpl3().test("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt14243_class.kt b/backend.native/tests/external/codegen/box/super/kt14243_class.kt deleted file mode 100644 index c0ec94be493..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt14243_class.kt +++ /dev/null @@ -1,20 +0,0 @@ - -open class Z { - open fun test(p: T, z: Y): T { - return p - } -} - -open class ZImpl : Z() - -open class ZImpl2 : ZImpl() - -class ZImpl3 : ZImpl2() { - override fun test(p: String, z: String): String { - return super.test(p, z) - } -} - -fun box(): String { - return ZImpl3().test("OK", "fail") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt14243_prop.kt b/backend.native/tests/external/codegen/box/super/kt14243_prop.kt deleted file mode 100644 index 73979c08226..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt14243_prop.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface Z { - val value: T - - val z: T - get() = value -} - -open class ZImpl : Z { - override val value: String - get() = "OK" -} - -open class ZImpl2 : ZImpl() { - override val z: String - get() = super.z -} - - -fun box(): String { - return ZImpl2().value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt3492ClassFun.kt b/backend.native/tests/external/codegen/box/super/kt3492ClassFun.kt deleted file mode 100644 index 1dd8d1b2770..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt3492ClassFun.kt +++ /dev/null @@ -1,19 +0,0 @@ -open class A { - open fun foo2(): String = "OK" -} - -open class B : A() { - -} - -class C : B() { - inner class D { - val foo: String = super@C.foo2() - } -} - -fun box() : String { - val obj = C().D(); - return obj.foo -} - diff --git a/backend.native/tests/external/codegen/box/super/kt3492ClassProperty.kt b/backend.native/tests/external/codegen/box/super/kt3492ClassProperty.kt deleted file mode 100644 index 25feedb525f..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt3492ClassProperty.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class A { - open val foo: String = "OK" -} - -open class B : A() { - -} - -class C : B() { - inner class D { - val foo: String = super@C.foo - } -} - -fun box() = C().D().foo diff --git a/backend.native/tests/external/codegen/box/super/kt3492TraitFun.kt b/backend.native/tests/external/codegen/box/super/kt3492TraitFun.kt deleted file mode 100644 index 144e86036a3..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt3492TraitFun.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface ATrait { - open fun foo2(): String = "OK" -} - -open class B : ATrait { - -} - -class C : B() { - inner class D { - val foo: String = super@C.foo2() - } -} - -fun box() : String { - val obj = C().D(); - return obj.foo -} - diff --git a/backend.native/tests/external/codegen/box/super/kt3492TraitProperty.kt b/backend.native/tests/external/codegen/box/super/kt3492TraitProperty.kt deleted file mode 100644 index c4c3298afcb..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt3492TraitProperty.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface A { - open val foo: String - get() = "OK" -} - -open class B : A { - -} - -class C : B() { - inner class D { - val foo: String = super@C.foo - } -} - -fun box() = C().D().foo diff --git a/backend.native/tests/external/codegen/box/super/kt4173.kt b/backend.native/tests/external/codegen/box/super/kt4173.kt deleted file mode 100644 index 12ca4f5c6ee..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt4173.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class C(val f: () -> Unit) { - fun test() { - f() - } -} - -class B(var x: Int) { - fun foo() { - object : C({x = 3}) {}.test() - } -} - - -fun box() : String { - val b = B(1) - b.foo() - return if (b.x != 3) "fail: b.x = ${b.x}" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt4173_2.kt b/backend.native/tests/external/codegen/box/super/kt4173_2.kt deleted file mode 100644 index 3bc81264f0c..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt4173_2.kt +++ /dev/null @@ -1,20 +0,0 @@ -open class X(var s: ()-> Unit) - -open class C(val f: X) { - fun test() { - f.s() - } -} - -class B(var x: Int) { - fun foo() { - object : C(object: X({x = 3}) {}) {}.test() - } -} - - -fun box() : String { - val b = B(1) - b.foo() - return if (b.x != 3) "fail: b.x = ${b.x}" else "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt4173_3.kt b/backend.native/tests/external/codegen/box/super/kt4173_3.kt deleted file mode 100644 index 8c23cf83f28..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt4173_3.kt +++ /dev/null @@ -1,27 +0,0 @@ -open class C(s: Int) { - fun test() { - - } -} - -class B(var x: Int) { - fun foo() { - class A(val a: Int) : C({a}()) { - - } - A(11).test() - - - class B(val a: Int) : C(a) { - } - - B(11).test() - } -} - - -fun box() : String { - val b = B(1) - b.foo() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/kt4982.kt b/backend.native/tests/external/codegen/box/super/kt4982.kt deleted file mode 100644 index 8c01d8f2212..00000000000 --- a/backend.native/tests/external/codegen/box/super/kt4982.kt +++ /dev/null @@ -1,21 +0,0 @@ -abstract class WaitFor { - init { - condition() - } - - abstract fun condition() : Boolean; -} - -fun box(): String { - val local = "" - var result = "fail" - val s = object: WaitFor() { - - override fun condition(): Boolean { - result = "OK" - return result.length== 2 - } - } - - return result; -} diff --git a/backend.native/tests/external/codegen/box/super/multipleSuperTraits.kt b/backend.native/tests/external/codegen/box/super/multipleSuperTraits.kt deleted file mode 100644 index 2ddb25d35b9..00000000000 --- a/backend.native/tests/external/codegen/box/super/multipleSuperTraits.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface T1 { - fun foo() = "O" -} - -interface T2 { - fun foo() = "K" -} - -class A : T1, T2 { - override fun foo() = super.foo() + super.foo() -} - -fun box() = A().foo() diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_arrayOf.kt b/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_arrayOf.kt deleted file mode 100644 index eb092f89776..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_arrayOf.kt +++ /dev/null @@ -1,5 +0,0 @@ -open class A(val array: Array) - -class B : A(arrayOf("OK")) - -fun box() = B().array[0].toString() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_linkedMapOf.kt b/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_linkedMapOf.kt deleted file mode 100644 index 66a8d9a8893..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/kt17464_linkedMapOf.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME -// FULL_JDK - -open class B(val map: LinkedHashMap) - -class C : B(linkedMapOf("O" to "K")) - -fun box() = - C().map.entries.first().let { it.key + it.value } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/kt18356.kt b/backend.native/tests/external/codegen/box/super/superConstructor/kt18356.kt deleted file mode 100644 index 150d2f5dd85..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/kt18356.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class Base(val addr: Long, val name: String) - -fun box(): String { - val obj1 = object : Base(name = "OK", addr = 0x1234L) {} - if (obj1.addr != 0x1234L) return "fail ${obj1.addr}" - return obj1.name -} - diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/kt18356_2.kt b/backend.native/tests/external/codegen/box/super/superConstructor/kt18356_2.kt deleted file mode 100644 index 9773342f5fa..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/kt18356_2.kt +++ /dev/null @@ -1,8 +0,0 @@ -abstract class Base(val s: String, vararg ints: Int) - -fun foo(s: String, ints: IntArray) = object : Base(ints = *ints, s = s) {} - -fun box(): String { - return foo("OK", intArrayOf(1, 2)).s -} - diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsInner.kt b/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsInner.kt deleted file mode 100644 index 83d075cdeae..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsInner.kt +++ /dev/null @@ -1,14 +0,0 @@ -open class Foo(val value: String) { - - open inner class Inner(val d: Double = -1.0, val s: String, vararg val y: Int) { - open fun result() = "Fail" - } - - val obj = object : Inner(s = "O") { - override fun result() = s + value - } -} - -fun box(): String { - return Foo("K").obj.result() -} diff --git a/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsLocalInner.kt b/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsLocalInner.kt deleted file mode 100644 index ab3c695f278..00000000000 --- a/backend.native/tests/external/codegen/box/super/superConstructor/objectExtendsLocalInner.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val capture = "O" - - class Local { - val captured = capture - - open inner class Inner(val d: Double = -1.0, val s: String, vararg val y: Int) { - open fun result() = "Fail" - } - - val obj = object : Inner(s = "K") { - override fun result() = capture + s - } - } - - return Local().obj.result() -} diff --git a/backend.native/tests/external/codegen/box/super/traitproperty.kt b/backend.native/tests/external/codegen/box/super/traitproperty.kt deleted file mode 100644 index a5de71c24eb..00000000000 --- a/backend.native/tests/external/codegen/box/super/traitproperty.kt +++ /dev/null @@ -1,31 +0,0 @@ -interface M { - var backingB : Int - var b : Int - get() = backingB - set(value: Int) { - backingB = value - } -} - -class N() : M { - public override var backingB : Int = 0 - - val a : Int - get() { - super.b = super.b + 1 - return super.b + 1 - } - override var b: Int = a + 1 - - val superb : Int - get() = super.b -} - -fun box(): String { - val n = N() - n.a - n.b - n.superb - if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK"; - return "fail"; -} diff --git a/backend.native/tests/external/codegen/box/super/unqualifiedSuper.kt b/backend.native/tests/external/codegen/box/super/unqualifiedSuper.kt deleted file mode 100644 index 9863671fa68..00000000000 --- a/backend.native/tests/external/codegen/box/super/unqualifiedSuper.kt +++ /dev/null @@ -1,66 +0,0 @@ -open class Base() { - open fun baseFun(): String = "Base.baseFun()" - - open fun unambiguous(): String = "Base.unambiguous()" - - open val baseProp: String - get() = "Base.baseProp" -} - -interface Interface { - fun interfaceFun(): String = "Interface.interfaceFun()" - - fun unambiguous(): String // NB abstract -} - -interface AnotherInterface - -interface DerivedInterface: Interface, AnotherInterface { - override fun interfaceFun(): String = "DerivedInterface.interfaceFun()" - - override fun unambiguous(): String = "DerivedInterface.unambiguous()" - - fun callsFunFromSuperInterface(): String = super.interfaceFun() -} - -class Derived : Base(), Interface { - override fun baseFun(): String = "Derived.baseFun()" - - override fun unambiguous(): String = "Derived.unambiguous()" - - override fun interfaceFun(): String = "Derived.interfaceFun()" - - override val baseProp: String - get() = "Derived.baseProp" - - fun callsBaseFun(): String = super.baseFun() - - fun callsUnambiguousFun(): String = super.unambiguous() - - fun getsBaseProp(): String = super.baseProp - - fun callsInterfaceFun(): String = super.interfaceFun() -} - -fun box(): String { - val d = Derived() - - val test1 = d.callsBaseFun() - if (test1 != "Base.baseFun()") return "Failed: d.callsBaseFun()==$test1" - - val test2 = d.callsUnambiguousFun() - if (test2 != "Base.unambiguous()") return "Failed: d.callsUnambiguousFun()==$test2" - - val test3 = d.getsBaseProp() - if (test3 != "Base.baseProp") return "Failed: d.getsBaseProp()==$test3" - - val test4 = d.callsInterfaceFun() - if (test4 != "Interface.interfaceFun()") return "Failed: d.callsInterfaceFun()==$test4" - - val di = object : DerivedInterface {} - - val test5 = di.callsFunFromSuperInterface() - if (test5 != "Interface.interfaceFun()") return "Failed: di.callsFunFromSuperInterface()==$test5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt b/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt deleted file mode 100644 index c9ab55a897d..00000000000 --- a/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithDeeperHierarchies.kt +++ /dev/null @@ -1,63 +0,0 @@ -open class DeeperBase { - open fun deeperBaseFun(): String = "DeeperBase.deeperBaseFun()" - - open val deeperBaseProp: String - get() = "DeeperBase.deeperBaseProp" -} - -open class DeepBase : DeeperBase() { -} - -interface DeeperInterface { - fun deeperInterfaceFun(): String = "DeeperInterface.deeperInterfaceFun()" - - val deeperInterfaceProp: String - get() = "DeeperInterface.deeperInterfaceProp" -} - -interface DeepInterface : DeeperInterface { - fun deepInterfaceFun(): String = "DeepInterface.deepInterfaceFun()" -} - -class DeepDerived : DeepBase(), DeepInterface { - override fun deeperBaseFun(): String = "DeepDerived.deeperBaseFun()" - - override val deeperBaseProp: String - get() = "DeepDerived.deeperBaseProp" - - override fun deeperInterfaceFun(): String = "DeepDerived.deeperInterfaceFun()" - - override val deeperInterfaceProp: String - get() = "DeepDerived.deeperInterfaceProp" - - override fun deepInterfaceFun(): String = "DeepDerived.deepInterfaceFun()" - - fun callsSuperDeeperBaseFun(): String = super.deeperBaseFun() - - fun getsSuperDeeperBaseProp(): String = super.deeperBaseProp - - fun callsSuperDeepInterfaceFun(): String = super.deepInterfaceFun() - fun callsSuperDeeperInterfaceFun(): String = super.deeperInterfaceFun() - fun getsSuperDeeperInterfaceProp(): String = super.deeperInterfaceProp -} - -fun box(): String { - val dd = DeepDerived() - - val test1 = dd.callsSuperDeeperBaseFun() - if (test1 != "DeeperBase.deeperBaseFun()") return "Failed: dd.callsSuperDeeperBaseFun()==$test1" - - val test2 = dd.getsSuperDeeperBaseProp() - if (test2 != "DeeperBase.deeperBaseProp") return "Failed: dd.getsSuperDeeperBaseProp()==$test2" - - val test3 = dd.callsSuperDeepInterfaceFun() - if (test3 != "DeepInterface.deepInterfaceFun()") return "Failed: dd.callsSuperDeepInterfaceFun()==$test3" - - val test4 = dd.callsSuperDeeperInterfaceFun() - if (test4 != "DeeperInterface.deeperInterfaceFun()") return "Failed: dd.callsSuperDeeperInterfaceFun()==$test4" - - val test5 = dd.getsSuperDeeperInterfaceProp() - if (test5 != "DeeperInterface.deeperInterfaceProp") return "Failed: dd.getsSuperDeeperInterfaceProp()==$test5" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithMethodsOfAny.kt b/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithMethodsOfAny.kt deleted file mode 100644 index b0eb1ec0d01..00000000000 --- a/backend.native/tests/external/codegen/box/super/unqualifiedSuperWithMethodsOfAny.kt +++ /dev/null @@ -1,25 +0,0 @@ -interface ISomething - -open class ClassWithToString { - override fun toString(): String = "C" -} - -interface IWithToString { - override fun toString(): String -} - -class C1 : ClassWithToString(), ISomething { - override fun toString(): String = super.toString() -} - -class C2 : ClassWithToString(), IWithToString, ISomething { - override fun toString(): String = super.toString() -} - -fun box(): String { - return when { - C1().toString() != "C" -> "Failed #1" - C2().toString() != "C" -> "Failed #2" - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/synchronized/changeMonitor.kt b/backend.native/tests/external/codegen/box/synchronized/changeMonitor.kt deleted file mode 100644 index effbf887c33..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/changeMonitor.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -fun box(): String { - var obj0 = "0" as java.lang.Object - var obj1 = "1" as java.lang.Object - - var v = obj0 - synchronized (v) { - v = obj1 - } - assertThatThreadDoesNotOwnMonitor(obj0) - - return "OK" -} - -fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) { - try { - obj.wait(1) - throw IllegalStateException("Not owning a monitor!") - } - catch (e: IllegalMonitorStateException) { - // OK - } -} diff --git a/backend.native/tests/external/codegen/box/synchronized/exceptionInMonitorExpression.kt b/backend.native/tests/external/codegen/box/synchronized/exceptionInMonitorExpression.kt deleted file mode 100644 index e0180c1e7a3..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/exceptionInMonitorExpression.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val obj = "" as java.lang.Object - val e = IllegalArgumentException() - fun m(): Nothing = throw e - try { - synchronized (m()) { - throw AssertionError("Should not have reached this point") - } - } - catch (caught: Throwable) { - if (caught !== e) return "Fail: $caught" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/finally.kt b/backend.native/tests/external/codegen/box/synchronized/finally.kt deleted file mode 100644 index 0cae07f34f0..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/finally.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -fun box(): String { - val obj = "" as java.lang.Object - - val e = IllegalArgumentException() - try { - synchronized (obj) { - throw e - } - } - catch (caught: Throwable) { - if (caught !== e) return "Fail: $caught" - // If monitorexit didn't happen (a finally block failed), this assertion would fail - assertThatThreadDoesNotOwnMonitor(obj) - } - - return "OK" -} - -fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) { - try { - obj.wait(1) - throw IllegalStateException("Not owning a monitor!") - } - catch (e: IllegalMonitorStateException) { - // OK - } -} diff --git a/backend.native/tests/external/codegen/box/synchronized/longValue.kt b/backend.native/tests/external/codegen/box/synchronized/longValue.kt deleted file mode 100644 index c06a4efd2a1..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/longValue.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - var obj = "0" as java.lang.Object - val result = synchronized (obj) { - 239L - } - - if (result != 239L) return "Fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/nestedDifferentObjects.kt b/backend.native/tests/external/codegen/box/synchronized/nestedDifferentObjects.kt deleted file mode 100644 index 369f1266120..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/nestedDifferentObjects.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val obj = "" as java.lang.Object - val obj2 = "1" as java.lang.Object - - synchronized (obj) { - synchronized (obj2) { - obj.wait(1) - obj2.wait(1) - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/nestedSameObject.kt b/backend.native/tests/external/codegen/box/synchronized/nestedSameObject.kt deleted file mode 100644 index 8f451dfd855..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/nestedSameObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - val obj = "" as java.lang.Object - - synchronized (obj) { - synchronized (obj) { - obj.wait(1) - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/nonLocalReturn.kt b/backend.native/tests/external/codegen/box/synchronized/nonLocalReturn.kt deleted file mode 100644 index de47313baa5..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/nonLocalReturn.kt +++ /dev/null @@ -1,182 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit -import java.util.concurrent.Executors -import java.util.concurrent.Callable -import java.util.concurrent.Future - -val count: Int = 10; -var index: Int = 0; -val doneSignal = CountDownLatch(count) -val startSignal = CountDownLatch(1); -val mutex: Any = Object() -val results = arrayListOf() -val executorService = Executors.newFixedThreadPool(count) - -class MyException(message: String): Exception(message) - -enum class ExecutionType { - LOCAL, - NON_LOCAL_SIMPLE, - NON_LOCAL_EXCEPTION, - NON_LOCAL_FINALLY, - NON_LOCAL_EXCEPTION_AND_FINALLY, - NON_LOCAL_EXCEPTION_AND_FINALLY_WITH_RETURN, - NON_LOCAL_NESTED -} - -class TestLocal(val name: String, val executionType: ExecutionType) : Callable { - - override fun call(): String { - startSignal.await() - return when (executionType) { - ExecutionType.LOCAL -> local() - ExecutionType.NON_LOCAL_SIMPLE -> nonLocalSimple() - ExecutionType.NON_LOCAL_EXCEPTION -> nonLocalWithException() - ExecutionType.NON_LOCAL_FINALLY -> nonLocalWithFinally() - ExecutionType.NON_LOCAL_EXCEPTION_AND_FINALLY -> nonLocalWithExceptionAndFinally() - ExecutionType.NON_LOCAL_EXCEPTION_AND_FINALLY_WITH_RETURN -> nonLocalWithExceptionAndFinallyWithReturn() - ExecutionType.NON_LOCAL_NESTED -> nonLocalNested() - else -> "fail" - } - } - - private fun underMutexFun() { - results.add(++index); - doneSignal.countDown() - } - - fun local(): String { - synchronized(mutex) { - underMutexFun() - } - return executionType.toString() - } - - - fun nonLocalSimple(): String { - synchronized(mutex) { - underMutexFun() - return executionType.name - } - return "fail" - } - - fun nonLocalWithException(): String { - synchronized(mutex) { - try { - underMutexFun() - throw MyException(executionType.name) - } catch (e: MyException) { - return e.message!! - } - } - return "fail" - } - - fun nonLocalWithFinally(): String { - synchronized(mutex) { - try { - underMutexFun() - return "fail" - } finally { - return executionType.name - } - } - return "fail" - } - - fun nonLocalWithExceptionAndFinally(): String { - synchronized(mutex) { - try { - underMutexFun() - throw MyException(executionType.name) - } catch (e: MyException) { - return e.message!! - } finally { - "123" - } - } - return "fail" - } - - fun nonLocalWithExceptionAndFinallyWithReturn(): String { - synchronized(mutex) { - try { - underMutexFun() - throw MyException(executionType.name) - } catch (e: MyException) { - return "fail1" - } finally { - return executionType.name - } - } - return "fail" - } - - fun nonLocalNested(): String { - synchronized(mutex) { - try { - try { - underMutexFun() - throw MyException(executionType.name) - } catch (e: MyException) { - return "fail1" - } finally { - return executionType.name - } - } finally { - val p = 1 + 1 - } - } - return "fail" - } -} - -fun testTemplate(type: ExecutionType, producer: (Int) -> Callable): String { - - try { - val futures = arrayListOf>() - for (i in 1..count) { - futures.add(executorService.submit (producer(i))) - } - - startSignal.countDown() - val b = doneSignal.await(10, TimeUnit.SECONDS) - if (!b) return "fail: processes not finished" - - for (i in 1..count) { - if (results[i - 1] != i) - return "fail $i != ${results[i]}: synchronization not works : " + results.joinToString() - } - - for (f in futures) { - if (f.get() != type.name) return "failed result ${f.get()} != ${type.name}" - } - } finally { - - } - - return "OK" -} - -fun runTest(type: ExecutionType): String { - return testTemplate (type) { TestLocal(it.toString(), type) } -} - -fun box(): String { - try { - for (type in ExecutionType.values()) { - val result = runTest(type) - if (result != "OK") return "fail on $type execution: $result" - } - } finally { - executorService.shutdown() - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/objectValue.kt b/backend.native/tests/external/codegen/box/synchronized/objectValue.kt deleted file mode 100644 index d1d2acd2e88..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/objectValue.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - var obj = "0" as java.lang.Object - val result = synchronized (obj) { - "239" - } - - if (result != "239") return "Fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/sync.kt b/backend.native/tests/external/codegen/box/synchronized/sync.kt deleted file mode 100644 index e08ad511b68..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/sync.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -import java.util.concurrent.* -import java.util.concurrent.atomic.* - -fun thread(block: ()->Unit ) { - val thread = object: Thread() { - override fun run() { - block() - } - } - thread.start() -} - -fun box() : String { - val mtref = AtomicInteger() - val cdl = CountDownLatch(11) - for(i in 0..10) { - thread { - var current = 0 - do { - current = synchronized(mtref) { - val v = mtref.get() + 1 - if(v < 100) - mtref.set(v+1) - v - } - } - while(current < 100) - cdl.countDown() - } - } - cdl.await() - return if(mtref.get() == 100) "OK" else mtref.get().toString() -} diff --git a/backend.native/tests/external/codegen/box/synchronized/value.kt b/backend.native/tests/external/codegen/box/synchronized/value.kt deleted file mode 100644 index 1f04c749df4..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/value.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - var obj = "0" as java.lang.Object - val result = synchronized (obj) { - 239 - } - - if (result != 239) return "Fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/synchronized/wait.kt b/backend.native/tests/external/codegen/box/synchronized/wait.kt deleted file mode 100644 index 64b788e3593..00000000000 --- a/backend.native/tests/external/codegen/box/synchronized/wait.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FULL_JDK - -fun box(): String { - val obj = "" as java.lang.Object - try { - obj.wait(1) - return "Fail: exception should have been thrown" - } - catch (e: IllegalMonitorStateException) { - // OK - } - - synchronized (obj) { - obj.wait(1) - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt deleted file mode 100644 index 9a97980a5a6..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericConstructor.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun box(): String { - A.Nested().nestedA() - A.Nested().Inner().innerA() - A.companionA() - return "OK" -} - -class A private constructor(val x: T, val y: Int = 0) { - class Nested { - fun nestedA() = A(1L) - - inner class Inner { - fun innerA() = A(1L) - } - } - - companion object { - fun companionA() = A(1L) - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethod.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethod.kt deleted file mode 100644 index a5ffca91336..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethod.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: test.kt -import b.B - -fun box() = - B().getOK() - -// FILE: a.kt -package a - -open class A { - protected fun getO(x: T) = "O" - protected fun getK(x: T) = "K" -} - -// FILE: b.kt -package b - -import a.A - -class B : A() { - inner class Inner { - fun innerGetO() = getO(0L) - } - - fun lambdaGetK() = { -> getK(0L) } - - fun getOK() = - Inner().innerGetO() + lambdaGetK().invoke() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethodWithDefaults.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethodWithDefaults.kt deleted file mode 100644 index 943d7e681cd..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForGenericMethodWithDefaults.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: test.kt -import b.B - -fun box() = - B().getOK() - -// FILE: a.kt -package a - -open class A { - protected fun getO(x: T, z: String = "") = "O" + z - protected fun getK(x: T, z: String = "") = "K" + z -} - -// FILE: b.kt -package b - -import a.A - -class B : A() { - inner class Inner { - fun innerGetO() = getO(0L) - } - - fun lambdaGetK() = { -> getK(0L) } - - fun getOK() = - Inner().innerGetO() + lambdaGetK().invoke() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtected.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtected.kt deleted file mode 100644 index 6250b18d1ce..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtected.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -import b.B -import a.BSamePackage - -fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail" - -// FILE: 2.kt - -package a - -open class A { - protected fun protectedFun(): String = "OK" -} - -class BSamePackage: A() { - fun test(): String { - val a = { - protectedFun() - } - return a() - } -} - -// FILE: 3.kt - -package b - -import a.A - -class B: A() { - fun test(): String { - val a = { - protectedFun() - } - return a() - } -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtectedInvokeVirtual.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtectedInvokeVirtual.kt deleted file mode 100644 index f68dda4d4b1..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/accessorForProtectedInvokeVirtual.kt +++ /dev/null @@ -1,68 +0,0 @@ -// WITH_RUNTIME -// FILE: 1.kt - -import test.A -import kotlin.test.assertEquals - -open class B : A() { - fun box(): String { - val overriddenMethod: () -> String = { - method() - } - assertEquals("C.method", overriddenMethod()) - - val superMethod: () -> String = { - super.method() - } - assertEquals("A.method", superMethod()) - - val overriddenPropertyGetter: () -> String = { - property - } - assertEquals("C.property", overriddenPropertyGetter()) - - val superPropertyGetter: () -> String = { - super.property - } - assertEquals("A.property", superPropertyGetter()) - - val overriddenPropertySetter: () -> Unit = { - property = "" - } - overriddenPropertySetter() - - val superPropertySetter: () -> Unit = { - super.property = "" - } - superPropertySetter() - - assertEquals("C.property;A.property;", state) - - return "OK" - } -} - -class C : B() { - override fun method() = "C.method" - override var property: String - get() = "C.property" - set(value) { state += "C.property;" } -} - -fun box() = C().box() - -// FILE: 2.kt - -package test - -abstract class A { - public var state = "" - - // These implementations should not be called, because they are overridden in C - - protected open fun method(): String = "A.method" - - protected open var property: String - get() = "A.property" - set(value) { state += "A.property;" } -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/jvmNameForAccessors.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/jvmNameForAccessors.kt deleted file mode 100644 index 0a39d77e650..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/jvmNameForAccessors.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_RUNTIME - - -@JvmName("fooA") -private fun String.foo(t: String?): String = this - -private fun String.foo(t: String): String = this - -fun runNoInline(fn: () -> String) = fn() - -fun box() = - runNoInline { "O".foo("") } + - runNoInline { "K".foo(null) } - diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/kt10047.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/kt10047.kt deleted file mode 100644 index 8317ac0f765..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/kt10047.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: a.kt - -package test2 - -import test.Actor -import test.O2dScriptAction - -class CompositeActor : Actor() - -public open class O2dDialog : O2dScriptAction() { - - fun test() = { owner }() - - fun test2() = { calc() }() -} - -fun box(): String { - if (O2dDialog().test() != null) return "fail 1" - if (O2dDialog().test2() != null) return "fail 2" - - return "OK" -} - -// FILE: b.kt - -package test - -open class Actor - -abstract public class O2dScriptAction { - protected var owner: T? = null - private set - - protected fun calc(): T? = null - -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717.kt deleted file mode 100644 index f2438b5a591..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: box.kt - -object Test { - val test: String = OK -} - -fun box(): String = Test.test - -// FILE: Vars.kt - -public var OK: String = "OK" - private set diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717DifferentPackages.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717DifferentPackages.kt deleted file mode 100644 index d201d7c2a39..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9717DifferentPackages.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: a.kt - -package a - -import b.* - -fun box(): String { - BB().ok() - return BB().OK -} - -// FILE: b.kt - -package b - -public open class B { - public var OK: String = "OK" - protected set -} - -public class BB : B() { - public fun ok(): String = OK -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958.kt deleted file mode 100644 index d138dc19fe4..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: a.kt - -package a - -import b.* - -class B { - companion object : A() {} - - init { - foo() - } -} - -fun box(): String { - B() - return result -} - -// FILE: b.kt - -package b - -var result = "fail" - -abstract class A { - protected fun foo() { - result = "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958Interface.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958Interface.kt deleted file mode 100644 index 639bf6b35bb..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/kt9958Interface.kt +++ /dev/null @@ -1,32 +0,0 @@ -// FILE: a.kt - -package a - -import b.* - -interface B { - companion object : A() {} - - fun test() { - foo() - } -} - -class C : B - -fun box(): String { - C().test() - return result -} - -// FILE: b.kt - -package b - -var result = "fail" - -abstract class A { - protected fun foo() { - result = "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/protectedFromLambda.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/protectedFromLambda.kt deleted file mode 100644 index a0cb7165308..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/protectedFromLambda.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: A.kt - -package first -import second.C - -open class A { - protected open fun test(): String = "FAIL (A)" -} - -fun box() = C().value() - -// FILE: B.kt - -// See also KT-8344: INVOKESPECIAL instead of INVOKEVIRTUAL in accessor - -package second - -import first.A - -public abstract class B(): A() { - val value = { - test() - } -} - -class C: B() { - override fun test() = "OK" -} diff --git a/backend.native/tests/external/codegen/box/syntheticAccessors/syntheticAccessorNames.kt b/backend.native/tests/external/codegen/box/syntheticAccessors/syntheticAccessorNames.kt deleted file mode 100644 index 7f90fb35831..00000000000 --- a/backend.native/tests/external/codegen/box/syntheticAccessors/syntheticAccessorNames.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// This test checks that synthetic accessors generated by Kotlin compiler have names starting with "access$" -// This is crucial for some JVM frameworks like Quasar which rely on the bytecode being similar to the one generated by javac -// See https://youtrack.jetbrains.com/issue/KT-6870 - -class PrivatePropertyGet { - private val x = 42 - - inner class Inner { val a = x } -} - -class PrivatePropertySet { - private var x = "a" - - inner class Inner { init { x = "b" } } -} - -class PrivateMethod { - private fun foo() = "" - - inner class Inner { val a = foo() } -} - -fun check(klass: Class<*>) { - for (method in klass.getDeclaredMethods()) { - if (method.isSynthetic() && method.getName().startsWith("access$")) return - } - - throw AssertionError("No synthetic methods starting with 'access$' found in class $klass") -} - -fun box(): String { - check(PrivatePropertyGet::class.java) - check(PrivatePropertySet::class.java) - check(PrivateMethod::class.java) - - // Also check that synthetic accessors really work - PrivatePropertyGet().Inner() - PrivatePropertySet().Inner() - PrivateMethod().Inner() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/toArray/kt3177-toTypedArray.kt b/backend.native/tests/external/codegen/box/toArray/kt3177-toTypedArray.kt deleted file mode 100644 index 6d941babc19..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/kt3177-toTypedArray.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - val list = ArrayList>() - list.add(Pair("Sample", "http://cyber.law.harvard.edu/rss/examples/rss2sample.xml")) - list.add(Pair("Scripting", "http://static.scripting.com/rss.xml")) - - val keys = list.map { it.first }.toTypedArray() - - val keysToString = keys.contentToString() - if (keysToString != "[Sample, Scripting]") return keysToString - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/toArray/returnToTypedArray.kt b/backend.native/tests/external/codegen/box/toArray/returnToTypedArray.kt deleted file mode 100644 index 5986dbe5bf4..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/returnToTypedArray.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -fun getCopyToArray(): Array = listOf(2, 3, 9).toTypedArray() - -fun box(): String { - val str = getCopyToArray().contentToString() - if (str != "[2, 3, 9]") return str - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/toArray/toArray.kt b/backend.native/tests/external/codegen/box/toArray/toArray.kt deleted file mode 100644 index 0475226a268..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/toArray.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME - -class MyCollection(val delegate: Collection): Collection by delegate - -fun box(): String { - val collection = MyCollection(listOf(2, 3, 9)) as java.util.Collection<*> - - val array1 = collection.toArray() - val array2 = collection.toArray(arrayOfNulls(3) as Array) - - if (!array1.isArrayOf()) return (array1 as Object).getClass().toString() - if (!array2.isArrayOf()) return (array2 as Object).getClass().toString() - - val s1 = array1.contentToString() - val s2 = array2.contentToString() - - if (s1 != "[2, 3, 9]") return "s1 = $s1" - if (s2 != "[2, 3, 9]") return "s2 = $s2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/toArray/toArrayAlreadyPresent.kt b/backend.native/tests/external/codegen/box/toArray/toArrayAlreadyPresent.kt deleted file mode 100644 index 3be85f8dad4..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/toArrayAlreadyPresent.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME - -import java.util.Arrays - -class MyCollection(val delegate: Collection): Collection by delegate { - public fun toArray(): Array { - val a = arrayOfNulls(3) - a[0] = 0 - a[1] = 1 - a[2] = 2 - return a - } - public fun toArray(array: Array): Array { - val asIntArray = array as Array - asIntArray[0] = 0 - asIntArray[1] = 1 - asIntArray[2] = 2 - return array - } -} - -fun box(): String { - val collection = MyCollection(Arrays.asList(2, 3, 9)) as java.util.Collection<*> - - val array1 = collection.toArray() - val array2 = collection.toArray(arrayOfNulls(3) as Array) - - if (!array1.isArrayOf()) return (array1 as Object).getClass().toString() - if (!array2.isArrayOf()) return (array2 as Object).getClass().toString() - - val s1 = Arrays.toString(array1) - val s2 = Arrays.toString(array2) - - if (s1 != "[0, 1, 2]") return "s1 = $s1" - if (s2 != "[0, 1, 2]") return "s2 = $s2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublic.kt b/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublic.kt deleted file mode 100644 index 78f1b92f895..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublic.kt +++ /dev/null @@ -1,50 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME - -// FILE: SingletonCollection.kt -package test - -open class SingletonCollection(val value: T) : AbstractCollection() { - override val size = 1 - override fun iterator(): Iterator = listOf(value).iterator() - - protected override final fun toArray(): Array = - arrayOf(value) - - protected override final fun toArray(a: Array): Array { - a[0] = value as E - return a - } -} - -// FILE: DerivedSingletonCollection.kt -package test2 - -import test.* - -class DerivedSingletonCollection(value: T) : SingletonCollection(value) - -// FILE: box.kt -import test.* -import test2.* - -fun box(): String { - val sc = SingletonCollection(42) - - val test1 = (sc as java.util.Collection).toArray() - if (test1[0] != 42) return "Failed #1" - - val test2 = arrayOf(0) - (sc as java.util.Collection).toArray(test2) - if (test2[0] != 42) return "Failed #2" - - val dsc = DerivedSingletonCollection(42) - val test3 = (dsc as java.util.Collection).toArray() - if (test3[0] != 42) return "Failed #3" - - val test4 = arrayOf(0) - (dsc as java.util.Collection).toArray(test4) - if (test4[0] != 42) return "Failed #4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublicWithJava.kt b/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublicWithJava.kt deleted file mode 100644 index 8e170ae174a..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/toArrayShouldBePublicWithJava.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// IGNORE_LIGHT_ANALYSIS - -// FILE: SingletonCollection.kt -package test - -open class SingletonCollection(val value: T) : AbstractCollection() { - override val size = 1 - override fun iterator(): Iterator = listOf(value).iterator() - - protected override fun toArray(): Array = - arrayOf(value) - - protected override fun toArray(a: Array): Array { - a[0] = value as E - return a - } -} - -// FILE: JavaSingletonCollection.java -import test.*; - -public class JavaSingletonCollection extends SingletonCollection { - public JavaSingletonCollection(T value) { - super(value); - } -} - -// FILE: JavaSingletonCollection2.java -import test.*; - -public class JavaSingletonCollection2 extends SingletonCollection { - public JavaSingletonCollection2(T value) { - super(value); - } - - public Object[] toArray() { - return super.toArray(); - } - - public E[] toArray(E[] arr) { - return super.toArray(arr); - } -} - - -// FILE: box.kt -import test.* - -fun box(): String { - val jsc = JavaSingletonCollection(42) as java.util.Collection - val test3 = jsc.toArray() - if (test3[0] != 42) return "Failed #3" - - val test4 = arrayOf(0) - jsc.toArray(test4) - if (test4[0] != 42) return "Failed #4" - - val jsc2 = JavaSingletonCollection2(42) as java.util.Collection - val test5 = jsc2.toArray() - if (test5[0] != 42) return "Failed #5" - - val test6 = arrayOf(0) - jsc2.toArray(test6) - if (test6[0] != 42) return "Failed #6" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/toArray/toTypedArray.kt b/backend.native/tests/external/codegen/box/toArray/toTypedArray.kt deleted file mode 100644 index 4a98b0cf943..00000000000 --- a/backend.native/tests/external/codegen/box/toArray/toTypedArray.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE -// missing isArrayOf on JS - -// WITH_RUNTIME - -fun box(): String { - val array = listOf(2, 3, 9).toTypedArray() - if (!array.isArrayOf()) return "fail: is not Array" - - val str = array.contentToString() - if (str != "[2, 3, 9]") return str - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt deleted file mode 100644 index e464f276b32..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:kotlin.jvm.JvmMultifileClass -@file:kotlin.jvm.JvmName("TestKt") -package test - -import kotlin.test.assertEquals - -private var prop = "O" - -private fun test() = "K" - -fun box(): String { - - val clazz = Class.forName("test.TestKt") - assertEquals(1, clazz.declaredMethods.size, "Facade should have only box and getProp methods") - assertEquals("box", clazz.declaredMethods.first().name, "Facade should have only box method") - - return { - prop + test() - }() -} diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt deleted file mode 100644 index a0a275444d4..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:kotlin.jvm.JvmMultifileClass -@file:kotlin.jvm.JvmName("TestKt") -package test - -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -public var prop = "fail" - private set - -private fun test() = "K" - -fun box(): String { - - val clazz = Class.forName("test.TestKt") - assertEquals(2, clazz.declaredMethods.size, "Facade should have only box method") - val methods = clazz.declaredMethods.map { it.name } - assertTrue(methods.contains("box"), "Facade should have box method") - assertTrue(methods.contains("getProp"), "Facade should have box method") - - return { - prop = "O" - prop + test() - }() -} diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/privateInInlineNested.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/privateInInlineNested.kt deleted file mode 100644 index 2f43f6e7930..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/privateInInlineNested.kt +++ /dev/null @@ -1,19 +0,0 @@ -package test - -private val prop = "O" - -private fun test() = "K" - -inline internal fun call(p: () -> String): String = p() - -inline internal fun inlineFun(): String { - return call { - object { - fun run() = prop + test() - }.run() - } -} - -fun box(): String { - return inlineFun(); -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/privateVisibility.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/privateVisibility.kt deleted file mode 100644 index b8fde078208..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/privateVisibility.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FULL_JDK -package test - -import java.lang.reflect.Modifier - -private val prop = "O" - -private fun test() = "K" - -fun box(): String { - val clazz = Class.forName("test.PrivateVisibilityKt") - if (!Modifier.isPrivate(clazz.getDeclaredMethod("test").modifiers)) - return "Private top level function should be private" - if (!Modifier.isPrivate(clazz.getDeclaredField("prop").modifiers)) - return "Backing field for private top level property should be private" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessor.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessor.kt deleted file mode 100644 index 68d402f57bc..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessor.kt +++ /dev/null @@ -1,11 +0,0 @@ -package test - -private val prop = "O" - -private fun test() = "K" - -fun box(): String { - return { - prop + test() - }() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessorInMultiFile.kt b/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessorInMultiFile.kt deleted file mode 100644 index 65ed58cc260..00000000000 --- a/backend.native/tests/external/codegen/box/topLevelPrivate/syntheticAccessorInMultiFile.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -@file:kotlin.jvm.JvmMultifileClass -@file:kotlin.jvm.JvmName("TestKt") -package test - -private val prop = "O" - -private fun test() = "K" - -fun box(): String { - return { - prop + test() - }() -} diff --git a/backend.native/tests/external/codegen/box/traits/abstractClassInheritsFromInterface.kt b/backend.native/tests/external/codegen/box/traits/abstractClassInheritsFromInterface.kt deleted file mode 100644 index 627b60834d9..00000000000 --- a/backend.native/tests/external/codegen/box/traits/abstractClassInheritsFromInterface.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: ExtendsKCWithT.java - -public class ExtendsKCWithT extends KC { - public static String bar() { - return new ExtendsKCWithT().foo(); - } -} - -// FILE: KC.kt - -// KT-3407 Implementing (in Java) an abstract Kotlin class that implements a trait does not respect trait method definition - -interface T { - fun foo() = "OK" -} - -abstract class KC: T {} - -fun box() = ExtendsKCWithT.bar() diff --git a/backend.native/tests/external/codegen/box/traits/diamondPropertyAccessors.kt b/backend.native/tests/external/codegen/box/traits/diamondPropertyAccessors.kt deleted file mode 100644 index ce344d9014f..00000000000 --- a/backend.native/tests/external/codegen/box/traits/diamondPropertyAccessors.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -interface A { - var bar: Boolean - get() = false - set(value) { throw AssertionError("Fail set") } -} - -interface B : A - -interface C : A { - override var bar: Boolean - get() = true - set(value) {} -} - -interface D : B, C - -class Impl : D - -fun box(): String { - Impl().bar = false - if (!Impl().bar) return "Fail get" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/traits/genericMethod.kt b/backend.native/tests/external/codegen/box/traits/genericMethod.kt deleted file mode 100644 index e3d47b24181..00000000000 --- a/backend.native/tests/external/codegen/box/traits/genericMethod.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface A { - val property : T - - open fun a() : T { - return property - } -} - -open class B : A { - - override val property: Any = "fail" -} - -open class C : B(), A { - - override val property: Any = "OK" -} - -fun box() : String { - return C().a() as String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/indirectlyInheritPropertyGetter.kt b/backend.native/tests/external/codegen/box/traits/indirectlyInheritPropertyGetter.kt deleted file mode 100644 index 75cde1daa46..00000000000 --- a/backend.native/tests/external/codegen/box/traits/indirectlyInheritPropertyGetter.kt +++ /dev/null @@ -1,10 +0,0 @@ -interface A { - val str: String - get() = "OK" -} - -interface B : A - -class Impl : B - -fun box() = Impl().str diff --git a/backend.native/tests/external/codegen/box/traits/inheritJavaInterface.kt b/backend.native/tests/external/codegen/box/traits/inheritJavaInterface.kt deleted file mode 100644 index 44f9fac7be5..00000000000 --- a/backend.native/tests/external/codegen/box/traits/inheritJavaInterface.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: MyInt.java - -public interface MyInt { - - String test(); -} - -// FILE: test.kt - -interface A : MyInt { - override public fun test(): String? { - return "OK" - } -} - -class B: A - -fun box() : String { - return B().test()!! -} diff --git a/backend.native/tests/external/codegen/box/traits/inheritedFun.kt b/backend.native/tests/external/codegen/box/traits/inheritedFun.kt deleted file mode 100644 index 756aed226c7..00000000000 --- a/backend.native/tests/external/codegen/box/traits/inheritedFun.kt +++ /dev/null @@ -1,10 +0,0 @@ -//KT-2206 -interface A { - fun f():Int = 239 -} - -class B() : A - -fun box() : String { - return if (B().f() == 239) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/traits/inheritedVar.kt b/backend.native/tests/external/codegen/box/traits/inheritedVar.kt deleted file mode 100644 index 887f33c2178..00000000000 --- a/backend.native/tests/external/codegen/box/traits/inheritedVar.kt +++ /dev/null @@ -1,14 +0,0 @@ -//KT-2206 - -interface A { - var a:Int - get() = 239 - set(value) { - } -} - -class B() : A - -fun box() : String { - return if (B().a == 239) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/traits/interfaceDefaultImpls.kt b/backend.native/tests/external/codegen/box/traits/interfaceDefaultImpls.kt deleted file mode 100644 index 65727b9bdd5..00000000000 --- a/backend.native/tests/external/codegen/box/traits/interfaceDefaultImpls.kt +++ /dev/null @@ -1,23 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: B.java - -class B { - static String test(A x) { - return A.DefaultImpls.foo(x); - } -} - -// FILE: main.kt - -interface A { - fun foo() = "OK" -} - -fun box(): String { - val result = B.test(object : A {}) - if (result != "OK") return "fail: $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt b/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt deleted file mode 100644 index e77b2472214..00000000000 --- a/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt +++ /dev/null @@ -1,29 +0,0 @@ -interface I { - fun foo(): String = "foo" - - fun bar(x: String = "default") = "bar:$x" -} - -interface J : I - -interface K : J - -class A : I, J - -class B : K, I - -fun box(): String { - val foo = A().foo() - if (foo != "foo") return "fail1: $foo" - - val bar1 = A().bar() - if (bar1 != "bar:default") return "fail2: $bar1" - - val bar2 = A().bar("q") - if (bar2 != "bar:q") return "fail3: $bar2" - - val foo2 = B().foo() - if (foo2 != "foo") return "fail4: $foo2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt b/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt deleted file mode 100644 index 65f641c2d5a..00000000000 --- a/backend.native/tests/external/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt +++ /dev/null @@ -1,27 +0,0 @@ -interface I { - fun foo(x: T): String = "foo($x)" - - fun bar(x: T, y: String = "default") = "bar($x,$y)" -} - -interface J : I - -class A : I, J - -class B : J, I - -fun box(): String { - val foo = A().foo("q") - if (foo != "foo(q)") return "fail1: $foo" - - val bar1 = A().bar("w") - if (bar1 != "bar(w,default)") return "fail2: $bar1" - - val bar2 = A().bar("e", "r") - if (bar2 != "bar(e,r)") return "fail3: $bar2" - - val foo2 = B().foo("t") - if (foo2 != "foo(t)") return "fail4: $foo2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/kt1936.kt b/backend.native/tests/external/codegen/box/traits/kt1936.kt deleted file mode 100644 index 0764dca3de4..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt1936.kt +++ /dev/null @@ -1,23 +0,0 @@ -var result = "Fail" - -interface MyTrait -{ - var property : String - fun foo() { - result = property - } -} - -open class B(param : String) : MyTrait -{ - override var property : String = param - override fun foo() { - super.foo() - } -} - -fun box(): String { - val b = B("OK") - b.foo() - return result -} diff --git a/backend.native/tests/external/codegen/box/traits/kt1936_1.kt b/backend.native/tests/external/codegen/box/traits/kt1936_1.kt deleted file mode 100644 index c3c6ef815f6..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt1936_1.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface MyTrait -{ - var property : String - fun foo() = property -} - -open class B(param : String) : MyTrait -{ - override var property : String = param - override fun foo() = super.foo() -} - -fun box()= B("OK").foo() diff --git a/backend.native/tests/external/codegen/box/traits/kt2260.kt b/backend.native/tests/external/codegen/box/traits/kt2260.kt deleted file mode 100644 index f63a2220542..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt2260.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface Flusher { - fun flush() = "OK" -} - -fun myFlusher() = object : Flusher { } - -fun flushIt(flusher: Flusher) = flusher.flush() - -fun box() = flushIt(myFlusher()) diff --git a/backend.native/tests/external/codegen/box/traits/kt2399.kt b/backend.native/tests/external/codegen/box/traits/kt2399.kt deleted file mode 100644 index 9b59cb8cab1..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt2399.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS -// on JS Parser.parse and MultiParser.parse clash in ProjectInfoJsonParser - -class JsonObject { -} - -class JsonArray { -} - -class ProjectInfo { - override fun toString(): String = "OK" -} - -public interface Parser { - public fun parse(source: IN): OUT -} - -public interface MultiParser { - public fun parse(source: IN): Collection -} - -public interface JsonParser: Parser, MultiParser { - public override fun parse(source: JsonArray): Collection { - return ArrayList() - } -} - -public abstract class ProjectInfoJsonParser(): JsonParser { - public override fun parse(source: JsonObject): ProjectInfo { - return ProjectInfo() - } -} - -class ProjectApiContext { - public val projectInfoJsonParser: ProjectInfoJsonParser = object : ProjectInfoJsonParser(){ - } -} - -fun box(): String { - val context = ProjectApiContext() - val array = context.projectInfoJsonParser.parse(JsonArray()) - return if (array != null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/traits/kt2541.kt b/backend.native/tests/external/codegen/box/traits/kt2541.kt deleted file mode 100644 index 5be4abf0272..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt2541.kt +++ /dev/null @@ -1,7 +0,0 @@ -interface A { - fun foo(t: T, u: U) = "OK" -} - -class B : A - -fun box(): String = B().foo(1, 2) diff --git a/backend.native/tests/external/codegen/box/traits/kt3315.kt b/backend.native/tests/external/codegen/box/traits/kt3315.kt deleted file mode 100644 index 91f7f81a489..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt3315.kt +++ /dev/null @@ -1,10 +0,0 @@ -interface B { - fun foo(dd: T): T = dd -} - -class A: B - -fun box(): String { - val a = A() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/kt3500.kt b/backend.native/tests/external/codegen/box/traits/kt3500.kt deleted file mode 100644 index 18433df514a..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt3500.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface BK { - fun foo(): String = 10.toString() -} - -interface KTrait: BK { - override fun foo() = 30.toString() -} - -class A : BK, KTrait { - -} - -fun box(): String { - return if (A().foo() == "30") "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/kt3579.kt b/backend.native/tests/external/codegen/box/traits/kt3579.kt deleted file mode 100644 index 64514c50d9b..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt3579.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class Persistent(val p: String) -interface Hierarchy where T : Hierarchy - -class Location(): Persistent("OK"), Hierarchy - -fun box(): String { - return Location().p -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/kt3579_2.kt b/backend.native/tests/external/codegen/box/traits/kt3579_2.kt deleted file mode 100644 index 10e9a962302..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt3579_2.kt +++ /dev/null @@ -1,10 +0,0 @@ -interface First -interface Some where T : Some - -val a: Some<*>? = null - -class MClass(val p: String) : First, Some - -fun box(): String { - return MClass("OK").p -} diff --git a/backend.native/tests/external/codegen/box/traits/kt5393.kt b/backend.native/tests/external/codegen/box/traits/kt5393.kt deleted file mode 100644 index 2b221df2cb3..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt5393.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface A { - fun foo(): String { - return "OK" - } -} - -interface B : A - -class C : B { - override fun foo(): String { - return super.foo() - } -} - -fun box(): String { - return C().foo() -} diff --git a/backend.native/tests/external/codegen/box/traits/kt5393_property.kt b/backend.native/tests/external/codegen/box/traits/kt5393_property.kt deleted file mode 100644 index 881fb3ba8ca..00000000000 --- a/backend.native/tests/external/codegen/box/traits/kt5393_property.kt +++ /dev/null @@ -1,20 +0,0 @@ -var result = "Fail" - -interface A { - var foo: String - get() = result - set(value) { result = value } -} - -interface B : A - -class C : B { - override var foo: String - get() = super.foo - set(value) { super.foo = value } -} - -fun box(): String { - C().foo = "OK" - return C().foo -} diff --git a/backend.native/tests/external/codegen/box/traits/multiple.kt b/backend.native/tests/external/codegen/box/traits/multiple.kt deleted file mode 100644 index bc6470c0d6b..00000000000 --- a/backend.native/tests/external/codegen/box/traits/multiple.kt +++ /dev/null @@ -1,21 +0,0 @@ -interface AL { - fun get(index: Int) : Any? = null -} - -interface ALE : AL { - fun getOrNull(index: Int, value: T) : T { - val r = get(index) as? T - return r ?: value - } -} - -open class SmartArrayList() : ALE { -} - -class SmartArrayList2() : SmartArrayList(), AL { -} - -fun box() : String { - val c = SmartArrayList2() - return if("239" == c.getOrNull(0, "239")) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/traits/noPrivateDelegation.kt b/backend.native/tests/external/codegen/box/traits/noPrivateDelegation.kt deleted file mode 100644 index d1c3bd777bf..00000000000 --- a/backend.native/tests/external/codegen/box/traits/noPrivateDelegation.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -interface Z{ - - private fun extension(): String { - return "OK" - } -} - -object Z2 : Z { - -} - -fun box() : String { - val size = Class.forName("Z2").declaredMethods.size - if (size != 0) return "fail: $size" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/traits/syntheticAccessor.kt b/backend.native/tests/external/codegen/box/traits/syntheticAccessor.kt deleted file mode 100644 index 32ce13d9d57..00000000000 --- a/backend.native/tests/external/codegen/box/traits/syntheticAccessor.kt +++ /dev/null @@ -1,21 +0,0 @@ -var result = "fail" - -interface B { - - private fun test() { - result = "OK" - } - - class Z { - fun ztest(b: B) { - b.test() - } - } -} - -class C : B - -fun box(): String { - B.Z().ztest(C()) - return result -} diff --git a/backend.native/tests/external/codegen/box/traits/traitImplDelegationWithCovariantOverride.kt b/backend.native/tests/external/codegen/box/traits/traitImplDelegationWithCovariantOverride.kt deleted file mode 100644 index 2c8af75f5c0..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitImplDelegationWithCovariantOverride.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - fun foo(): Number { - return 42 - } -} - -interface B : A - -class C : B { - override fun foo(): Int { - return super.foo() as Int - } -} - -fun box(): String { - val x = C().foo() - return if (x == 42) "OK" else "Fail: $x" -} diff --git a/backend.native/tests/external/codegen/box/traits/traitImplDiamond.kt b/backend.native/tests/external/codegen/box/traits/traitImplDiamond.kt deleted file mode 100644 index 7c0a3eaa1ad..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitImplDiamond.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -interface A { - fun foo() = "Fail" -} - -interface B : A - -interface C : A { - override fun foo() = "OK" -} - -interface D : B, C - -class Impl : D - -fun box(): String = Impl().foo() diff --git a/backend.native/tests/external/codegen/box/traits/traitImplGenericDelegation.kt b/backend.native/tests/external/codegen/box/traits/traitImplGenericDelegation.kt deleted file mode 100644 index 65253011fd9..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitImplGenericDelegation.kt +++ /dev/null @@ -1,22 +0,0 @@ -interface A { - fun foo(t: T, u: U): V? { - return null - } -} - -interface B : A - -class C : B { - override fun foo(t: String, u: Int): Runnable? { - return super.foo(t, u) - } -} - -interface Runnable { - fun run(): Unit -} - -fun box(): String { - val x = C().foo("", 0) - return if (x == null) "OK" else "Fail: $x" -} diff --git a/backend.native/tests/external/codegen/box/traits/traitWithPrivateExtension.kt b/backend.native/tests/external/codegen/box/traits/traitWithPrivateExtension.kt deleted file mode 100644 index 5dee33c0792..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitWithPrivateExtension.kt +++ /dev/null @@ -1,28 +0,0 @@ -open class B { - val p = "OK" -} - -class BB : B() - -interface Z { - fun T.getString() : String { - return p - } - - fun test(s: T) : String { - return s.extension() - } - - private fun T.extension(): String { - return getString() - } -} - -object Z2 : Z { - -} - -fun box() : String { - return Z2.test(BB()) -} - diff --git a/backend.native/tests/external/codegen/box/traits/traitWithPrivateMember.kt b/backend.native/tests/external/codegen/box/traits/traitWithPrivateMember.kt deleted file mode 100644 index 50debaa1e26..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitWithPrivateMember.kt +++ /dev/null @@ -1,26 +0,0 @@ -interface Z { - - fun testFun() : String { - return privateFun() - } - - fun testProperty() : String { - return privateProp - } - - private fun privateFun(): String { - return "O" - } - - private val privateProp: String - get() = "K" -} - -object Z2 : Z { - -} - -fun box() : String { - return Z2.testFun() + Z2.testProperty() -} - diff --git a/backend.native/tests/external/codegen/box/traits/traitWithPrivateMemberAccessFromLambda.kt b/backend.native/tests/external/codegen/box/traits/traitWithPrivateMemberAccessFromLambda.kt deleted file mode 100644 index 0b2a16072d3..00000000000 --- a/backend.native/tests/external/codegen/box/traits/traitWithPrivateMemberAccessFromLambda.kt +++ /dev/null @@ -1,26 +0,0 @@ -interface Z { - - fun testFun(): String { - return { privateFun() } () - } - - fun testProperty(): String { - return { privateProp } () - } - - private fun privateFun(): String { - return "O" - } - - private val privateProp: String - get() = "K" -} - -object Z2 : Z { - -} - -fun box(): String { - return Z2.testFun() + Z2.testProperty() -} - diff --git a/backend.native/tests/external/codegen/box/typeInfo/asInLoop.kt b/backend.native/tests/external/codegen/box/typeInfo/asInLoop.kt deleted file mode 100644 index 5c10094c85d..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/asInLoop.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -import java.io.* - -fun foo(args: Array) { - val reader = BufferedReader(InputStreamReader(System.`in`)) - while(true) { - val cmd = reader.readLine() as String - } -} - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/typeInfo/ifOrWhenSpecialCall.kt b/backend.native/tests/external/codegen/box/typeInfo/ifOrWhenSpecialCall.kt deleted file mode 100644 index 54ec5152a12..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/ifOrWhenSpecialCall.kt +++ /dev/null @@ -1,26 +0,0 @@ -interface Option { - val s: String -} -class Some(override val s: String) : Option -class None(override val s: String = "None") : Option - -fun whenTest(a: Int): Option = when (a) { - 239 -> { - if (a == 239) Some("239") else None() - } - else -> if (a != 239) Some("$a") else None() -} - -fun ifTest(a: Int): Option = if (a == 239) { - if (a == 239) Some("239") else None() -} else if (a != 239) Some("$a") else None() - -fun box(): String { - if (whenTest(2).s != "2") return "Fail 1" - if (whenTest(239).s != "239") return "Fail 2" - - if (ifTest(2).s != "2") return "Fail 3" - if (ifTest(239).s != "239") return "Fail 4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeInfo/implicitSmartCastThis.kt b/backend.native/tests/external/codegen/box/typeInfo/implicitSmartCastThis.kt deleted file mode 100644 index a4587005887..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/implicitSmartCastThis.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class A - -class B : A() { - fun foo(i: Int) = i -} - -fun A.test() = if (this is B) foo(42) else 0 - -fun box(): String { - if (B().test() != 42) return "fail1" - if (A().test() != 0) return "fail2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typeInfo/inheritance.kt b/backend.native/tests/external/codegen/box/typeInfo/inheritance.kt deleted file mode 100644 index f40166007db..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/inheritance.kt +++ /dev/null @@ -1,11 +0,0 @@ -open class A () { - fun plus(e: T) = B (e) -} - -class B (val e: T) : A() { - fun add() = B (e) -} - -fun box() : String { - return if(A().plus("239").add().e == "239" ) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/typeInfo/kt2811.kt b/backend.native/tests/external/codegen/box/typeInfo/kt2811.kt deleted file mode 100644 index 293eb80b20b..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/kt2811.kt +++ /dev/null @@ -1,25 +0,0 @@ -open class Test1 { - fun test1(): String { - if (this is Test2) { - return this.foo() - } - return "fail" - } -} - -class Test2(): Test1() { - fun foo(): String { - return "OK" - } -} - -fun Test1.test2(): String { - if (this is Test2) return this.foo() else return "fail" -} - -fun box(): String { - if ("OK" == Test2().test1() && "OK" == Test2().test2()) { - return "OK" - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/typeInfo/primitiveTypeInfo.kt b/backend.native/tests/external/codegen/box/typeInfo/primitiveTypeInfo.kt deleted file mode 100644 index ff67d156b7d..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/primitiveTypeInfo.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Box(t: T) { - var value = t -} - -fun isIntBox(box: Box): Boolean { - return box is Box<*>; -} - - -fun box(): String { - val box = Box(1) - return if (isIntBox(box)) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/typeInfo/smartCastThis.kt b/backend.native/tests/external/codegen/box/typeInfo/smartCastThis.kt deleted file mode 100644 index 6ed06c50328..00000000000 --- a/backend.native/tests/external/codegen/box/typeInfo/smartCastThis.kt +++ /dev/null @@ -1,11 +0,0 @@ -package h - -open class A { - fun bar() = if (this is B) this.foo() else "fail" -} - -class B() : A() { - fun foo() = "OK" -} - -fun box() = B().bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeMapping/enhancedPrimitives.kt b/backend.native/tests/external/codegen/box/typeMapping/enhancedPrimitives.kt deleted file mode 100644 index b94098789db..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/enhancedPrimitives.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - // This test checks that although type '@org.jetbrains.annotations.NotNull Integer' is perceived as simple Int, - // it's correctly mapped to 'Lj.l.Integer' by JVM backend - public static String test(@org.jetbrains.annotations.NotNull Integer x) { - return "OK"; - } -} - -// FILE: box.kt - -fun box() = J.test(1) diff --git a/backend.native/tests/external/codegen/box/typeMapping/genericTypeWithNothing.kt b/backend.native/tests/external/codegen/box/typeMapping/genericTypeWithNothing.kt deleted file mode 100644 index 8f6c732f1ef..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/genericTypeWithNothing.kt +++ /dev/null @@ -1,86 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -package foo - -import kotlin.reflect.KClass - -class A -class B - -class TestRaw { - val a1: A = A() - val a2: A? = A() - val a3: A = A() - val a4: A? = A() - - var b1: B = B() - var b2: B = B() - - val l: List = listOf() - - fun test1(a: A, b: B>): A? = A() - fun test2(a: A?, b: B): B = B() -} - -class TestNotRaw { - val a1: A = A() - val a2: A>? = A() - val a3: A = A() - val a4: A? = A() - - var b1: B = B() - var b2: B, Int> = B() - - val l: List = listOf() - - fun test1(a: A, b: B>): A? = A() - fun test2(a: A?, b: B>): B = B() -} - -abstract class C { - abstract val foo: A - abstract fun bar(): A? -} - -class C1 : C() { - override val foo = A() - override fun bar() = foo -} -class C2 : C() { - override val foo = A() - override fun bar() = foo -} - -fun testAllDeclaredMembers(klass: KClass<*>, expectedIsRaw: Boolean): String? { - val clazz = klass.java - - for (it in clazz.declaredFields) { - if ((it.type == it.genericType) == expectedIsRaw) return "failed on field '${clazz.simpleName}::${it.name}'" - } - - for (m in clazz.declaredMethods) { - for (i in m.parameterTypes.indices) { - if ((m.parameterTypes[i] == m.genericParameterTypes[i]) == expectedIsRaw) return "failed on type of param#$i of method '${clazz.simpleName}::${m.name}'" - } - if (m.returnType != Void.TYPE && (m.returnType == m.genericReturnType) == expectedIsRaw) return "failed on return type of method '${clazz.simpleName}::${m.name}'" - } - - return null -} - -fun box(): String { - testAllDeclaredMembers(TestRaw::class, expectedIsRaw = true) ?: - testAllDeclaredMembers(TestNotRaw::class, expectedIsRaw = false)?.let { return it } - - if (C1::class.java.superclass != C1::class.java.genericSuperclass) return "failed on C1 superclass" - - if (C2::class.java.superclass == C2::class.java.genericSuperclass) return "failed on C2 superclass" - - testAllDeclaredMembers(C1::class, expectedIsRaw = true) ?: - testAllDeclaredMembers(C2::class, expectedIsRaw = false)?.let { return it } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typeMapping/kt2831.kt b/backend.native/tests/external/codegen/box/typeMapping/kt2831.kt deleted file mode 100644 index 3ead49d90ad..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/kt2831.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Exception in thread "main" java.lang.VerifyError: (class: org/jetbrains/kannotator/controlFlowBuilder/GraphBuilderInterpreter, method: binaryOperation signature: (Lorg/objectweb/asm/tree/AbstractInsnNode;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;)Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;) Wrong return type in function - -fun foo(): Nothing = throw Exception() - -fun bar(x: Any): Int { - return when(x) { - is String -> 0 - is Int -> 1 - else -> foo() - } -} - -fun box(): String { - bar(3) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeMapping/kt309.kt b/backend.native/tests/external/codegen/box/typeMapping/kt309.kt deleted file mode 100644 index 873343a37ba..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/kt309.kt +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class N { - fun foo() = null -} - -fun box(): String { - val method = N::class.java.getDeclaredMethod("foo") - if (method.returnType.name != "java.lang.Void") return "Fail: Nothing should be mapped to Void" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typeMapping/kt3286.kt b/backend.native/tests/external/codegen/box/typeMapping/kt3286.kt deleted file mode 100644 index 8d5c36246f9..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/kt3286.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun test(x: Int): String = when(x) { - 0 -> "zero" - 1 -> "one" - 2 -> "two" - else -> blowUpHorribly() - } - -fun blowUpHorribly(): Nothing = throw RuntimeException("Blow up!") - -fun box(): String { - test(1) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeMapping/kt3863.kt b/backend.native/tests/external/codegen/box/typeMapping/kt3863.kt deleted file mode 100644 index 21b6b4acd63..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/kt3863.kt +++ /dev/null @@ -1,19 +0,0 @@ -import kotlin.reflect.KProperty - -// java.lang.VerifyError: (class: NotImplemented, method: get signature: (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;) Unable to pop operand off an empty stack - -class NotImplemented(){ - operator fun getValue(thisRef: Any?, prop: KProperty<*>): T = notImplemented() - operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: T): Nothing = notImplemented() -} - -fun notImplemented() : Nothing = notImplemented() - -class Test { - val x: Int by NotImplemented() -} - -fun box(): String { - Test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typeMapping/kt3976.kt b/backend.native/tests/external/codegen/box/typeMapping/kt3976.kt deleted file mode 100644 index 47110878e72..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/kt3976.kt +++ /dev/null @@ -1,20 +0,0 @@ -import kotlin.reflect.KProperty - -// java.lang.ClassNotFoundException: kotlin.Nothing - -var currentAccountId: Int? by SessionAccessor() -class SessionAccessor { - operator fun getValue(o : Nothing?, desc: KProperty<*>): T { - return null as T - } - - operator fun setValue(o : Nothing?, desc: KProperty<*>, value: T) { - - } -} - -fun box(): String { - currentAccountId = 1 - if (currentAccountId != null) return "Fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typeMapping/nothing.kt b/backend.native/tests/external/codegen/box/typeMapping/nothing.kt deleted file mode 100644 index 93cafb65401..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/nothing.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - // kotlin.Nothing should not be loaded here - val x = "" is Nothing - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeMapping/nullableNothing.kt b/backend.native/tests/external/codegen/box/typeMapping/nullableNothing.kt deleted file mode 100644 index 79fd2fa060f..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/nullableNothing.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - // This used to be problematic because of an attempt to load kotlin/Nothing class - val x = "" is Nothing? - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typeMapping/typeParameterMultipleBounds.kt b/backend.native/tests/external/codegen/box/typeMapping/typeParameterMultipleBounds.kt deleted file mode 100644 index 138c2d51355..00000000000 --- a/backend.native/tests/external/codegen/box/typeMapping/typeParameterMultipleBounds.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -interface I1 -interface I2 -open class C - -interface K { - // Erasure of a type parameter with multiple bounds should be the class bound, or the first bound if there's no class bound - - fun c1(t: T) where T : C, T : I1, T : I2 - fun c2(t: T) where T : I1, T : C, T : I2 - fun c3(t: T) where T : I2, T : C, T : I1 - fun c4(t: T) where T : I2, T : I1, T : C - - fun i1(t: T) where T : I1, T : I2 - fun i2(t: T) where T : I2, T : I1 -} - -fun box(): String { - val k = K::class.java - - k.getDeclaredMethod("c1", C::class.java) - k.getDeclaredMethod("c2", C::class.java) - k.getDeclaredMethod("c3", C::class.java) - k.getDeclaredMethod("c4", C::class.java) - - k.getDeclaredMethod("i1", I1::class.java) - k.getDeclaredMethod("i2", I2::class.java) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/typealias/enumEntryQualifier.kt b/backend.native/tests/external/codegen/box/typealias/enumEntryQualifier.kt deleted file mode 100644 index 19c383aaed0..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/enumEntryQualifier.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class MyEnum { - O; - companion object { - val K = "K" - } -} - -typealias MyAlias = MyEnum - -fun box() = MyAlias.O.name + MyAlias.K \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor.kt b/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor.kt deleted file mode 100644 index 6dfe839c270..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor.kt +++ /dev/null @@ -1,6 +0,0 @@ -class Cell(val x: T) - -typealias StringCell = Cell - -fun box(): String = - StringCell("O").x + Cell("K").x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor2.kt b/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor2.kt deleted file mode 100644 index 845d35b4aed..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/genericTypeAliasConstructor2.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Pair(val x1: T1, val x2: T2) - -typealias ST = Pair - -fun box(): String { - val st = ST("O", "K") - return st.x1 + st.x2 -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructor.kt b/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructor.kt deleted file mode 100644 index 6193b148048..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructor.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Outer(val x: String) { - inner class Inner(val y: String) { - val z = x + y - } -} - -typealias OI = Outer.Inner - -fun box(): String = - Outer("O").OI("K").z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructorInSupertypes.kt b/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructorInSupertypes.kt deleted file mode 100644 index 0c1b2ee469f..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/innerClassTypeAliasConstructorInSupertypes.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Outer(val x: String) { - abstract inner class InnerBase - - inner class Inner(val y: String) : OIB() { - val z = x + y - } -} - -typealias OIB = Outer.InnerBase - -fun box(): String = - Outer("O").Inner("K").z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/kt15109.kt b/backend.native/tests/external/codegen/box/typealias/kt15109.kt deleted file mode 100644 index f6846176bf5..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/kt15109.kt +++ /dev/null @@ -1,9 +0,0 @@ -open class A(private val s: String = "") { - fun foo() = s -} - -typealias B = A - -class C : B(s = "OK") - -fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/box/typealias/objectLiteralConstructor.kt b/backend.native/tests/external/codegen/box/typealias/objectLiteralConstructor.kt deleted file mode 100644 index eab3abf7d1d..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/objectLiteralConstructor.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class LockFreeLinkedListNode(val s: String) -private class SendBuffered(s: String) : LockFreeLinkedListNode(s) -open class AddLastDesc2(val node: T) -typealias AddLastDesc = AddLastDesc2 - -fun describeSendBuffered(): AddLastDesc<*> { - return object : AddLastDesc(SendBuffered("OK")) {} -} - -fun box() = describeSendBuffered().node.s diff --git a/backend.native/tests/external/codegen/box/typealias/simple.kt b/backend.native/tests/external/codegen/box/typealias/simple.kt deleted file mode 100644 index a5cd67b9ad7..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/simple.kt +++ /dev/null @@ -1,7 +0,0 @@ -typealias S = String - -typealias SF = (T) -> S - -val f: SF = { it } - -fun box(): S = f("OK") diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasAsBareType.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasAsBareType.kt deleted file mode 100644 index eed82fc0045..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasAsBareType.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME - -typealias L = List - -fun box(): String { - val test: Collection = listOf(1, 2, 3) - if (test !is L) return "test !is L" - val test2 = test as L - if (test.toList() != test2) return "test.toList() != test2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasCompanion.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasCompanion.kt deleted file mode 100644 index 07efa97a0f0..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasCompanion.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - companion object { - val result = "OK" - } -} - -typealias Alias = A.Companion - -fun box(): String = Alias.result diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructor.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasConstructor.kt deleted file mode 100644 index d466f977248..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructor.kt +++ /dev/null @@ -1,5 +0,0 @@ -class C(val x: String) - -typealias Alias = C - -fun box(): String = Alias("OK").x diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorAccessor.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorAccessor.kt deleted file mode 100644 index 3b92f4005d2..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorAccessor.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Outer private constructor(public val x: String) { - class Nested { - fun foo() = OuterAlias("OK") - } -} - -typealias OuterAlias = Outer - -fun box(): String = - Outer.Nested().foo().x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorForArray.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorForArray.kt deleted file mode 100644 index 8be95d2e91d..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorForArray.kt +++ /dev/null @@ -1,16 +0,0 @@ -typealias BoolArray = Array -typealias IArray = IntArray -typealias MyArray = Array - -fun box(): String { - val ba = BoolArray(1) { true } - if (!ba[0]) return "Fail #1" - - val ia = IArray(1) { 42 } - if (ia[0] != 42) return "Fail #2" - - val ma = MyArray(1) { 42 } - if (ma[0] != 42) return "Fail #2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorInSuperCall.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorInSuperCall.kt deleted file mode 100644 index 95cee2f88ef..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasConstructorInSuperCall.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class Cell(val value: T) - -typealias CT = Cell -typealias CStr = Cell - -class C1 : CT("O") -class C2 : CStr("K") - -fun box(): String = - C1().value + C2().value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasInAnonymousObjectType.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasInAnonymousObjectType.kt deleted file mode 100644 index ba3a87abaec..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasInAnonymousObjectType.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class Foo(val x: T) - -typealias FooStr = Foo - -val test = object : FooStr("OK") {} - -fun box() = test.x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasObject.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasObject.kt deleted file mode 100644 index 203f4e5bd5f..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasObject.kt +++ /dev/null @@ -1,15 +0,0 @@ -object OHolder { - val O = "O" -} - -typealias OHolderAlias = OHolder - -class KHolder { - companion object { - val K = "K" - } -} - -typealias KHolderAlias = KHolder - -fun box(): String = OHolderAlias.O + KHolderAlias.K diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasObjectCallable.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasObjectCallable.kt deleted file mode 100644 index 5a321ecd586..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasObjectCallable.kt +++ /dev/null @@ -1,9 +0,0 @@ -object O { - val x = "OK" - - operator fun invoke() = x -} - -typealias A = O - -fun box(): String = A() diff --git a/backend.native/tests/external/codegen/box/typealias/typeAliasSecondaryConstructor.kt b/backend.native/tests/external/codegen/box/typealias/typeAliasSecondaryConstructor.kt deleted file mode 100644 index fd0f2bd66c9..00000000000 --- a/backend.native/tests/external/codegen/box/typealias/typeAliasSecondaryConstructor.kt +++ /dev/null @@ -1,11 +0,0 @@ -class C(val x: String) { - constructor(n: Int) : this(n.toString()) -} - -typealias Alias = C - -fun box(): String { - val c = Alias(23) - if (c.x != "23") return "fail: $c" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unaryOp/call.kt b/backend.native/tests/external/codegen/box/unaryOp/call.kt deleted file mode 100644 index fe138509d88..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/call.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val a1: Byte = 1.unaryMinus() - val a2: Short = 1.unaryMinus() - val a3: Int = 1.unaryMinus() - val a4: Long = 1.unaryMinus() - val a5: Double = 1.0.unaryMinus() - val a6: Float = 1f.unaryMinus() - - if (a1 != (-1).toByte()) return "fail 1" - if (a2 != (-1).toShort()) return "fail -1" - if (a3 != -1) return "fail 3" - if (a4 != -1L) return "fail 4" - if (a5 != -1.0) return "fail 5" - if (a6 != -1f) return "fail 6" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/unaryOp/callNullable.kt b/backend.native/tests/external/codegen/box/unaryOp/callNullable.kt deleted file mode 100644 index f3ff7db949a..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/callNullable.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val a1: Byte? = 1.unaryMinus() - val a2: Short? = 1.unaryMinus() - val a3: Int? = 1.unaryMinus() - val a4: Long? = 1.unaryMinus() - val a5: Double? = 1.0.unaryMinus() - val a6: Float? = 1f.unaryMinus() - - if (a1!! != (-1).toByte()) return "fail 1" - if (a2!! != (-1).toShort()) return "fail 2" - if (a3!! != -1) return "fail 3" - if (a4!! != -1L) return "fail 4" - if (a5!! != -1.0) return "fail 5" - if (a6!! != -1f) return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unaryOp/callWithCommonType.kt b/backend.native/tests/external/codegen/box/unaryOp/callWithCommonType.kt deleted file mode 100644 index a3fa43dc3c3..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/callWithCommonType.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - if (!foo(1.toByte())) return "fail 1" - if (!foo((1.toByte()).inc())) return "fail 2" - - return "OK" -} - -fun foo(p: Any) = p is Byte \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/unaryOp/intrinsic.kt b/backend.native/tests/external/codegen/box/unaryOp/intrinsic.kt deleted file mode 100644 index 30bd7d9d8f0..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/intrinsic.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val a1: Byte = -1 - val a2: Short = -1 - val a3: Int = -1 - val a4: Long = -1 - val a5: Double = -1.0 - val a6: Float = -1f - - if (a1 != (-1).toByte()) return "fail 1" - if (a2 != (-1).toShort()) return "fail 2" - if (a3 != -1) return "fail 3" - if (a4 != -1L) return "fail 4" - if (a5 != -1.0) return "fail 5" - if (a6 != -1f) return "fail 6" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/unaryOp/intrinsicNullable.kt b/backend.native/tests/external/codegen/box/unaryOp/intrinsicNullable.kt deleted file mode 100644 index 0463bcddba9..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/intrinsicNullable.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - val a1: Byte? = -1 - val a2: Short? = -1 - val a3: Int? = -1 - val a4: Long? = -1 - val a5: Double? = -1.0 - val a6: Float? = -1f - - if (a1!! != (-1).toByte()) return "fail 1" - if (a2!! != (-1).toShort()) return "fail 2" - if (a3!! != -1) return "fail 3" - if (a4!! != -1L) return "fail 4" - if (a5!! != -1.0) return "fail 5" - if (a6!! != -1f) return "fail 6" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unaryOp/longOverflow.kt b/backend.native/tests/external/codegen/box/unaryOp/longOverflow.kt deleted file mode 100644 index d3615f071ea..00000000000 --- a/backend.native/tests/external/codegen/box/unaryOp/longOverflow.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - val a: Long = -(1 shl 31) - if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/unit/UnitValue.kt b/backend.native/tests/external/codegen/box/unit/UnitValue.kt deleted file mode 100644 index 243b563dba8..00000000000 --- a/backend.native/tests/external/codegen/box/unit/UnitValue.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo() {} - -fun box(): String { - return if (foo() == Unit) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/unit/closureReturnsNullableUnit.kt b/backend.native/tests/external/codegen/box/unit/closureReturnsNullableUnit.kt deleted file mode 100644 index 604b35ab71f..00000000000 --- a/backend.native/tests/external/codegen/box/unit/closureReturnsNullableUnit.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun isNull(x: Unit?) = x == null - -fun box(): String { - val closure: () -> Unit? = { null } - if (!isNull(closure())) return "Fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/ifElse.kt b/backend.native/tests/external/codegen/box/unit/ifElse.kt deleted file mode 100644 index 171b2b2fdeb..00000000000 --- a/backend.native/tests/external/codegen/box/unit/ifElse.kt +++ /dev/null @@ -1,31 +0,0 @@ -class A (val p: String, p1: String, p2: String) { - - var cond1: String = "" - - var cond2: String = "" - - val prop1 = if (cond1(p)) p1 else null - - val prop2 = if (cond2(p)) p2 else null; - - - fun cond1(p: String): Boolean { - cond1 = "cond1" - return p == "test" - } - - fun cond2(p: String): Boolean { - cond2 = "cond2" - return p == "test" - } -} - -fun box(): String { - val a = A("test", "OK", "fail") - - if (a.cond1 != "cond1") return "fail 2 : ${a.cond1}" - - if (a.cond2 != "cond2") return "fail 3 : ${a.cond2}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/unit/kt3634.kt b/backend.native/tests/external/codegen/box/unit/kt3634.kt deleted file mode 100644 index 4dcbf3f5bfe..00000000000 --- a/backend.native/tests/external/codegen/box/unit/kt3634.kt +++ /dev/null @@ -1,8 +0,0 @@ -val c = Unit -val d = c - -fun box(): String { - c - d - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/kt4212.kt b/backend.native/tests/external/codegen/box/unit/kt4212.kt deleted file mode 100644 index 5d9db4097e7..00000000000 --- a/backend.native/tests/external/codegen/box/unit/kt4212.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun foo(): Any? = bar() - -fun bar() {} - -fun baz(): Any? { - return bar() -} - -fun quux(): Unit? = bar() - -fun box(): String { - foo() - - if (foo() != Unit) return "Fail 1" - if (foo() != bar()) return "Fail 2" - if (bar() != baz()) return "Fail 3" - if (baz() != quux()) return "Fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/kt4265.kt b/backend.native/tests/external/codegen/box/unit/kt4265.kt deleted file mode 100644 index 3c1aaf9d462..00000000000 --- a/backend.native/tests/external/codegen/box/unit/kt4265.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun T.let(f: (T) -> R): R = f(this) - -fun box(): String { - val o: String? = null - - var state = 0 - - o?.let { - state = 1 - } ?: ({ state = 2 })() - - if (state != 2) return "Fail: $state" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/nullableUnit.kt b/backend.native/tests/external/codegen/box/unit/nullableUnit.kt deleted file mode 100644 index 0289cca09ba..00000000000 --- a/backend.native/tests/external/codegen/box/unit/nullableUnit.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun isNull(x: Unit?) = x == null - -fun isNullGeneric(x: T?) = x == null - -fun deepIsNull0(x: Unit?) = isNull(x) -fun deepIsNull(x: Unit?) = deepIsNull0(x) - -fun box(): String { - if (!isNull(null)) return "Fail 1" - - val x: Unit? = null - if (!isNull(x)) return "Fail 2" - - val y = x - if (!isNullGeneric(y)) return "Fail 3" - - if (!deepIsNull(x ?: null)) return "Fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen1.kt b/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen1.kt deleted file mode 100644 index 2d6768af748..00000000000 --- a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen1.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo() {} - -fun box(): String { - when ("A") { - "B" -> foo() - else -> null - } - - foo() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen2.kt b/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen2.kt deleted file mode 100644 index 47807e50f19..00000000000 --- a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen2.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo() {} - -fun box(): String { - when ("A") { - "B" -> null - else -> foo() - } - - foo() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen3.kt b/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen3.kt deleted file mode 100644 index b2e2b0ae439..00000000000 --- a/backend.native/tests/external/codegen/box/unit/nullableUnitInWhen3.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo() {} - -fun box(): String { - val x = when ("A") { - "B" -> foo() - else -> null - } - - foo() - - return if (x == null) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/unit/unitClassObject.kt b/backend.native/tests/external/codegen/box/unit/unitClassObject.kt deleted file mode 100644 index e4cdbacbe14..00000000000 --- a/backend.native/tests/external/codegen/box/unit/unitClassObject.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - Unit - - val a = Unit - val b = Unit - if (a != b) return "Fail a != b" - - if (Unit != Unit) return "Fail Unit != Unit" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt b/backend.native/tests/external/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt deleted file mode 100644 index 354ab6bddbf..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt +++ /dev/null @@ -1,68 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_REFLECT - -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -// FILE: JavaAnn.java - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - String[] value() default {}; - String[] path() default {}; -} - -// FILE: test.kt - -import java.util.Arrays -import kotlin.reflect.KClass -import kotlin.reflect.KFunction0 -import kotlin.reflect.full.findAnnotation - -inline fun test(kFunction: KFunction0, test: T.() -> Unit) { - val annotation = kFunction.findAnnotation()!! - annotation.test() -} - -fun check(b: Boolean, message: String) { - if (!b) throw RuntimeException(message) -} - -annotation class Ann(vararg val s: String) - -@Ann(s = ["value1", "value2"]) -fun test1() {} - -@Ann(s = arrayOf("value3", "value4")) -fun test2() {} - -@JavaAnn(value = ["value5"], path = ["value6"]) -fun test3() {} - -@JavaAnn("value7", path = ["value8"]) -fun test4() {} - -fun box(): String { - test(::test1) { - check(s.contentEquals(arrayOf("value1", "value2")), "Fail 1: ${s.joinToString()}") - } - - test(::test2) { - check(s.contentEquals(arrayOf("value3", "value4")), "Fail 2: ${s.joinToString()}") - } - - test(::test3) { - check(value.contentEquals(arrayOf("value5")), "Fail 3: ${value.joinToString()}") - check(path.contentEquals(arrayOf("value6")), "Fail 3: ${path.joinToString()}") - } - - test(::test4) { - check(value.contentEquals(arrayOf("value7")), "Fail 4: ${value.joinToString()}") - check(path.contentEquals(arrayOf("value8")), "Fail 4: ${path.joinToString()}") - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/vararg/doNotCopyImmediatelyCreatedArrays.kt b/backend.native/tests/external/codegen/box/vararg/doNotCopyImmediatelyCreatedArrays.kt deleted file mode 100644 index 6cc4d47dc23..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/doNotCopyImmediatelyCreatedArrays.kt +++ /dev/null @@ -1,102 +0,0 @@ -fun booleanVararg(vararg xs: Boolean) { - if (xs.size != 1 && xs[0] != true) throw AssertionError() -} - -fun byteVararg(vararg xs: Byte) { - if (xs.size != 1 && xs[0] != 1.toByte()) throw AssertionError() -} - -fun shortVararg(vararg xs: Short) { - if (xs.size != 1 && xs[0] != 1.toShort()) throw AssertionError() -} - -fun intVararg(vararg xs: Int) { - if (xs.size != 1 && xs[0] != 1) throw AssertionError() -} - -fun longVararg(vararg xs: Long) { - if (xs.size != 1 && xs[0] != 1L) throw AssertionError() -} - -fun floatVararg(vararg xs: Float) { - if (xs.size != 1 && xs[0] != 1.0f) throw AssertionError() -} - -fun doubleVararg(vararg xs: Double) { - if (xs.size != 1 && xs[0] != 1.0) throw AssertionError() -} - -fun anyVararg(vararg xs: Any?) { - if (xs.size != 1 && (xs[0] != 1 && xs[0] != null)) throw AssertionError() -} - -fun genericVararg(vararg xs: T) { - if (xs.size != 1 && (xs[0] != 1 && xs[0] != null)) throw AssertionError() -} - -fun box(): String { - booleanVararg(*booleanArrayOf(true)) - booleanVararg(*BooleanArray(1)) - booleanVararg(*BooleanArray(1) { true }) - booleanVararg(xs = *booleanArrayOf(true)) - booleanVararg(xs = *BooleanArray(1)) - booleanVararg(xs = *BooleanArray(1) { true }) - - byteVararg(*byteArrayOf(1)) - byteVararg(*ByteArray(1)) - byteVararg(*ByteArray(1) { 1 }) - byteVararg(xs = *byteArrayOf(1)) - byteVararg(xs = *ByteArray(1)) - byteVararg(xs = *ByteArray(1) { 1 }) - - shortVararg(*shortArrayOf(1)) - shortVararg(*ShortArray(1)) - shortVararg(*ShortArray(1) { 1 }) - shortVararg(xs = *shortArrayOf(1)) - shortVararg(xs = *ShortArray(1)) - shortVararg(xs = *ShortArray(1) { 1 }) - - intVararg(*intArrayOf(1)) - intVararg(*IntArray(1)) - intVararg(*IntArray(1) { 1 }) - intVararg(xs = *intArrayOf(1)) - intVararg(xs = *IntArray(1)) - intVararg(xs = *IntArray(1) { 1 }) - - longVararg(*longArrayOf(1L)) - longVararg(*LongArray(1)) - longVararg(*LongArray(1) { 1L }) - longVararg(xs = *longArrayOf(1L)) - longVararg(xs = *LongArray(1)) - longVararg(xs = *LongArray(1) { 1L }) - - floatVararg(*floatArrayOf(1.0f)) - floatVararg(*FloatArray(1)) - floatVararg(*FloatArray(1) { 1.0f }) - floatVararg(xs = *floatArrayOf(1.0f)) - floatVararg(xs = *FloatArray(1)) - floatVararg(xs = *FloatArray(1) { 1.0f }) - - doubleVararg(*doubleArrayOf(1.0)) - doubleVararg(*DoubleArray(1)) - doubleVararg(*DoubleArray(1) { 1.0 }) - doubleVararg(xs = *doubleArrayOf(1.0)) - doubleVararg(xs = *DoubleArray(1)) - doubleVararg(xs = *DoubleArray(1) { 1.0 }) - - anyVararg(*arrayOf(1)) - anyVararg(*Array(1) { 1 }) - anyVararg(*arrayOfNulls(1)) - anyVararg(xs = *arrayOf(1)) - anyVararg(xs = *Array(1) { 1 }) - anyVararg(xs = *arrayOfNulls(1)) - - genericVararg(*arrayOf(1)) - genericVararg(*Array(1) { 1 }) - genericVararg(*arrayOfNulls(1)) - genericVararg(xs = *arrayOf(1)) - genericVararg(xs = *Array(1) { 1 }) - genericVararg(xs = *arrayOfNulls(1)) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/vararg/kt1978.kt b/backend.native/tests/external/codegen/box/vararg/kt1978.kt deleted file mode 100644 index 6d27ec3a311..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/kt1978.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun aa(vararg a : String): String = a[0] - -fun box(): String { - var result: String = "" - var i = 1 - while (3 > i++) { - result = aa(if (true) "OK" else "fail") - } - return result -} diff --git a/backend.native/tests/external/codegen/box/vararg/kt581.kt b/backend.native/tests/external/codegen/box/vararg/kt581.kt deleted file mode 100644 index 829dc640f1d..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/kt581.kt +++ /dev/null @@ -1,17 +0,0 @@ -package whats.the.difference - -fun iarray(vararg a : Int) = a // BUG -val IntArray.indices: IntRange get() = IntRange(0, lastIndex()) -fun IntArray.lastIndex() = size - 1 - -fun box() : String { - val vals = iarray(789, 678, 567, 456, 345, 234, 123, 12) - val diffs = HashSet() - for (i in vals.indices) - for (j in i..vals.lastIndex()) - diffs.add(vals[i] - vals[j]) - val size = diffs.size - - if (size != 8) return "Fail $size" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/vararg/kt6192.kt b/backend.native/tests/external/codegen/box/vararg/kt6192.kt deleted file mode 100644 index 89296cf18c2..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/kt6192.kt +++ /dev/null @@ -1,93 +0,0 @@ - -fun barB(vararg args: Byte) = args -fun barC(vararg args: Char) = args -fun barD(vararg args: Double) = args -fun barF(vararg args: Float) = args -fun barI(vararg args: Int) = args -fun barJ(vararg args: Long) = args -fun barS(vararg args: Short) = args -fun barZ(vararg args: Boolean) = args - -fun sumInt(x: Int, vararg args: Int): Int { - var result = x - for(a in args) { - result += a - } - return result -} - -fun sumFunOnParameters(x: Int, vararg args: Int, f: (Int) -> Int): Int { - var result = f(x) - for(a in args) { - result += f(a) - } - return result -} - -fun concatParameters(vararg args: Int): String { - var result = "" - for(a in args) { - result += a.toString() - } - return result -} - -fun box(): String { - - val aB = ByteArray(3) - val aC = CharArray(3) - val aD = DoubleArray(3) - val aF = FloatArray(3) - val aI = IntArray(3) - aI[0] = 1 - aI[1] = 2 - aI[2] = 3 - val bI = IntArray(2) - bI[0] = 4 - bI[1] = 5 - val aJ = LongArray(3) - val aS = ShortArray(3) - val aZ = BooleanArray(3) - - - if (barB(*aB, 23.toByte()).size != 4) return "fail: Byte" - if (barB(11.toByte(), *aB, 23.toByte(), *aB).size != 8) return "fail: Byte" - - if (barC(*aC, 'A').size != 4) return "fail: Char" - if (barC('A', *aC, 'A', *aC).size != 8) return "fail: Char" - - if (barD(*aD, 2.3).size != 4) return "fail: Double" - if (barD(*aD, *aD, 2.3).size != 7) return "fail: Double" - - if (barF(*aF, 2.3f).size != 4) return "fail: Float" - if (barF(*aF, 2.3f, 1.1f).size != 5) return "fail: Float" - - if (barI(*aI, 23).size != 4) return "fail: Int" - if (barI(11, 10, *aI, 23).size != 6) return "fail: Int" - if (barI(100, *aI, *aI).size != 7) return "fail: Int 3" - - if (sumInt(100, *aI) != 106) return "fail: sumInt 1" - if (sumInt(100, *aI, 200) != 306) return "fail: sumInt 2" - if (sumInt(100, *aI, *aI) != 112) return "fail: sumInt 3" - if (sumFunOnParameters(100, *aI, 200) { 2*it } != 612) return "fail: sumFunOnParameters 1" - if (sumFunOnParameters(100, *aI, *aI) { 2*it } != 224) return "fail: sumFunOnParameters 2" - - if (concatParameters(1,2,3) != "123") return "fail: concatParameters 1" - if (concatParameters(*aI) != "123") return "fail: concatParameters 2" - if (concatParameters(4, 5, *aI) != "45123") return "fail: concatParameters 3" - if (concatParameters(*aI, 4, 5) != "12345") return "fail: concatParameters 4" - if (concatParameters(*aI, *bI) != "12345") return "fail: concatParameters 5" - if (concatParameters(*aI, 7, 8, *bI) != "1237845") return "fail: concatParameters 6" - if (concatParameters(*aI, 7, *bI, *aI, 9) != "1237451239") return "fail: concatParameters 7" - - if (barJ(*aJ, 23L).size != 4) return "fail: Long" - if (barJ(*aJ, 23L, *aJ, *aJ).size != 10) return "fail: Long" - - if (barS(*aS, 23.toShort()).size != 4) return "fail: Short" - if (barS(*aS, *aS, 23.toShort(), *aS).size != 10) return "fail: Short" - - if (barZ(*aZ, true).size != 4) return "fail: Boolean" - if (barZ(false, *aZ, true, *aZ).size != 8) return "fail: Boolean" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/vararg/kt796_797.kt b/backend.native/tests/external/codegen/box/vararg/kt796_797.kt deleted file mode 100644 index ebb6be014c3..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/kt796_797.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Array?.get(i : Int?) = this!!.get(i!!) -fun array(vararg t : T) : Array = t as Array - -fun box() : String { - val a : Array? = array("Str", "Str2") - val i : Int? = 1 - return if(a[i] == "Str2") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/vararg/spreadCopiesArray.kt b/backend.native/tests/external/codegen/box/vararg/spreadCopiesArray.kt deleted file mode 100644 index d5b7fc1fe65..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/spreadCopiesArray.kt +++ /dev/null @@ -1,29 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.* - -fun copyArray(vararg data: T): Array = data - -inline fun reifiedCopyArray(vararg data: T): Array = data - -fun copyIntArray(vararg data: Int): IntArray = data - -fun box(): String { - val sarr = arrayOf("OK") - val sarr2 = copyArray(*sarr) - sarr[0] = "Array was not copied" - assertEquals(sarr2[0], "OK", "Failed: Array") - - var rsarr = arrayOf("OK") - var rsarr2 = reifiedCopyArray(*rsarr) - rsarr[0] = "Array was not copied" - assertEquals(rsarr2[0], "OK", "Failed: Array, reified copy") - - val iarr = IntArray(1) - iarr[0] = 1 - val iarr2 = copyIntArray(*iarr) - iarr[0] = 42 - assertEquals(iarr2[0], 1, "Failed: IntArray") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/vararg/varargInFunParam.kt b/backend.native/tests/external/codegen/box/vararg/varargInFunParam.kt deleted file mode 100644 index 4f5438618f2..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/varargInFunParam.kt +++ /dev/null @@ -1,69 +0,0 @@ -fun box(): String { - if (test1() != "") return "fail 1" - if (test1(1) != "1") return "fail 2" - if (test1(1, 2) != "12") return "fail 3" - - if (test1(*intArrayOf()) != "") return "fail 4" - if (test1(*intArrayOf(1)) != "1") return "fail 5" - if (test1(*intArrayOf(1, 2)) != "12") return "fail 6" - - if (test1(p = 1) != "1") return "fail 7" - - if (test1(p = *intArrayOf()) != "") return "fail 8" - if (test1(p = *intArrayOf(1)) != "1") return "fail 9" - if (test1(p = *intArrayOf(1, 2)) != "12") return "fail 10" - - if (test2() != "") return "fail 11" - if (test2("1") != "1") return "fail 12" - if (test2("1", "2") != "12") return "fail 13" - - if (test2(*arrayOf()) != "") return "fail 14" - if (test2(*arrayOf("1")) != "1") return "fail 15" - if (test2(*arrayOf("1", "2")) != "12") return "fail 16" - - if (test2(p = "1") != "1") return "fail 17" - - if (test2(p = *arrayOf()) != "") return "fail 18" - if (test2(p = *arrayOf("1")) != "1") return "fail 19" - if (test2(p = *arrayOf("1", "2")) != "12") return "fail 20" - - if (test3() != "") return "fail 21" - if (test3("1") != "1") return "fail 22" - if (test3("1", "2") != "12") return "fail 23" - - if (test3(*arrayOf()) != "") return "fail 24" - if (test3(*arrayOf("1")) != "1") return "fail 25" - if (test3(*arrayOf("1", "2")) != "12") return "fail 26" - - if (test3(p = "1") != "1") return "fail 27" - - if (test3(p = *arrayOf()) != "") return "fail 28" - if (test3(p = *arrayOf("1")) != "1") return "fail 29" - if (test3(p = *arrayOf("1", "2")) != "12") return "fail 30" - - return "OK" -} - -fun test1(vararg p: Int): String { - var result = "" - for (i in p) { - result += i - } - return result -} - -fun test2(vararg p: String): String { - var result = "" - for (i in p) { - result += i - } - return result -} - -fun test3(vararg p: T): String { - var result = "" - for (i in p) { - result += i - } - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/vararg/varargInJava.kt b/backend.native/tests/external/codegen/box/vararg/varargInJava.kt deleted file mode 100644 index 89e7e8004e6..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/varargInJava.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: A.java - -public class A { - public int foo(int x, String ... args) { - return x + args.length; - } - - public static String[] ar = new String[] { "a", "b"}; -} - -// FILE: test.kt - -fun bar(args: Array?): Int { - var res = 0 - - if (args != null) { - res += A().foo(1, *args) - } - - res += A().foo(1, *A.ar) - - return res -} - -fun box(): String { - if (bar(null) != 3) return "Fail" - - if (bar(A.ar) != 6) return "Fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/vararg/varargsAndFunctionLiterals.kt b/backend.native/tests/external/codegen/box/vararg/varargsAndFunctionLiterals.kt deleted file mode 100644 index 3c7dca68c44..00000000000 --- a/backend.native/tests/external/codegen/box/vararg/varargsAndFunctionLiterals.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun foo(a: Int, vararg b: Int, f: (IntArray) -> String): String { - return "test" + a + " " + f(b) -} - -fun box(): String { - val test1 = foo(1) {a -> "" + a.size} - if (test1 != "test1 0") return test1 - - val test2 = foo(2, 2) {a -> "" + a.size} - if (test2 != "test2 1") return test2 - - val test3 = foo(3, 2, 3) {a -> "" + a.size} - if (test3 != "test3 2") return test3 - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/callProperty.kt b/backend.native/tests/external/codegen/box/when/callProperty.kt deleted file mode 100644 index 65fc9b7997d..00000000000 --- a/backend.native/tests/external/codegen/box/when/callProperty.kt +++ /dev/null @@ -1,12 +0,0 @@ -class C(val p: Boolean) { } - -fun box(): String { - val c = C(true) - - // Commented for KT-621 - // return when(c) { - // .p => "OK" - // else => "fail" - // } - return if (c.p) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/when/emptyWhen.kt b/backend.native/tests/external/codegen/box/when/emptyWhen.kt deleted file mode 100644 index 62ab58b6bf3..00000000000 --- a/backend.native/tests/external/codegen/box/when/emptyWhen.kt +++ /dev/null @@ -1,7 +0,0 @@ -enum class A { X1, X2 } - -fun box(): String { - when {} - when (A.X1) {} - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/bigEnum.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/bigEnum.kt deleted file mode 100644 index fb76910b59d..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/bigEnum.kt +++ /dev/null @@ -1,52 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class BigEnum { - ITEM1, ITEM2, ITEM3, ITEM4, ITEM5, ITEM6, ITEM7, ITEM8, ITEM9, ITEM10, - ITEM11, ITEM12, ITEM13, ITEM14, ITEM15, ITEM16, ITEM17, ITEM18, ITEM19, ITEM20 -} - -fun bar1(x : BigEnum) : String { - when (x) { - BigEnum.ITEM1, BigEnum.ITEM2, BigEnum.ITEM3 -> return "123" - BigEnum.ITEM4, BigEnum.ITEM5, BigEnum.ITEM6 -> return "456" - } - - return "-1"; - -} - -fun bar2(x : BigEnum) : String { - when (x) { - BigEnum.ITEM7, BigEnum.ITEM8, BigEnum.ITEM9 -> return "789" - BigEnum.ITEM10 -> return "10" - BigEnum.ITEM11, BigEnum.ITEM12 -> return "1112" - else -> return "-1" - } -} - -fun box() : String { - //bar1 - assertEquals("123", bar1(BigEnum.ITEM1)) - assertEquals("123", bar1(BigEnum.ITEM2)) - assertEquals("123", bar1(BigEnum.ITEM3)) - - assertEquals("456", bar1(BigEnum.ITEM4)) - assertEquals("456", bar1(BigEnum.ITEM5)) - assertEquals("456", bar1(BigEnum.ITEM6)) - - assertEquals("-1", bar1(BigEnum.ITEM7)) - - //bar2 - assertEquals("789", bar2(BigEnum.ITEM7)) - assertEquals("789", bar2(BigEnum.ITEM8)) - assertEquals("789", bar2(BigEnum.ITEM9)) - - assertEquals("10", bar2(BigEnum.ITEM10)) - - assertEquals("1112", bar2(BigEnum.ITEM11)) - assertEquals("1112", bar2(BigEnum.ITEM12)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/duplicatingItems.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/duplicatingItems.kt deleted file mode 100644 index 2760d6daa88..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/duplicatingItems.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun bar(x : Season) : String { - when (x) { - Season.WINTER, Season.SPRING -> return "winter_spring" - Season.SUMMER, Season.SPRING -> return "summer" - else -> return "autumn" - } -} - -fun box() : String { - assertEquals("winter_spring", bar(Season.WINTER)) - assertEquals("winter_spring", bar(Season.SPRING)) - assertEquals("summer", bar(Season.SUMMER)) - assertEquals("autumn", bar(Season.AUTUMN)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/enumInsideClassObject.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/enumInsideClassObject.kt deleted file mode 100644 index 18131fed078..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/enumInsideClassObject.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -class A { - companion object { - enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN - } - } -} - -fun foo(x : A.Companion.Season) : String { - return when (x) { - A.Companion.Season.WINTER -> "winter" - A.Companion.Season.SPRING -> "spring" - A.Companion.Season.SUMMER -> "summer" - else -> "other" - } -} - -fun box() : String { - assertEquals("winter", foo(A.Companion.Season.WINTER)) - assertEquals("spring", foo(A.Companion.Season.SPRING)) - assertEquals("summer", foo(A.Companion.Season.SUMMER)) - assertEquals("other", foo(A.Companion.Season.AUTUMN)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/expression.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/expression.kt deleted file mode 100644 index e1774794dea..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/expression.kt +++ /dev/null @@ -1,39 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun bar1(x : Season) : String { - return when (x) { - Season.WINTER, Season.SPRING -> "winter_spring" - Season.SUMMER -> "summer" - else -> "autumn" - } -} - -fun bar2(x : Season) : String { - return when (x) { - Season.WINTER, Season.SPRING -> "winter_spring" - Season.SUMMER -> "summer" - Season.AUTUMN -> "autumn" - } -} - -fun box() : String { - assertEquals("winter_spring", bar1(Season.WINTER)) - assertEquals("winter_spring", bar1(Season.SPRING)) - assertEquals("summer", bar1(Season.SUMMER)) - assertEquals("autumn", bar1(Season.AUTUMN)) - - assertEquals("winter_spring", bar2(Season.WINTER)) - assertEquals("winter_spring", bar2(Season.SPRING)) - assertEquals("summer", bar2(Season.SUMMER)) - assertEquals("autumn", bar2(Season.AUTUMN)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt deleted file mode 100644 index 9b97152b2f3..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt +++ /dev/null @@ -1,17 +0,0 @@ -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo(x : Season, block : (Season) -> String) = block(x) - -fun box() : String { - return foo(Season.SPRING) { - x -> when (x) { - Season.SPRING -> "OK" - else -> "fail" - } - } -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597.kt deleted file mode 100644 index bd278f2a72e..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597.kt +++ /dev/null @@ -1,22 +0,0 @@ -enum class En { A, B, С } - -fun box(): String { - var res = "" - // nullable variable - val en2: Any? = En.A - if (en2 is En) { - when (en2) { - En.A -> {res += "O"} - En.B -> {} - En.С -> {} - } - - when (en2 as En) { - En.A -> {res += "K"} - En.B -> {} - En.С -> {} - } - } - - return res -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597_full.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597_full.kt deleted file mode 100644 index 4b45ed81a12..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14597_full.kt +++ /dev/null @@ -1,56 +0,0 @@ -enum class En { A, B, С } - -fun box(): String { - var res1 = "fail" - var res2 = "fail2" - - val en: En = En.A - when (en) { - En.A -> {res1 = ""} - En.B -> {} - En.С -> {} - } - - when (en as En) { - En.A -> {res1 += "O"} - En.B -> {} - En.С -> {} - } - - - // nullable variable - val en2: Any? = En.A - if (en2 is En) { - when (en2) { - En.A -> {res1 += "K"} - En.B -> {} - En.С -> {} - } - - when (en2 as En) { - En.A -> {res2 = ""} - En.B -> {} - En.С -> {} - } - } - - - // not nullable variable - val en1: Any = En.A - if (en1 is En) { - when (en1) { - En.A -> {res2 += "O"} - En.B -> {} - En.С -> {} - } - // Working without other examples - when (en1 as En) { - En.A -> {res2 += "K"} - En.B -> {} - En.С -> {} - } - } - - if (res1 != res2) return "different results: $res1 != $res2" - return res1 -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14802.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/kt14802.kt deleted file mode 100644 index bdfc991c967..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/kt14802.kt +++ /dev/null @@ -1,25 +0,0 @@ -class EncapsulatedEnum>(val value: T) - -enum class MyEnum(val value: String) { - VALUE_A("OK"), - VALUE_B("fail"), -} - -private fun crash(encapsulated: EncapsulatedEnum<*>) { - val myEnum = encapsulated.value - if (myEnum !is MyEnum) { - return - } - - when (myEnum) { - MyEnum.VALUE_A -> res = myEnum.value - MyEnum.VALUE_B -> res = myEnum.value - } -} - -var res = "fail" - -fun box(): String { - crash(EncapsulatedEnum(MyEnum.VALUE_A)) - return res -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/kt15806.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/kt15806.kt deleted file mode 100644 index ad603bf7a5f..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/kt15806.kt +++ /dev/null @@ -1,25 +0,0 @@ - -private fun Any?.doTheThing(): String { - when (this) { - is String -> return this - is Level -> { - when (this) { - Level.O -> return Level.O.name - Level.K -> return Level.K.name - } - } - - else -> return "fail" - } -} - - -enum class Level { - O, - K -} - - -fun box(): String { - return "O".doTheThing() + Level.K.doTheThing() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/manyWhensWithinClass.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/manyWhensWithinClass.kt deleted file mode 100644 index 3a29f080cb3..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/manyWhensWithinClass.kt +++ /dev/null @@ -1,52 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -class A { - public fun bar1(x : Season) : String { - when (x) { - Season.WINTER, Season.SPRING -> return "winter_spring" - Season.SPRING -> return "spring" - Season.SUMMER -> return "summer" - } - - return "autumn"; - } - - public fun bar2(y : Season) : String { - return bar3(y) { x -> - when (x) { - Season.WINTER, Season.SPRING -> "winter_spring" - Season.SPRING -> "spring" - Season.SUMMER -> "summer" - else -> "autumn" - } - } - } - - private fun bar3(x : Season, block : (Season) -> String) = block(x) -} - -fun box() : String { - val a = A() - - assertEquals("winter_spring", a.bar1(Season.WINTER)) - assertEquals("winter_spring", a.bar1(Season.SPRING)) - assertEquals("summer", a.bar1(Season.SUMMER)) - assertEquals("autumn", a.bar1(Season.AUTUMN)) - - assertEquals("winter_spring", a.bar2(Season.WINTER)) - assertEquals("winter_spring", a.bar2(Season.SPRING)) - assertEquals("summer", a.bar2(Season.SUMMER)) - assertEquals("autumn", a.bar2(Season.AUTUMN)) - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/nonConstantEnum.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/nonConstantEnum.kt deleted file mode 100644 index a1440b4712b..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/nonConstantEnum.kt +++ /dev/null @@ -1,16 +0,0 @@ -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo(): Season = Season.SPRING -fun bar(): Season = Season.SPRING - -fun box() : String { - when (foo()) { - bar() -> return "OK" - else -> return "fail" - } -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/nullability.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/nullability.kt deleted file mode 100644 index d8734f77526..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/nullability.kt +++ /dev/null @@ -1,42 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo1(x : Season?) : String { - when(x) { - Season.AUTUMN, Season.SPRING -> return "autumn_or_spring"; - Season.SUMMER, null -> return "summer_or_null" - } - - return "other" -} - -fun foo2(x : Season?) : String { - when(x) { - Season.AUTUMN, Season.SPRING -> return "autumn_or_spring"; - Season.SUMMER -> return "summer" - } - - return "other" -} - -fun box() : String { - assertEquals("autumn_or_spring", foo1(Season.AUTUMN)) - assertEquals("autumn_or_spring", foo1(Season.SPRING)) - assertEquals("summer_or_null", foo1(Season.SUMMER)) - assertEquals("summer_or_null", foo1(null)) - - assertEquals("autumn_or_spring", foo2(Season.AUTUMN)) - assertEquals("autumn_or_spring", foo2(Season.SPRING)) - assertEquals("summer", foo2(Season.SUMMER)) - assertEquals("other", foo2(null)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/nullableEnum.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/nullableEnum.kt deleted file mode 100644 index 457f6281e1e..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/nullableEnum.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class E { - A, - B -} - -fun test(e: E?) = when (e) { - E.A -> "Fail A" - null -> "OK" - E.B -> "Fail B" -} - -fun box(): String { - return test(null) -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/subjectAny.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/subjectAny.kt deleted file mode 100644 index 0f21003c5f6..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/subjectAny.kt +++ /dev/null @@ -1,28 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun foo(x : Any) : String { - return when (x) { - Season.WINTER -> "winter" - Season.SPRING -> "spring" - Season.SUMMER -> "summer" - else -> "other" - } -} - -fun box() : String { - assertEquals("winter", foo(Season.WINTER)) - assertEquals("spring", foo(Season.SPRING)) - assertEquals("summer", foo(Season.SUMMER)) - assertEquals("other", foo(Season.AUTUMN)) - assertEquals("other", foo(123)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/enumOptimization/withoutElse.kt b/backend.native/tests/external/codegen/box/when/enumOptimization/withoutElse.kt deleted file mode 100644 index abaea695949..00000000000 --- a/backend.native/tests/external/codegen/box/when/enumOptimization/withoutElse.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -enum class Season { - WINTER, - SPRING, - SUMMER, - AUTUMN -} - -fun bar1(x : Season) : String { - when (x) { - Season.WINTER, Season.SPRING -> return "winter_spring" - Season.SPRING -> return "spring" - Season.SUMMER -> return "summer" - } - return "autumn" -} - -fun bar2(x : Season) : String { - when (x) { - Season.WINTER, Season.SPRING -> return "winter_spring" - Season.SPRING -> return "spring" - Season.SUMMER -> return "summer" - Season.AUTUMN -> return "autumn" - } - - return "fail unknown" -} - -fun box() : String { - assertEquals("winter_spring", bar1(Season.WINTER)) - assertEquals("winter_spring", bar1(Season.SPRING)) - assertEquals("summer", bar1(Season.SUMMER)) - assertEquals("autumn", bar1(Season.AUTUMN)) - - assertEquals("winter_spring", bar2(Season.WINTER)) - assertEquals("winter_spring", bar2(Season.SPRING)) - assertEquals("summer", bar2(Season.SUMMER)) - assertEquals("autumn", bar2(Season.AUTUMN)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/exceptionOnNoMatch.kt b/backend.native/tests/external/codegen/box/when/exceptionOnNoMatch.kt deleted file mode 100644 index 15a1b759082..00000000000 --- a/backend.native/tests/external/codegen/box/when/exceptionOnNoMatch.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun isZero(x: Int) = when(x) { - 0 -> true - else -> throw Exception() -} - -fun box(): String { - try { - isZero(1) - } - catch (e: Exception) { - return "OK" - } - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/when/exhaustiveBoolean.kt b/backend.native/tests/external/codegen/box/when/exhaustiveBoolean.kt deleted file mode 100644 index 4ac2633da11..00000000000 --- a/backend.native/tests/external/codegen/box/when/exhaustiveBoolean.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box() : String = when (true) { - ((true)) -> "OK" - (1 == 2) -> "Not ok" -} diff --git a/backend.native/tests/external/codegen/box/when/exhaustiveBreakContinue.kt b/backend.native/tests/external/codegen/box/when/exhaustiveBreakContinue.kt deleted file mode 100644 index 69c959e13cb..00000000000 --- a/backend.native/tests/external/codegen/box/when/exhaustiveBreakContinue.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class Color { RED, GREEN, BLUE } - -fun foo(arr: Array): Color { - loop@ for (color in arr) { - when (color) { - Color.RED -> return color - Color.GREEN -> break@loop - Color.BLUE -> if (arr.size == 1) return color else continue@loop - } - } - return Color.GREEN -} - -fun box() = if (foo(arrayOf(Color.BLUE, Color.GREEN)) == Color.GREEN) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/exhaustiveWhenInitialization.kt b/backend.native/tests/external/codegen/box/when/exhaustiveWhenInitialization.kt deleted file mode 100644 index ccf67614e6c..00000000000 --- a/backend.native/tests/external/codegen/box/when/exhaustiveWhenInitialization.kt +++ /dev/null @@ -1,10 +0,0 @@ -enum class A { V } - -fun box(): String { - val a: A = A.V - val b: Boolean - when (a) { - A.V -> b = true - } - return if (b) "OK" else "FAIL" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/exhaustiveWhenReturn.kt b/backend.native/tests/external/codegen/box/when/exhaustiveWhenReturn.kt deleted file mode 100644 index 6b3b7658cc2..00000000000 --- a/backend.native/tests/external/codegen/box/when/exhaustiveWhenReturn.kt +++ /dev/null @@ -1,8 +0,0 @@ -enum class A { V } - -fun box(): String { - val a: A = A.V - when (a) { - A.V -> return "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/implicitExhaustiveAndReturn.kt b/backend.native/tests/external/codegen/box/when/implicitExhaustiveAndReturn.kt deleted file mode 100644 index d28e7064678..00000000000 --- a/backend.native/tests/external/codegen/box/when/implicitExhaustiveAndReturn.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun test(i: Int): String { - when (i) { - 0 -> return "0" - 1 -> return "1" - } - return "OK" -} - -fun box(): String = test(42) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/integralWhenWithNoInlinedConstants.kt b/backend.native/tests/external/codegen/box/when/integralWhenWithNoInlinedConstants.kt deleted file mode 100644 index 4b58f875147..00000000000 --- a/backend.native/tests/external/codegen/box/when/integralWhenWithNoInlinedConstants.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun foo1(x: Int): Boolean { - when(x) { - 2 + 2 -> return true - else -> return false - } -} - -fun foo2(x: Int): Boolean { - when(x) { - Integer.MAX_VALUE -> return true - else -> return false - } -} - -fun box(): String { - assert(foo1(4)) - assert(!foo1(1)) - - assert(foo2(Integer.MAX_VALUE)) - assert(!foo2(1)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/is.kt b/backend.native/tests/external/codegen/box/when/is.kt deleted file mode 100644 index fa0580b2740..00000000000 --- a/backend.native/tests/external/codegen/box/when/is.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun typeName(a: Any?) : String { - return when(a) { - is ArrayList<*> -> "array list" - else -> "no idea" - } -} - -fun box() : String { - if(typeName(ArrayList()) != "array list") return "array list failed" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/kt2457.kt b/backend.native/tests/external/codegen/box/when/kt2457.kt deleted file mode 100644 index e6f15becd08..00000000000 --- a/backend.native/tests/external/codegen/box/when/kt2457.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo(i: Int) : Int = - when (i) { - 1 -> 1 - null -> 1 - else -> 1 - } - -fun box() : String = if (foo(1) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/when/kt2466.kt b/backend.native/tests/external/codegen/box/when/kt2466.kt deleted file mode 100644 index ba2e7dd052a..00000000000 --- a/backend.native/tests/external/codegen/box/when/kt2466.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun foo(b: Boolean) = - when (b) { - false -> 0 - true -> 1 - else -> 2 - } - -fun box(): String = if (foo(false) == 0 && foo(true) == 1) "OK" else "Fail" - diff --git a/backend.native/tests/external/codegen/box/when/kt5307.kt b/backend.native/tests/external/codegen/box/when/kt5307.kt deleted file mode 100644 index bbbbc8611c4..00000000000 --- a/backend.native/tests/external/codegen/box/when/kt5307.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val value = 1 - when (value) { - 0 -> {} - 1 -> when (value) { - 2 -> false - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/kt5448.kt b/backend.native/tests/external/codegen/box/when/kt5448.kt deleted file mode 100644 index e1c81b55ca9..00000000000 --- a/backend.native/tests/external/codegen/box/when/kt5448.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -class A - -class B(val items: Collection) - -class C { - fun foo(p: Int) { - when (p) { - 1 -> arrayListOf().add(1) - } - } - - fun bar() = B(listOf().map { it }) -} - -fun box(): String { - C().foo(1) - if (C().bar().items.isNotEmpty()) return "fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/longInRange.kt b/backend.native/tests/external/codegen/box/when/longInRange.kt deleted file mode 100644 index c73169ff600..00000000000 --- a/backend.native/tests/external/codegen/box/when/longInRange.kt +++ /dev/null @@ -1,9 +0,0 @@ -class LongR { - operator fun contains(l : Long): Boolean = l == 5.toLong() -} - -fun box(): String { - if (5 !in LongR()) return "fail 1" - if (6 in LongR()) return "fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/matchNotNullAgainstNullable.kt b/backend.native/tests/external/codegen/box/when/matchNotNullAgainstNullable.kt deleted file mode 100644 index c0598674113..00000000000 --- a/backend.native/tests/external/codegen/box/when/matchNotNullAgainstNullable.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo(i: Int, j: Int?): String = - when (i) { - j -> "OK" - else -> "Fail" - } - -fun box(): String = foo(0, 0) diff --git a/backend.native/tests/external/codegen/box/when/multipleEntries.kt b/backend.native/tests/external/codegen/box/when/multipleEntries.kt deleted file mode 100644 index 65c20b334d2..00000000000 --- a/backend.native/tests/external/codegen/box/when/multipleEntries.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo(x: Any) = - when (x) { - 0, 1 -> "bit" - else -> "something" - } - -fun box(): String { - if (foo(0) != "bit") return "Fail 0" - if (foo(1) != "bit") return "Fail 1" - if (foo(2) != "something") return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/noElseExhaustive.kt b/backend.native/tests/external/codegen/box/when/noElseExhaustive.kt deleted file mode 100644 index e02125f19c8..00000000000 --- a/backend.native/tests/external/codegen/box/when/noElseExhaustive.kt +++ /dev/null @@ -1,9 +0,0 @@ -enum class En { - A, - B -} - -fun box(): String = when(En.A) { - En.A -> "OK" - En.B -> "Fail 1" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/noElseExhaustiveStatement.kt b/backend.native/tests/external/codegen/box/when/noElseExhaustiveStatement.kt deleted file mode 100644 index da79d180335..00000000000 --- a/backend.native/tests/external/codegen/box/when/noElseExhaustiveStatement.kt +++ /dev/null @@ -1,12 +0,0 @@ -enum class En { - A, - B -} - -fun box(): String { - when(En.A) { - En.A -> "s1" - En.B -> "s2" - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/noElseExhaustiveUnitExpected.kt b/backend.native/tests/external/codegen/box/when/noElseExhaustiveUnitExpected.kt deleted file mode 100644 index 2c69069abac..00000000000 --- a/backend.native/tests/external/codegen/box/when/noElseExhaustiveUnitExpected.kt +++ /dev/null @@ -1,14 +0,0 @@ -enum class En { - A, - B -} - -fun box(): String { - - val u: Unit = when(En.A) { - En.A -> {} - En.B -> {} - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/noElseInStatement.kt b/backend.native/tests/external/codegen/box/when/noElseInStatement.kt deleted file mode 100644 index 9ab1c3fef63..00000000000 --- a/backend.native/tests/external/codegen/box/when/noElseInStatement.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val x = 1 - when (x) { - 1 -> return "OK" - } - return "Fail 1" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/noElseNoMatch.kt b/backend.native/tests/external/codegen/box/when/noElseNoMatch.kt deleted file mode 100644 index 2c4e803b07b..00000000000 --- a/backend.native/tests/external/codegen/box/when/noElseNoMatch.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val x = 3 - when (x) { - 1 -> {} - 2 -> {} - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/nullableWhen.kt b/backend.native/tests/external/codegen/box/when/nullableWhen.kt deleted file mode 100644 index 717b6a9c303..00000000000 --- a/backend.native/tests/external/codegen/box/when/nullableWhen.kt +++ /dev/null @@ -1,13 +0,0 @@ -// KT-2148 - - -fun f(p: Int?): Int { - return when(p) { - null -> 3 - else -> p!! - } -} - -fun box(): String { - return if (f(null) == 3) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/when/range.kt b/backend.native/tests/external/codegen/box/when/range.kt deleted file mode 100644 index a8d8c41c144..00000000000 --- a/backend.native/tests/external/codegen/box/when/range.kt +++ /dev/null @@ -1,29 +0,0 @@ -fun isDigit(a: Int) : String { - val aa = ArrayList () - aa.add(239) - - return when(a) { - in aa -> "array list" - in 0..9 -> "digit" - !in 0..100 -> "not small" - else -> "something" - } -} - -fun assertDigit(i: Int, expected: String): String { - val result = isDigit(i) - return if (result == expected) "" else "fail: isDigit($i) = \"$result\"" -} - -fun box(): String { - val result = - assertDigit(239, "array list") + - assertDigit(0, "digit") + - assertDigit(9, "digit") + - assertDigit(5, "digit") + - assertDigit(19, "something") + - assertDigit(190, "not small") - - if (result == "") return "OK" - return result -} diff --git a/backend.native/tests/external/codegen/box/when/sealedWhenInitialization.kt b/backend.native/tests/external/codegen/box/when/sealedWhenInitialization.kt deleted file mode 100644 index 5f9db0bde7d..00000000000 --- a/backend.native/tests/external/codegen/box/when/sealedWhenInitialization.kt +++ /dev/null @@ -1,15 +0,0 @@ -sealed class A { - object B : A() - - class C : A() -} - -fun box(): String { - val a: A = A.C() - val b: Boolean - when (a) { - A.B -> b = true - is A.C -> b = false - } - return if (!b) "OK" else "FAIL" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItems.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItems.kt deleted file mode 100644 index d000aa96cfa..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItems.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(x : String) : String { - when (x) { - "abc" -> return "abc" - "efg", "ghi", "abc" -> return "efg_ghi" - else -> return "other" - } -} - -fun box() : String { - assertEquals("abc", foo("abc")) - assertEquals("efg_ghi", foo("efg")) - assertEquals("efg_ghi", foo("ghi")) - - assertEquals("other", foo("xyz")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItemsSameHashCode.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItemsSameHashCode.kt deleted file mode 100644 index 53f6754fb71..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/duplicatingItemsSameHashCode.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(x : String) : String { - assert("abz]".hashCode() == "aby|".hashCode()) - - when (x) { - "abz]" -> return "abz" - "ghi" -> return "ghi" - "aby|" -> return "aby" - "abz]" -> return "fail" - } - - return "other" -} - -fun box() : String { - assertEquals("abz", foo("abz]")) - assertEquals("aby", foo("aby|")) - assertEquals("ghi", foo("ghi")) - - assertEquals("other", foo("xyz")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/expression.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/expression.kt deleted file mode 100644 index bc9759e64ee..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/expression.kt +++ /dev/null @@ -1,22 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(x : String) : String { - return when (x) { - "abc", "cde" -> "abc_cde" - "efg", "ghi" -> "efg_ghi" - else -> "other" - } -} - -fun box() : String { - assertEquals("abc_cde", foo("abc")) - assertEquals("abc_cde", foo("cde")) - assertEquals("efg_ghi", foo("efg")) - assertEquals("efg_ghi", foo("ghi")) - - assertEquals("other", foo("xyz")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/nullability.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/nullability.kt deleted file mode 100644 index d2d047fb153..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/nullability.kt +++ /dev/null @@ -1,43 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo1(x : String?) : String { - when (x) { - "abc", "cde" -> return "abc_cde" - "efg", "ghi", null -> return "efg_ghi" - } - - return "other" -} - -fun foo2(x : String?) : String { - when (x) { - "abc", "cde" -> return "abc_cde" - "efg", "ghi" -> return "efg_ghi" - else -> return "other" - } -} - -fun box() : String { - //foo1 - assertEquals("abc_cde", foo1("abc")) - assertEquals("abc_cde", foo1("cde")) - assertEquals("efg_ghi", foo1("efg")) - assertEquals("efg_ghi", foo1("ghi")) - assertEquals("efg_ghi", foo1(null)) - - assertEquals("other", foo1("xyz")) - - //foo2 - assertEquals("abc_cde", foo2("abc")) - assertEquals("abc_cde", foo2("cde")) - assertEquals("efg_ghi", foo2("efg")) - assertEquals("efg_ghi", foo2("ghi")) - - - assertEquals("other", foo2("xyz")) - assertEquals("other", foo2(null)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/sameHashCode.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/sameHashCode.kt deleted file mode 100644 index fd4d11e6b65..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/sameHashCode.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo(x : String) : String { - assert("abz]".hashCode() == "aby|".hashCode()) - - when (x) { - "abz]", "cde" -> return "abz_cde" - "aby|", "ghi", "abz]" -> return "aby_ghi" - } - - return "other" -} - -fun box() : String { - assertEquals("abz_cde", foo("abz]")) - assertEquals("abz_cde", foo("cde")) - assertEquals("aby_ghi", foo("aby|")) - assertEquals("aby_ghi", foo("ghi")) - - assertEquals("other", foo("xyz")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/stringOptimization/statement.kt b/backend.native/tests/external/codegen/box/when/stringOptimization/statement.kt deleted file mode 100644 index 4f9bdc05158..00000000000 --- a/backend.native/tests/external/codegen/box/when/stringOptimization/statement.kt +++ /dev/null @@ -1,40 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun foo1(x : String) : String { - when (x) { - "abc", "cde" -> return "abc_cde" - "efg", "ghi" -> return "efg_ghi" - } - - return "other" -} - -fun foo2(x : String) : String { - when (x) { - "abc", "cde" -> return "abc_cde" - "efg", "ghi" -> return "efg_ghi" - else -> return "other" - } -} - -fun box() : String { - //foo1 - assertEquals("abc_cde", foo1("abc")) - assertEquals("abc_cde", foo1("cde")) - assertEquals("efg_ghi", foo1("efg")) - assertEquals("efg_ghi", foo1("ghi")) - - assertEquals("other", foo1("xyz")) - - //foo2 - assertEquals("abc_cde", foo2("abc")) - assertEquals("abc_cde", foo2("cde")) - assertEquals("efg_ghi", foo2("efg")) - assertEquals("efg_ghi", foo2("ghi")) - - assertEquals("other", foo2("xyz")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationDense.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationDense.kt deleted file mode 100644 index 3fc11852388..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationDense.kt +++ /dev/null @@ -1,24 +0,0 @@ -// WITH_RUNTIME - -fun dense(x: Int): Int { - return when (x) { - -4 -> 9 - -1 -> 10 - 0 -> 11 - 1 -> 12 - 4 -> 13 - 5 -> 14 - 6 -> 15 - 7 -> 16 - 8 -> 17 - 9 -> 18 - else -> 19 - } -} - -fun box(): String { - var result = (-5..10).map(::dense).joinToString() - - if (result != "19, 9, 19, 19, 10, 11, 12, 19, 19, 13, 14, 15, 16, 17, 18, 19") return "dense:" + result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationMultipleConditions.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationMultipleConditions.kt deleted file mode 100644 index d9cd6fd5809..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationMultipleConditions.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -fun foo(x: Int): Int { - return when (x) { - 1, 2, 3 -> 1 - 4, 5, 6 -> 2 - 7, 8, 9 -> 3 - else -> 4 - } -} - -fun box(): String { - var result = (0..10).map(::foo).joinToString() - - if (result != "4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4") return result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationSparse.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationSparse.kt deleted file mode 100644 index 35e33e80d73..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationSparse.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -fun sparse(x: Int): Int { - return when ((x % 4) * 100) { - 100 -> 1 - 200 -> 2 - 300 -> 3 - else -> 4 - } -} - -fun box(): String { - var result = (0..3).map(::sparse).joinToString() - - if (result != "4, 1, 2, 3") return "sparse:" + result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationStatement.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationStatement.kt deleted file mode 100644 index 2e436ca37f1..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationStatement.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME - -fun exhaustive(x: Int): Int { - var r: Int - when (x) { - 1 -> r = 1 - 2 -> r = 2 - 3 -> r = 3 - else -> r = 4 - } - - return r -} - -fun nonExhaustive(x: Int): Int { - var r: Int = 4 - when (x) { - 1 -> r = 1 - 2 -> r = 2 - 3 -> r = 3 - } - - return r -} - -fun box(): String { - var result = (0..3).map(::exhaustive).joinToString() - - if (result != "4, 1, 2, 3") return "exhaustive:" + result - - result = (0..3).map(::nonExhaustive).joinToString() - - if (result != "4, 1, 2, 3") return "non-exhaustive:" + result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationTypes.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationTypes.kt deleted file mode 100644 index 75333b05096..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationTypes.kt +++ /dev/null @@ -1,56 +0,0 @@ -// WITH_RUNTIME - -fun intFoo(x: Int): Int { - return when (x) { - 1 -> 5 - 2 -> 6 - 3 -> 7 - else -> 8 - } -} - -fun shortFoo(x: Short): Int { - return when (x) { - 1.toShort() -> 5 - 2.toShort() -> 6 - 3.toShort() -> 7 - else -> 8 - } -} - -fun byteFoo(x: Byte): Int { - return when (x) { - 1.toByte() -> 5 - 2.toByte() -> 6 - 3.toByte() -> 7 - else -> 8 - } -} - -fun charFoo(x: Char): Int { - return when (x) { - 'a' -> 5 - 'b' -> 6 - 'c' -> 7 - else -> 8 - } -} - -fun box(): String { - var result = (1..4).map(::intFoo).joinToString() - - if (result != "5, 6, 7, 8") return "int:" + result - - result = (listOf(1, 2, 3, 4)).map(::shortFoo).joinToString() - - if (result != "5, 6, 7, 8") return "short:" + result - - result = (listOf(1, 2, 3, 4)).map(::byteFoo).joinToString() - - if (result != "5, 6, 7, 8") return "byte:" + result - - result = ('a'..'d').map(::charFoo).joinToString() - - if (result != "5, 6, 7, 8") return "int:" + result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/switchOptimizationUnordered.kt b/backend.native/tests/external/codegen/box/when/switchOptimizationUnordered.kt deleted file mode 100644 index e299845073a..00000000000 --- a/backend.native/tests/external/codegen/box/when/switchOptimizationUnordered.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -fun foo(x: Int): Int { - return when (x) { - 2 -> 6 - 1 -> 5 - 3 -> 7 - else -> 8 - } -} - -fun box(): String { - var result = (0..3).map(::foo).joinToString() - - if (result != "8, 5, 6, 7") return "unordered:" + result - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/when/typeDisjunction.kt b/backend.native/tests/external/codegen/box/when/typeDisjunction.kt deleted file mode 100644 index 1d2910393b0..00000000000 --- a/backend.native/tests/external/codegen/box/when/typeDisjunction.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun foo(s: Any): String { - val x = when (s) { - is String -> s - is Int -> "$s" - else -> return "" - } - - val y: String = x - return y -} - -fun box() = if (foo("OK") == "OK" && foo(42) == "42" && foo(true) == "") "OK" else "Fail" - - - diff --git a/backend.native/tests/external/codegen/box/when/whenArgumentIsEvaluatedOnlyOnce.kt b/backend.native/tests/external/codegen/box/when/whenArgumentIsEvaluatedOnlyOnce.kt deleted file mode 100644 index 48ebea48731..00000000000 --- a/backend.native/tests/external/codegen/box/when/whenArgumentIsEvaluatedOnlyOnce.kt +++ /dev/null @@ -1,13 +0,0 @@ -var x = 0 -fun inc(): Int { - x++ - return 0 -} -fun box(): String { - val al = ArrayList() - when (inc()) { - in al -> return "fail 1" - else -> {} - } - return if (x == 1) "OK" else "fail 2" -} diff --git a/backend.native/tests/external/codegen/box/when/whenSafeCallSubjectEvaluatedOnce.kt b/backend.native/tests/external/codegen/box/when/whenSafeCallSubjectEvaluatedOnce.kt deleted file mode 100644 index 18ec8a99651..00000000000 --- a/backend.native/tests/external/codegen/box/when/whenSafeCallSubjectEvaluatedOnce.kt +++ /dev/null @@ -1,19 +0,0 @@ -var subjectEvaluated = 0 - -fun String.foo() = length.also { ++subjectEvaluated } - -fun test(s: String?) = - when (s?.foo()) { - 0 -> "zero" - 1 -> "one" - 2 -> "two" - else -> "other" - } - -fun box(): String { - val t = test("12") - if (t != "two") return "Fail: $t" - if (subjectEvaluated != 1) return "Fail: subjectEvaluated=$subjectEvaluated" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt deleted file mode 100644 index 7a81294a751..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt +++ /dev/null @@ -1,45 +0,0 @@ -// FILE: 1.kt - -package test - -abstract class A { - abstract fun getO() : R - - abstract fun getK() : R -} - - -inline fun doWork(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box() : String { - val o = "O" - val p = "GOOD" - val result = doWork { - val k = "K" - val s = object : A() { - - val param = p; - - override fun getO(): String { - return o; - } - - override fun getK(): String { - return k; - } - } - - s.getO() + s.getK() + s.param - } - - if (result != "OKGOOD") return "fail $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSiteSuperParams.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSiteSuperParams.kt deleted file mode 100644 index bfbbb44d282..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnCallSiteSuperParams.kt +++ /dev/null @@ -1,41 +0,0 @@ -// FILE: 1.kt - -package test - -abstract class A(val param: R) { - abstract fun getO() : R - - abstract fun getK() : R -} - - -inline fun doWork(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box() : String { - val o = "O" - val result = doWork { - val k = "K" - val s = object : A("11") { - override fun getO(): String { - return o; - } - - override fun getK(): String { - return k; - } - } - - s.getO() + s.getK() + s.param - } - - if (result != "OK11") return "fail $result" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSite.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSite.kt deleted file mode 100644 index 9a8d1f21d2f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSite.kt +++ /dev/null @@ -1,85 +0,0 @@ -// FILE: 1.kt - -package test - - -abstract class A { - abstract fun getO() : R - - abstract fun getK() : R - - abstract fun getParam() : R -} - -inline fun doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A { - val s = object : A() { - - override fun getO(): R { - return jobO() - } - override fun getK(): R { - return jobK() - } - - override fun getParam(): R { - return param - } - } - return s; -} - -inline fun doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A { - val s = object : A() { - - val p = param; - - val o1 = jobO() - - val k1 = jobK() - - override fun getO(): R { - return o1 - } - override fun getK(): R { - return k1 - } - - override fun getParam(): R { - return p - } - } - return s; -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(): String { - val o = "O" - - val result = doWork ({o}, {"K"}, "GOOD") - - return result.getO() + result.getK() + result.getParam() -} - -fun test2() : String { - //same names as in object - val o1 = "O" - val k1 = "K" - - val result = doWorkInConstructor ({o1}, {k1}, "GOOD") - - return result.getO() + result.getK() + result.getParam() -} - -fun box() : String { - val result1 = test1(); - if (result1 != "OKGOOD") return "fail1 $result1" - - val result2 = test2(); - if (result2 != "OKGOOD") return "fail2 $result2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt deleted file mode 100644 index 9344cbacd75..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt +++ /dev/null @@ -1,72 +0,0 @@ -// FILE: 1.kt - -package test - - -abstract class A(val param : R) { - abstract fun getO() : R - - abstract fun getK() : R -} - -inline fun doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A { - val s = object : A(param) { - - override fun getO(): R { - return jobO() - } - override fun getK(): R { - return jobK() - } - } - return s; -} - -inline fun doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, crossinline param: () -> R) : A { - val s = object : A(param()) { - val o1 = jobO() - - val k1 = jobK() - - override fun getO(): R { - return o1 - } - override fun getK(): R { - return k1 - } - } - return s; -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(): String { - val o = "O" - - val result = doWork ({o}, {"K"}, "11") - - return result.getO() + result.getK() + result.param -} - -fun test2() : String { - //same names as in object - val o1 = "O" - val k1 = "K" - val param = "11" - val result = doWorkInConstructor ({o1}, {k1}, {param}) - - return result.getO() + result.getK() + result.param -} - -fun box() : String { - val result1 = test1(); - if (result1 != "OK11") return "fail1 $result1" - - val result2 = test2(); - if (result2 != "OK11") return "fail2 $result2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt deleted file mode 100644 index e93b5834074..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun bar(crossinline y: () -> String) = { - call(y) -} - -public inline fun call(f: () -> T): T = f() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return bar {"OK"} () -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt deleted file mode 100644 index 65bd20276ef..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun bar(crossinline y: () -> String) = { - { { call(y) }() }() -} - -public inline fun call(f: () -> T): T = f() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return bar {"OK"} () -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt deleted file mode 100644 index c8ad1f3620a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun bar(crossinline y: () -> String) = { - { { call(y) }() }() -} - -public inline fun call(crossinline f: () -> T): T = {{ f() }()}() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - val bar1 = bar {"123"} () - val bar2 = bar2 { "1234" } () - return if (bar1 == "123" && bar2 == "1234") "OK" else "fail: $bar1 $bar2" -} - -inline fun bar2(crossinline y: () -> String) = { - { { call(y) }() }() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt deleted file mode 100644 index 575323aa02a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package test - -internal interface A { - fun run(): T; -} - -internal inline fun bar(crossinline y: () -> String) = object : A { - override fun run() : String { - return call(y) - } -} - -public inline fun call(crossinline f: () -> T): T = object : A { - override fun run() : T { - return f() - } -}.run() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return bar { "OK" }.run() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/changingReturnType.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/changingReturnType.kt deleted file mode 100644 index 7f115210d1e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/changingReturnType.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt - -package test - -open class Entity(val value: String) - -public abstract class Task() { - abstract fun calc(): T -} - -fun nullableTask(factory: () -> Task): Task { - return factory() -} - -inline fun Self.directed(): Task = - nullableTask { - object : Task() { - override fun calc(): Self = this@directed - } - } - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -//KT-7490 -import test.* - -fun box(): String { - return Entity("OK").directed().calc().value -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibility.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibility.kt deleted file mode 100644 index 08f1968bdcf..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibility.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -package test - -interface Run { - fun run(): String -} - -internal class A { - inline fun doSomething(): Run { - return object : Run { - override fun run(): String = "OK" - } - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return A().doSomething().run() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt deleted file mode 100644 index a1bd16a0116..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -internal class A { - inline fun doSomething(): String { - return { - "OK" - }() - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return A().doSomething() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt deleted file mode 100644 index e31ce7b1575..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -internal class A { - inline fun doSomething(s: String): String { - return { - s - }() - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return A().doSomething("OK") -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/defineClass.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/defineClass.kt deleted file mode 100644 index 788602e4de7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/defineClass.kt +++ /dev/null @@ -1,54 +0,0 @@ -// FILE: 1.kt - -package test - -interface Run { - fun run(): String -} - -inline fun i2(crossinline s: () -> String): Run { - return i1 { - object : Run { - override fun run(): String { - return s() - } - }.run() - } -} - -inline fun i1(crossinline s: () -> String): Run { - return object : Run { - override fun run(): String { - return s() - } - } -} - -// FILE: 2.kt - -import test.* - -inline fun i4(crossinline s: () -> String): Run { - return i3 { - object : Run { - override fun run(): String { - return s() - } - }.run() - } -} - -inline fun i3(crossinline s: () -> String): Run { - return i2 { - object : Run { - override fun run(): String { - return s() - } - }.run() - } -} - -fun box(): String { - val i4 = i4 { "OK" } - return i4.run() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/callSite.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/callSite.kt deleted file mode 100644 index 3539bbfb478..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/callSite.kt +++ /dev/null @@ -1,30 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -enum class X { - A, - B -} - -inline fun test(x: X, s: (X) -> String): String { - return s(x) -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test(X.A) { - when(it) { - X.A-> "O" - X.B-> "K" - } - } + test(X.B) { - when(it) { - X.A-> "O" - X.B-> "K" - } - } -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSite.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSite.kt deleted file mode 100644 index e5942e3987e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSite.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -enum class X { - A, - B -} - -inline fun test(e: X): String { - return when(e) { - X.A-> "O" - X.B-> "K" - } -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test(X.A) + test(X.B) -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappings.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappings.kt deleted file mode 100644 index 7e01061e0df..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappings.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -enum class X { - A, - B -} - -enum class Y { - A, - B -} - -inline fun test(e: X): String { - return when(e) { - X.A-> "O" - X.B-> "K" - } -} - -fun funForAdditionalMappingArrayInMappingFile(e: Y): String { - return when(e) { - Y.A-> "O" - Y.B-> "K" - } -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test(X.A) + test(X.B) -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappingsDifOrder.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappingsDifOrder.kt deleted file mode 100644 index a54536a0b2f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/enumWhen/declSiteSeveralMappingsDifOrder.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -enum class X { - A, - B -} - -enum class Y { - A, - B -} - -fun funForAdditionalMappingArrayInMappingFile(e: Y): String { - return when(e) { - Y.A-> "O" - Y.B-> "K" - } -} - -inline fun test(e: X): String { - return when(e) { - X.A-> "O" - X.B-> "K" - } -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test(X.A) + test(X.B) -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13133.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13133.kt deleted file mode 100644 index f3cbff09ac5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13133.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_REFLECT -// FILE: 1.kt - -package test - -inline fun inf(crossinline cif: Any.() -> String): () -> String { - return { - object : () -> String { - override fun invoke() = cif() - } - }() -} -// FILE: 2.kt - -import test.* - -fun box(): String { - val simpleName = inf { - javaClass.simpleName - }() - - if (simpleName != "" ) return "fail 1: $simpleName" - - val name = inf { - javaClass.name - }() - - if (name != "_2Kt\$box$\$inlined\$inf$2$1" ) return "fail 2: $name" - - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13182.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13182.kt deleted file mode 100644 index 91d42494a12..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13182.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun test(cond: Boolean, crossinline cif: () -> String): String { - return if (cond) { - { cif() }() - } - else { - cif() - } -} -// FILE: 2.kt - -import test.* - -fun box(): String { - val s = "OK" - return test(true) { - { - s - }() - } -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13374.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13374.kt deleted file mode 100644 index 5db8f48053e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt13374.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt - -package test - -interface IZ { - fun z() -} - -interface IZZ : IZ { - fun zz() -} - -inline fun implZZ(zImpl: IZ, crossinline zzImpl: () -> Unit): IZZ = - object : IZZ, IZ by zImpl { - override fun zz() = zzImpl() - } - - -// FILE: 2.kt - -import test.* - -var result = "fail"; - -object ZImpl : IZ { - override fun z() { - result = "O" - } -} - -fun box(): String { - val zz = implZZ(ZImpl) { result += "K" } - zz.z() - zz.zz() - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011.kt deleted file mode 100644 index 1e8e1ab579c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -package test - -inline fun inline1(crossinline action: () -> Unit) { - action(); - { action() }() -} - -inline fun inline2(crossinline action: () -> Unit) = { action() } - - -// FILE: 2.kt -import test.* - -var result = "fail" -fun box(): String { - inline1 { inline2 { result = "OK" }() } - - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_2.kt deleted file mode 100644 index 3997d2aa02f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_2.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -package test - -inline fun inline1(crossinline action: () -> Unit) { - { action () } - action(); -} - -inline fun inline2(crossinline action: () -> Unit) = { action() } - - -// FILE: 2.kt -import test.* - -var result = "fail" -fun box(): String { - inline1 { inline2 { result ="OK" }() } - - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_3.kt deleted file mode 100644 index 77cf8a653b5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt14011_3.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -package test - -inline fun inline1(crossinline action: () -> Unit) { - { action () } - action(); -} - -inline fun inline2(crossinline action: () -> Unit) = { - action() -} - - -// FILE: 2.kt -import test.* - -var result = "fail" -fun box(): String { - inline1 { - inline2 { { result ="OK" }() }() - } - - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt16193.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt16193.kt deleted file mode 100644 index 28c677f229f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt16193.kt +++ /dev/null @@ -1,30 +0,0 @@ -// IGNORE_BACKEND: NATIVE -//WITH_RUNTIME -//FULL_JDK -// FILE: 1.kt -package test - -inline fun crashMe(crossinline callback: () -> Unit): Function0 { - return object: Function0 { - override fun invoke() { - callback() - } - } -} - -// FILE: 2.kt - -import test.* -import java.lang.reflect.Modifier - -var result = "fail" - - -fun box(): String { - val crashMe = crashMe { result = "OK" } - val modifiers = crashMe::class.java.getDeclaredConstructor().modifiers - if (!Modifier.isPublic(modifiers)) return "fail $modifiers" - - crashMe.invoke() - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972.kt deleted file mode 100644 index 42272555489..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt -package test - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - object { - val inflater = prop - }.inflater - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_2.kt deleted file mode 100644 index 04ac09e1f8e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_2.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt -package test - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - inlineFun2 { - object { - val inflater = prop - }.inflater - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -inline fun inlineFun2(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_3.kt deleted file mode 100644 index d5550708d35..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_3.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt -package test - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - inlineFun { - object { - val inflater = prop - }.inflater - } - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_4.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_4.kt deleted file mode 100644 index 63a24a7a48c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_4.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt -package test - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - inlineFun { - noInline { - object { - val inflater = prop - }.inflater - } - } - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_5.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_5.kt deleted file mode 100644 index e244855dd3d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_5.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt -package test - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - noInline { - object { - val inflater = prop - }.inflater - } - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super.kt deleted file mode 100644 index 81121ef7928..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt -package test - -open class A(val value: String) - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - object : A(prop) { - - }.value - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super2.kt deleted file mode 100644 index 8f07e0d611e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super2.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt -package test - -open class A(val value: String) - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - inlineFun { - object : A(prop) { - - }.value - } - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super3.kt deleted file mode 100644 index 2e6ec71e3f4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt17972_super3.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt -package test - -open class A(val value: String) - -class Test { - - val prop: String = "OK" - - fun test() = - inlineFun { - noInline { - inlineFun { - noInline { - object : A(prop) { - - }.value - } - } - } - } -} - -inline fun inlineFun(init: () -> T): T { - return init() -} - -fun noInline(init: () -> T): T { - return init() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - return Test().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434.kt deleted file mode 100644 index 88cfdd9de98..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -//WITH_RUNTIME -package test - -annotation class MethodAnnotation - -inline fun reproduceIssue(crossinline s: () -> String): String { - val obj = object { - @MethodAnnotation fun annotatedMethod(): String { - return s() - } - } - val annotatedMethod = obj::class.java.declaredMethods.first { it.name == "annotatedMethod" } - if (annotatedMethod.annotations.isEmpty()) return "fail: can't find annotated method" - return obj.annotatedMethod() -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return reproduceIssue { "OK" } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434_2.kt deleted file mode 100644 index 7f397cb3469..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19434_2.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -//WITH_RUNTIME -package test - -annotation class FieldAnnotation - -inline fun reproduceIssue(crossinline s: () -> String): String { - val obj = object { - @field:FieldAnnotation val annotatedField = "O" - fun method(): String { - return annotatedField + s() - } - } - val annotatedMethod = obj::class.java.declaredFields.first { it.name == "annotatedField" } - if (annotatedMethod.annotations.isEmpty()) return "fail: can't find annotated field" - return obj.method() -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return reproduceIssue { "K" } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19723.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19723.kt deleted file mode 100644 index b02b61375c8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt19723.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -package test - -inline fun String.fire(message: String? = null) { - val res = this + message!! -} - -// FILE: 2.kt -// NO_CHECK_LAMBDA_INLINING - -import test.* - -fun box(): String { - val receiver = "receiver" - "".let { - { - receiver.fire() - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt6552.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt6552.kt deleted file mode 100644 index fefcc854cbc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt6552.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -public enum class X { A, B } - -public inline fun switch(x: X): String = when (x) { - X.A -> "O" - X.B -> "K" -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return switch(X.A) + switch(X.B) -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt8133.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt8133.kt deleted file mode 100644 index afbe87298a7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt8133.kt +++ /dev/null @@ -1,23 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -public inline fun T.myLet(f: (T) -> R): R = f(this) - -// FILE: 2.kt - -import test.* - -interface foo { - fun bar(): String -} - -fun box(): String { - val baz = "OK".myLet { - object : foo { - override fun bar() = it - } - } - return baz.bar() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064.kt deleted file mode 100644 index 1e02fc44601..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package testpack - -class Test(val _member: String) { - val _parameter: Z = test { - object : Z { - override val property = _member - } - } -} - -interface Z { - val property: String -} - -inline fun test(s: () -> Z): Z { - return s() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import testpack.* - -fun box(): String { - - val test = Test("OK") - - return test._parameter.property -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064v2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064v2.kt deleted file mode 100644 index d0d37963ec1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9064v2.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package testpack - -class Test(val _member: String) { - val _parameter: Z> = test { - object : Z> { - override val property = test { - object : Z { - override val property = _member - } - } - } - } -} - -interface Z { - val property: T -} - -inline fun test(s: () -> Z): Z { - return s() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import testpack.* - -fun box(): String { - - val test = Test("OK") - - return test._parameter.property.property -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9591.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9591.kt deleted file mode 100644 index 858e2bd78d1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9591.kt +++ /dev/null @@ -1,29 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// WITH_RUNTIME -// FILE: 1.kt -package test - - - -inline fun inlineFun(p: () -> Unit) { - p() -} - -// FILE: 2.kt - -import test.* - -public fun box(): String { - var z = "fail" - inlineFun { - val obj = object { - val _delegate by lazy { - z = "OK" - } - } - - obj._delegate - } - - return z; -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877.kt deleted file mode 100644 index cd05b1f097d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877.kt +++ /dev/null @@ -1,33 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// WITH_RUNTIME -// FILE: 1.kt -package test - -fun T.noInline(p: (T) -> Unit) { - p(this) -} - -inline fun inlineCall(p: () -> Unit) { - p() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val loci = listOf("a", "b", "c") - var gene = "g1" - - inlineCall { - val value = 10.0 - loci.forEach { - var locusMap = 1.0 - { - locusMap = value - gene = "OK" - }() - } - } - return gene -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877_2.kt deleted file mode 100644 index 74159b48cb9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/kt9877_2.kt +++ /dev/null @@ -1,28 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun inlineCall(p: () -> Unit) { - p() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var gene = "g1" - - inlineCall { - val value = 10.0 - inlineCall { - { - value - gene = "OK" - }() - } - } - - return gene -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/objectInLambdaCapturesAnotherObject.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/objectInLambdaCapturesAnotherObject.kt deleted file mode 100644 index 165d34191c8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/objectInLambdaCapturesAnotherObject.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt -package test - -public inline fun myRun(block: () -> Unit) { - return block() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - var res = "" - myRun { - val x = object { - fun foo() { - res = "OK" - } - } - object { - fun bar() = x.foo() - }.bar() - } - - return res -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt deleted file mode 100644 index ff2504b3164..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -inline fun testNested(crossinline f: (String) -> Unit) { - object : A { - override fun run() { - f("OK") - } - }.run() -} - -inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it) }()} -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - test { it -> result = it } - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt deleted file mode 100644 index 317e87c1467..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.kt +++ /dev/null @@ -1,30 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, f: (T) -> Unit) { - f(arg) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val param = "start" - var result = "fail" - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - - return if (result == "start12") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt deleted file mode 100644 index 8cba9323d98..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { - { - f(arg) - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val param = "start" - var result = "fail" - - inlineFun("2") { a -> - { - result = param + a - }() - } - - - return if (result == "start2") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt deleted file mode 100644 index b746026fa96..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { - { - f(arg) - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val param = "start" - var result = "fail" - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - - return if (result == "start12") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt deleted file mode 100644 index a65c88f9e09..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, crossinline f: (T) -> Unit) { - { - f(arg) - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val param = "start" - var result = "fail" - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - result = param + c + a - }() - } - }() - } - - return if (result == "start12") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt deleted file mode 100644 index 8aa242bb0fd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -inline fun testNested(crossinline f: (String) -> Unit) { - object : A { - override fun run() { - f("OK") - } - }.run() -} - -fun test(f: (String) -> Unit) { - testNested { it -> { f(it) }()} -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - test { it -> result = it } - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt deleted file mode 100644 index 324fa7fb4b2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f: (String) -> Unit) { - object : A { - override fun run() { - f(o) - } - }.run() - } - - inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it + k) }() } - } - - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - B("O", "K").test { it -> result = it } - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt deleted file mode 100644 index 2d1ad3de754..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.kt +++ /dev/null @@ -1,41 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { - { - f(arg + addParam) - }() - } - - fun box(): String { - { - inlineFun("1") { c -> - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - - } - }() - - return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" - } -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt deleted file mode 100644 index e9a6f6be895..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, f: (String) -> Unit) { - f(arg + addParam) - } - - fun box(): String { - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - - return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" - } - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt deleted file mode 100644 index 6a46172ff5c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { - { - f(arg + addParam) - }() - } - - - fun box(): String { - inlineFun("2") { a -> - { - result = param + a - }() - } - return if (result == "start2_additional_") "OK" else "fail: $result" - } - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt deleted file mode 100644 index 2229d03b306..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { - { - f(arg + addParam) - }() - } - - - fun box(): String { - { - inlineFun("2") { a -> - { - result = param + a - }() - } - }() - return if (result == "start2_additional_") "OK" else "fail: $result" - } - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt deleted file mode 100644 index 52e6faed839..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { - { - f(arg + addParam) - }() - } - - fun box(): String { - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - - return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" - } -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt deleted file mode 100644 index 94cfc46759f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - val param = "start" - var result = "fail" - var addParam = "_additional_" - - inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) { - { - f(arg + addParam) - }() - } - - fun box(): String { - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - result = param + c + a - }() - } - }() - } - - return if (result == "start1_additional_2_additional_") "OK" else "fail: $result" - } - - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().box() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt deleted file mode 100644 index 867a8a040bb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f: (String) -> Unit) { - object : A { - override fun run() { - f(o) - } - }.run() - } - - inline fun test(crossinline f: (String) -> Unit) { - testNested { it -> { f(it + "K") }() } - } - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - B("O", "fail").test { it -> result = it } - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt deleted file mode 100644 index fa95495148c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f: (String) -> Unit) { - object : A { - override fun run() { - f(o) - } - }.run() - } - - fun test(f: (String) -> Unit) { - testNested { it -> { f(it + k) }() } - } - - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - var result = "fail" - B("O", "K").test { it -> result = it } - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambda.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambda.kt deleted file mode 100644 index 09d238f9d76..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambda.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f2: (String) -> Unit, crossinline f3: (String) -> Unit) { - object : A { - override fun run() { - f2(o) - f3(k) - } - }.run() - } - - inline fun test(crossinline f: (String) -> Unit) { - testNested ({ it -> f(it + o) }) { it -> f(it + k) } - } - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "" - B("O", "K").test { it -> result += it } - return if (result == "OOKK") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt deleted file mode 100644 index 2459a2f67e6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.kt +++ /dev/null @@ -1,43 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f: (String) -> Unit, crossinline f2: (String) -> Unit) { - object : A { - override fun run() { - f(o) - f2(k) - } - }.run() - } - - inline fun test(crossinline f: (String) -> Unit) { - call { - { - testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() } - }() - } - } - - inline fun call(f: () -> Unit) { - f() - } - - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "" - B("O", "K").test { it -> result += it } - return if (result == "OOKK") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt deleted file mode 100644 index 472657d058b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.kt +++ /dev/null @@ -1,44 +0,0 @@ -// FILE: 1.kt - -package test - -interface A { - fun run() -} - -class B(val o: String, val k: String) { - - inline fun testNested(crossinline f: (String) -> Unit, crossinline f2: (String) -> Unit) { - object : A { - override fun run() { - f(o) - f2(k) - } - }.run() - } - - inline fun test(crossinline f: (String) -> Unit) { - call { - f("start"); - { - testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() } - }() - } - } - - inline fun call(f: () -> Unit) { - f() - } - - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "" - B("O", "K").test { it -> result += it } - return if (result == "startOOKK") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall.kt deleted file mode 100644 index 761baaab332..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -class W(val value: Any) - -inline fun W.safe(crossinline body : Any.() -> Unit) { - { - this.value?.body() - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - W("OK").safe { - result = this as String - } - - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall_2.kt deleted file mode 100644 index ed67f8175f0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/safeCall_2.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt - -package test - -class W(val value: Any) - -inline fun W.safe(crossinline body : Any.() -> Unit) { - { - this.value?.body() - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - W("OK").safe { - { - result = this as String - }() - } - - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/sam.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/sam.kt deleted file mode 100644 index 8fa1a21446e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/sam.kt +++ /dev/null @@ -1,20 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -package test - -inline fun makeRunnable(noinline lambda: ()->Unit) : Runnable { - return Runnable(lambda) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - - makeRunnable { result = "OK" }.run() - - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt deleted file mode 100644 index 6aabb90b5b5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - - fun callK(): String { - return "K" - } - - fun callO(): String { - return "O" - } - - fun testCall(): String = test { callO() } - - inline fun test(crossinline l: () -> String): String { - return { - l() + callK() - }() - } -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return A().testCall() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_2.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_2.kt deleted file mode 100644 index c25485dceac..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_2.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt - -package test - -class Person(val name: String) { - - fun sayName() = doSayName { name } - - inline fun doSayName(crossinline call: () -> String): String { - return nestedSayName1 { nestedSayName2 { call() } } - } - - fun nestedSayName1(call: () -> String) = call() - - inline fun nestedSayName2(call: () -> String) = call() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return Person("OK").sayName() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_3.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_3.kt deleted file mode 100644 index 66f310e4426..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_3.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package test - -class Person(val name: String) { - - fun sayName() = doSayName { name } - - inline fun doSayName(crossinline call: () -> String): String { - return nestedSayName1 { name + Person("sub").nestedSayName2 { call() } } - } - - fun nestedSayName1(call: () -> String) = call() - - inline fun nestedSayName2(call: () -> String) = name + call() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - val res = Person("OK").sayName() - if (res != "OKsubOK") return "fail: $res" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoDifferentDispatchReceivers.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoDifferentDispatchReceivers.kt deleted file mode 100644 index d1188cc9d1f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoDifferentDispatchReceivers.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package test - -class Company(val name: String) { - fun sayName() = Person("test").doSayName { name } -} - -class Person(val name: String) { - - inline fun doSayName(crossinline call: () -> String): String { - return companyName { parsonName { call() } } - } - - inline fun parsonName(call: () -> String) = call() - - fun companyName(call: () -> String) = call() - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return Company("OK").sayName() -} diff --git a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoExtensionReceivers.kt b/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoExtensionReceivers.kt deleted file mode 100644 index 569b29472d2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoExtensionReceivers.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -fun Person.sayName() = doSayName { name } - -class Person(val name: String) - -inline fun Person.doSayName(crossinline call: () -> String): String { - return companyName { parsonName { call() } } -} - -inline fun Person.parsonName(call: () -> String) = call() - -fun Person.companyName(call: () -> String) = call() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return Person("OK").sayName() -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference.kt deleted file mode 100644 index 0607fff5303..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference.kt +++ /dev/null @@ -1,41 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun test(a: String, b: String, c: () -> String): String { - return a + b + c(); -} - -// FILE: 2.kt - -import test.* - -var res = "" - -fun String.id() = this - -val receiver: String - get() { - res += "L" - return "L" - } - - -fun box(): String { - res = "" - var call = test(b = { res += "K"; "K" }(), a = { res += "O"; "O" }(), c = receiver::id) - if (res != "KOL" || call != "OKL") return "fail 1: $res != KOL or $call != OKL" - - res = "" - call = test(b = { res += "K"; "K" }(), c = receiver::id, a = { res += "O"; "O" }()) - if (res != "KLO" || call != "OKL") return "fail 2: $res != KLO or $call != OKL" - - - res = "" - call = test(c = receiver::id, b = { res += "K"; "K" }(), a = { res += "O"; "O" }()) - if (res != "LKO" || call != "OKL") return "fail 3: $res != LKO or $call != OKL" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference2.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference2.kt deleted file mode 100644 index afeec54fea1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/boundFunctionReference2.kt +++ /dev/null @@ -1,41 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun test(a: String, b: Long, c: () -> String): String { - return a + b + c(); -} - -// FILE: 2.kt - -import test.* - -var res = "" - -fun String.id() = this - -val receiver: String - get() { - res += "L" - return "L" - } - - -fun box(): String { - res = "" - var call = test(b = { res += "K"; 1L }(), a = { res += "O"; "O" }(), c = receiver::id) - if (res != "KOL" || call != "O1L") return "fail 1: $res != KOL or $call != O1L" - - res = "" - call = test(b = { res += "K"; 1L }(), c = receiver::id, a = { res += "O"; "O" }()) - if (res != "KLO" || call != "O1L") return "fail 2: $res != KLO or $call != O1L" - - - res = "" - call = test(c = receiver::id, b = { res += "K"; 1L }(), a = { res += "O"; "O" }()) - if (res != "LKO" || call != "O1L") return "fail 3: $res != LKO or $call != O1L" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/captured.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/captured.kt deleted file mode 100644 index 0388cd57054..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/captured.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun test(a: Int, b: Long, crossinline c: () -> String): String { - return { "${a}_${b}_${c()}"} () -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var invokeOrder = ""; - val expectedResult = "0_1_9" - val expectedInvokeOrder = "1_0_9" - var l = 1L - var i = 0 - val captured = 9L - - var result = test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "$captured"; "$captured"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = test(c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/capturedInExtension.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/capturedInExtension.kt deleted file mode 100644 index 096c5fe75e4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/capturedInExtension.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun Double.test(a: Int, b: Long, crossinline c: () -> String): String { - - return { "${this}_${a}_${b}_${c()}"} () -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var invokeOrder = ""; - val expectedResult = "1.0_0_1_9" - val expectedInvokeOrder = "1_0_9" - var l = 1L - var i = 0 - val captured = 9L - - var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "${captured}"; "${captured}"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt deleted file mode 100644 index 0cd491e95c6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt +++ /dev/null @@ -1,54 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -// WITH_RUNTIME -package test - -open class A(val value: String) - -var invokeOrder = "" - -inline fun inlineFun( - receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(), - init: String, - vararg constraints: A -): String { - return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init -} - -// FILE: 2.kt -import test.* - - -var result = "" -fun box(): String { - - result = "" - invokeOrder = "" - result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }(), - init = { invokeOrder += " init"; "I" }()) - if (result != "C, R, I") return "fail 1: $result" - - //Change test after KT-17691 FIX - if (invokeOrder != " receiver initconstraints") return "fail 2: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }() - ) - if (result != "C, R, I") return "fail 3: $result" - //Change test after KT-17691 FIX - if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += " constraints";A("C") }()) - if (result != "C, DEFAULT, I") return "fail 5: $result" - if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/extension.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/extension.kt deleted file mode 100644 index 94fa2176376..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/extension.kt +++ /dev/null @@ -1,39 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun Double.test(a: Int, b: Long, c: () -> String): String { - return "${this}_${a}_${b}_${c()}" -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var invokeOrder = ""; - val expectedResult = "1.0_0_1_L" - val expectedInvokeOrder = "1_0_L" - var l = 1L - var i = 0 - - var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "L"; "L"}, a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}()) - if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/extensionInClass.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/extensionInClass.kt deleted file mode 100644 index a6c970d4c36..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/extensionInClass.kt +++ /dev/null @@ -1,43 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -// WITH_RUNTIME -package test - -class Z { - inline fun Double.test(a: Int, b: Long, c: () -> String): String { - return "${this}_${a}_${b}_${c()}" - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - with (Z()) { - var invokeOrder = ""; - val expectedResult = "1.0_0_1_L" - val expectedInvokeOrder = "1_0_L" - var l = 1L - var i = 0 - - var result = 1.0.test(b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - invokeOrder = ""; - result = 1.0.test(b = { invokeOrder += "1_"; l }(), c = { invokeOrder += "L"; "L" }, a = { invokeOrder += "0_"; i }()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }()) - if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" - - - invokeOrder = ""; - result = 1.0.test(a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }()) - if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigration.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigration.kt deleted file mode 100644 index 71d688725b8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigration.kt +++ /dev/null @@ -1,30 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun test(a: String, b: String, c: () -> String): String { - return a + b + c(); -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var res = ""; - var call = test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "KOL") return "fail 1: $res != KOL or $call != KOL" - - res = ""; - call = test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOL") return "fail 2: $res != KOL or $call != KOL" - - - res = ""; - call = test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOL") return "fail 3: $res != KOL or $call != KOL" - - return "OK" - -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigrationInClass.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigrationInClass.kt deleted file mode 100644 index e371e456f9f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/lambdaMigrationInClass.kt +++ /dev/null @@ -1,34 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -class Z(val p: String) { - - inline fun test(a: String, b: String, c: () -> String): String { - return a + b + c() + p; - } - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var res = ""; - var call = Z("Z").test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "KOLZ") return "fail 1: $res != KOL or $call != KOLZ" - - res = ""; - call = Z("Z").test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOLZ") return "fail 2: $res != KOL or $call != KOLZ" - - - res = ""; - call = Z("Z").test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) - if (res != "KOL" || call != "KOLZ") return "fail 3: $res != KOL or $call != KOLZ" - - return "OK" - -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/simple.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/simple.kt deleted file mode 100644 index e7dd36ac31a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/simple.kt +++ /dev/null @@ -1,30 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -inline fun test(a: String, b: String, c: () -> String): String { - return a + b + c(); -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var res = ""; - var call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "OKL") return "fail 1: $res != KOL or $call != OKL" - - res = ""; - call = test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKL") return "fail 2: $res != KOL or $call != OKL" - - - res = ""; - call = test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKL") return "fail 3: $res != KOL or $call != OKL" - - return "OK" - -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/simpleInClass.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/simpleInClass.kt deleted file mode 100644 index ae7f9c84f67..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/simpleInClass.kt +++ /dev/null @@ -1,32 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt - -package test - -class Z(val p: String) { - inline fun test(a: String, b: String, c: () -> String): String { - return a + b + c() + p; - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var res = ""; - var call = Z("Z").test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) - if (res != "KOL" || call != "OKLZ") return "fail 1: $res != KOL or $call != OKLZ" - - res = ""; - call = Z("Z").test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKLZ") return "fail 2: $res != KOL or $call != OKLZ" - - - res = ""; - call = Z("Z").test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) - if (res != "KOL" || call != "OKLZ") return "fail 3: $res != KOL or $call != OKLZ" - - return "OK" - -} diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt deleted file mode 100644 index e50b5bb04d6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt +++ /dev/null @@ -1,53 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -// WITH_RUNTIME -package test - -open class A(val value: String) - -var invokeOrder = "" - -inline fun inlineFun( - vararg constraints: A, - receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(), - init: String -): String { - return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init -} - -// FILE: 2.kt -import test.* - - -var result = "" -fun box(): String { - - result = "" - invokeOrder = "" - result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }(), - init = { invokeOrder += " init"; "I" }()) - if (result != "C, R, I") return "fail 1: $result" - - if (invokeOrder != "constraints receiver init") return "fail 2: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += "constraints";A("C") }(), - receiver = { invokeOrder += " receiver"; "R" }() - ) - if (result != "C, R, I") return "fail 3: $result" - //Change test after KT-17691 FIX - if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder" - - result = "" - invokeOrder = "" - result = inlineFun(init = { invokeOrder += "init"; "I" }(), - constraints = { invokeOrder += " constraints";A("C") }()) - if (result != "C, DEFAULT, I") return "fail 5: $result" - if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccess.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccess.kt deleted file mode 100644 index 39130114ad1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccess.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -var res = 1 - -inline operator fun Int.get(z: Int, p: Int) = this + z + p - -inline operator fun Int.set(z: Int, p: Int, l: Int) { - res = this + z + p + l -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - val z = 1; - - val p = z[2, 3] - if (p != 6) return "fail 1: $p" - - z[2, 3] = p - if (res != 12) return "fail 2: $res" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessInClass.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessInClass.kt deleted file mode 100644 index 98947d35b34..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessInClass.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -var res = 1 - -class A { - - inline operator fun Int.get(z: Int, p: Int) = this + z + p - - inline operator fun Int.set(z: Int, p: Int, l: Int) { - res = this + z + p + l - } - -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - with(A()) { - val z = 1; - - val p = z[2, 3] - if (p != 6) return "fail 1: $p" - - z[2, 3] = p - if (res != 12) return "fail 2: $res" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefault.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefault.kt deleted file mode 100644 index 08697f40633..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefault.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt - -package test - -var res = 1 - -inline operator fun Int.get(z: Int, p: () -> Int, defaultt: Int = 100) = this + z + p() + defaultt - -inline operator fun Int.set(z: Int, p: () -> Int, l: Int/*, x : Int = 1000*/) { - res = this + z + p() + l /*+ x*/ -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - val z = 1; - - val p = z[2, { 3 }] - if (p != 106) return "fail 1: $p" - - val captured = 3; - z[2, { captured } ] = p - if (res != 112) return "fail 2: $res" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefaultInClass.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefaultInClass.kt deleted file mode 100644 index 974b843f626..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithDefaultInClass.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -var res = 1 - -class A { - - inline operator fun Int.get(z: Int, p: () -> Int, defaultt: Int = 100) = this + z + p() + defaultt - - inline operator fun Int.set(z: Int, p: () -> Int, l: Int/*, x : Int = 1000*/) { - res = this + z + p() + l /*+ x*/ - } -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - val z = 1; - - with(A()) { - - val p = z[2, { 3 }] - if (p != 106) return "fail 1: $p" - - val captured = 3; - z[2, { captured }] = p - if (res != 112) return "fail 2: $res" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambda.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambda.kt deleted file mode 100644 index 15ee64d9166..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambda.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt - -package test - -var res = 1 - -inline operator fun Int.get(z: Int, p: () -> Int) = this + z + p() - -inline operator fun Int.set(z: Int, p: () -> Int, l: Int) { - res = this + z + p() + l -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - val z = 1; - - val p = z[2, { 3 }] - if (p != 6) return "fail 1: $p" - - val captured = 3; - z[2, { captured } ] = p - if (res != 12) return "fail 2: $res" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambdaInClass.kt b/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambdaInClass.kt deleted file mode 100644 index 550aa88fa5d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/arrayConvention/simpleAccessWithLambdaInClass.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -var res = 1 - -class A { - - inline operator fun Int.get(z: Int, p: () -> Int) = this + z + p() - - inline operator fun Int.set(z: Int, p: () -> Int, l: Int) { - res = this + z + p() + l - } - -} - -// FILE: 2.kt - -import test.* - - -fun box(): String { - - val z = 1; - - with(A()) { - - val p = z[2, { 3 }] - if (p != 6) return "fail 1: $p" - - val captured = 3; - z[2, { captured }] = p - if (res != 12) return "fail 2: $res" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/builders/builders.kt b/backend.native/tests/external/codegen/boxInline/builders/builders.kt deleted file mode 100644 index c272ab3269f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/builders/builders.kt +++ /dev/null @@ -1,288 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package builders - -import java.util.ArrayList -import java.util.HashMap - -abstract class Element { - abstract fun render(builder: StringBuilder, indent: String) - - override fun toString(): String { - val builder = StringBuilder() - render(builder, "") - return builder.toString() - } -} - -class TextElement(val text: String) : Element() { - override fun render(builder: StringBuilder, indent: String) { - builder.append("$indent$text\n") - } -} - -abstract class Tag(val name: String) : Element() { - val children = ArrayList() - val attributes = HashMap() - - inline protected fun initTag(tag: T, init: T.() -> Unit): T { - tag.init() - children.add(tag) - return tag - } - - override fun render(builder: StringBuilder, indent: String) { - builder.append("$indent<$name${renderAttributes()}>\n") - for (c in children) { - c.render(builder, indent + " ") - } - builder.append("$indent\n") - } - - private fun renderAttributes(): String? { - val builder = StringBuilder() - for (a in attributes.keys) { - builder.append(" $a=\"${attributes[a]}\"") - } - return builder.toString() - } -} - -abstract class TagWithText(name: String) : Tag(name) { - operator fun String.unaryPlus() { - children.add(TextElement(this)) - } -} - -class HTML() : TagWithText("html") { - inline fun head(init: Head.() -> Unit) = initTag(Head(), init) - - inline fun body(init: Body.() -> Unit) = initTag(Body(), init) - - fun bodyNoInline(init: Body.() -> Unit) = initTag(Body(), init) -} - -class Head() : TagWithText("head") { - inline fun title(init: Title.() -> Unit) = initTag(Title(), init) -} - -class Title() : TagWithText("title") - -abstract class BodyTag(name: String) : TagWithText(name) { - inline fun b(init: B.() -> Unit) = initTag(B(), init) - inline fun p(init: P.() -> Unit) = initTag(P(), init) - inline fun pNoInline(init: P.() -> Unit) = initTag(P(), init) - inline fun h1(init: H1.() -> Unit) = initTag(H1(), init) - inline fun ul(init: UL.() -> Unit) = initTag(UL(), init) - inline fun a(href: String, init: A.() -> Unit) { - val a = initTag(A(), init) - a.href = href - } -} - -class Body() : BodyTag("body") -class UL() : BodyTag("ul") { - inline fun li(init: LI.() -> Unit) = initTag(LI(), init) -} - -class B() : BodyTag("b") -class LI() : BodyTag("li") -class P() : BodyTag("p") -class H1() : BodyTag("h1") -class A() : BodyTag("a") { - public var href: String - get() = attributes["href"]!! - set(value) { - attributes["href"] = value - } -} - -inline fun html(init: HTML.() -> Unit): HTML { - val html = HTML() - html.init() - return html -} - -fun htmlNoInline(init: HTML.() -> Unit): HTML { - val html = HTML() - html.init() - return html -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import builders.* - -fun testAllInline() : String { - val args = arrayOf("1", "2", "3") - val result = - html { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - body { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar" } - } - } - } - } - - return result.toString()!! -} - -fun testHtmlNoInline() : String { - val args = arrayOf("1", "2", "3") - val result = - htmlNoInline() { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - body { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar" } - } - } - } - } - - return result.toString()!! -} - -fun testBodyNoInline() : String { - val args = arrayOf("1", "2", "3") - val result = - html { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - bodyNoInline { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar" } - } - } - } - } - - return result.toString()!! -} - -fun testBodyHtmlNoInline() : String { - val args = arrayOf("1", "2", "3") - val result = - htmlNoInline { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - bodyNoInline { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar" } - } - } - } - } - - return result.toString()!! -} - -fun box(): String { - var expected = testAllInline(); - - if (expected != testHtmlNoInline()) return "fail 1: ${testHtmlNoInline()}\nbut expected\n${expected} " - - if (expected != testBodyNoInline()) return "fail 2: ${testBodyNoInline()}\nbut expected\n${expected} " - - if (expected != testBodyHtmlNoInline()) return "fail 3: ${testBodyHtmlNoInline()}\nbut expected\n${expected} " - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/builders/buildersAndLambdaCapturing.kt b/backend.native/tests/external/codegen/boxInline/builders/buildersAndLambdaCapturing.kt deleted file mode 100644 index 118e0c5043c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/builders/buildersAndLambdaCapturing.kt +++ /dev/null @@ -1,292 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package builders - -import java.util.ArrayList -import java.util.HashMap - -abstract class Element { - abstract fun render(builder: StringBuilder, indent: String) - - override fun toString(): String { - val builder = StringBuilder() - render(builder, "") - return builder.toString() - } -} - -class TextElement(val text: String) : Element() { - override fun render(builder: StringBuilder, indent: String) { - builder.append("$indent$text\n") - } -} - -abstract class Tag(val name: String) : Element() { - val children = ArrayList() - val attributes = HashMap() - - inline protected fun initTag(tag: T, init: T.() -> Unit): T { - tag.init() - children.add(tag) - return tag - } - - override fun render(builder: StringBuilder, indent: String) { - builder.append("$indent<$name${renderAttributes()}>\n") - for (c in children) { - c.render(builder, indent + " ") - } - builder.append("$indent\n") - } - - private fun renderAttributes(): String? { - val builder = StringBuilder() - for (a in attributes.keys) { - builder.append(" $a=\"${attributes[a]}\"") - } - return builder.toString() - } -} - -abstract class TagWithText(name: String) : Tag(name) { - operator fun String.unaryPlus() { - children.add(TextElement(this)) - } -} - -class HTML() : TagWithText("html") { - inline fun head(init: Head.() -> Unit) = initTag(Head(), init) - - inline fun body(init: Body.() -> Unit) = initTag(Body(), init) - - fun bodyNoInline(init: Body.() -> Unit) = initTag(Body(), init) -} - -class Head() : TagWithText("head") { - inline fun title(init: Title.() -> Unit) = initTag(Title(), init) -} - -class Title() : TagWithText("title") - -abstract class BodyTag(name: String) : TagWithText(name) { - inline fun b(init: B.() -> Unit) = initTag(B(), init) - inline fun p(init: P.() -> Unit) = initTag(P(), init) - fun pNoInline(init: P.() -> Unit) = initTag(P(), init) - inline fun h1(init: H1.() -> Unit) = initTag(H1(), init) - inline fun ul(init: UL.() -> Unit) = initTag(UL(), init) - inline fun a(href: String, init: A.() -> Unit) { - val a = initTag(A(), init) - a.href = href - } -} - -class Body() : BodyTag("body") -class UL() : BodyTag("ul") { - inline fun li(init: LI.() -> Unit) = initTag(LI(), init) -} - -class B() : BodyTag("b") -class LI() : BodyTag("li") -class P() : BodyTag("p") -class H1() : BodyTag("h1") -class A() : BodyTag("a") { - public var href: String - get() = attributes["href"]!! - set(value) { - attributes["href"] = value - } -} - -inline fun html(init: HTML.() -> Unit): HTML { - val html = HTML() - html.init() - return html -} - -fun htmlNoInline(init: HTML.() -> Unit): HTML { - val html = HTML() - html.init() - return html -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import builders.* - -inline fun testAllInline(f: () -> String) : String { - val args = arrayOf("1", "2", "3") - val result = - html { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - body { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar"; +"${f()}" } - } - } - } - } - - return result.toString()!! -} - -inline fun testHtmlNoInline(crossinline f: () -> String) : String { - val args = arrayOf("1", "2", "3") - val result = - htmlNoInline() { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - body { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar"; +"${f()}" } - } - } - } - } - - return result.toString()!! -} - -inline fun testBodyNoInline(crossinline f: () -> String) : String { - val args = arrayOf("1", "2", "3") - val result = - html { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - bodyNoInline { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar"; +"${f()}" } - } - } - } - } - - return result.toString()!! -} - -inline fun testBodyHtmlNoInline(crossinline f: () -> String) : String { - val args = arrayOf("1", "2", "3") - val result = - htmlNoInline { - val htmlVal = 0 - head { - title { +"XML encoding with Kotlin" } - } - bodyNoInline { - var bodyVar = 1 - h1 { +"XML encoding with Kotlin" } - p { +"this format can be used as an alternative markup to XML" } - - // an element with attributes and text content - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - - // mixed content - p { - +"This is some" - b { +"mixed" } - +"text. For more see the" - a(href = "http://jetbrains.com/kotlin") { +"Kotlin" } - +"project" - } - p { +"some text" } - - // content generated from command-line arguments - p { - +"Command line arguments were:" - ul { - for (arg in args) - li { +arg; +"$htmlVal"; +"$bodyVar"; +"${f()}" } - } - } - } - } - - return result.toString()!! -} - -fun box(): String { - var expected = testAllInline({"x"}); - print(expected + " " + testHtmlNoInline({"x"})) - - if (expected != testHtmlNoInline({"x"})) return "fail 1: ${testHtmlNoInline({"x"})}\nbut expected\n${expected} " - if (expected != testBodyNoInline({"x"})) return "fail 2: ${testBodyNoInline({"x"})}\nbut expected\n${expected} " - if (expected != testBodyHtmlNoInline({"x"})) return "fail 3: ${testBodyHtmlNoInline({"x"})}\nbut expected\n${expected} " - - var captured = "x" - if (expected != testHtmlNoInline({captured})) return "fail 4: ${testHtmlNoInline({captured})}\nbut expected\n${expected} " - if (expected != testBodyNoInline({captured})) return "fail 5: ${testBodyNoInline({captured})}\nbut expected\n${expected} " - if (expected != testBodyHtmlNoInline({captured})) return "fail 6: ${testBodyHtmlNoInline({captured})}\nbut expected\n${expected} " - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/bytecodePreprocessing/apiVersionAtLeast1.kt b/backend.native/tests/external/codegen/boxInline/bytecodePreprocessing/apiVersionAtLeast1.kt deleted file mode 100644 index b5364190bb1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/bytecodePreprocessing/apiVersionAtLeast1.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -package kotlin.internal - -fun apiVersionIsAtLeast(epic: Int, major: Int, minor: Int): Boolean { - return false -} - -var properFunctionWasClled = false - -fun doSomethingNew() { - properFunctionWasClled = true -} - -fun doSomethingOld() { - throw AssertionError("Should not be called") -} - -inline fun versionDependentInlineFun() { - if (apiVersionIsAtLeast(1, 1, 0)) { - doSomethingNew() - } - else { - doSomethingOld() - } -} - -fun test() { - versionDependentInlineFun() -} - - -// FILE: 2.kt -import kotlin.internal.* - -fun box(): String { - test() - if (!properFunctionWasClled) return "Fail 1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/classProperty.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/classProperty.kt deleted file mode 100644 index d005b752b41..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/classProperty.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo(val a: String) - -inline fun test(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(Foo("OK")::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/expression.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/expression.kt deleted file mode 100644 index 5c83f97b312..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/expression.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun go(f: () -> String) = f() - -fun String.id(): String = this - -fun foo(x: String, y: String): String { - return go((x + y)::id) -} - -// FILE: 2.kt - -import test.* - -fun box() = foo("O", "K") diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/extensionReceiver.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/extensionReceiver.kt deleted file mode 100644 index c031c5192d7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/extensionReceiver.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: () -> String, z: String) = x() + z - -fun String.id() = this - -// FILE: 2.kt - -import test.* - -fun String.test() : String { - return foo(this::id, "K") -} - - -fun box() : String { - return "O".test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/filter.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/filter.kt deleted file mode 100644 index 552c9e17da0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/filter.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME -// FILE: 1.kt - -package test - -inline fun stub(f: () -> String): String = f() - -// FILE: 2.kt - -import test.* - -class A(val z: String) { - fun filter(s: String) = z == s -} - - -fun box(): String { - val a = A("OK") - val s = arrayOf("OK") - return s.filter(a::filter).first() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/intrinsic.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/intrinsic.kt deleted file mode 100644 index ab6fb03092d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/intrinsic.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: (String) -> String, z: String) = x(z) - -fun String.id() = this - -// FILE: 2.kt - -import test.* - -fun box() : String { - var zeroSlot = "fail"; - val z = "O" - return foo(z::plus, "K") -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728.kt deleted file mode 100644 index 8da9f6097a1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun T.map(transform: (T) -> R): R { - return transform(this) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = 1.map(2::plus) - return if (result == 3) "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_2.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_2.kt deleted file mode 100644 index 164bc0ee3ec..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_2.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun T.map(transform: (T) -> R): R { - return transform(this) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = 1.map(3L::plus) - return if (result == 4L) "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_3.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_3.kt deleted file mode 100644 index 40df3101338..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_3.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun map(transform: () -> R): R { - return transform() -} - -// FILE: 2.kt - -import test.* - -val Int.myInc - get() = this + 1 - -fun box(): String { - val result = map(2::myInc) - return if (result == 3) "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_4.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_4.kt deleted file mode 100644 index 0bcc8fd80d4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/kt18728_4.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun map(transform: () -> R): R { - return transform() -} - -// FILE: 2.kt - -import test.* -val Long.myInc - get() = this + 1 - -fun box(): String { - val result = map(2L::myInc) - return if (result == 3L) "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/map.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/map.kt deleted file mode 100644 index 2a561a1547a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/map.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_RUNTIME -// FILE: 1.kt - -package test - -inline fun stub(f: () -> String): String = f() - -// FILE: 2.kt - -import test.* - -class A(val z: String) { - fun map(s: String) = z + s -} - - -fun box(): String { - val a = A("O") - val s = arrayOf("K") - return s.map(a::map).first() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/mixed.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/mixed.kt deleted file mode 100644 index 426984d7d1e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/mixed.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo { - fun foo() = "OK" - fun foo2() = "OK2" -} - -inline fun inlineFn(a: String, crossinline fn: () -> String, x: Long = 1, crossinline fn2: () -> String, c: String): String { - return a + fn() + x + fn2() + c -} - -// FILE: 2.kt - -import test.* - -private val foo = Foo() - -fun box(): String { - val result = inlineFn("a", foo::foo, 5, foo::foo2, "end") - return if (result == "aOK5OK2end") "OK" else "fail: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/objectProperty.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/objectProperty.kt deleted file mode 100644 index 4400cd85b8d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/objectProperty.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -object Foo { - val a: String = "OK" -} - -inline fun test(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(Foo::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt deleted file mode 100644 index c08e617e2b1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -object Foo { - val a: String = "OK" -} - -inline fun test(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.Foo.a -import test.test - -fun box(): String { - return test(::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/simple.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/simple.kt deleted file mode 100644 index 6b4306c4705..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/simple.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: () -> String, z: String) = x() + z - -fun String.id() = this - -// FILE: 2.kt - -import test.* - -fun box() : String { - var zeroSlot = "fail"; - val z = "O" - return foo(z::id, "K") -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt b/backend.native/tests/external/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt deleted file mode 100644 index ad0438b07f4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo(val z: String) - -val Foo.a: String - get() = z - -inline fun test(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(Foo("OK")::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/classLevel.kt b/backend.native/tests/external/codegen/boxInline/callableReference/classLevel.kt deleted file mode 100644 index 384931b1398..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/classLevel.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -class A(val z: Int) { - fun calc() = z -} - -inline fun call(p: A, s: A.() -> Int): Int { - return p.s() -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - val call = call(A(11), A::calc) - return if (call == 11) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/classLevel2.kt b/backend.native/tests/external/codegen/boxInline/callableReference/classLevel2.kt deleted file mode 100644 index 893b834aed8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/classLevel2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -class A(val z: Int) { - fun calc() = z - - fun test() = call(A(z), A::calc) -} - -inline fun call(p: A, s: A.() -> Int): Int { - return p.s() -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - val call = A(11).test() - return if (call == 11) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/constructor.kt b/backend.native/tests/external/codegen/boxInline/callableReference/constructor.kt deleted file mode 100644 index d16c19fb284..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/constructor.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -class A(val z: Int) { - fun calc() = z -} - -inline fun call(p: Int, s: (Int) -> A): Int { - return s(p).z -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - val call = call(11, ::A) - return if (call == 11) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/intrinsic.kt b/backend.native/tests/external/codegen/boxInline/callableReference/intrinsic.kt deleted file mode 100644 index e1ef3a40ca3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/intrinsic.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Enable when callable references to builtin members and using lambdas as extension lambdas (KT-13312) is supported -// FILE: 1.kt - -package test - -inline fun call(a: String, b: String, s: String.(String) -> String): String { - return a.s(b) -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - return call("O", "K", String::plus) -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/kt15449.kt b/backend.native/tests/external/codegen/boxInline/callableReference/kt15449.kt deleted file mode 100644 index 7d537bbffa9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/kt15449.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun linearLayout2(init: X.() -> Unit) { - return X().init() -} - -var result = "fail" -class X { - fun calc() { - result = "OK" - } -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -class A { - fun test() { - linearLayout2 { - { - apply2 { - this@linearLayout2::calc - }() - }() - } - } - - public fun T.apply2(block: T.() -> Z): Z { - return block() - } - -} - -fun box(): String { - A().test() - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/kt16411.kt b/backend.native/tests/external/codegen/boxInline/callableReference/kt16411.kt deleted file mode 100644 index d9465d269b3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/kt16411.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -inline fun startFlow( - flowConstructor: (String) -> R -): R { - return flowConstructor("OK") -} - -object Foo { - class Requester(val dealToBeOffered: String) -} - -// FILE: 2.kt - -fun box(): String { - return startFlow(Foo::Requester).dealToBeOffered -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/propertyIntrinsic.kt b/backend.native/tests/external/codegen/boxInline/callableReference/propertyIntrinsic.kt deleted file mode 100644 index 83710b2f5f4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/propertyIntrinsic.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Enable when callable references to builtin members and using lambdas as extension lambdas (KT-13312) is supported -// FILE: 1.kt - -package test - -inline fun call(p: String, s: String.() -> Int): Int { - return p.s() -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - return if (call("123", String::length) == 3) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/propertyReference.kt b/backend.native/tests/external/codegen/boxInline/callableReference/propertyReference.kt deleted file mode 100644 index 8a1091e81c6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/propertyReference.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo(val a: String) - -inline fun test(receiver: T, selector: (T) -> String): String { - return selector(receiver) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(Foo("OK"), Foo::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/topLevel.kt b/backend.native/tests/external/codegen/boxInline/callableReference/topLevel.kt deleted file mode 100644 index 87208f55ed4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/topLevel.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(p: Int, s: (Int) -> Int): Int { - return s(p) -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - return if (call(10, ::calc) == 5) "OK" else "fail" -} - -fun calc(p: Int) : Int { - return p / 2 -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/topLevelExtension.kt b/backend.native/tests/external/codegen/boxInline/callableReference/topLevelExtension.kt deleted file mode 100644 index eaabbf11261..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/topLevelExtension.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(p: Int, s: Int.(Int) -> Int): Int { - return p.s(p) -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - return if (call(10, Int::calc) == 100) "OK" else "fail" -} - -fun Int.calc(p: Int) : Int { - return p * this -} diff --git a/backend.native/tests/external/codegen/boxInline/callableReference/topLevelProperty.kt b/backend.native/tests/external/codegen/boxInline/callableReference/topLevelProperty.kt deleted file mode 100644 index ae31ab979ce..00000000000 --- a/backend.native/tests/external/codegen/boxInline/callableReference/topLevelProperty.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -val a: String - get() = "OK" - -inline fun test(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(::a) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/capture/captureInlinable.kt b/backend.native/tests/external/codegen/boxInline/capture/captureInlinable.kt deleted file mode 100644 index 0e55f8165c5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/captureInlinable.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun doWork(crossinline job: ()-> R) : R { - return notInline({job()}) -} - -fun notInline(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - val result = doWork({11}) - if (result != 11) return "test1: ${result}" - - val result2 = doWork({12; result+1}) - if (result2 != 12) return "test2: ${result2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/capture/captureInlinableAndOther.kt b/backend.native/tests/external/codegen/boxInline/capture/captureInlinableAndOther.kt deleted file mode 100644 index 222c0cabea3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/captureInlinableAndOther.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun doWork(crossinline job: ()-> R) : R { - val k = 10; - return notInline({k; job()}) -} - -fun notInline(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - val result = doWork({11}) - if (result != 11) return "test1: ${result}" - - val result2 = doWork({12; result+1}) - if (result2 != 12) return "test2: ${result2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/capture/captureThisAndReceiver.kt b/backend.native/tests/external/codegen/boxInline/capture/captureThisAndReceiver.kt deleted file mode 100644 index d2f288948e0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/captureThisAndReceiver.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -class My(val value: Int) - -inline fun T.perform(job: (T)-> R) : R { - return job(this) -} - -// FILE: 2.kt - -fun test1() : Int { - val inlineX = My(111) - - return inlineX.perform{ - - val outX = My(1111111) - outX.perform( - {inlineX.value} - ) - } -} - -inline fun My.execute(): Int { - return perform { this.value } -} - -fun test2(): Int { - val inlineX = My(11) - - return inlineX.execute() -} - -fun box(): String { - if (test1() != 111) return "test1: ${test1()}" - if (test2() != 11) return "test2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/capture/generics.kt b/backend.native/tests/external/codegen/boxInline/capture/generics.kt deleted file mode 100644 index 925c4bf703e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/generics.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun mfun(arg: T, f: (T) -> R) : R { - return f(arg) -} - -inline fun doSmth(a: T): String { - return a.toString() -} - -// FILE: 2.kt - -import test.* - -fun test1(s: Long): String { - var result = "OK" - result = mfun(s) { a -> - result + doSmth(s) + doSmth(a) - } - - return result -} - -fun box(): String { - val result = test1(11.toLong()) - if (result != "OK1111") return "fail1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInClass.kt b/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInClass.kt deleted file mode 100644 index 1122dc88f07..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInClass.kt +++ /dev/null @@ -1,82 +0,0 @@ -// FILE: 1.kt - -class InlineAll { - - inline fun inline(s: (Int, Double, Double, String, Long) -> String, - a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String { - return s(a1, a2, a3, a4, a5) - } -} - -// FILE: 2.kt - -fun testAll(): String { - val inlineX = InlineAll() - - return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedVal(): String { - val inlineX = InlineAll() - - val c1 = 21 - val c2 = 22.0 - val c3 = 23.0 - val c4 = "24" - val c5 = 25.toLong() - val c6 = 'H' - val c7 = 26.toByte() - val c8 = 27.toShort() - val c9 = 28.toFloat() - - return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedVar(): String { - val inlineX = InlineAll() - - var c1 = 21 - var c2 = 22.0 - var c3 = 23.0 - var c4 = "24" - var c5 = 25.toLong() - var c6 = 'H' - var c7 = 26.toByte() - var c8 = 27.toShort() - val c9 = 28.toFloat() - - return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedValAndVar(): String { - val inlineX = InlineAll() - - var c1 = 21 - var c2 = 22.0 - val c3 = 23.0 - val c4 = "24" - var c5 = 25.toLong() - val c6 = 'H' - var c7 = 26.toByte() - var c8 = 27.toShort() - val c9 = 28.toFloat() - - return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - - -fun box(): String { - if (testAll() != "112.013.01415") return "testAll: ${testAll()}" - if (testAllWithCapturedVal() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedVal()}" - if (testAllWithCapturedVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVar: ${testAllWithCapturedVar()}" - if (testAllWithCapturedValAndVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedValAndVar()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInPackage.kt b/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInPackage.kt deleted file mode 100644 index 6577399d232..00000000000 --- a/backend.native/tests/external/codegen/boxInline/capture/simpleCapturingInPackage.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt - -inline fun inline(s: (Int, Double, Double, String, Long) -> String, - a1: Int, a2: Double, a3: Double, a4: String, a5: Long): String { - return s(a1, a2, a3, a4, a5) -} - -// FILE: 2.kt - -fun testAll(): String { - return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedVal(): String { - val c1 = 21 - val c2 = 22.0 - val c3 = 23.0 - val c4 = "24" - val c5 = 25.toLong() - val c6 = 'H' - val c7 = 26.toByte() - val c8 = 27.toShort() - val c9 = 28.toFloat() - - return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedVar(): String { - var c1 = 21 - var c2 = 22.0 - var c3 = 23.0 - var c4 = "24" - var c5 = 25.toLong() - var c6 = 'H' - var c7 = 26.toByte() - var c8 = 27.toShort() - val c9 = 28.toFloat() - - return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - -fun testAllWithCapturedValAndVar(): String { - var c1 = 21 - var c2 = 22.0 - val c3 = 23.0 - val c4 = "24" - var c5 = 25.toLong() - val c6 = 'H' - var c7 = 26.toByte() - var c8 = 27.toShort() - val c9 = 28.toFloat() - - return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) -} - - -fun box(): String { - if (testAll() != "112.013.01415") return "testAll: ${testAll()}" - if (testAllWithCapturedVal() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedVal()}" - if (testAllWithCapturedVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVar: ${testAllWithCapturedVar()}" - if (testAllWithCapturedValAndVar() != "112.013.014152122.023.02425H262728.0") return "testAllWithCapturedVal: ${testAllWithCapturedValAndVar()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complex/closureChain.kt b/backend.native/tests/external/codegen/boxInline/complex/closureChain.kt deleted file mode 100644 index 369c9e65d6e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/closureChain.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -class Inline() { - - inline fun foo(closure1 : (l: Int) -> String, param: Int, closure2: String.() -> Int) : Int { - return closure1(param).closure2() - } -} - -// FILE: 2.kt - -fun test1(): Int { - val inlineX = Inline() - return inlineX.foo({ z: Int -> "" + z}, 25, fun String.(): Int = this.length) -} - -fun box(): String { - if (test1() != 2) return "test1: ${test1()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complex/forEachLine.kt b/backend.native/tests/external/codegen/boxInline/complex/forEachLine.kt deleted file mode 100644 index b642024b5f4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/forEachLine.kt +++ /dev/null @@ -1,48 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package test - -public class Input(val s1: String, val s2: String) { - public fun iterator() : Iterator { - return arrayListOf(s1, s2).iterator() - } -} - -public inline fun T.use(block: (T)-> R) : R { - return block(this) -} - -public inline fun Input.forEachLine(block: (String) -> Unit): Unit { - useLines { lines -> lines.forEach(block) } -} - -public inline fun Input.useLines(block2: (Iterator) -> Unit): Unit { - this.use{ block2(it.iterator()) } -} - -// FILE: 2.kt - -import test.* -import java.util.* - - -fun sample(): Input { - return Input("Hello", "World"); -} - -fun testForEachLine() { - val list = ArrayList() - val reader = sample() - - reader.forEachLine{ - list.add(it) - } -} - - -fun box(): String { - testForEachLine() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complex/lambdaInLambda.kt b/backend.native/tests/external/codegen/boxInline/complex/lambdaInLambda.kt deleted file mode 100644 index 334d345ea21..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/lambdaInLambda.kt +++ /dev/null @@ -1,48 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package test - -public class Input(val s1: String, val s2: String) { - public fun iterator() : Iterator { - return arrayListOf(s1, s2).iterator() - } -} - -public inline fun T.use(block: ()-> R) : R { - return block() -} - -public inline fun T.use2(block: ()-> R) : R { - return block() -} - -public inline fun Input.forEachLine(block: () -> Unit): Unit { - use { use2 (block) } -} - -// FILE: 2.kt - -import test.* -import java.util.* - - -fun sample(): Input { - return Input("Hello", "World"); -} - -fun testForEachLine() { - val list = ArrayList() - val reader = sample() - - reader.forEachLine{ - list.add("111") - } -} - - -fun box(): String { - testForEachLine() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complex/swapAndWith.kt b/backend.native/tests/external/codegen/boxInline/complex/swapAndWith.kt deleted file mode 100644 index 0c1f2a7c6ed..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/swapAndWith.kt +++ /dev/null @@ -1,20 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -package test - -public inline fun with2(receiver: T, body: T.() -> String) = receiver.body() - -// FILE: 2.kt -import test.* - -fun test(item: T?, defaultLink: T.() -> String): String { - return with2("") { - item?.defaultLink() ?: "fail" - } -} - -fun box(): String { - return test("O") { - this + "K" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/complex/swapAndWith2.kt b/backend.native/tests/external/codegen/boxInline/complex/swapAndWith2.kt deleted file mode 100644 index bd914e909a6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/swapAndWith2.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt -package test - -public inline fun with2(receiver: T, body: T.() -> String) = receiver.body() - -// FILE: 2.kt -import test.* - -inline fun test(item: T?, defaultLink: T.() -> String): String { - return with2("") { - item?.defaultLink() ?: "fail" - } -} - -fun box(): String { - return test("O") { - this + "K" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/complex/use.kt b/backend.native/tests/external/codegen/boxInline/complex/use.kt deleted file mode 100644 index 97dc7fdfbd7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/use.kt +++ /dev/null @@ -1,65 +0,0 @@ -// FILE: 1.kt - -package test - -public class Data() - -public class Input(val d: Data) : Closeable { - public fun data() : Int = 100 -} -public class Output(val d: Data) : Closeable { - public fun doOutput(data: Int): Int = data -} - -public interface Closeable { - open public fun close() {} -} - -public inline fun T.use(block: (T)-> R) : R { - var closed = false - try { - return block(this) - } catch (e: Exception) { - closed = true - try { - this.close() - } catch (closeException: Exception) { - - } - throw e - } finally { - if (!closed) { - this.close() - } - } -} - - -public fun Input.copyTo(output: Output, size: Int): Long { - return output.doOutput(this.data()).toLong() -} - -// FILE: 2.kt - -import test.* - - -fun Data.test1(d: Data) : Long { - val input2 = Input(this) - val input = Input(this) - return input.use{ - val output = Output(d) - output.use{ - input.copyTo(output, 10) - } - } -} - - -fun box(): String { - - val result = Data().test1(Data()) - if (result != 100.toLong()) return "test1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complex/with.kt b/backend.native/tests/external/codegen/boxInline/complex/with.kt deleted file mode 100644 index 54e147cfeeb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complex/with.kt +++ /dev/null @@ -1,80 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - - -public class Data() - -public class Input(val d: Data) : Closeable { - public fun data() : Int = 100 -} -public class Output(val d: Data) : Closeable { - public fun doOutput(data: Int): Int = data -} - -public interface Closeable { - open public fun close() {} -} - -public inline fun use(block: ()-> R) : R { - return block() -} - -public fun useNoInline(block: ()-> R) : R { - return block() -} - - -public fun Input.copyTo(output: Output, size: Int): Long { - return output.doOutput(this.data()).toLong() -} - - -public inline fun with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun Data.test1(d: Data) : Long { - val input = Input(this) - var result = 10.toLong() - with(input) { - result = use{ - val output = Output(d) - use{ - data() - copyTo(output, 10) - } - } - } - return result -} - -fun Data.test2(d: Data) : Long { - val input = Input(this) - var result = 10.toLong() - with2(input) { - result = use{ - val output = Output(d) - useNoInline{ - data() - copyTo(output, 10) - } - } - } - return result -} - - -fun box(): String { - - val result = Data().test1(Data()) - if (result != 100.toLong()) return "test1: ${result}" - - val result2 = Data().test2(Data()) - if (result2 != 100.toLong()) return "test2: ${result2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/asCheck.kt b/backend.native/tests/external/codegen/boxInline/complexStack/asCheck.kt deleted file mode 100644 index 7612ca6abd5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/asCheck.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -object ContentTypeByExtension { - inline fun processRecords(crossinline operation: (String) -> String) = - listOf("O", "K").map { - val ext = B(it) - operation(ext.toLowerCase()) - }.joinToString("") -} - - - - -inline fun A.toLowerCase(): String = (this as B).value - -open class A - -open class B(val value: String) : A() - -// FILE: 2.kt - -import test.* - -fun box(): String { - return ContentTypeByExtension.processRecords { ext -> ext } -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/asCheck2.kt b/backend.native/tests/external/codegen/boxInline/complexStack/asCheck2.kt deleted file mode 100644 index 18a0bd3273d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/asCheck2.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package test - -object ContentTypeByExtension { - inline fun processRecords(crossinline operation: (String) -> String) = - { - val ext = B("OK") - operation(ext.toLowerCase()) - }() -} - - - - -inline fun A.toLowerCase(): String = (this as B).value - -open class A - -open class B(val value: String) : A() - -// FILE: 2.kt - -import test.* - -fun box(): String { - return ContentTypeByExtension.processRecords { ext -> ext } -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/simple.kt b/backend.native/tests/external/codegen/boxInline/complexStack/simple.kt deleted file mode 100644 index 616f28638a4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/simple.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: String) = x - -inline fun processRecords(block: (String) -> String) = block(foo("O")) - -// FILE: 2.kt - -import test.* - -fun box(): String { - return processRecords { ext -> ext + "K" } -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/simple2.kt b/backend.native/tests/external/codegen/boxInline/complexStack/simple2.kt deleted file mode 100644 index 500ee47930d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/simple2.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: String) = x - -class A { - fun test(s: String) = s -} - -inline fun processRecords(block: (String) -> String): String { - return A().test(block(foo("K"))) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return processRecords { "O" + it } -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/simple3.kt b/backend.native/tests/external/codegen/boxInline/complexStack/simple3.kt deleted file mode 100644 index 1604d306de2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/simple3.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: String, y: String) = x + y - -class A { - fun test(s: String) = s -} - -inline fun processRecords(block: (String) -> String): String { - return A().test(block(foo("O", foo("K", "1")))) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = processRecords { "B" + it } - - return if (result == "BOK1") "OK" else "fail: $result" -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/simple4.kt b/backend.native/tests/external/codegen/boxInline/complexStack/simple4.kt deleted file mode 100644 index cab0e2460d3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/simple4.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: String) = x - -fun test(a: String, s: String) = s - - -inline fun processRecords(block: (String, String) -> String): String { - return test("stub", block(foo("O"), foo("K"))) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return processRecords { a, b -> a + b} -} diff --git a/backend.native/tests/external/codegen/boxInline/complexStack/simpleExtension.kt b/backend.native/tests/external/codegen/boxInline/complexStack/simpleExtension.kt deleted file mode 100644 index f8e565554ae..00000000000 --- a/backend.native/tests/external/codegen/boxInline/complexStack/simpleExtension.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(x: String) = x - -inline fun processRecords(s: String?, block: String.(String) -> String) = s?.block(foo("O")) - -// FILE: 2.kt - -import test.* - -fun box(): String? { - return processRecords("O") { this + "K" } -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/33Parameters.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/33Parameters.kt deleted file mode 100644 index 81cee73d167..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/33Parameters.kt +++ /dev/null @@ -1,53 +0,0 @@ -// FILE: 1.kt - -package testpackage - -fun calc() = "OK" - -inline fun String.test() = this - -fun test( - p1: String = "1", - p2: String = "2", - p3: String = "3", - p4: String = "4", - p5: String = "5", - p6: String = "6", - p7: String = "7", - p8: String = "8", - p9: String = "9", - p10: String = "10", - p11: String = "11", - p12: String = "12", - p13: String = "13", - p14: String = "O".test(), - p15: String = "15", - p16: String = "16", - p17: String = "17", - p18: String = "18", - p19: String = "19", - p20: String = "20", - p21: String = "21", - p22: String = "22", - p23: String = "23", - p24: String = "24", - p25: String = "25", - p26: String = "26", - p27: String = "27", - p28: String = "28", - p29: String = "29", - p30: String = "30", - p31: String = "31", - p32: String = "32", - p33: String = "K".test() -): String { - return p14 + p33 -} - -// FILE: 2.kt - -import testpackage.* - -fun box(): String { - return test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/33ParametersInConstructor.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/33ParametersInConstructor.kt deleted file mode 100644 index ffd5c3fadc9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/33ParametersInConstructor.kt +++ /dev/null @@ -1,51 +0,0 @@ -// FILE: 1.kt - -package testpackage - -fun calc() = "OK" - -inline fun String.test() = this - -class Test( - p1: String = "1", - p2: String = "2", - p3: String = "3", - p4: String = "4", - p5: String = "5", - p6: String = "6", - p7: String = "7", - p8: String = "8", - p9: String = "9", - p10: String = "10", - p11: String = "11", - p12: String = "12", - p13: String = "13", - val p14: String = "O".test(), - p15: String = "15", - p16: String = "16", - p17: String = "17", - p18: String = "18", - p19: String = "19", - p20: String = "20", - p21: String = "21", - p22: String = "22", - p23: String = "23", - p24: String = "24", - p25: String = "25", - p26: String = "26", - p27: String = "27", - p28: String = "28", - p29: String = "29", - p30: String = "30", - p31: String = "31", - p32: String = "32", - val p33: String = "K".test() -) -// FILE: 2.kt - -import testpackage.* - -fun box(): String { - val test = Test() - return test.p14 + test.p33 -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultInExtension.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/defaultInExtension.kt deleted file mode 100644 index c48b83e2365..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultInExtension.kt +++ /dev/null @@ -1,61 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline public fun String.run(p1: String? = null): String { - return this + p1 -} - -inline public fun String.run(p1: String = "", lambda: (a: String, b: Int) -> String, p2: Int = 0): String { - return lambda(p1, p2) + this -} - -public class Z(val value: Int = 0) { - - inline public fun String.run(p1: String? = null): String? { - return this + p1 - } - - inline public fun String.run(p1: String = "", lambda: (a: String, b: Int) -> String, p2: Int = 0): String { - return lambda(p1, p2) + this - } - -} - -// FILE: 2.kt - -import test.* - -fun testExtensionInClass() : String { - - var res = with(Z(1)) { "1".run("OK") } - if (res != "1OK") return "failed in class 1: $res" - - res = with(Z(1)) { "1".run() } - if (res != "1null") return "failed in class 2: $res" - - res = with(Z(2)) { "3".run("OK", { a, b -> a + b + value }, 1) } - if (res != "OK123") return "failed in class 3: $res" - - res = with(Z(3)) { "4".run(lambda = { a, b -> a + b + value }) } - if (res != "034") return "failed in class 4: $res" - - return "OK" -} - -fun box(): String { - - var res = "1".run("OK") - if (res != "1OK") return "failed 1: $res" - - res = "1".run() - if (res != "1null") return "failed 2: $res" - - res = "3".run("OK", { a, b -> a + b}, 1) - if (res != "OK13") return "failed 3: $res" - - res = "4".run(lambda = { a, b -> a + b}) - if (res != "04") return "failed 4: $res" - - return testExtensionInClass() -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethod.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethod.kt deleted file mode 100644 index 398f6768a0f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethod.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun simpleFun(arg: String = "O", lambda: (String) -> T): T { - return lambda(arg) -} - - -inline fun simpleFunR(lambda: (String) -> T, arg: String = "O"): T { - return lambda(arg) -} - -// FILE: 2.kt - -import test.* - -fun simple(): String { - val k = "K" - return simpleFun(lambda = {it + "O"}) + simpleFun("K", {k + it}) -} - -fun simpleR(): String { - val k = "K" - return simpleFunR({it + "O"}) + simpleFunR({k + it}, "K") -} - -fun box(): String { - - var result = simple() - if (result != "OOKK") return "fail1: ${result}" - - result = simpleR() - if (result != "OOKK") return "fail2: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethodInClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethodInClass.kt deleted file mode 100644 index 912517ea563..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultMethodInClass.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package test - -public class Z(public val value: Int = 0) { - - inline public fun run(p1: String? = null): String? { - return p1 + value - } - - - inline public fun run(p1: String = "", lambda: (a: String, b: Int) -> String, p2: Int = 0): String { - return lambda(p1, p2) - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (Z().run() != "null0") return "fail 1: ${Z().run()}" - - if (Z().run("OK") != "OK0") return "fail 2" - - if (Z().run("OK", { a, b -> a + b }, 1) != "OK1") return "fail 3" - - if (Z().run(lambda = { a: String, b: Int -> a + b }) != "0") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultParamRemapping.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/defaultParamRemapping.kt deleted file mode 100644 index 948111cf500..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/defaultParamRemapping.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun a(s1: String = "s1", s2: String = "s2", body: (a1: String, a2: String) -> String) = body(s1, s2) - -inline fun String.b(body: (a1: String, a2: String) -> String) = a(s2 = this, body = body) - -// FILE: 2.kt - -import test.* - -fun box(): String { - val z = "OK".b { a, b -> - a + b - } - - return if (z == "s1OK") "OK" else "fail $z" -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/inlineInDefaultParameter.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/inlineInDefaultParameter.kt deleted file mode 100644 index 191d6171085..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/inlineInDefaultParameter.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun getStringInline(): String { - return "OK" -} - -// FILE: 2.kt - -import test.* - -fun testCompilation(arg: String = getStringInline()): String { - return arg -} - -inline fun testCompilationInline(arg: String = getStringInline()): String { - return arg -} - -fun box(): String { - var result = testCompilation() - if (result != "OK") return "fail1: ${result}" - - result = testCompilation("OKOK") - if (result != "OKOK") return "fail2: ${result}" - - - result = testCompilationInline() - if (result != "OK") return "fail3: ${result}" - - result = testCompilationInline("OKOK") - if (result != "OKOK") return "fail4: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/inlineLambdaInNoInlineDefault.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/inlineLambdaInNoInlineDefault.kt deleted file mode 100644 index ddfd491cc90..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/inlineLambdaInNoInlineDefault.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLambda: () -> String = { inlineLambda() }): String { - return noInlineLambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return inlineFun({ "OK" }) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479.kt deleted file mode 100644 index 9c757fcfdab..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -package test - -inline fun log(lazyMessage: () -> Any?) { - lazyMessage() -} - -// FILE: 2.kt - -import test.* - -inline fun getOrCreate( - z : Boolean = false, - s: () -> String -) { - log { s() } -} - - -fun box(): String { - var z = "fail" - getOrCreate { z = "OK"; z } - - return z -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479InlinedDefaultParameter.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479InlinedDefaultParameter.kt deleted file mode 100644 index 65308a1fd16..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt11479InlinedDefaultParameter.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt -package test - -inline fun log(lazyMessage: () -> Any?) { - lazyMessage() -} - -inline fun z(): Boolean { - "zzz" - return true -} - -// FILE: 2.kt - -import test.* - -inline fun getOrCreate( - z : Boolean = z(), - s: () -> String -) { - log { s() } -} - - -fun box(): String { - var z = "fail" - getOrCreate { z = "OK"; z } - - return z -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt deleted file mode 100644 index c9a422774fc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt -//NO_CHECK_LAMBDA_INLINING - -package test - -object TimeUtil { - inline fun waitForEx(retryWait: Int = 200, - action: () -> Boolean) { - var now = 1L - if (now++ <= 3) { - action() - } - - } - -} - -// FILE: 2.kt - -import test.* - -var result = "fail" - -fun box(): String { - TimeUtil.waitForEx( - action = { - try { - result = "OK" - true - } - catch (t: Throwable) { - false - } - }) - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt deleted file mode 100644 index bc0a465bd53..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt - -package test - -var result = "fail" - -object TimeUtil { - - fun waitForAssert(z: String) { - waitForEx( - action = { - result = z - result - }) - } - - inline fun waitForEx(retryWait: Int = 200, - action: () -> String) { - var now = 1L - now++ - action() - } - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - TimeUtil.waitForAssert("OK") - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689.kt deleted file mode 100644 index f64cd2306d2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo { - fun foo() = "OK" -} - -inline fun inlineFn(crossinline fn: () -> String, x: Int? = 1): String { - return fn() -} - -// FILE: 2.kt - -import test.* - -private val foo = Foo() - -fun box(): String { - return inlineFn(foo::foo) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_2.kt deleted file mode 100644 index 5ad6a07bf34..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_2.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo { - fun foo() = "O" -} - -inline fun inlineFn(crossinline fn: () -> String, x: String = "K"): String { - return fn() + x -} - -// FILE: 2.kt - -import test.* - -private val foo = Foo() - -fun box(): String { - return inlineFn(foo::foo) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_3.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_3.kt deleted file mode 100644 index 137eaa4138d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_3.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo { - fun foo() = "O" -} - -inline fun inlineFn(crossinline fn: () -> String, x: String = "X"): String { - return fn() + x -} - -// FILE: 2.kt - -import test.* - -private val foo = Foo() - -fun box(): String { - return inlineFn(foo::foo, "K") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_4.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_4.kt deleted file mode 100644 index 23c19b4b11d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt18689_4.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -package test - -class Foo { - fun foo() = "OK" -} - -inline fun inlineFn(crossinline fn: () -> String, x: Long = 1L): String { - return fn() -} - -// FILE: 2.kt - -import test.* - -private val foo = Foo() - -fun box(): String { - return inlineFn(foo::foo) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt5685.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt5685.kt deleted file mode 100644 index 287dd42f56b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/kt5685.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -class Measurements -{ - inline fun measure(key: String, logEvery: Long = -1, divisor: Int = 1, body: () -> Unit): String { - body() - return key - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var s1 = "" - val s2 = Measurements().measure("K") { - s1 = "O" - } - - return s1 + s2 -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReference.kt deleted file mode 100644 index 70154e97dfe..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReference.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - fun ok() = value -} - -inline fun inlineFun(a: A, lambda: () -> String = a::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun(A("OK")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnInt.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnInt.kt deleted file mode 100644 index 9fd1b67261d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnInt.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(a: Int, lambda: (Int) -> Int = 1::plus): Int { - return lambda(a) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = inlineFun(2) - return if (result == 3) return "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnLong.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnLong.kt deleted file mode 100644 index 9fd1b67261d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReferenceOnLong.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(a: Int, lambda: (Int) -> Int = 1::plus): Int { - return lambda(a) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = inlineFun(2) - return if (result == 3) return "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReference.kt deleted file mode 100644 index 83bb3f0b7c9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReference.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val ok: String) - -inline fun inlineFun(a: A, lambda: () -> String = a::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun(A("OK")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnInt.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnInt.kt deleted file mode 100644 index 18acbd44ecd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnInt.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -val Int.myInc - get() = this + 1 - - -inline fun inlineFun(lambda: () -> Int = 1::myInc): Int { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = inlineFun() - return if (result == 2) return "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnLong.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnLong.kt deleted file mode 100644 index 250edbe0877..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReferenceOnLong.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -val Long.myInc - get() = this + 1 - - -inline fun inlineFun(lambda: () -> Long = 1L::myInc): Long { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val result = inlineFun() - return if (result == 2L) return "OK" else "fail $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/constuctorReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/constuctorReference.kt deleted file mode 100644 index b953e910015..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/constuctorReference.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - fun ok() = value -} - -inline fun inlineFun(a: String, lambda: (String) -> A = ::A): A { - return lambda(a) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun("OK").value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionImportedFromObject.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionImportedFromObject.kt deleted file mode 100644 index 98b9e147958..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionImportedFromObject.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt -package test - -fun ok() = "OK" - -object A { - fun ok() = "OK" -} - -inline fun stub() {} - - -// FILE: 2.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -import test.A.ok - -inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReference.kt deleted file mode 100644 index ae652db6fc2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReference.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -fun ok() = "OK" - -inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromClass.kt deleted file mode 100644 index b979f06a998..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromClass.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - fun ok() = value -} - -inline fun inlineFun(a: A, lambda: (A) -> String = A::ok): String { - return lambda(a) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun(A("OK")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromObject.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromObject.kt deleted file mode 100644 index cd1d2d67bd9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromObject.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -fun ok() = "OK" - -object A { - fun ok() = "OK" -} - -inline fun inlineFun(lambda: () -> String = A::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/innerClassConstuctorReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/innerClassConstuctorReference.kt deleted file mode 100644 index 3c1e468291e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/innerClassConstuctorReference.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - - inner class Inner { - fun ok() = value - } -} - -inline fun inlineFun(a: A, lambda: () -> A.Inner = a::Inner): A.Inner { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun(A("OK")).ok() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privateFunctionReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privateFunctionReference.kt deleted file mode 100644 index 9daf1aa9f06..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privateFunctionReference.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -private fun ok() = "OK" - -internal inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privatePropertyReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privatePropertyReference.kt deleted file mode 100644 index 4514cfd5a70..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privatePropertyReference.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -private val ok = "OK" - -internal inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyImportedFromObject.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyImportedFromObject.kt deleted file mode 100644 index c09d36b5d90..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyImportedFromObject.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -package test - -object A { - val ok = "OK" -} -inline fun stub() {} - - -// FILE: 2.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -import test.A.ok - -inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReference.kt deleted file mode 100644 index aaa25f84e3c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReference.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -val ok = "OK" - -inline fun inlineFun(lambda: () -> String = ::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromClass.kt deleted file mode 100644 index ba9f84bcb56..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromClass.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val ok: String) - -inline fun inlineFun(a: A, lambda: (A) -> String = A::ok): String { - return lambda(a) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun(A("OK")) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromObject.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromObject.kt deleted file mode 100644 index e569fdf7d8b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromObject.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -object A { - val ok = "OK" -} - -inline fun inlineFun(lambda: () -> String = A::ok): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt deleted file mode 100644 index 5ffab7914d9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(crossinline inlineLambda: () -> String = { "OK" }, noinline noInlineLambda: () -> String = { inlineLambda() }): String { - return noInlineLambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt deleted file mode 100644 index 080ee06cd0e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - - inline fun inlineFun(lambda: () -> String = { value }): String { - return lambda() - } -} - -// FILE: 2.kt - -import test.* - -// CHECK_CONTAINS_NO_CALLS: box -fun box(): String { - return A("OK").inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt deleted file mode 100644 index 05608dbb358..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -// CHECK_CONTAINS_NO_CALLS: test -package test - -//problem in test framework -inline fun inlineFunStub(){} - -interface A { - val value: String - - fun test() = inlineFun() - - private inline fun inlineFun(lambda: () -> String = { value }): String { - return lambda() - } -} - -// FILE: 2.kt - -import test.* - -class B : A { - override val value: String = "OK" -} - -fun box(): String { - return B().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt deleted file mode 100644 index 94f9a3e282d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -// IGNORE_BACKEND: JS, NATIVE -//WITH_RUNTIME -package test - -object X { - @JvmStatic - inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedParam }): String { - return lambda() - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return X.inlineFun("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt deleted file mode 100644 index 2f9c2618cc3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -package test - -inline fun inlineFun(capturedParam: String, noinline lambda: () -> String = { capturedParam }): String { - return call(lambda) -} - -fun call(lambda: () -> String ) = lambda() - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=call scope=box -import test.* - -fun box(): String { - return inlineFun("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt deleted file mode 100644 index abe5059b0e8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLambda: () -> String = { inlineLambda() }): String { - return noInlineLambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=inlineFun -import test.* - -fun box(): String { - return inlineFun ({ "OK" }) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt deleted file mode 100644 index f5367e6f018..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String { - return { - this + lambda() - }() -} - -// FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box - -import test.* - -fun box(): String { - val result = "OK".inlineFun() - return if (result == "OKOK") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt deleted file mode 100644 index 7a8f71ffc8b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambda: () -> String = { this }): String { - return { - "${this} ${lambda()} ${dlambda()}" - }() -} - -// FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=test -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=test -import test.* - -fun String.test(): String = "INLINE".inlineFun({ this }) - -fun box(): String { - val result = "TEST".test() - return if (result == "INLINE TEST INLINE") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt deleted file mode 100644 index 75d74f77eb1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - - inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String { - return { - "$value ${this} ${lambda()}" - }() - } -} - -// FILE: 2.kt -//WITH_RUNTIME -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box -import test.* - -fun box(): String { - val result = with(A("VALUE")) { "OK".inlineFun() } - return if (result == "VALUE OK OK") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt deleted file mode 100644 index 11117e9422a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - - inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambda: () -> String = { this }): String { - return { - "$value ${this} ${lambda()} ${dlambda()}" - }() - } -} - -// FILE: 2.kt -//WIH_RUNTIME -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=test -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=test -import test.* - -fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) } - -fun box(): String { - val result = "TEST".test() - return if (result == "VALUE INLINE TEST INLINE") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt deleted file mode 100644 index e032606205d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedParam }): String { - return lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box - -import test.* - -fun box(): String { - return inlineFun("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt deleted file mode 100644 index 2171f31be46..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(capturedParam: String, lambda: () -> Any = { capturedParam as Any }): Any { - return lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType - -import test.* - -fun box(): String { - return inlineFun("OK") as String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt deleted file mode 100644 index ebd9a91bed9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(lambda: () -> Any = { "OK" as Any }): Any { - return lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType - -import test.* - -fun box(): String { - return inlineFun() as String -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleExtension.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleExtension.kt deleted file mode 100644 index 29c9f3dac2d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleExtension.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(param: String, lambda: String.() -> String = { this }): String { - return param.lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box - -import test.* - -fun box(): String { - return inlineFun("OK") -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt deleted file mode 100644 index 3a91a6322ec..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -open class A(val value: String) - -class B(value: String): A(value) - -inline fun inlineFun(capturedParam: T, lambda: () -> T = { capturedParam }): T { - return lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box - -import test.* - -fun box(): String { - return inlineFun(B("O")).value + inlineFun(A("K")).value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt deleted file mode 100644 index fb8a67b97ac..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(lambda: () -> String = { "OK" }): String { - return lambda() -} - -// FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box - -import test.* - -fun box(): String { - return inlineFun() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt deleted file mode 100644 index ecfd75bc120..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }): String { - return { - { - this + lambda() - }() - }() -} - -// FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box - -import test.* - -fun box(): String { - val result = "OK".inlineFun() - return if (result == "OKOK") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt deleted file mode 100644 index e6f5016471d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -class A(val value: String) { - inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }): String { - return { - { - this + lambda() - }() - }() - } -} - -// FILE: 2.kt -//WITH_RUNTIME -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box -import test.* - -fun box(): String { - val result = with(A("VALUE")) { "OK".inlineFun() } - return if (result == "OKOK") "OK" else "fail 1: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt deleted file mode 100644 index 5ec5e8be2a5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt +++ /dev/null @@ -1,66 +0,0 @@ -// FILE: 1.kt - -package test - -fun calc() = "OK" - -inline fun test( - p1: String = "1", - p2: String = "2", - p3: String = "3", - p4: String = "4", - p5: String = "5", - p6: String = "6", - p7: String = "7", - p8: String = "8", - p9: String = "9", - p10: String = "10", - p11: String = "11", - p12: String = "12", - p13: String = "13", - p14: String = "14", - p15: String = "15", - p16: String = "16", - p17: String = "17", - p18: String = "18", - p19: String = "19", - p20: String = "20", - p21: String = "21", - p22: String = "22", - p23: String = "23", - p24: String = "24", - p25: String = "25", - p26: String = "26", - p27: String = "27", - p28: String = "28", - p29: String = "29", - p30: String = "30", - p31: String = "31", - p32: String = "32" -): String { - return p1 + " " + p2 + " " + p3 + " " + p4 + " " + p5 + " " + p6 + " " + - p7 + " " + p8 + " " + p9 + " " + p10 + " " + p11 + " " + p12 + " " + p13 + " " + p14 + " " + - p15 + " " + p16 + " " + p17 + " " + p18 + " " + p19 + " " + p20 + " " + p21 + " " + - p22 + " " + p23 + " " + p24 + " " + p25 + " " + p26 + " " + p27 + " " + p28 + " " + - p29 + " " + p30 + " " + p31 + " " + p32 -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (test() != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") - return "fail 1: ${test()}" - - if (test(p20 = "OK") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 OK 21 22 23 24 25 26 27 28 29 30 31 32") - return "fail 2: ${test(p20 = "OK")}" - - if (test(p20 = "O", p22 = "K") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 32") - return "fail 3: ${test(p20 = "O", p22 = "K")}" - - if (test(p20 = "O", p22 = "K", p32 = "23") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 23") - return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "23")}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt deleted file mode 100644 index 70b89a7c6d2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt +++ /dev/null @@ -1,70 +0,0 @@ -// FILE: 1.kt - -package test - -fun calc() = "OK" - -inline fun test( - p1: String = "1", - p2: String = "2", - p3: String = "3", - p4: String = "4", - p5: String = "5", - p6: String = "6", - p7: String = "7", - p8: String = "8", - p9: String = "9", - p10: String = "10", - p11: String = "11", - p12: String = "12", - p13: String = "13", - p14: String = "14", - p15: String = "15", - p16: String = "16", - p17: String = "17", - p18: String = "18", - p19: String = "19", - p20: String = "20", - p21: String = "21", - p22: String = "22", - p23: String = "23", - p24: String = "24", - p25: String = "25", - p26: String = "26", - p27: String = "27", - p28: String = "28", - p29: String = "29", - p30: String = "30", - p31: String = "31", - p32: String = "32", - p33: String = "33" -): String { - return p1 + " " + p2 + " " + p3 + " " + p4 + " " + p5 + " " + p6 + " " + - p7 + " " + p8 + " " + p9 + " " + p10 + " " + p11 + " " + p12 + " " + p13 + " " + p14 + " " + - p15 + " " + p16 + " " + p17 + " " + p18 + " " + p19 + " " + p20 + " " + p21 + " " + - p22 + " " + p23 + " " + p24 + " " + p25 + " " + p26 + " " + p27 + " " + p28 + " " + - p29 + " " + p30 + " " + p31 + " " + p32 + " " + p33 -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (test() != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33") - return "fail 1: ${test()}" - - if (test(p20 = "OK") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 OK 21 22 23 24 25 26 27 28 29 30 31 32 33") - return "fail 2: ${test(p20 = "OK")}" - - if (test(p20 = "O", p22 = "K") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 32 33") - return "fail 3: ${test(p20 = "O", p22 = "K")}" - - if (test(p20 = "O", p22 = "K", p32 = "23") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 23 33") - return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "23")}" - - if (test(p20 = "O", p22 = "K", p32 = "33", p33 ="32") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 33 32") - return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "33", p33 ="32")}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt18792.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt18792.kt deleted file mode 100644 index 24ea76ce57c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt18792.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -//WITH_RUNTIME - -package test - -class SceneContainer2() { - - inline fun pushTo(time: Long = 0.seconds, transition: String = "TR"): String { - return "OK" - } -} - -inline val Number.seconds: Long get() = this.toLong() - -// FILE: 2.kt - -import test.* - -fun box(): String { - return SceneContainer2().pushTo(time = 0.2.seconds) -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679.kt deleted file mode 100644 index 046b61f6bd1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt -package test - -inline fun build(func: () -> Unit, noinline pathFunc: (() -> String)? = null) { - func() - - pathFunc?.invoke() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - build({ result = "OK" }) - - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_2.kt deleted file mode 100644 index 001a65f8d62..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_2.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt -package test - -inline fun build(noinline pathFunc: (() -> String)? = null) { - pathFunc?.invoke() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - build () - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_3.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_3.kt deleted file mode 100644 index 8a8385a6857..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/kt19679_3.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -package test - -@Suppress("NULLABLE_INLINE_PARAMETER") -inline fun build(func: () -> Unit, pathFunc: (() -> String)? = null) { - func() - - pathFunc?.invoke() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - build ({ result = "OK" }) - - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt deleted file mode 100644 index bca4b1fd4a8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -package test - -fun calc() = "OK" - -/*open modifier for method handle check in default method*/ -open class A { - inline fun test(p: String = calc()): String { - return p - } - - inline fun String.testExt(p: String = "K"): String { - return this + p - } - - fun callExt(): String { - return "O".testExt() - } - - fun callExt(arg: String): String { - return "O".testExt(arg) - } -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - if (A().callExt() != "OK") return "fail 1: ${A().callExt()}" - if (A().callExt("O") != "OO") return "fail 2: ${A().callExt("O")}" - if (A().test("KK") != "KK") return "fail 3: ${A().test("KK")}" - - return A().test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/simpleDefaultMethod.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/simpleDefaultMethod.kt deleted file mode 100644 index 6e401f286af..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/simpleDefaultMethod.kt +++ /dev/null @@ -1,46 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun emptyFun(arg: String = "O") { - -} - -inline fun simpleFun(arg: String = "O"): String { - val r = arg; - return r; -} - - -inline fun simpleDoubleFun(arg: Double = 1.0): Double { - val r = arg + 1; - return r; -} - -// FILE: 2.kt - -import test.* - -fun testCompilation(): String { - emptyFun() - emptyFun("K") - - return "OK" -} - -fun simple(): String { - return simpleFun() + simpleFun("K") -} - -fun box(): String { - var result = testCompilation() - if (result != "OK") return "fail1: ${result}" - - result = simple() - if (result != "OK") return "fail2: ${result}" - - var result2 = simpleDoubleFun(2.0) - if (result2 != 2.0 + 1.0) return "fail3: ${result2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/varArgNoInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/varArgNoInline.kt deleted file mode 100644 index bfd1c940bc5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/defaultValues/varArgNoInline.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -//WITH_RUNTIME -package test - -var res = "" - -inline fun inlineFun(vararg s : () -> String = arrayOf({ "OK" })) { - for (p in s) { - res += p() - } -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - inlineFun() - return res -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/delegatedProperty/kt16864.kt b/backend.native/tests/external/codegen/boxInline/delegatedProperty/kt16864.kt deleted file mode 100644 index 0261b5f3b00..00000000000 --- a/backend.native/tests/external/codegen/boxInline/delegatedProperty/kt16864.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt -package test - - -inline fun mrun(lambda: () -> T): T = lambda() - - -// FILE: 2.kt -// NO_CHECK_LAMBDA_INLINING -import test.* - -object Whatever { - operator fun getValue(thisRef: Any?, prop: Any?) = "OK" -} - -fun box(): String { - val key by Whatever - return mrun { - object { - val keys = key - }.keys - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/delegatedProperty/local.kt b/backend.native/tests/external/codegen/boxInline/delegatedProperty/local.kt deleted file mode 100644 index 36fc9fc367e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/delegatedProperty/local.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -package test - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String = "OK" -} - -inline fun test(): String { - val prop: String by Delegate() - return prop -} - - -// FILE: 2.kt -import test.* - -fun box(): String { - return test() -} diff --git a/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt b/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt deleted file mode 100644 index c098619f778..00000000000 --- a/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt -package test - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String = "O" -} - -inline fun test(crossinline s: () -> String): String { - val delegate = Delegate() - val o = object { - fun run(): String { - val prop: String by delegate - return prop + s() - } - } - return o.run() -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test { "K" } -} diff --git a/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInLambda.kt b/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInLambda.kt deleted file mode 100644 index 851a60fab73..00000000000 --- a/backend.native/tests/external/codegen/boxInline/delegatedProperty/localInLambda.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt -package test - -import kotlin.reflect.KProperty - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): String = "OK" -} - -inline fun test(): String { - val b by Delegate() - - return run { - b - } -} - -// FILE: 2.kt -import test.* - -fun box(): String { - return test() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/anonymousInLambda.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/anonymousInLambda.kt deleted file mode 100644 index 7c0113e6a32..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/anonymousInLambda.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// NO_CHECK_LAMBDA_INLINING -// WITH_REFLECT -// FILE: 1.kt -package test - -inline fun call(s: () -> R) = s() - -// FILE: 2.kt - -import test.* - -fun box(): String { - val res = call { - { "OK" } - } - - var enclosingMethod = res.javaClass.enclosingMethod - if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}" - - var enclosingClass = res.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt") return "fail 2: ${enclosingClass?.name}" - - return res() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain.kt deleted file mode 100644 index 73844c7f794..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -inline fun call(s: () -> R) = s() - -inline fun test(crossinline z: () -> String) = { z() } - -// FILE: 2.kt - -import test.* - -fun box(): String { - val res = call { - test { "OK" } - } - - var enclosingMethod = res.javaClass.enclosingMethod - if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}" - - var enclosingClass = res.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt") return "fail 2: ${enclosingClass?.name}" - - val res2 = call { - call { - test { "OK" } - } - } - - enclosingMethod = res2.javaClass.enclosingMethod - if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}" - - enclosingClass = res2.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt") return "fail 2: ${enclosingClass?.name}" - - return res2() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain2.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain2.kt deleted file mode 100644 index 1f2e6456ec1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/inlineChain2.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -inline fun call(crossinline s: () -> R) = { s() }() - -inline fun test(crossinline z: () -> String) = { z() } - -// FILE: 2.kt - -import test.* - -fun box(): String { - val res = call { - test { "OK" } - } - - var enclosingMethod = res.javaClass.enclosingMethod - if (enclosingMethod?.name != "invoke") return "fail 1: ${enclosingMethod?.name}" - - var enclosingClass = res.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt\$box$\$inlined\$call$1") return "fail 2: ${enclosingClass?.name}" - - val res2 = call { - call { - test { "OK" } - } - } - - enclosingMethod = res2.javaClass.enclosingMethod - if (enclosingMethod?.name != "invoke") return "fail 1: ${enclosingMethod?.name}" - - enclosingClass = res2.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt\$box$\$inlined\$call$2\$lambda$1") return "fail 2: ${enclosingClass?.name}" - - return res2() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/objectInInlineFun.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/objectInInlineFun.kt deleted file mode 100644 index 23e4bc1add5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/objectInInlineFun.kt +++ /dev/null @@ -1,31 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface Z { - fun a(): String -} - -inline fun test(crossinline z: () -> String) = - object : Z { - override fun a() = z() - } - -// FILE: 2.kt - -import test.* - -fun box(): String { - val res = test { - "OK" - } - - val enclosingMethod = res.javaClass.enclosingMethod - if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}" - - val enclosingClass = res.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt") return "fail 2: ${enclosingClass?.name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructor.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructor.kt deleted file mode 100644 index 3fa860dc68f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructor.kt +++ /dev/null @@ -1,42 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface Z { - fun a() : String -} - -inline fun test(crossinline z: () -> String) = - object : Z { - - val p = z() - - override fun a() = p - } - -// FILE: 2.kt - -import test.* - -fun box(): String { - /*This captured parameter would be added to object constructor*/ - val captured = "OK"; - var z: Any = "fail" - val res = test { - - z = { - captured - } - (z as Function0)() - } - - - val enclosingConstructor = z.javaClass.enclosingConstructor - if (enclosingConstructor?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}" - - val enclosingClass = z.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}" - - return res.a() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithAdditionalObject.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithAdditionalObject.kt deleted file mode 100644 index d17ee44c246..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithAdditionalObject.kt +++ /dev/null @@ -1,52 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface Z { - fun a() : T -} - -inline fun test(crossinline z: () -> String) = - object : Z> { - - val p: Z = object : Z { - - val p2 = z() - - override fun a() = p2 - } - - override fun a() = p - } - -// FILE: 2.kt - -import test.* - -fun box(): String { - var z = "OK" - val res = test { - z - } - - - val javaClass1 = res.javaClass - val enclosingMethod = javaClass1.enclosingMethod - if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}" - - val enclosingClass = javaClass1.enclosingClass - if (enclosingClass?.name != "_2Kt") return "fail 2: ${enclosingClass?.name}" - - - val res2 = res.a() - val enclosingConstructor = res2.javaClass.enclosingConstructor - if (enclosingConstructor?.name != javaClass1.name) return "fail 3: ${enclosingConstructor?.name} != ${javaClass1.name}" - - val enclosingClass2 = res2.javaClass.enclosingClass - if (enclosingClass2?.name != javaClass1.name) return "fail 4: ${enclosingClass2?.name} != ${javaClass1.name}" - - - - return res2.a() -} diff --git a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.kt b/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.kt deleted file mode 100644 index ef9453887eb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.kt +++ /dev/null @@ -1,48 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface Z { - fun a() : String -} - -inline fun test(crossinline z: () -> String) = - object : Z { - - val p = z() - - override fun a() = p - } - - -inline fun call(crossinline z: () -> T) = z() - -// FILE: 2.kt - -import test.* - -fun box(): String { - /*This captured parameter would be added to object constructor*/ - val captured = "OK"; - var z: Any = "fail" - val res = test { - - call { - z = { - captured - } - } - - (z as Function0)() - } - - - val enclosingConstructor = z.javaClass.enclosingConstructor - if (enclosingConstructor?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}" - - val enclosingClass = z.javaClass.enclosingClass - if (enclosingClass?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}" - - return res.a() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/kt10569.kt b/backend.native/tests/external/codegen/boxInline/enum/kt10569.kt deleted file mode 100644 index 2ffd30c8ad8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/kt10569.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -var result = "" - -inline fun > renderOptions(render: (T) -> String) { - val values = enumValues() - for (v in values) { - result += render(v) - } -} - -enum class Z { - O, K; - - val myParam = name -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - renderOptions { - it.myParam - } - return result -} - diff --git a/backend.native/tests/external/codegen/boxInline/enum/valueOf.kt b/backend.native/tests/external/codegen/boxInline/enum/valueOf.kt deleted file mode 100644 index 85d4e64100b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valueOf.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValueOf(): String { - return enumValueOf("OK").name -} - -enum class Z { - OK -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValueOf() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valueOfCapturedType.kt b/backend.native/tests/external/codegen/boxInline/enum/valueOfCapturedType.kt deleted file mode 100644 index c0519a81e3e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valueOfCapturedType.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValueOf(): String { - return { enumValueOf("OK") }().name -} - -enum class Z { - OK -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValueOf() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valueOfChain.kt b/backend.native/tests/external/codegen/boxInline/enum/valueOfChain.kt deleted file mode 100644 index 15d240b28c5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valueOfChain.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValueOf(): String { - return myValueOf2() -} - -inline fun > myValueOf2(): String { - return enumValueOf("OK").name -} - - -enum class Z { - OK -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValueOf() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valueOfChainCapturedType.kt b/backend.native/tests/external/codegen/boxInline/enum/valueOfChainCapturedType.kt deleted file mode 100644 index 48e1b314d51..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valueOfChainCapturedType.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValueOf(): String { - return myValueOf2() -} - -inline fun > myValueOf2(): String { - return { enumValueOf("OK").name }() -} - - -enum class Z { - OK -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValueOf() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valueOfNonReified.kt b/backend.native/tests/external/codegen/boxInline/enum/valueOfNonReified.kt deleted file mode 100644 index 761813faec2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valueOfNonReified.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun myValueOf(): String { - return enumValueOf("OK").name -} - -enum class Z { - OK -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValueOf() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/values.kt b/backend.native/tests/external/codegen/boxInline/enum/values.kt deleted file mode 100644 index b0f397f5a1a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/values.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValues(): String { - val values = enumValues() - return values.joinToString("") -} - -enum class Z { - O, K -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValues() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valuesAsArray.kt b/backend.native/tests/external/codegen/boxInline/enum/valuesAsArray.kt deleted file mode 100644 index 027b228d6be..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valuesAsArray.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValues(): Array { - return enumValues() -} - -enum class Z { - O, K; - - val myParam = name -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return test(myValues()) -} - -fun test(myValues: Array): String { - return myValues.map { it.myParam }.joinToString (""); -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valuesCapturedType.kt b/backend.native/tests/external/codegen/boxInline/enum/valuesCapturedType.kt deleted file mode 100644 index 99ce9e279c1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valuesCapturedType.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValues(): String { - val values = { enumValues() }() - return values.joinToString("") -} - -enum class Z { - O, K -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValues() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valuesChain.kt b/backend.native/tests/external/codegen/boxInline/enum/valuesChain.kt deleted file mode 100644 index 2207e07e806..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valuesChain.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValues2(): String { - val values = enumValues() - return values.joinToString("") -} - -inline fun > myValues(): String { - return myValues2() -} - -enum class Z { - O, K -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValues() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valuesChainCapturedType.kt b/backend.native/tests/external/codegen/boxInline/enum/valuesChainCapturedType.kt deleted file mode 100644 index 12436f80868..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valuesChainCapturedType.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun > myValues2(): String { - val values = { enumValues() }() - return values.joinToString("") -} - -inline fun > myValues(): String { - return myValues2() -} - -enum class Z { - O, K -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValues() -} diff --git a/backend.native/tests/external/codegen/boxInline/enum/valuesNonReified.kt b/backend.native/tests/external/codegen/boxInline/enum/valuesNonReified.kt deleted file mode 100644 index fee857c2c3c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/enum/valuesNonReified.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun myValues(): String { - val values = enumValues() - return values.joinToString("") -} - -enum class Z { - O, K -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - return myValues() -} diff --git a/backend.native/tests/external/codegen/boxInline/functionExpression/extension.kt b/backend.native/tests/external/codegen/boxInline/functionExpression/extension.kt deleted file mode 100644 index 747e96a6b61..00000000000 --- a/backend.native/tests/external/codegen/boxInline/functionExpression/extension.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -inline fun Inline.calcExt(s: (Int) -> Int, p: Int) : Int { - return s(p) -} - -inline fun Inline.calcExt2(s: Int.() -> Int, p: Int) : Int { - return p.s() -} - -class InlineX(val value : Int) {} - -class Inline(val res: Int) { - - inline fun InlineX.calcInt(s: (Int, Int) -> Int) : Int { - return s(res, this.value) - } - - inline fun Double.calcDouble(s: (Int, Double) -> Double) : Double { - return s(res, this) - } - - fun doWork(l : InlineX) : Int { - return l.calcInt(fun (a: Int, b: Int) = a + b) - } - - fun doWorkWithDouble(s : Double) : Double { - return s.calcDouble(fun (a: Int, b: Double) = a + b) - } - -} - -// FILE: 2.kt - -fun test1(): Int { - val inlineX = Inline(9) - return inlineX.calcExt(fun(z: Int) = z, 25) -} - -fun test2(): Int { - val inlineX = Inline(9) - return inlineX.calcExt2(fun Int.(): Int = this, 25) -} - -fun test3(): Int { - val inlineX = Inline(9) - return inlineX.doWork(InlineX(11)) -} - -fun test4(): Double { - val inlineX = Inline(9) - return inlineX.doWorkWithDouble(11.0) -} - -fun test5(): Double { - val inlineX = Inline(9) - with(inlineX) { - 11.0.calcDouble(fun (a: Int, b: Double) = a + b) - } - return inlineX.doWorkWithDouble(11.0) -} - -fun box(): String { - if (test1() != 25) return "test1: ${test1()}" - if (test2() != 25) return "test2: ${test2()}" - if (test3() != 20) return "test3: ${test3()}" - if (test4() != 20.0) return "test4: ${test4()}" - if (test5() != 20.0) return "test5: ${test5()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/innerClasses/innerLambda.kt b/backend.native/tests/external/codegen/boxInline/innerClasses/innerLambda.kt deleted file mode 100644 index 737b62c60cc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/innerClasses/innerLambda.kt +++ /dev/null @@ -1,33 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun foo1() = run { - { - "OK" - } -} - -var sideEffects = "fail" - -inline fun foo2() = run { - { - Runnable { - sideEffects = "OK" - } - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val x1 = foo1()() - if (x1 != "OK") return "fail 1: $x1" - - foo2()().run() - - return sideEffects -} diff --git a/backend.native/tests/external/codegen/boxInline/innerClasses/kt10259.kt b/backend.native/tests/external/codegen/boxInline/innerClasses/kt10259.kt deleted file mode 100644 index bd1ad8fa1fe..00000000000 --- a/backend.native/tests/external/codegen/boxInline/innerClasses/kt10259.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// NO_CHECK_LAMBDA_INLINING -// WITH_RUNTIME -// FILE: 1.kt -package test - -inline fun test(s: () -> Unit) { - s() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var encl1 = "fail"; - var encl2 = "fail"; - test { - { - val p = object {} - encl1 = p.javaClass.enclosingMethod.declaringClass.name - { - - val p = object {} - encl2 = p.javaClass.enclosingMethod.declaringClass.name - }() - }() - } - - if (encl1 != "_2Kt\$box\$\$inlined\$test\$lambda$1") return "fail 1: $encl1" - if (encl2 != "_2Kt\$box\$\$inlined\$test\$lambda$1$2") return "fail 2: $encl2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/jvmPackageName/simple.kt b/backend.native/tests/external/codegen/boxInline/jvmPackageName/simple.kt deleted file mode 100644 index a68cc6dd26d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/jvmPackageName/simple.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// LANGUAGE_VERSION: 1.2 - -// FILE: 1.kt - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -@file:JvmPackageName("baz.foo.quux.bar") -package foo.bar - -fun f(): String = "O" - -val g: String? get() = "K" - -inline fun i(block: () -> T): T = block() - -// FILE: 2.kt - -import foo.bar.* - -fun box(): String = i { f() + g } diff --git a/backend.native/tests/external/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt b/backend.native/tests/external/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt deleted file mode 100644 index 6b77f48e346..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt - -package zzz - - -inline fun calc(crossinline lambda: () -> Int): Int { - return doCalc { lambda() } -} - -fun doCalc(lambda2: () -> Int): Int { - return lambda2() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import zzz.* - -fun box(): String { - - val p = { calc { 11 }} () - - val z = { calc { 12 }}() - - if (p == z) return "fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt b/backend.native/tests/external/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt deleted file mode 100644 index 97ac05955d3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaClassClash/noInlineLambdaX2.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt - -package test -var s: Int = 1; - -inline fun Int.inlineMethod() : Int { - noInlineLambda() - return noInlineLambda() -} - -inline fun Int.noInlineLambda() = { s++ } () - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* -fun test1(): Int { - return 1.inlineMethod() -} - -fun box(): String { - val result = test1() - if (result != 2) return "test1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaCloning.kt b/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaCloning.kt deleted file mode 100644 index 0d4a9e06dba..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaCloning.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun doSmth(a: T) : String { - return {a.toString()}() -} - -inline fun doSmth2(a: T) : String { - return {{a.toString()}()}() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(s: Long): String { - return doSmth(s) -} - -fun test2(s: Int): String { - return doSmth2(s) -} - -fun box(): String { - var result = test1(11.toLong()) - if (result != "11") return "fail1: ${result}" - - result = test2(11) - if (result != "11") return "fail2: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambda2.kt b/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambda2.kt deleted file mode 100644 index 442a0ba56ef..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambda2.kt +++ /dev/null @@ -1,38 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun mfun(f: () -> R) { - f() -} - -fun noInline(suffix: String, l: (s: String) -> Unit) { - l(suffix) -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* -import java.util.* - -fun test1(prefix: String): String { - var result = "fail" - mfun { - noInline("start") { - if (it.startsWith(prefix)) { - result = "OK" - } - } - } - - return result -} - -fun box(): String { - if (test1("start") != "OK") return "fail1" - if (test1("nostart") != "fail") return "fail2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt b/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt deleted file mode 100644 index 86aab34cb6d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt +++ /dev/null @@ -1,72 +0,0 @@ -// FILE: 1.kt - -package test - -fun concat(suffix: String, l: (s: String) -> Unit) { - l(suffix) -} - -fun noInlineFun(arg: T, f: (T) -> Unit) { - f(arg) -} - -inline fun doSmth(a: String): String { - return a.toString() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(param: String): String { - var result = "fail1" - noInlineFun(param) { a -> - concat("start") { - result = doSmth(a).toString() - } - } - - return result -} - -fun test11(param: String): String { - var result = "fail1" - noInlineFun("stub") { a -> - concat("start") { - result = doSmth(param).toString() - } - } - - return result -} - -inline fun test2(crossinline param: () -> String): String { - var result = "fail1" - noInlineFun("stub") { a -> - concat(param()) { - result = doSmth(param()).toString() - } - } - - return result -} - -inline fun test22(crossinline param: () -> String): String { - var result = "fail1" - {{result = param()}()}() - - return result -} - - -fun box(): String { - if (test1("start") != "start") return "fail1: ${test1("start")}" - if (test1("nostart") != "nostart") return "fail2: ${test1("nostart")}" - if (test11("start") != "start") return "fail3: ${test11("start")}" - - if (test2({"start"}) != "start") return "fail4: ${test2({"start"})}" - if (test22({"start"}) != "start") return "fail5: ${test22({"start"})}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt b/backend.native/tests/external/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt deleted file mode 100644 index 80e630ccc3b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/regeneratedLambdaName.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun call(crossinline f: () -> R) : R { - return {f()} () -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun sameName(s: Long): Long { - return call { - s - } -} - -fun sameName(s: Int): Int { - return call { - s - } -} - -fun box(): String { - val result = sameName(1.toLong()) - if (result != 1.toLong()) return "fail1: ${result}" - - val result2 = sameName(2) - if (result2 != 2) return "fail2: ${result2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/sameCaptured.kt b/backend.native/tests/external/codegen/boxInline/lambdaTransformation/sameCaptured.kt deleted file mode 100644 index 3cdd3687bf2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/lambdaTransformation/sameCaptured.kt +++ /dev/null @@ -1,44 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun doWork(crossinline job: ()-> R) : R { - val k = 10; - return notInline({k; job()}) -} - -inline fun doWork(crossinline job: ()-> R, crossinline job2: () -> R) : R { - val k = 10; - return notInline({k; job(); job2()}) -} - -fun notInline(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun testSameCaptured() : String { - var result = 0; - result = doWork({result+=1; result}, {result += 11; result}) - return if (result == 12) "OK" else "fail ${result}" -} - -inline fun testSameCaptured(crossinline lambdaWithResultCaptured: () -> Unit) : String { - var result = 1; - result = doWork({result+=11; lambdaWithResultCaptured(); result}) - return if (result == 12) "OK" else "fail ${result}" -} - -fun box(): String { - if (testSameCaptured() != "OK") return "test1 : ${testSameCaptured()}" - - var result = 0; - if (testSameCaptured{result += 1111} != "OK") return "test2 : ${testSameCaptured{result = 1111}}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/localFunInLambda/lambdaInLambdaCapturesAnotherFun.kt b/backend.native/tests/external/codegen/boxInline/localFunInLambda/lambdaInLambdaCapturesAnotherFun.kt deleted file mode 100644 index ba32dcfee23..00000000000 --- a/backend.native/tests/external/codegen/boxInline/localFunInLambda/lambdaInLambdaCapturesAnotherFun.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt -package test - -public inline fun myRun(block: () -> Unit) { - return block() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - var res = "" - myRun { - fun f1() { - res = "OK" - } - val x: () -> Unit = { - f1() - } - - x() - } - - return res -} diff --git a/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambda.kt b/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambda.kt deleted file mode 100644 index aef72d1f305..00000000000 --- a/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambda.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -public class Data(val value: Int) - -public class Input(val d: Data) { - public fun data() : Int = 100 -} - -public inline fun use(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(d: Data): Int { - val input = Input(d) - var result = 10 - with(input) { - fun localFun() { - result = input.d.value - } - localFun() - } - return result -} - - -fun box(): String { - val result = test1(Data(11)) - if (result != 11) return "test1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambdaCapturesAnotherFun.kt b/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambdaCapturesAnotherFun.kt deleted file mode 100644 index f5ae9ebb3db..00000000000 --- a/backend.native/tests/external/codegen/boxInline/localFunInLambda/localFunInLambdaCapturesAnotherFun.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt -package test - -public inline fun myRun(block: () -> Unit) { - return block() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - var res = "" - myRun { - fun f1() { - res = "OK" - } - fun f2() { - f1() - } - f2() - } - - return res -} diff --git a/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOptimizedMultifileClass.kt b/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOptimizedMultifileClass.kt deleted file mode 100644 index 94c8b563259..00000000000 --- a/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOptimizedMultifileClass.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS -// FILE: 1.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -inline fun foo(body: () -> String): String = bar(body()) - -public fun bar(x: String): String = x - -inline fun inlineOnly(x: Any?): Boolean = x is T - -// FILE: 2.kt - -import a.foo -import a.inlineOnly - -fun box(): String { - if (!inlineOnly("OK")) return "fail 1" - return foo { "OK" } -} diff --git a/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOtherPackage.kt b/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOtherPackage.kt deleted file mode 100644 index 202e8186c30..00000000000 --- a/backend.native/tests/external/codegen/boxInline/multifileClasses/inlineFromOtherPackage.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -inline fun foo(body: () -> String): String = bar(body()) - -public fun bar(x: String): String = x - -inline fun inlineOnly(x: Any?): Boolean = x is T - -// FILE: 2.kt - -import a.foo -import a.inlineOnly - -fun box(): String { - if (!inlineOnly("OK")) return "fail 1" - return foo { "OK" } -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/extensionReceiver.kt b/backend.native/tests/external/codegen/boxInline/noInline/extensionReceiver.kt deleted file mode 100644 index 40555a42091..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/extensionReceiver.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -inline fun (() -> String).test(): (() -> String) = { invoke() + this.invoke() + this() } - -// call this.hashCode() guarantees that extension receiver is noinline by default -inline fun (() -> String).extensionNoInline(): String = this() + (this.hashCode().toString()) - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -fun box(): String { - val res = { "OK" }.test()() - if (res != "OKOKOK") return "fail 1: $res" - - val res2 = { "OK" }.extensionNoInline().subSequence(0, 2) - if (res2 != "OK") return "fail 2: $res2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsGeneric.kt b/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsGeneric.kt deleted file mode 100644 index fa760a238c1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsGeneric.kt +++ /dev/null @@ -1,14 +0,0 @@ -// FILE: 1.kt - -inline fun test(p: T) { - p.toString() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -fun box() : String { - test {"123"} - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsNonFunction.kt b/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsNonFunction.kt deleted file mode 100644 index 98751109cac..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/lambdaAsNonFunction.kt +++ /dev/null @@ -1,14 +0,0 @@ -// FILE: 1.kt - -inline fun test(p: Any) { - p.toString() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -fun box() : String { - test {"123"} - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/noInline.kt b/backend.native/tests/external/codegen/boxInline/noInline/noInline.kt deleted file mode 100644 index 8c313f6bba9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/noInline.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt - -inline fun calc(s: (Int) -> Int, noinline p: (Int) -> Int) : Int { - val z = p - return s(11) + z(11) + p(11) -} - -inline fun extensionLambda(noinline bar: Int.() -> Int) = 10.bar() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -fun test1(): Int { - return calc( { l: Int -> 2*l}, { l: Int -> 4*l}) -} - -fun test2(): Int { - return extensionLambda({this * 16}) -} - -fun box(): String { - if (test1() != 110) return "test1: ${test1()}" - if (test2() != 160) return "test2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChain.kt b/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChain.kt deleted file mode 100644 index 541efe7cbf3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChain.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, f: (T) -> Unit) { - f(arg) -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(param: String): String { - var result = "fail" - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - - return result -} - - -fun test2(param: String): String { - var result = "fail" - inlineFun("2") { a -> - { - { - result = param + a - }() - }() - } - - return result -} - -fun test3(param: String): String { - var result = "fail" - inlineFun("2") { d -> - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param + c + a - }() - }() - } - }() - } - } - - return result -} - - -fun box(): String { - if (test1("start") != "start12") return "fail1: ${test1("start")}" - if (test2("start") != "start2") return "fail2: ${test2("start")}" - if (test3("start") != "start12") return "fail3: ${test3("start")}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt b/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt deleted file mode 100644 index 97254e08ff8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/noInlineLambdaChainWithCapturedInline.kt +++ /dev/null @@ -1,83 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(arg: T, f: (T) -> Unit) { - f(arg) -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -inline fun test1(crossinline param: () -> String): String { - var result = "fail" - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param() + c + a - }() - }() - } - }() - } - - return result -} - - -inline fun test2(crossinline param: () -> String): String { - var result = "fail" - inlineFun("2") { a -> - { - { - result = param() + a - }() - }() - } - - return result -} - -inline fun test3(crossinline param: () -> String): String { - var result = "fail" - inlineFun("2") { d -> - inlineFun("1") { c -> - { - inlineFun("2") { a -> - { - { - result = param() + c + a - }() - }() - } - }() - } - } - - return result -} - - -fun box(): String { - if (test1({"start"}) != "start12") return "fail1: ${test1({"start"})}" - if (test2({"start"}) != "start2") return "fail2: ${test2({"start"})}" - if (test3({"start"}) != "start12") return "fail3: ${test3({"start"})}" - - var captured1 = "sta"; - val captured2 = "rt"; - if (test1({captured1 + captured2}) != "start12") return "fail4: ${test1({captured1 + captured2})}" - if (test2({captured1 + captured2}) != "start2") return "fail5: ${test2({captured1 + captured2})}" - if (test3({captured1 + captured2}) != "start12") return "fail6: ${test3({captured1 + captured2})}" - - return { - if (test1 { captured1 + captured2 } != "start12") "fail7: ${test1 { captured1 + captured2 }}" - else if (test2 { captured1 + captured2 } != "start2") "fail8: ${test2 { captured1 + captured2 }}" - else if (test3 { captured1 + captured2 } != "start12") "fail9: ${test3 { captured1 + captured2 }}" - else "OK" - } () - -} diff --git a/backend.native/tests/external/codegen/boxInline/noInline/withoutInline.kt b/backend.native/tests/external/codegen/boxInline/noInline/withoutInline.kt deleted file mode 100644 index 7508473e98b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/noInline/withoutInline.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -class Inline { - - inline fun calc(s: (Int) -> Int, p: Int) : Int { - return s(p) - } -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -fun test1(): Int { - val inlineX = Inline() - var p = { l : Int -> l}; - return inlineX.calc(p, 25) -} - -fun box(): String { - if (test1() != 25) return "test1: ${test1()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.kt deleted file mode 100644 index 8d3805a819a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(b: Boolean): String { - val localResult = doCall ((local@ { - if (b) { - return@local "local" - } else { - return "nonLocal" - } - })) - - return "result=" + localResult; -} - -fun test2(nonLocal: String): String { - val localResult = doCall { - return nonLocal - } -} - -fun box(): String { - val test1 = test1(true) - if (test1 != "result=local") return "test1: ${test1}" - - val test2 = test1(false) - if (test2 != "nonLocal") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.kt deleted file mode 100644 index 34b99e73279..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(b: Boolean): String { - val localResult = doCall local@ { - if (b) { - return@local "local" - } else { - return "nonLocal" - } - } - - return "localResult=" + localResult; -} - -fun test2(nonLocal: String): String { - val localResult = doCall { - return nonLocal - } -} - -fun box(): String { - val test1 = test1(true) - if (test1 != "localResult=local") return "test1: ${test1}" - - val test2 = test1(false) - if (test2 != "nonLocal") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/explicitLocalReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/explicitLocalReturn.kt deleted file mode 100644 index 34b99e73279..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/explicitLocalReturn.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(b: Boolean): String { - val localResult = doCall local@ { - if (b) { - return@local "local" - } else { - return "nonLocal" - } - } - - return "localResult=" + localResult; -} - -fun test2(nonLocal: String): String { - val localResult = doCall { - return nonLocal - } -} - -fun box(): String { - val test1 = test1(true) - if (test1 != "localResult=local") return "test1: ${test1}" - - val test2 = test1(false) - if (test2 != "nonLocal") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/justReturnInLambda.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/justReturnInLambda.kt deleted file mode 100644 index 200ee54cf38..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/justReturnInLambda.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -class Z {} - -fun test1(nonLocal: String): String { - - val localResult = doCall { - return nonLocal - } -} - -fun box(): String { - val test2 = test1("OK_NONLOCAL") - if (test2 != "OK_NONLOCAL") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt5199.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt5199.kt deleted file mode 100644 index d7e1c7edc17..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt5199.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(nonLocal: String): String { - val localResult = doCall { - return nonLocal - } - - return "NON_LOCAL_FAILED" -} - - -fun box(): String { - return test1("OK") -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948.kt deleted file mode 100644 index a4cffc30e40..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(f: () -> Unit) { - try { - f() - } - finally { - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - foo { - try { - return "OK" - } catch(e: Exception) { - return "fail 1" - } - } - - return "fail 2" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948v2.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948v2.kt deleted file mode 100644 index 7a0be75b0a4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/kt8948v2.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun foo(f: () -> Unit) { - try { - f() - } - finally { - 1 - } -} - -// FILE: 2.kt - -import test.* - -var p = "fail" - -fun test1() { - foo { - try { - p = "O" - return - } catch(e: Exception) { - return - } finally { - p += "K" - } - } -} - -fun box(): String { - test1() - return p -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nestedNonLocals.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nestedNonLocals.kt deleted file mode 100644 index 97ff7ccdaeb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nestedNonLocals.kt +++ /dev/null @@ -1,81 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* -import Kind.* - -enum class Kind { - LOCAL, - EXTERNAL, - GLOBAL -} - -class Internal(val value: String) - -class External(val value: String) - -class Global(val value: String) - -fun test1(intKind: Kind, extKind: Kind): Global { - - var externalResult = doCall ext@ { - - val internalResult = doCall int@ { - if (intKind == Kind.GLOBAL) { - return@test1 Global("internal -> global") - } else if (intKind == EXTERNAL) { - return@ext External("internal -> external") - } - return@int Internal("internal -> local") - } - - if (extKind == GLOBAL || extKind == EXTERNAL) { - return Global("external -> global") - } - - External(internalResult.value + ": external -> local"); - } - - return Global(externalResult.value + ": exit") -} - -fun box(): String { - var test1 = test1(LOCAL, LOCAL).value - if (test1 != "internal -> local: external -> local: exit") return "test1: ${test1}" - - test1 = test1(EXTERNAL, LOCAL).value - if (test1 != "internal -> external: exit") return "test2: ${test1}" - - test1 = test1(GLOBAL, LOCAL).value - if (test1 != "internal -> global") return "test3: ${test1}" - - - test1 = test1(LOCAL, EXTERNAL).value - if (test1 != "external -> global") return "test4: ${test1}" - - test1 = test1(EXTERNAL, EXTERNAL).value - if (test1 != "internal -> external: exit") return "test5: ${test1}" - - test1 = test1(GLOBAL, EXTERNAL).value - if (test1 != "internal -> global") return "test6: ${test1}" - - - test1 = test1(LOCAL, GLOBAL).value - if (test1 != "external -> global") return "test7: ${test1}" - - test1 = test1(EXTERNAL, GLOBAL).value - if (test1 != "internal -> external: exit") return "test8: ${test1}" - - test1 = test1(GLOBAL, GLOBAL).value - if (test1 != "internal -> global") return "test9: ${test1}" - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.kt deleted file mode 100644 index cc2c560762a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -public fun noInlineCall(block: ()-> R) : R { - return block() -} - -public inline fun notUsed(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun test1(b: Boolean): String { - val localResult = noInlineCall local@ { - if (b) { - return@local 1 - } else { - return@local 2 - } - 3 - } - - return "result=" + localResult; -} - -fun box(): String { - val test1 = test1(true) - if (test1 != "result=1") return "test1: ${test1}" - - val test2 = test1(false) - if (test2 != "result=2") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nonLocalReturnFromOuterLambda.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nonLocalReturnFromOuterLambda.kt deleted file mode 100644 index af6f1e3d223..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/nonLocalReturnFromOuterLambda.kt +++ /dev/null @@ -1,59 +0,0 @@ -// FILE: 1.kt - -package test - -fun a(b: () -> String) : String { - return b() -} - -inline fun test(l: () -> String): String { - return l() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun test1() : String { - return a { - test { - return@a "OK" - } - } -} - -fun test2() : String { - return test z@ { - return@z "OK" - } -} - -fun test3() : String { - return test { - return@test "OK" - } -} - -fun test4() : String { - return a z@ { - test { - return@z "OK" - } - } -} - - - -fun box() : String { - if (test1() != "OK") return "fail 1: ${test1()}" - - if (test2() != "OK") return "fail 2: ${test2()}" - - if (test3() != "OK") return "fail 3: ${test3()}" - - if (test4() != "OK") return "fail 4: ${test4()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/propertyAccessors.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/propertyAccessors.kt deleted file mode 100644 index 275024ae34f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/propertyAccessors.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun doCall(p: () -> R) { - p() -} - -// FILE: 2.kt - -import test.* - -class A { - var result = 0; - - var field: Int - get() { - doCall { return 1 } - return 2 - } - set(v: Int) { - doCall { - result = v / 2 - return - } - result = v - } -} - - -fun box(): String { - - val a = A() - if (a.field != 1) return "fail 1: ${a.field}" - - a.field = 4 - if (a.result != 2) return "fail 2: ${a.result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt deleted file mode 100644 index d653a70cc5a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/returnFromFunctionExpr.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt - -inline fun foo(f: () -> Unit) { - f() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -fun test(): String = fun (): String { - foo { return "OK" } - return "fail" -} () - -fun test2(): String = (l@ fun (): String { - foo { return@l "OK" } - return "fail" -}) () - -fun box(): String { - if (test() != "OK") return "fail 1: ${test()}" - - if (test2() != "OK") return "fail 2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simple.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simple.kt deleted file mode 100644 index efe029b8d69..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simple.kt +++ /dev/null @@ -1,61 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(local: Int, nonLocal: String, doNonLocal: Boolean): String { - - val localResult = doCall { - if (doNonLocal) { - return nonLocal - } - local - } - - if (localResult == 11) { - return "OK_LOCAL" - } - else { - return "LOCAL_FAILED" - } -} - -fun test2(local: Int, nonLocal: String, doNonLocal: Boolean): String { - - val localResult = doCall { - if (doNonLocal) { - return@test2 nonLocal - } - local - } - - if (localResult == 11) { - return "OK_LOCAL" - } - else { - return "LOCAL_FAILED" - } -} - -fun box(): String { - var test1 = test1(11, "fail", false) - if (test1 != "OK_LOCAL") return "test1: ${test1}" - - test1 = test1(-1, "OK_NONLOCAL", true) - if (test1 != "OK_NONLOCAL") return "test2: ${test1}" - - var test2 = test2(11, "fail", false) - if (test2 != "OK_LOCAL") return "test1: ${test2}" - - test2 = test2(-1, "OK_NONLOCAL", true) - if (test2 != "OK_NONLOCAL") return "test2: ${test2}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleFunctional.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleFunctional.kt deleted file mode 100644 index 4790c794384..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleFunctional.kt +++ /dev/null @@ -1,87 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(local: Int, nonLocal: String, doNonLocal: Boolean): String { - - val localResult = doCall( - fun (): Int { - if (doNonLocal) { - return@test1 nonLocal - } - return local - }) - - if (localResult == 11) { - return "OK_LOCAL" - } - else { - return "LOCAL_FAILED" - } -} - -fun test2(local: Int, nonLocal: String, doNonLocal: Boolean): String { - - val localResult = doCall( - xxx@ fun(): Int { - if (doNonLocal) { - return@test2 nonLocal - } - return@xxx local - }) - - if (localResult == 11) { - return "OK_LOCAL" - } - else { - return "LOCAL_FAILED" - } -} - -fun test3(local: Int, nonLocal: String, doNonLocal: Boolean): String { - - val localResult = doCall( - yy@ fun(): Int { - if (doNonLocal) { - return@test3 nonLocal - } - return@yy local - }) - - if (localResult == 11) { - return "OK_LOCAL" - } - else { - return "LOCAL_FAILED" - } -} - -fun box(): String { - var test1 = test1(11, "fail", false) - if (test1 != "OK_LOCAL") return "test1: ${test1}" - - test1 = test1(-1, "OK_NONLOCAL", true) - if (test1 != "OK_NONLOCAL") return "test2: ${test1}" - - var test2 = test2(11, "fail", false) - if (test2 != "OK_LOCAL") return "test1: ${test2}" - - test2 = test2(-1, "OK_NONLOCAL", true) - if (test2 != "OK_NONLOCAL") return "test2: ${test2}" - - var test3 = test3(11, "fail", false) - if (test3 != "OK_LOCAL") return "test1: ${test3}" - - test3 = test3(-1, "OK_NONLOCAL", true) - if (test3 != "OK_NONLOCAL") return "test2: ${test3}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleVoid.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleVoid.kt deleted file mode 100644 index 8cebf05330e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/simpleVoid.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -class Holder(var value: Int) - -fun test1(holder: Holder, doNonLocal: Boolean) { - holder.value = -1; - - val localResult = doCall { - if (doNonLocal) { - holder.value = 1000 - return - } - 10 - } - - holder.value = localResult -} - - -fun box(): String { - val h = Holder(-1) - - test1(h, false) - if (h.value != 10) return "test1: ${h.value}" - - test1(h, true) - if (h.value != 1000) return "test2: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.kt deleted file mode 100644 index 0b168a75dbe..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.kt +++ /dev/null @@ -1,108 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* -import Kind.* - -enum class Kind { - LOCAL, - EXTERNAL, - GLOBAL -} - -class Holder { - var value: String = "" -} - -val FINALLY_CHAIN = "in local finally, in external finally, in global finally" - -class Internal(val value: String) - -class External(val value: String) - -class Global(val value: String) - -fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global { - holder.value = "" - try { - var externalResult = doCall ext@ { - - try { - val internalResult = doCall int@ { - try { - if (intKind == Kind.GLOBAL) { - return@test1 Global("internal -> global") - } - else if (intKind == EXTERNAL) { - return@ext External("internal -> external") - } - return@int Internal("internal -> local") - } - finally { - holder.value += "in local finally" - } - } - - if (extKind == GLOBAL || extKind == EXTERNAL) { - return Global("external -> global") - } - - External(internalResult.value + ": external -> local"); - - } - finally { - holder.value += ", in external finally" - } - } - - return Global(externalResult.value + ": exit") - } - finally { - holder.value += ", in global finally" - } - - -} - -fun box(): String { - var holder = Holder() - - var test1 = test1(LOCAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> local: external -> local: exit") return "test1: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test2: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test3: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test4: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test5: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test6: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test7: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test8: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test9: ${test1}, finally = ${holder.value}" - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSiteComplex.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSiteComplex.kt deleted file mode 100644 index 304d0c1b23b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSiteComplex.kt +++ /dev/null @@ -1,112 +0,0 @@ -// FILE: 1.kt - -package test - -class Holder { - var value: String = "" -} - -inline fun doCall(block: ()-> R, h: Holder) : R { - try { - return block() - } finally { - h.value += ", in doCall finally" - } -} - -// FILE: 2.kt - -import test.* -import Kind.* - -enum class Kind { - LOCAL, - EXTERNAL, - GLOBAL -} - -val FINALLY_CHAIN = "in local finally, in doCall finally, in external finally, in doCall finally, in global finally" - -class Internal(val value: String) - -class External(val value: String) - -class Global(val value: String) - -fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global { - holder.value = "" - try { - var externalResult = doCall (ext@ { - try { - - val internalResult = doCall (int@ { - try { - if (intKind == Kind.GLOBAL) { - return@test1 Global("internal -> global") - } - else if (intKind == EXTERNAL) { - return@ext External("internal -> external") - } - return@int Internal("internal -> local") - } - finally { - holder.value += "in local finally" - } - }, holder) - - if (extKind == GLOBAL || extKind == EXTERNAL) { - return Global("external -> global") - } - - External(internalResult.value + ": external -> local"); - - } - finally { - holder.value += ", in external finally" - } - }, holder) - - return Global(externalResult.value + ": exit") - } - finally { - holder.value += ", in global finally" - } - - -} - -fun box(): String { - var holder = Holder() - - var test1 = test1(LOCAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> local: external -> local: exit") return "test1: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test2: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test3: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test4: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test5: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test6: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test7: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test8: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test9: ${test1}, finally = ${holder.value}" - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplit.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplit.kt deleted file mode 100644 index f1f060af423..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplit.kt +++ /dev/null @@ -1,139 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package holder - -public class Holder(var value: String = "") { - - operator fun plusAssign(s: String?) { - if (value.length != 0) { - value += " -> " - } - value += s - } - - override fun toString(): String { - return value - } - -} - -public inline fun doCall(h: Holder, block: ()-> R) : R { - try { - return block() - } finally { - h += "inline fun finally" - } -} - -public inline fun doCallWithException(h: Holder, block: ()-> R) : R { - try { - return block() - } finally { - h += "inline fun finally" - throw RuntimeException("fail"); - } -} - -// FILE: 2.kt - -import holder.* -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.test.fail - -fun test1(): Holder { - val h = Holder("") - - try { - val internalResult = doCall(h) { - h += "in lambda body" - return h - } - } - finally { - h += "in call site finally" - } - - h += "local" - return h -} - -fun test1Lambda(): Holder { - val h = Holder("") - - val internalResult = doCall(h) { - try { - h += "in lambda body" - return h - } - finally { - h += "in lambda finally" - } - } - - - h += "local" - return h -} - -fun test2(h: Holder): Holder { - try { - val internalResult = doCallWithException(h) { - h += "in lambda body" - return h - } - } - finally { - h += "in call site finally" - } - - h += "local" - return h -} - -fun test2Lambda(h: Holder): Holder { - - val internalResult = doCallWithException(h) { - try { - h += "in lambda body" - return h - } - finally { - h += "in lambda finally" - } - } - - h += "local" - return h -} - -fun box(): String { - val test = test1() - if (test.value != "in lambda body -> inline fun finally -> in call site finally") return "fail 1: $test" - - val testLambda = test1Lambda() - if (testLambda.value != "in lambda body -> in lambda finally -> inline fun finally") return "fail 1 lambda: $testLambda" - - var h = Holder() - assertError(2, h, "in lambda body -> inline fun finally -> in call site finally") { - test2(h) - } - - h = Holder() - assertError(22, h, "in lambda body -> in lambda finally -> inline fun finally") { - test2Lambda(h) - } - - return "OK" -} - - -inline fun assertError(index: Int, h: Holder, expected: String, l: (h: Holder) -> Holder) { - try { - l(h) - fail("fail $index: no error") - } - catch (e: Exception) { - assertEquals(expected, h.value, "failed on $index") - } -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplitNoReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplitNoReturn.kt deleted file mode 100644 index 3da0a59d67d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/exceptionTableSplitNoReturn.kt +++ /dev/null @@ -1,139 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package testpack - -public class Holder(var value: String = "") { - - operator fun plusAssign(s: String?) { - if (value.length != 0) { - value += " -> " - } - value += s - } - - override fun toString(): String { - return value - } - -} - -public inline fun doCall(h: Holder, block: ()-> R) { - try { - block() - } finally { - h += "inline fun finally" - } -} - -public inline fun doCallWithException(h: Holder, block: ()-> R) { - try { - block() - } finally { - h += "inline fun finally" - throw RuntimeException("fail"); - } -} - -// FILE: 2.kt - -import testpack.* -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.test.fail - -fun test1(): Holder { - val h = Holder("") - - try { - doCall(h) { - h += "in lambda body" - return h - } - } - finally { - h += "in call site finally" - } - - h += "local" - return h -} - -fun test1Lambda(): Holder { - val h = Holder("") - - doCall(h) { - try { - h += "in lambda body" - return h - } - finally { - h += "in lambda finally" - } - } - - - h += "local" - return h -} - -fun test2(h: Holder): Holder { - try { - doCallWithException(h) { - h += "in lambda body" - return h - } - } - finally { - h += "in call site finally" - } - - h += "local" - return h -} - -fun test2Lambda(h: Holder): Holder { - - doCallWithException(h) { - try { - h += "in lambda body" - return h - } - finally { - h += "in lambda finally" - } - } - - h += "local" - return h -} - -fun box(): String { - val test = test1() - if (test.value != "in lambda body -> inline fun finally -> in call site finally") return "fail 1: $test" - - val testLambda = test1Lambda() - if (testLambda.value != "in lambda body -> in lambda finally -> inline fun finally") return "fail 1 lambda: $testLambda" - - var h = Holder() - assertError(2, h, "in lambda body -> inline fun finally -> in call site finally") { - test2(h) - } - - h = Holder() - assertError(22, h, "in lambda body -> in lambda finally -> inline fun finally") { - test2Lambda(h) - } - - return "OK" -} - - -inline fun assertError(index: Int, h: Holder, expected: String, l: (h: Holder) -> Holder) { - try { - l(h) - fail("fail $index: no error") - } - catch (e: Exception) { - assertEquals(expected, h.value, "failed on $index") - } -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/finallyInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/finallyInFinally.kt deleted file mode 100644 index 32d8b0ebec0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/finallyInFinally.kt +++ /dev/null @@ -1,83 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> Unit, finallyBlock1: ()-> Unit) { - try { - block() - } finally { - finallyBlock1() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - h.value += ", OF_FINALLY1" - return "OF_FINALLY1" - } - ) - - return "LOCAL"; -} - - -fun test2(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - try { - h.value += ", OF_FINALLY1" - return "OF_FINALLY1" - } finally { - h.value += ", OF_FINALLY1_FINALLY" - } - } - ) - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - val test10 = test1(h, 0) - if (test10 != "OF_FINALLY1" || h.value != "OK_NONLOCAL, OF_FINALLY1") return "test10: ${test10}, holder: ${h.value}" - - h = Holder() - val test11 = test1(h, 1) - if (test11 != "OF_FINALLY1" || h.value != "LOCAL, OF_FINALLY1") return "test11: ${test11}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h, 0) - if (test2 != "OF_FINALLY1" || h.value != "OK_NONLOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY") return "test20: ${test2}, holder: ${h.value}" - - h = Holder() - val test21 = test2(h, 1) - if (test21 != "OF_FINALLY1" || h.value != "LOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY") return "test21: ${test21}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/wrongVarInterval.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/wrongVarInterval.kt deleted file mode 100644 index 6d8641272e2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/callSite/wrongVarInterval.kt +++ /dev/null @@ -1,45 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R) : R { - return block() -} - -// FILE: 2.kt - -import test.* - -fun test1(): String { - try { - doCall { - try { - doCall { - val a = 1 - if (1 == 1) { - return "a" - } - else if (2 == 2) { - return "b" - } - } - - return "d" - } - finally { - "1" - } - } - - } - finally { - "2" - } - return "f" -} - -fun box(): String { - test1() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally.kt deleted file mode 100644 index 8ea6a0004ac..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally.kt +++ /dev/null @@ -1,98 +0,0 @@ -// FILE: 1.kt - -package test - -class Holder { - var value: String = "" -} - -inline fun doCall_1(block: ()-> Unit, h: Holder) { - try { - doCall(block) { - h.value += ", OF_FINALLY1" - return - } - } finally { - h.value += ", DO_CALL_1_FINALLY" - } -} - -inline fun doCall_2(block: ()-> Unit, h: Holder) { - try { - doCall(block) { - try { - h.value += ", OF_FINALLY1" - return - } - finally { - h.value += ", OF_FINALLY1_FINALLY" - } - } - } finally { - h.value += ", DO_CALL_1_FINALLY" - } -} - -inline fun doCall(block: ()-> Unit, finallyBlock1: ()-> Unit) { - try { - block() - } finally { - finallyBlock1() - } -} - -// FILE: 2.kt - -import test.* - -fun test1(h: Holder, doReturn: Int): String { - doCall_1 ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - h - ) - - return "TEST1"; -} - -fun test2(h: Holder, doReturn: Int): String { - doCall_2 ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - h - ) - - return "TEST2"; -} - -fun box(): String { - var h = Holder() - val test10 = test1(h, 0) - if (test10 != "TEST1" || h.value != "OK_NONLOCAL, OF_FINALLY1, DO_CALL_1_FINALLY") return "test10: ${test10}, holder: ${h.value}" - - h = Holder() - val test11 = test1(h, 1) - if (test11 != "TEST1" || h.value != "LOCAL, OF_FINALLY1, DO_CALL_1_FINALLY") return "test11: ${test11}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h, 0) - if (test2 != "TEST2" || h.value != "OK_NONLOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY, DO_CALL_1_FINALLY") return "test20: ${test2}, holder: ${h.value}" - - h = Holder() - val test21 = test2(h, 1) - if (test21 != "TEST2" || h.value != "LOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY, DO_CALL_1_FINALLY") return "test21: ${test21}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally2.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally2.kt deleted file mode 100644 index 8b4b28414fe..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/finallyInFinally2.kt +++ /dev/null @@ -1,96 +0,0 @@ -// FILE: 1.kt - -package test - -class Holder { - var value: String = "" -} - -inline fun doCall_1(block: ()-> Unit, h: Holder) { - try { - doCall(block) { - h.value += ", OF_FINALLY1" - } - } finally { - h.value += ", DO_CALL_1_FINALLY" - } -} - -inline fun doCall_2(block: ()-> Unit, h: Holder) { - try { - doCall(block) { - try { - h.value += ", OF_FINALLY1" - } - finally { - h.value += ", OF_FINALLY1_FINALLY" - } - } - } finally { - h.value += ", DO_CALL_1_FINALLY" - } -} - -inline fun doCall(block: ()-> Unit, finallyBlock1: ()-> Unit) { - try { - block() - } finally { - finallyBlock1() - } -} - -// FILE: 2.kt - -import test.* - -fun test1(h: Holder, doReturn: Int): String { - doCall_1 ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - h - ) - - return "TEST1"; -} - -fun test2(h: Holder, doReturn: Int): String { - doCall_2 ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - h - ) - - return "TEST2"; -} - -fun box(): String { - var h = Holder() - val test10 = test1(h, 0) - if (test10 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OF_FINALLY1, DO_CALL_1_FINALLY") return "test10: ${test10}, holder: ${h.value}" - - h = Holder() - val test11 = test1(h, 1) - if (test11 != "TEST1" || h.value != "LOCAL, OF_FINALLY1, DO_CALL_1_FINALLY") return "test11: ${test11}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h, 0) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY, DO_CALL_1_FINALLY") return "test20: ${test2}, holder: ${h.value}" - - h = Holder() - val test21 = test2(h, 1) - if (test21 != "TEST2" || h.value != "LOCAL, OF_FINALLY1, OF_FINALLY1_FINALLY, DO_CALL_1_FINALLY") return "test21: ${test21}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturn.kt deleted file mode 100644 index a57aa8087e6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturn.kt +++ /dev/null @@ -1,67 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall2_2(block: () -> R, res: R, h: Holder): R { - return doCall2_1(block, { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, res, h) -} - -public inline fun doCall2_1(block: () -> R, exception: (e: Exception) -> Unit, res: R, h: Holder): R { - return doCall2(block, exception, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, res) -} - -public inline fun doCall2(block: () -> R, exception: (e: Exception) -> Unit, finallyBlock: () -> Unit, res: R): R { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0(h: Holder, throwException: Boolean): Int { - val localResult = doCall2_2 ( - { - h.value += "OK_NONLOCAL" - if (throwException) { - throw RuntimeException() - } - return 1 - }, - "FAIL", - h - ) - - return -1; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h, true) - if (test0 != -1 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test0(h, false) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex.kt deleted file mode 100644 index 7baefdcce3b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall2_2(block: () -> R, res: R, h: Holder): R { - return doCall2_1(block, { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, res, h) -} - -public inline fun doCall2_1(block: () -> R, exception: (e: Exception) -> Unit, res: R, h: Holder): R { - return doCall2(block, exception, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, res, h) -} - -public inline fun doCall2(block: () -> R, exception: (e: Exception) -> Unit, finallyBlock: () -> Unit, res: R, h: Holder): R { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", DO_CALL_2_FINALLY" - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0(h: Holder, throwException: Boolean): Int { - val localResult = doCall2_2 ( - { - h.value += "OK_NONLOCAL" - if (throwException) { - throw RuntimeException() - } - return 1 - }, - "FAIL", - h - ) - - return -1; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h, true) - if (test0 != -1 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, DO_CALL_2_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test0(h, false) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY, DO_CALL_2_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex2.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex2.kt deleted file mode 100644 index 5f930d23e92..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex2.kt +++ /dev/null @@ -1,79 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall2_2(block: () -> R, res: R, h: Holder): R { - try { - return doCall2_1(block, { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, res, h) - } finally{ - h.value += ", DO_CALL_2_2_FINALLY" - } -} - -public inline fun doCall2_1(block: () -> R, exception: (e: Exception) -> Unit, res: R, h: Holder): R { - try { - return doCall2(block, exception, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, res, h) - } finally { - h.value += ", DO_CALL_2_1_FINALLY" - } -} - -public inline fun doCall2(block: () -> R, exception: (e: Exception) -> Unit, finallyBlock: () -> Unit, res: R, h: Holder): R { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", DO_CALL_2_FINALLY" - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0(h: Holder, throwException: Boolean): Int { - val localResult = doCall2_2 ( - { - h.value += "OK_NONLOCAL" - if (throwException) { - throw RuntimeException() - } - return 1 - }, - "FAIL", - h - ) - - return -1; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h, true) - if (test0 != -1 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test0(h, false) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex3.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex3.kt deleted file mode 100644 index 90cfc9e8785..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex3.kt +++ /dev/null @@ -1,81 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall2_2(block: () -> String, res: String, h: Holder): String { - try { - return doCall2_1(block, { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, res, h) - } finally{ - h.value += ", DO_CALL_2_2_FINALLY" - } -} - -public inline fun doCall2_1(block: () -> R, exception: (e: Exception) -> Unit, res: R, h: Holder): R { - try { - return doCall2(block, exception, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, res, h) - } finally { - h.value += ", DO_CALL_2_1_FINALLY" - } -} - -public inline fun doCall2(block: () -> R, exception: (e: Exception) -> Unit, finallyBlock: () -> Unit, res: R, h: Holder): R { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", DO_CALL_2_FINALLY" - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0(h: Holder, throwException: Boolean): Int { - val localResult = doCall2_2 ( - { - h.value += "OK_NONLOCAL" - if (throwException) { - throw RuntimeException() - } - return 1 - }, - "FAIL", - h - ) - - return -1; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h, true) - if (test0 != -1 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") - return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test0(h, false) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") - return "test1: ${test1}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex4.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex4.kt deleted file mode 100644 index 3b507b537bd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/intReturnComplex4.kt +++ /dev/null @@ -1,85 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall2_2(block: () -> String, res: String, h: Holder): String { - try { - return doCall2_1(block, { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, res, h) - } finally{ - h.value += ", DO_CALL_2_2_FINALLY" - } -} - -public inline fun doCall2_1(block: () -> R, exception: (e: Exception) -> Unit, res: R, h: Holder): R { - try { - return doCall2(block, exception, { - try { - h.value += ", OK_FINALLY" - "OK_FINALLY" - } finally { - h.value += ", OK_FINALLY_NESTED" - } - }, res, h) - } finally { - h.value += ", DO_CALL_2_1_FINALLY" - } -} - -public inline fun doCall2(block: () -> R, exception: (e: Exception) -> Unit, finallyBlock: () -> Unit, res: R, h: Holder): R { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", DO_CALL_2_FINALLY" - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0(h: Holder, throwException: Boolean): Int { - val localResult = doCall2_2 ( - { - h.value += "OK_NONLOCAL" - if (throwException) { - throw RuntimeException() - } - return 1 - }, - "FAIL", - h - ) - - return -1; -} - - -fun box(): String { - var h = Holder() - val test0 = test0(h, true) - - if (test0 != -1 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, OK_FINALLY_NESTED, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test0(h, false) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY, OK_FINALLY_NESTED, DO_CALL_2_FINALLY, DO_CALL_2_1_FINALLY, DO_CALL_2_2_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/nestedLambda.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/nestedLambda.kt deleted file mode 100644 index c6ad7820683..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/chained/nestedLambda.kt +++ /dev/null @@ -1,86 +0,0 @@ -// FILE: 1.kt - -package test - -class Holder { - var value: String = "" -} - -inline fun doCall(block: ()-> R, h: Holder) : R { - try { - return block() - } finally { - h.value += ", in doCall finally" - } -} - -// FILE: 2.kt - -import test.* - -val FINALLY_CHAIN = "in local finally, in doCall finally, in external finally, in doCall finally, in global finally" - -fun test1(holder: Holder, p: Int): String { - holder.value = "start" - return test2(holder) { i -> - if (p == i) { - return "call $i" - } - } -} - -inline fun test2(holder: Holder, l: (s: Int) -> Unit): String { - try { - l(0) - var externalResult = doCall (ext@ { - l(1) - try { - l(2) - val internalResult = doCall (int@ { - l(3) - try { - l(4) - return "fail" - } - finally { - holder.value += ", in local finally" - } - }, holder) - } - finally { - holder.value += ", in external finally" - } - }, holder) - - return "fail" - } - finally { - holder.value += ", in global finally" - } -} - -fun box(): String { - var holder = Holder() - - var test1 = test1(holder, 0) - if (holder.value != "start, in global finally" || test1 != "call 0") return "test1: ${test1}, finally = ${holder.value}" - - test1 = test1(holder, 1) - if (holder.value != "start, in doCall finally, in global finally" || test1 != "call 1") - return "test2: ${test1}, finally = ${holder.value}" - - test1 = test1(holder, 2) - if (holder.value != "start, in external finally, in doCall finally, in global finally" || test1 != "call 2") - return "test3: ${test1}, finally = ${holder.value}" - - - test1 = test1(holder, 3) - if (holder.value != "start, in doCall finally, in external finally, in doCall finally, in global finally" || test1 != "call 3") - return "test4: ${test1}, finally = ${holder.value}" - - test1 = test1(holder, 4) - if (holder.value != "start, in local finally, in doCall finally, in external finally, in doCall finally, in global finally" || test1 != "call 4") - return "test5: ${test1}, finally = ${holder.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.kt deleted file mode 100644 index 583f141128c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.kt +++ /dev/null @@ -1,114 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyLambda: ()-> Unit) : R { - try { - return block() - } finally { - finallyLambda() - } -} - -// FILE: 2.kt - -import test.* -import Kind.* - -enum class Kind { - LOCAL, - EXTERNAL, - GLOBAL -} - -class Holder { - var value: String = "" -} - -val FINALLY_CHAIN = "in local finally, in declaration local finally, in external finally, in declaration external finally, in global finally" - -class Internal(val value: String) - -class External(val value: String) - -class Global(val value: String) - -fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global { - holder.value = "" - try { - var externalResult = doCall (ext@ { - - try { - val internalResult = doCall (int@ { - try { - if (intKind == Kind.GLOBAL) { - return@test1 Global("internal -> global") - } - else if (intKind == EXTERNAL) { - return@ext External("internal -> external") - } - return@int Internal("internal -> local") - } - finally { - holder.value += "in local finally" - } - }, { - holder.value += ", in declaration local finally" - }) - if (extKind == GLOBAL || extKind == EXTERNAL) { - return Global("external -> global") - } - - External(internalResult.value + ": external -> local"); - - } - finally { - holder.value += ", in external finally" - } - }, { - holder.value += ", in declaration external finally" - }) - - return Global(externalResult.value + ": exit") - } - finally { - holder.value += ", in global finally" - } - - -} - -fun box(): String { - var holder = Holder() - - var test1 = test1(LOCAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> local: external -> local: exit") return "test1: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test2: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, LOCAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test3: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test4: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test5: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, EXTERNAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test6: ${test1}, finally = ${holder.value}" - - - test1 = test1(LOCAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "external -> global") return "test7: ${test1}, finally = ${holder.value}" - - test1 = test1(EXTERNAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> external: exit") return "test8: ${test1}, finally = ${holder.value}" - - test1 = test1(GLOBAL, GLOBAL, holder).value - if (holder.value != FINALLY_CHAIN || test1 != "internal -> global") return "test9: ${test1}, finally = ${holder.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturn.kt deleted file mode 100644 index 08e00e74ef2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturn.kt +++ /dev/null @@ -1,157 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> Int, exception: (e: Exception)-> Unit, finallyBlock: ()-> Int, res: Int = -111) : Int { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): Int { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return 1 - }, - { - h.value += ", OK_EXCEPTION" - return 2 - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAILT") - - return -1; -} - -fun test1(h: Holder): Int { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - return 1 - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL") - - return -1; -} - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - 2 - }, - { - h.value += ", OK_FINALLY" - 3 - }) - - return "" + localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - 3 - }) - - return "" + localResult; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "" + localResult; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != 2 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test1(h) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturnComplex.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturnComplex.kt deleted file mode 100644 index 4392856e92c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/intReturnComplex.kt +++ /dev/null @@ -1,171 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder { - public var value: String = "" -} - -public inline fun doCall(block: ()-> Int, exception: (e: Exception)-> Unit, finallyBlock: ()-> Int, h : Holder, res: Int = -111) : Int { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", INLINE_CALL_FINALLY" - } - return res -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R, h : Holder) : R { - try { - try { - return block() - } - catch (e: Exception) { - exception(e) - } - finally { - finallyBlock() - } - } finally { - h.value += ", INLINE_CALL_FINALLY" - } - return res -} - -// FILE: 2.kt - -import test.* - - - -fun test0(h: Holder): Int { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return 1 - }, - { - h.value += ", OK_EXCEPTION" - return 2 - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL", h) - - return -1; -} - -fun test1(h: Holder): Int { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - return 1 - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL", h) - - return -1; -} - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - 2 - }, - { - h.value += ", OK_FINALLY" - 3 - }, h) - - return "" + localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - 3 - }, h) - - return "" + localResult; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }, h) - - return "" + localResult; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != 2 || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, INLINE_CALL_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test1(h) - if (test1 != 1 || h.value != "OK_NONLOCAL, OK_FINALLY, INLINE_CALL_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY, INLINE_CALL_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, INLINE_CALL_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY, INLINE_CALL_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/longReturn.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/longReturn.kt deleted file mode 100644 index eabc5ffccfc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/longReturn.kt +++ /dev/null @@ -1,157 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> Long, exception: (e: Exception)-> Unit, finallyBlock: ()-> Long, res: Long = -1111.toLong()) : Long { - try { - block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): Long { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return 1.toLong() - }, - { - h.value += ", OK_EXCEPTION" - return 2.toLong() - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL") - - return -1.toLong() -} - -fun test1(h: Holder): Long { - val localResult = doCall2 ( - { - h.value += "OK_NONLOCAL" - return 1.toLong() - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL") - - return -1.toLong() -} - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - 2.toLong() - }, - { - h.value += ", OK_FINALLY" - 3.toLong() - }) - - return "" + localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - 3.toLong() - }) - - return "" + localResult; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "" + localResult; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != 2.toLong() || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test1 = test1(h) - if (test1 != 1.toLong() || h.value != "OK_NONLOCAL, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/nested.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/nested.kt deleted file mode 100644 index d6beb7eaf5c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/nested.kt +++ /dev/null @@ -1,132 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> Unit, finallyBlock1: ()-> Unit, finallyBlock2: ()-> Unit) { - try { - try { - block() - } - finally { - finallyBlock1() - } - } finally { - finallyBlock2() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder): String { - doCall ( - { - h.value += "OK_LOCAL" - }, - { - h.value += ", OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - } - ) - - return "LOCAL"; -} - - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - }) - - return "FAIL"; -} - -fun test3(h: Holder): String { - doCall ( - { - h.value += "OK_LOCAL" - }, - { - h.value += ", OK_FINALLY1" - return "OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - }) - - return "FAIL"; -} - -fun test4(h: Holder): String { - doCall ( - { - h.value += "OK_LOCAL" - }, - { - h.value += ", OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - return "OK_FINALLY2" - }) - - return "FAIL"; -} - -fun test5(h: Holder): String { - doCall ( - { - h.value += "OK_LOCAL" - }, - { - h.value += ", OK_FINALLY1" - return "OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - return "OK_FINALLY2" - }) - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - val test1 = test1(h) - if (test1 != "LOCAL" || h.value != "OK_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY1, OK_FINALLY2") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_FINALLY1" || h.value != "OK_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY2" || h.value != "OK_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test4: ${test4}, holder: ${h.value}" - - h = Holder() - val test5 = test5(h) - if (test5 != "OK_FINALLY2" || h.value != "OK_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test5: ${test5}, holder: ${h.value}" - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInFinally.kt deleted file mode 100644 index 11e1e00e537..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInFinally.kt +++ /dev/null @@ -1,94 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyBlock: ()-> R) : R { - try { - block() - } finally { - return finallyBlock() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - "OK_LOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - - -fun box(): String { - var h = Holder() - val test1 = test1(h) - if (test1 != "OK_FINALLY" || h.value != "OK_LOCAL, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.kt deleted file mode 100644 index 9c81bdedc71..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.kt +++ /dev/null @@ -1,72 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyBlock: ()-> Unit) : R { - try { - return block() - } finally { - finallyBlock() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder): String { - val localResult = doCall ({ - return "OK_NONLOCAL" - }, { - h.value = "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun test2(h: Holder): String { - val localResult = doCall (lambda@ { - h.value += "OK_LOCAL" - return@lambda "OK_LOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - -fun test3(h: Holder): String { - val localResult = doCall ({ - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun box(): String { - var h = Holder() - val test1 = test1(h) - if (test1 != "OK_NONLOCAL" || h.value != "OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_FINALLY" || h.value != "OK_LOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.kt deleted file mode 100644 index 5e943261554..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.kt +++ /dev/null @@ -1,95 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyBlock: ()-> R) : R { - try { - return block() - } finally { - return finallyBlock() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - "OK_LOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun test2(h: Holder): String { - val localResult = doCall ( - lambda@ { - h.value += "OK_NONLOCAL" - return@lambda "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - l2@ { - h.value += ", OK_FINALLY" - return@l2 "OK_FINALLY" - }) - - return localResult; -} - - -fun box(): String { - var h = Holder() - val test1 = test1(h) - if (test1 != "OK_FINALLY" || h.value != "OK_LOCAL, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTry.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTry.kt deleted file mode 100644 index 4dd77538331..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTry.kt +++ /dev/null @@ -1,90 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> Unit, block2: ()-> Unit, finallyBlock2: ()-> Unit) { - try { - block() - block2() - } finally { - finallyBlock2() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - h.value += ", OK_NONLOCAL2" - return "OK_NONLOCAL2" - }, - { - h.value += ", OK_FINALLY" - } - ) - - return "LOCAL"; -} - - -fun test2(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - try { - h.value += ", OK_NONLOCAL2" - return "OK_NONLOCAL2" - } finally { - h.value += ", OK_NONLOCAL2_FINALLY" - } - }, - { - h.value += ", OK_FINALLY" - } - ) - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - val test10 = test1(h, 0) - if (test10 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test10: ${test10}, holder: ${h.value}" - - h = Holder() - val test11 = test1(h, 1) - if (test11 != "OK_NONLOCAL2" || h.value != "LOCAL, OK_NONLOCAL2, OK_FINALLY") return "test11: ${test11}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h, 0) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test20: ${test2}, holder: ${h.value}" - - h = Holder() - val test21 = test2(h, 1) - if (test21 != "OK_NONLOCAL2" || h.value != "LOCAL, OK_NONLOCAL2, OK_NONLOCAL2_FINALLY, OK_FINALLY") return "test21: ${test21}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTryComplex.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTryComplex.kt deleted file mode 100644 index 49acaa70b09..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/severalInTryComplex.kt +++ /dev/null @@ -1,96 +0,0 @@ -// FILE: 1.kt - -package test - -class Holder { - var value: String = "" -} - -inline fun doCall(block: ()-> Unit, block2: ()-> Unit, finallyBlock2: ()-> Unit, res: Holder) { - try { - try { - block() - block2() - } - finally { - finallyBlock2() - } - } finally { - res.value += ", DO_CALL_EXT_FINALLY" - } -} - -// FILE: 2.kt - -import test.* - -fun test1(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - h.value += ", OK_NONLOCAL2" - return "OK_NONLOCAL2" - }, - { - h.value += ", OK_FINALLY" - }, - h - ) - - return "LOCAL"; -} - - -fun test2(h: Holder, doReturn: Int): String { - doCall ( - { - if (doReturn < 1) { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - } - h.value += "LOCAL" - "OK_LOCAL" - }, - { - try { - h.value += ", OK_NONLOCAL2" - return "OK_NONLOCAL2" - } finally { - h.value += ", OK_NONLOCAL2_FINALLY" - } - }, - { - h.value += ", OK_FINALLY" - }, - h - ) - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - val test10 = test1(h, 0) - if (test10 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY, DO_CALL_EXT_FINALLY") return "test10: ${test10}, holder: ${h.value}" - - h = Holder() - val test11 = test1(h, 1) - if (test11 != "OK_NONLOCAL2" || h.value != "LOCAL, OK_NONLOCAL2, OK_FINALLY, DO_CALL_EXT_FINALLY") return "test11: ${test11}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h, 0) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY, DO_CALL_EXT_FINALLY") return "test20: ${test2}, holder: ${h.value}" - - h = Holder() - val test21 = test2(h, 1) - if (test21 != "OK_NONLOCAL2" || h.value != "LOCAL, OK_NONLOCAL2, OK_NONLOCAL2_FINALLY, OK_FINALLY, DO_CALL_EXT_FINALLY") return "test21: ${test21}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidInlineFun.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidInlineFun.kt deleted file mode 100644 index 924358c4462..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidInlineFun.kt +++ /dev/null @@ -1,72 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyBlock: ()-> Unit) { - try { - block() - } finally { - finallyBlock() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder): String { - doCall ({ - return "OK_NONLOCAL" - }, { - h.value = "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun test2(h: Holder): String { - doCall ({ - h.value += "OK_LOCAL" - "OK_LOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - -fun test3(h: Holder): String { - doCall ({ - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }) - - return "FAIL"; -} - - -fun box(): String { - var h = Holder() - val test1 = test1(h) - if (test1 != "OK_NONLOCAL" || h.value != "OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_FINALLY" || h.value != "OK_LOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidNonLocal.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidNonLocal.kt deleted file mode 100644 index 3cb24c35d54..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/declSite/voidNonLocal.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, finallyBlock: ()-> Unit) : R { - try { - return block() - } finally { - finallyBlock() - } -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - - -fun test1(h: Holder) { - val localResult = doCall ( - { - h.value = "OK_NONLOCAL" - return - }, { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) -} - - -fun test2(h: Holder) { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - "OK_LOCAL" - }, { - h.value += ", OK_FINALLY" - return - }) -} - -fun test3(h: Holder) { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return - }, { - h.value += ", OK_FINALLY" - return - }) -} - - -fun box(): String { - var h = Holder() - test1(h) - if (h.value != "OK_NONLOCAL, OK_FINALLY") return "test1 holder: ${h.value}" - - h = Holder() - test2(h) - if (h.value != "OK_LOCAL, OK_FINALLY") return "test2 holder: ${h.value}" - - h = Holder() - test3(h) - if (h.value != "OK_NONLOCAL, OK_FINALLY") return "test3 holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt deleted file mode 100644 index 71b18f6ca38..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/break.kt +++ /dev/null @@ -1,95 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCallAlwaysBreak(block: (i: Int)-> Int) : Int { - var res = 0; - for (i in 1..10) { - try { - block(i) - } finally { - break; - } - } - return res -} - -public val z: Boolean = true - -public inline fun doCallAlwaysBreak2(block: (i: Int)-> Int) : Int { - var res = 0; - for (i in 1..10) { - try { - res = block(i) - } finally { - if (z) - break - } - } - return res -} - -//public inline fun doCallAlwaysBreak2(block: (i: Int)-> Int) : Int { -// var res = 0; -// for (i in 1..10) { -// try { -// res += block(i) -// } finally { -// if (z) -// break -// } -// } -// return res -//} - -// FILE: 2.kt - -import test.* - -fun test1(): Int { - var s = 0 - doCallAlwaysBreak { - s += it*it - s - } - return s; -} - -fun test11(): Int { - return doCallAlwaysBreak { - return -100 - } -} - -fun test2(): Int { - return doCallAlwaysBreak2 { - return -100 - } -} - -fun test22(): Int { - var s = 0 - doCallAlwaysBreak { - s += it*it - s - } - return s; -} - - - -fun box(): String { - val test1 = test1() - if (test1 != 1) return "test1: ${test1}" - - val test11 = test11() - if (test11 != 0) return "test11: ${test11}" - - val test2 = test2() - if (test2 != 0) return "test2: ${test2}" - - val test22 = test22() - if (test22 != 1) return "test22: ${test22}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt deleted file mode 100644 index 6a7bd5071f3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/continue.kt +++ /dev/null @@ -1,94 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCallAlwaysBreak(block: (i: Int)-> Int) : Int { - var res = 0; - for (i in 1..10) { - try { - res = block(i) - } finally { - continue; - } - } - return res -} - -public val z: Boolean = true - -public inline fun doCallAlwaysBreak2(block: (i: Int)-> Int) : Int { - var res = 0; - for (i in 1..10) { - try { - res = block(i) - } finally { - if (z) - continue - } - } - return res -} - -//public inline fun doCallAlwaysBreak2(block: (i: Int)-> Int) : Int { -// var res = 0; -// for (i in 1..10) { -// try { -// res += block(i) -// } finally { -// if (z) -// continue -// } -// } -// return res -//} - -// FILE: 2.kt - -import test.* - -fun test1(): Int { - var s = 0 - doCallAlwaysBreak { - s += it*it - s - } - return s; -} - -fun test11(): Int { - return doCallAlwaysBreak { - return -100 - } -} - -fun test2(): Int { - return doCallAlwaysBreak2 { - return -100 - } -} - -fun test22(): Int { - var s = 0 - doCallAlwaysBreak { - s += it*it - s - } - return s; -} - - -fun box(): String { - val test1 = test1() - if (test1 != 385) return "test1: ${test1}" - - val test11 = test11() - if (test11 != 0) return "test11: ${test11}" - - val test2 = test2() - if (test2 != 0) return "test2: ${test2}" - - val test22 = test22() - if (test22 != 385) return "test22: ${test22}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/exceptionInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/exceptionInFinally.kt deleted file mode 100644 index 24699b9bfd0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/exceptionInFinally.kt +++ /dev/null @@ -1,82 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -public interface MCloseable { - public open fun close() -} - -public inline fun T.muse(block: (T) -> R): R { - try { - return block(this) - } finally { - this.close() - } -} - -// FILE: 2.kt - -import test.* -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.test.fail - -class MyException(message: String) : Exception(message) - -class Holder(var value: String) { - operator fun plusAssign(s: String?) { - value += s - if (s != "closed") { - value += "->" - } - } -} - -class Test() : MCloseable { - - val status = Holder("") - - private fun jobFun() { - status += "called" - } - - fun nonLocalWithExceptionAndFinally(): Holder { - muse { - try { - jobFun() - throw MyException("exception") - } - catch (e: MyException) { - status += e.message - return status - } - finally { - status += "finally" - } - } - return Holder("fail") - } - - override fun close() { - status += "closed" - throw MyException("error") - } -} - -fun box() : String { - assertError(1, "called->exception->finally->closed") { - nonLocalWithExceptionAndFinally() - } - - return "OK" -} - -inline fun assertError(index: Int, expected: String, l: Test.()->Unit) { - val testLocal = Test() - try { - testLocal.l() - fail("fail $index: no error") - } catch (e: Exception) { - assertEquals(expected, testLocal.status.value, "failed on $index") - } -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt deleted file mode 100644 index 1aba6d9892e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/forInFinally.kt +++ /dev/null @@ -1,60 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: (i: Int)-> Int, fblock: (i: Int)-> Unit) : Int { - var res = 0; - for (i in 1..10) { - try { - res = block(i) - } finally { - for (i in 1..10) { - fblock(i) - } - } - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: Int = 0 -} - -fun test1(): Int { - var s = 0 - doCall ( - { - s += it * it - s - }, - { - s += it - } - ) - return s; -} - -fun test11(h: Holder): Int { - return doCall ( - { - return -100 - }, { - h.value += it - }) -} - - -fun box(): String { - val test1 = test1() - if (test1 != 935) return "test1: ${test1}" - - val h = Holder() - val test11 = test11(h) - if (test11 != -100 && h.value != 55) return "test11: ${test11} holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternal.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternal.kt deleted file mode 100644 index 1458ab657d3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternal.kt +++ /dev/null @@ -1,154 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { - try { - block() - } catch (e: Exception1) { - exception(e) - } catch (e: Exception2) { - exception2(e) - } finally { - finallyBlock() - } - return res -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - throw RuntimeException("fail") -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - try { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - } finally { - h.value += ", OK_FINALLY_INNER" - } - }) - - return localResult; - } - catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } - else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test01(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - throw Exception1("1") - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - try { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - } catch(e: RuntimeException) { - h.value += ", OK_CATCHED" - } finally { - h.value += ", OK_FINALLY_INNER" - } - "OK_FINALLY" - }) - - return localResult; -} - -fun test02(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - throw Exception2("1") - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - try { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - } catch(e: RuntimeException) { - h.value += ", OK_CATCHED" - } finally { - h.value += ", OK_FINALLY_INNER" - } - "OK_FINALLY" - }, "OK") - - return localResult; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != "CATCHED_EXCEPTION" || h.value != "OK_NON_LOCAL, OK_FINALLY, OK_FINALLY_INNER") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test01 = test01(h) - if (test01 != "OK_EXCEPTION1" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY, OK_CATCHED, OK_FINALLY_INNER") return "test01: ${test01}, holder: ${h.value}" - - h = Holder() - val test02 = test02(h) - if (test02 != "OK_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY, OK_CATCHED, OK_FINALLY_INNER") return "test02: ${test02}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalNested.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalNested.kt deleted file mode 100644 index e97c1169949..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalNested.kt +++ /dev/null @@ -1,152 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, - exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { - try { - try { - block() - } - catch (e: Exception1) { - exception1(e) - } - catch (e: Exception2) { - exception2(e) - } - finally { - finallyBlock() - } - } catch (e: Exception1) { - exception3(e) - } - catch (e: Exception2) { - exception4(e) - } - finally { - finallyBlock2() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder, throwEx1: Boolean, throwEx2: Boolean, throwEx3: Boolean = false, throwEx4: Boolean = false): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - if (throwEx1) { - throw Exception1("1") - } - if (throwEx2) { - throw Exception2("1") - } - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - if (throwEx3) { - throw Exception1("3_1") - } - if (throwEx4) { - throw Exception2("4_1") - } - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - if (throwEx3) { - throw Exception1("3_2") - } - if (throwEx4) { - throw Exception2("4_2") - } - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY1" - try { - try { - throw Exception1("fail") - } - catch (e: RuntimeException) { - h.value += ", CATCHED1" - } - finally { - h.value += ", ADDITIONAL" - } - } finally { - h.value += " FINALLY1" - } - "OK_FINALLY1" - }, - { - h.value += ", OK_EXCEPTION3" - return "OK_EXCEPTION3" - }, - { - h.value += ", OK_EXCEPTION4" - return "OK_EXCEPTION4" - }, - { - h.value += ", OK_FINALLY2" - try { - try { - throw Exception1("fail2") - } catch (e: RuntimeException) { - h.value += ", CATCHED2" - } finally { - h.value += ", ADDITIONAL" - } - } finally { - h.value += " FINALLY2" - } - "OK_FINALLY2" - }) - - return localResult; - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - var test0 = test0(h, false, false) - if (test0 != "OK_NON_LOCAL" || h.value != "OK_NON_LOCAL, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_1: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false) - if (test0 != "OK_EXCEPTION1" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_2: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true) - if (test0 != "OK_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_3: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false, true, false) - if (test0 != "OK_EXCEPTION3" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_EXCEPTION3, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_4: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false, false, true) - if (test0 != "OK_EXCEPTION4" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_EXCEPTION4, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_5: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true, true, false) - if (test0 != "OK_EXCEPTION3" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_EXCEPTION3, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_6: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true, false, true) - if (test0 != "OK_EXCEPTION4" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, CATCHED1, ADDITIONAL FINALLY1, OK_EXCEPTION4, OK_FINALLY2, CATCHED2, ADDITIONAL FINALLY2") return "test0_7: ${test0}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalSimple.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalSimple.kt deleted file mode 100644 index 61ba24ab136..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/innerAndExternalSimple.kt +++ /dev/null @@ -1,55 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { - try { - block() - } catch (e: Exception1) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test01(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - throw Exception1("1") - "OK_NON_LOCAL_RES" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - try { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - } catch(e: RuntimeException) { - h.value += ", OK_CATCHED" - } - "OK_FINALLY_RES" - }, "FAIL") - - return localResult; -} -fun box(): String { - var h = Holder() - val test01 = test01(h) - if (test01 != "OK_EXCEPTION1" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY, OK_CATCHED") return "test01: ${test01}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nested.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nested.kt deleted file mode 100644 index e6278519e69..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nested.kt +++ /dev/null @@ -1,128 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, - exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { - try { - try { - block() - } - catch (e: Exception1) { - exception1(e) - } - catch (e: Exception2) { - exception2(e) - } - finally { - finallyBlock() - } - } catch (e: Exception1) { - exception3(e) - } - catch (e: Exception2) { - exception4(e) - } - finally { - finallyBlock2() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder, throwEx1: Boolean, throwEx2: Boolean, throwEx3: Boolean = false, throwEx4: Boolean = false): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - if (throwEx1) { - throw Exception1("1") - } - if (throwEx2) { - throw Exception2("1") - } - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - if (throwEx3) { - throw Exception1("3_1") - } - if (throwEx4) { - throw Exception2("4_1") - } - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - if (throwEx3) { - throw Exception1("3_2") - } - if (throwEx4) { - throw Exception2("4_2") - } - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY1" - "OK_FINALLY1" - }, - { - h.value += ", OK_EXCEPTION3" - return "OK_EXCEPTION3" - }, - { - h.value += ", OK_EXCEPTION4" - return "OK_EXCEPTION4" - }, - { - h.value += ", OK_FINALLY2" - "OK_FINALLY2" - }) - - return localResult; - - return "FAIL"; -} - -fun box(): String { - var h = Holder() - var test0 = test0(h, false, false) - if (test0 != "OK_NON_LOCAL" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_1: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false) - if (test0 != "OK_EXCEPTION1" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_2: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true) - if (test0 != "OK_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, OK_FINALLY2") return "test0_3: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false, true, false) - if (test0 != "OK_EXCEPTION3" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, OK_EXCEPTION3, OK_FINALLY2") return "test0_4: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, false, false, true) - if (test0 != "OK_EXCEPTION4" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY1, OK_EXCEPTION4, OK_FINALLY2") return "test0_5: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true, true, false) - if (test0 != "OK_EXCEPTION3" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, OK_EXCEPTION3, OK_FINALLY2") return "test0_6: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, true, false, true) - if (test0 != "OK_EXCEPTION4" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY1, OK_EXCEPTION4, OK_FINALLY2") return "test0_7: ${test0}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturns.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturns.kt deleted file mode 100644 index 6539f8bc4bc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturns.kt +++ /dev/null @@ -1,165 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, finallyBlock: ()-> String, - exception3: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { - try { - try { - block() - } - catch (e: Exception1) { - exception1(e) - } - finally { - if (true) { - finallyBlock() - /*External finally would be injected here*/ - return res + "_INNER_FINALLY" - } - } - } catch (e: Exception2) { - exception3(e) - } - finally { - finallyBlock2() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0( - h: Holder, - throwExceptionInTry: Boolean, - throwInternalEx2: Boolean = false, - throwInternalFinEx1: Boolean = false, - throwInternalFinEx2: Boolean = false, - throwExternalFinEx1: Boolean = false, - throwExternalFinEx2: Boolean = false, - res: String = "Fail" -): String { - try { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - if (throwExceptionInTry) { - throw Exception1("1") - } - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_INTERNAL_EXCEPTION1" - if (throwInternalEx2) { - throw Exception2("2_1") - } - return "OK_INTERNAL_EXCEPTION1" - }, - { - h.value += ", OK_FINALLY1" - if (throwInternalFinEx1) { - throw Exception1("EXCEPTION_IN_INTERNAL_FINALLY") - } - if (throwInternalFinEx2) { - throw Exception2("EXCEPTION222_IN_INTERNAL_FINALLY") - } - "OK_FINALLY1" - }, - { - h.value += ", OK_EXTERNAL_EXCEPTION2" - return "OK_EXTERNAL_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY2" - if (throwExternalFinEx1) { - throw Exception1("EXCEPTION_IN_EXTERNAL_FINALLY") - } - if (throwExternalFinEx2) { - throw Exception2("EXCEPTION222_IN_EXTERNAL_FINALLY") - } - "OK_FINALLY2" - }, res) - return localResult; - } catch(e: Exception1) { - return e.message!! - } catch(e: Exception2) { - return e.message!! - } -} - -fun box(): String { - var h = Holder() - var test0 = test0(h, false, throwExternalFinEx1 = false, res = "OK") - if (test0 != "OK_INNER_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_1: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, throwExternalFinEx1 = true, res = "OK") - if (test0 != "EXCEPTION_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_2: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, throwExternalFinEx2 = true, res = "OK") - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_4: ${test0}, holder: ${h.value}" - - - - - h = Holder() - test0 = test0(h, true, throwExternalFinEx1 = true, res = "OK") - if (test0 != "EXCEPTION_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_3: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, throwInternalEx2 = true, throwExternalFinEx1 = true, res = "OK") - if (test0 != "EXCEPTION_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_5: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, throwInternalEx2 = true, throwExternalFinEx2 = true, res = "OK") - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_6: ${test0}, holder: ${h.value}" - - - - h = Holder() - test0 = test0(h, false, throwInternalFinEx1 = true) - if (test0 != "EXCEPTION_IN_INTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_7: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, throwInternalFinEx1 = true, throwExternalFinEx2 = true) - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_71: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, throwInternalFinEx2 = true) - if (test0 != "OK_EXTERNAL_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_EXTERNAL_EXCEPTION2, OK_FINALLY2") return "test0_8: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, false, throwInternalFinEx2 = true, throwExternalFinEx2 = true) - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_EXTERNAL_EXCEPTION2, OK_FINALLY2") return "test0_81: ${test0}, holder: ${h.value}" - - - - h = Holder() - test0 = test0(h, true, throwInternalFinEx1 = true) - if (test0 != "EXCEPTION_IN_INTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_9: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, throwInternalFinEx1 = true, throwExternalFinEx2 = true) - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_FINALLY2") return "test0_10: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, throwInternalFinEx2 = true) - if (test0 != "OK_EXTERNAL_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_EXTERNAL_EXCEPTION2, OK_FINALLY2") return "test0_11: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, true, throwInternalFinEx2 = true, throwExternalFinEx2 = true) - if (test0 != "EXCEPTION222_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_INTERNAL_EXCEPTION1, OK_FINALLY1, OK_EXTERNAL_EXCEPTION2, OK_FINALLY2") return "test0_12: ${test0}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturnsSimple.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturnsSimple.kt deleted file mode 100644 index 91cf72d4f98..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/nestedWithReturnsSimple.kt +++ /dev/null @@ -1,76 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, finallyBlock: ()-> String, - finallyBlock2: ()-> String, res: String = "Fail") : String { - try { - try { - block() - } - finally { - if (true) { - finallyBlock() - /*External finally would be injected here*/ - return res + "_INNER_FINALLY" - } - } - } finally { - finallyBlock2() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0( - h: Holder, - throwExternalFinEx1: Boolean = false, - res: String = "Fail" -): String { - try { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_FINALLY1" - "OK_FINALLY1" - }, - { - h.value += ", OK_FINALLY2" - if (throwExternalFinEx1) { - throw Exception1("EXCEPTION_IN_EXTERNAL_FINALLY") - } - "OK_FINALLY2" - }, res) - return localResult; - } catch(e: Exception1) { - return e.message!! - } catch(e: Exception2) { - return e.message!! - } -} - -fun box(): String { - var h = Holder() - var test0 = test0(h, res = "OK") - if (test0 != "OK_INNER_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_1: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, throwExternalFinEx1 = true, res = "OK") - if (test0 != "EXCEPTION_IN_EXTERNAL_FINALLY" || h.value != "OK_NON_LOCAL, OK_FINALLY1, OK_FINALLY2") return "test0_2: ${test0}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/noFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/noFinally.kt deleted file mode 100644 index 81b70d478dd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/noFinally.kt +++ /dev/null @@ -1,120 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit) : String { - try { - return block() - } catch (e: Exception) { - exception(e) - } - return "Fail in doCall" -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }) - - return localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }) - - return localResult; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }) - - return localResult; -} - -fun test5(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - if (true) { - throw RuntimeException("EXCEPTION") - } - h.value += "fail" - - return "OK_EXCEPTION" - }) - - return localResult; - } catch (e: RuntimeException) { - if (e.message != "EXCEPTION") { - return "FAIL in exception: " + e.message - } else { - return "CATCHED_EXCEPTION" - } - } -} - -fun box(): String { - var h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION") return "test4: ${test4}, holder: ${h.value}" - - h = Holder() - val test5 = test5(h) - if (test5 != "CATCHED_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION") return "test5: ${test5}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/severalCatchClause.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/severalCatchClause.kt deleted file mode 100644 index ab9be4bd138..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/severalCatchClause.kt +++ /dev/null @@ -1,312 +0,0 @@ -// FILE: 1.kt - -package test - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { - try { - block() - } catch (e: Exception1) { - exception(e) - } catch (e: Exception2) { - exception2(e) - } finally { - finallyBlock() - } - return res -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - throw RuntimeException("fail") -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }) - - return localResult; - } - catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } - else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test01(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - throw Exception1("1") - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - -fun test02(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - throw Exception2("1") - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - -fun test1(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw Exception1("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }, "Fail") - } - catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } - else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test2(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw Exception1("1") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - throw Exception2("2") - "OK_EXCEPTION" - }, - { - h.value += ", OK_EXCEPTION2" - "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - return localResult; - } - catch (e: Exception2) { - return "CATCHED_EXCEPTION" - } - - return "Fail"; -} - -fun test3(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw Exception2("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION1" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }, "Fail") - } - catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } - else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test4(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw Exception2("1") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION1" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_EXCEPTION2" - throw Exception1("1") - "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - return localResult; - } - catch (e: Exception1) { - return "CATCHED_EXCEPTION" - } - - return "Fail"; -} - - -fun test5(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw Exception2("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - throw RuntimeException("FAIL_EX") - "OK_EXCEPTION" - }, - { - h.value += ", OK_EXCEPTION2" - return "OK_EXCEPTION2" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - - return localResult; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != "CATCHED_EXCEPTION" || h.value != "OK_NON_LOCAL, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - h = Holder() - val test01 = test01(h) - if (test01 != "OK_EXCEPTION1" || h.value != "OK_NON_LOCAL, OK_EXCEPTION1, OK_FINALLY") return "test01: ${test01}, holder: ${h.value}" - - h = Holder() - val test02 = test02(h) - if (test02 != "OK_EXCEPTION2" || h.value != "OK_NON_LOCAL, OK_EXCEPTION2, OK_FINALLY") return "test02: ${test02}, holder: ${h.value}" - - - h = Holder() - val test1 = test1(h) - if (test1 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION1, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION1, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - - h = Holder() - val test3 = test3(h) - if (test3 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION2, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION2, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - h = Holder() - val test5 = test5(h) - if (test5 != "OK_EXCEPTION2" || h.value != "OK_LOCAL, OK_EXCEPTION2, OK_FINALLY") return "test5: ${test5}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/simpleThrow.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/simpleThrow.kt deleted file mode 100644 index c0c910216b8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/simpleThrow.kt +++ /dev/null @@ -1,213 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - return res -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "Fail") - - return localResult; -} - -fun test1(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw RuntimeException() - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "OK") - - return localResult; -} - -fun test2(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL") - - return localResult; -} - -fun test3(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, "FAIL") - - return localResult; -} - -fun test4(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }, "FAIL") - - return localResult; -} - -fun test5(h: Holder): String { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - if (true) { - throw RuntimeException() - } - h.value += "fail" - - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - return "OK_FINALLY" - }, "FAIL") - - return localResult; -} - - -fun test6(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_NONLOCAL" - if (true) { - throw RuntimeException() - } - h.value += "fail" - return "OK_NONLOCAL" - }, - { - h.value += ", OK_EXCEPTION" - if (true) { - throw RuntimeException() - } - h.value += "fail" - - return "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }, - "FAIL1") - } catch (e: Exception) { - return "OK" - } - - return "FAIL2"; -} - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != "OK_LOCAL" || h.value != "OK_LOCAL, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - - h = Holder() - val test1 = test1(h) - if (test1 != "OK" || h.value != "OK_LOCAL, OK_EXCEPTION, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_NONLOCAL" || h.value != "OK_NONLOCAL, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - h = Holder() - val test3 = test3(h) - if (test3 != "OK_EXCEPTION" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - h = Holder() - val test5 = test5(h) - if (test5 != "OK_FINALLY" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test5: ${test5}, holder: ${h.value}" - - h = Holder() - val test6 = test6(h) - if (test6 != "OK" || h.value != "OK_NONLOCAL, OK_EXCEPTION, OK_FINALLY") return "test6: ${test6}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/synchonized.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/synchonized.kt deleted file mode 100644 index 40ecb0de2d4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/synchonized.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun mysynchronized(lock: Any, block: () -> R): R { - try { - return block() - } - finally { - //do nothing - 1 - } -} - -// FILE: 2.kt - -import test.* - -fun call(): String { - return nonLocal() -} - -inline fun nonLocal(): String { - mysynchronized("__LOCK__") { - return "nonLocal" - } - return "local" -} - -fun box(): String { - val call = call() - if (call != "nonLocal") return "fail $call" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/throwInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/throwInFinally.kt deleted file mode 100644 index 5ec79bdf657..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/throwInFinally.kt +++ /dev/null @@ -1,195 +0,0 @@ -// FILE: 1.kt - -package test - -public inline fun doCall(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - return finallyBlock() - } -} - -public inline fun doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R) : R { - try { - return block() - } catch (e: Exception) { - exception(e) - } finally { - finallyBlock() - } - throw RuntimeException("fail") -} - -// FILE: 2.kt - -import test.* - -class Holder { - var value: String = "" -} - -fun test0(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_NON_LOCAL" - return "OK_NON_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }) - - return localResult; - } catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test1(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw RuntimeException("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }) - } catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test2(h: Holder): String { - - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw RuntimeException() - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - - return localResult; -} - -fun test3(h: Holder): String { - try { - val localResult = doCall ( - { - h.value += "OK_LOCAL" - throw RuntimeException("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - throw RuntimeException("FAIL_EX") - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - throw RuntimeException("FINALLY") - "OK_FINALLY" - }) - } catch (e: RuntimeException) { - if (e.message != "FINALLY") { - return "FAIL in exception: " + e.message - } else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - -fun test4(h: Holder): String { - try { - val localResult = doCall2 ( - { - h.value += "OK_LOCAL" - throw RuntimeException("FAIL") - "OK_LOCAL" - }, - { - h.value += ", OK_EXCEPTION" - throw RuntimeException("EXCEPTION") - "OK_EXCEPTION" - }, - { - h.value += ", OK_FINALLY" - "OK_FINALLY" - }) - } catch (e: RuntimeException) { - if (e.message != "EXCEPTION") { - return "FAIL in exception: " + e.message - } else { - return "CATCHED_EXCEPTION" - } - } - - return "FAIL"; -} - - - - -fun box(): String { - var h = Holder() - val test0 = test0(h) - if (test0 != "CATCHED_EXCEPTION" || h.value != "OK_NON_LOCAL, OK_FINALLY") return "test0: ${test0}, holder: ${h.value}" - - - h = Holder() - val test1 = test1(h) - if (test1 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION, OK_FINALLY") return "test1: ${test1}, holder: ${h.value}" - - h = Holder() - val test2 = test2(h) - if (test2 != "OK_FINALLY" || h.value != "OK_LOCAL, OK_EXCEPTION, OK_FINALLY") return "test2: ${test2}, holder: ${h.value}" - - - h = Holder() - val test3 = test3(h) - if (test3 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION, OK_FINALLY") return "test3: ${test3}, holder: ${h.value}" - - h = Holder() - val test4 = test4(h) - if (test4 != "CATCHED_EXCEPTION" || h.value != "OK_LOCAL, OK_EXCEPTION, OK_FINALLY") return "test4: ${test4}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/tryCatchInFinally.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/tryCatchInFinally.kt deleted file mode 100644 index f263407c3d2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/exceptionTable/tryCatchInFinally.kt +++ /dev/null @@ -1,90 +0,0 @@ -// FILE: 1.kt - -package test - -public class Holder(var value: String = "") { - - operator fun plusAssign(s: String?) { - if (value.length != 0) { - value += " -> " - } - value += s - } - - override fun toString(): String { - return value - } - -} - -public class Exception1(message: String) : RuntimeException(message) - -public class Exception2(message: String) : RuntimeException(message) - -public inline fun doCall(block: ()-> String, finallyBlock: ()-> String, - tryBlock2: ()-> String, catchBlock2: ()-> String, res: String = "Fail") : String { - try { - block() - } - finally { - finallyBlock() - try { - tryBlock2() - } catch (e: Exception) { - catchBlock2() - } - } - return res -} - -// FILE: 2.kt - -import test.* - - -fun test0( - h: Holder, - throwExternalFinEx1: Boolean = false, - res: String = "Fail" -): String { - try { - val localResult = doCall ( - { - h += "OK_NON_LOCAL" - return "OK_NON_LOCAL" - }, - { - h += "OK_FINALLY1" - "OK_FINALLY1" - }, - { - h += "innerTryBlock" - if (throwExternalFinEx1) { - throw Exception1("EXCEPTION_IN_EXTERNAL_FINALLY") - } - "innerTryBlock" - }, - { - h += "CATCHBLOCK" - "CATCHBLOCK" - }, - res) - return localResult; - } catch(e: Exception1) { - return e.message!! - } catch(e: Exception2) { - return e.message!! - } -} - -fun box(): String { - var h = Holder() - var test0 = test0(h, res = "OK") - if (test0 != "OK_NON_LOCAL" || h.value != "OK_NON_LOCAL -> OK_FINALLY1 -> innerTryBlock") return "test0_1: ${test0}, holder: ${h.value}" - - h = Holder() - test0 = test0(h, throwExternalFinEx1 = true, res = "OK") - if (test0 != "OK_NON_LOCAL" || h.value != "OK_NON_LOCAL -> OK_FINALLY1 -> innerTryBlock -> CATCHBLOCK") return "test0_2: ${test0}, holder: ${h.value}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt6956.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt6956.kt deleted file mode 100644 index 230950ad26c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt6956.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun baz(x: Int) {} - -inline fun foo(action: () -> T): T { - baz(0) - try { - return action() - } finally { - baz(1) - } -} - -// FILE: 2.kt - -import test.* - -inline fun bar(arg: String, action: () -> T) { - try { - action() - } finally { - arg.length - } -} - -fun box(): String { - foo() { - bar("") { - return "OK" - } - } - - return "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt7273.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt7273.kt deleted file mode 100644 index c5fa8d206bb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/kt7273.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -inline fun test(s: () -> R): R { - var b = false - try { - return s() - } finally { - !b - } -} - -// FILE: 2.kt - -fun box(): String { - try { - test { - return@box "OK" - } - } finally { - } - - return "fail" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromCatchBlock.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromCatchBlock.kt deleted file mode 100644 index 240ec77b316..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromCatchBlock.kt +++ /dev/null @@ -1,54 +0,0 @@ -// MODULE: lib -// FILE: lib.kt - -package utils - -inline fun foo(a: Int) { - bar(a) -} - -inline fun bar(a: Int) { - try { - if (a > 0) throw Exception() - log("foo($a) #1") - } - catch (e: Exception) { - myRun { - log("foo($a) #2") - if (a > 1) return - log("foo($a) #3") - } - } - log("foo($a) #4") -} - -var LOG: String = "" - -fun log(s: String): String { - LOG += s + ";" - return LOG -} - -inline fun myRun(f: () -> Unit) = f() - - -// MODULE: main(lib) -// FILE: main.kt - -import utils.* - -fun box(): String { - foo(0) - if (LOG != "foo(0) #1;foo(0) #4;") return "fail1: $LOG" - LOG = "" - - foo(1) - if (LOG != "foo(1) #2;foo(1) #3;foo(1) #4;") return "fail2: $LOG" - LOG = "" - - foo(2) - if (LOG != "foo(2) #2;") return "fail3: $LOG" - LOG = "" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromOuterLambda.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromOuterLambda.kt deleted file mode 100644 index 90ad2de9c7c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnFromOuterLambda.kt +++ /dev/null @@ -1,81 +0,0 @@ -// FILE: 1.kt - -package test - -fun a(b: () -> String) : String { - return b() -} - -inline fun test(l: () -> String): String { - return l() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* - -fun test1(): String { - return a { - try { - test { - return@a "OK" - } - } - finally { - - } - } -} - -fun test2(): String { - - return test z@ { - try { - return@z "OK" - } - finally { - - } - } - -} - -fun test3(): String { - return test { - try { - return@test "OK" - } - finally { - - } - } -} - - -fun test4(): String { - return a z@ { - try { - test { - return@z "OK" - } - } - finally { - - } - } -} - - -fun box(): String { - if (test1() != "OK") return "fail 1: ${test1()}" - - if (test2() != "OK") return "fail 2: ${test2()}" - - if (test3() != "OK") return "fail 3: ${test3()}" - - if (test4() != "OK") return "fail 4: ${test4()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnToCatchBlock.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnToCatchBlock.kt deleted file mode 100644 index 319213c08c8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/nonLocalReturnToCatchBlock.kt +++ /dev/null @@ -1,51 +0,0 @@ -// MODULE: lib -// FILE: lib.kt - -package utils - -inline fun foo(a: Int) { - try { - if (a > 0) throw Exception() - log("foo($a)") - } - catch (e: Exception) { - bar(a) - } -} - -inline fun bar(a: Int) { - myRun { - log("bar($a) #1") - if (a == 2) return - log("bar($a) #2") - } -} - -var LOG: String = "" - -fun log(s: String): String { - LOG += s + ";" - return LOG -} - -inline fun myRun(f: () -> Unit) = f() - -// MODULE: main(lib) -// FILE: main.kt - -import utils.* - -fun box(): String { - foo(0) - if (LOG != "foo(0);") return "fail1: $LOG" - LOG = "" - - foo(1) - if (LOG != "bar(1) #1;bar(1) #2;") return "fail2: $LOG" - LOG = "" - - foo(2) - if (LOG != "bar(2) #1;") return "fail3: $LOG" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/variables/kt7792.kt b/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/variables/kt7792.kt deleted file mode 100644 index 8849e4c20a2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/nonLocalReturns/tryFinally/variables/kt7792.kt +++ /dev/null @@ -1,59 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun mySynchronized(lock: Any, block: () -> R): R { - monitorCall(lock) - try { - return block() - } - finally { - monitorCall(lock) - } -} - -fun monitorCall(lock: Any) { - -} - -// FILE: 2.kt - -import test.* - -public class ClassA { - val LOCK = "__LOCK__" - - var result = "fail" - - fun test(name1: String?, name2: String, cond: Boolean) { - mySynchronized (LOCK) { - var name = name1 - - if (name == null) { - if (cond) { - result = "NLR" + name2 - return - } - - name = name2 - } - - result = name + name2 - - val length = name.length - } - } -} - -fun box(): String { - val classA = ClassA() - classA.test(null, "2", true) - if (classA.result != "NLR2") return "fail 1: ${classA.result}" - - classA.test(null, "K", false) - if (classA.result != "KK") return "fail 1: ${classA.result}" - - - classA.test("O", "K", false) - return classA.result -} diff --git a/backend.native/tests/external/codegen/boxInline/optimizations/kt20844.kt b/backend.native/tests/external/codegen/boxInline/optimizations/kt20844.kt deleted file mode 100644 index 7775771039c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/optimizations/kt20844.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt -//WITH_RUNTIME -package test - -data class Address( - val createdTimeMs: Long = 0, - val firstName: String = "", - val lastName: String = "" -) - -inline fun String.switchIfEmpty(provider: () -> String): String { - return if (isEmpty()) provider() else this -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val address = Address() - val result = address.copy( - firstName = address.firstName.switchIfEmpty { "O" }, - lastName = address.lastName.switchIfEmpty { "K" } - ) - - return result.firstName + result.lastName -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/private/accessorForConst.kt b/backend.native/tests/external/codegen/boxInline/private/accessorForConst.kt deleted file mode 100644 index 9d057efdda5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/accessorForConst.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -class IntentionsBundle { - companion object { - internal inline fun message(): String { - return KEY + BUNDLE - } - - private const val BUNDLE = "K" - protected const val KEY = "O" - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return IntentionsBundle.message() -} diff --git a/backend.native/tests/external/codegen/boxInline/private/accessorStability.kt b/backend.native/tests/external/codegen/boxInline/private/accessorStability.kt deleted file mode 100644 index 152d6215a45..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/accessorStability.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -fun call() = inlineFun2 { stub()} - -internal inline fun inlineFun2(p: () -> Unit): String { - p() - - return inlineFun { - test() - } -} - -private fun stub() = "fail" - -private fun test() = "OK" - -inline internal fun inlineFun(p: () -> String): String { - return p() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return call() -} diff --git a/backend.native/tests/external/codegen/boxInline/private/accessorStabilityInClass.kt b/backend.native/tests/external/codegen/boxInline/private/accessorStabilityInClass.kt deleted file mode 100644 index f57b2f26be4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/accessorStabilityInClass.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt - -package test - -class A { - fun call() = inlineFun2 { stub() } - - internal inline fun inlineFun2(p: () -> Unit): String { - p() - - return inlineFun { - test() - } - } - - private fun stub() = "fail" - - private fun test() = "OK" - - - inline internal fun inlineFun(p: () -> String): String { - return p() - } - -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return A().call() -} diff --git a/backend.native/tests/external/codegen/boxInline/private/effectivePrivate.kt b/backend.native/tests/external/codegen/boxInline/private/effectivePrivate.kt deleted file mode 100644 index c177e30a453..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/effectivePrivate.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: 1.kt - -package test - -class Test { - private abstract class Base { - protected fun duplicate(s: String) = s + "K" - - protected inline fun doInline(block: () -> String): String { - return duplicate(block()) - } - } - - private class Extender: Base() { - fun doSomething(): String { - return doInline { "O" } - } - } - - fun run(): String { - return Extender().doSomething(); - } -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - return Test().run() -} diff --git a/backend.native/tests/external/codegen/boxInline/private/kt6453.kt b/backend.native/tests/external/codegen/boxInline/private/kt6453.kt deleted file mode 100644 index 1714c3ebcbf..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/kt6453.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt - -package test - -class A() { - private val x = "OK" - internal inline fun foo(p: (String) -> Unit) { - p(x) - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var r = "fail" - A().foo { r = it } - return r -} diff --git a/backend.native/tests/external/codegen/boxInline/private/kt8094.kt b/backend.native/tests/external/codegen/boxInline/private/kt8094.kt deleted file mode 100644 index ef22ca47d34..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/kt8094.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -package test - -object X { - private fun f() { } - - internal inline fun g(x: () -> Unit) { - x() - f() - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var r = "fail" - X.g { r = "OK" } - - return r; -} diff --git a/backend.native/tests/external/codegen/boxInline/private/kt8095.kt b/backend.native/tests/external/codegen/boxInline/private/kt8095.kt deleted file mode 100644 index 3cd6ed10474..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/kt8095.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -class C(private val a : String) { - internal inline fun g(x: (s: String) -> Unit) { - x(a) - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var r = "fail" - C("OK").g { r = it } - return r -} diff --git a/backend.native/tests/external/codegen/boxInline/private/nestedInPrivateClass.kt b/backend.native/tests/external/codegen/boxInline/private/nestedInPrivateClass.kt deleted file mode 100644 index 13bc819cd1a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/nestedInPrivateClass.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt - -package test - -private class S public constructor() { - class Z { - fun a(): String { - return "K" - } - } -} -// This function exposes S.Z which is a class nested into a private class S (package-private in the byte code) -// It can be accessed outside the `test` package now that S.Z. is public in the byte code, but it may be changed later -internal inline fun call(s: () -> String): String { - return s() + test().a() -} - -private fun test(): S.Z { - return S.Z() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return call { - "O" - } -} diff --git a/backend.native/tests/external/codegen/boxInline/private/privateClass.kt b/backend.native/tests/external/codegen/boxInline/private/privateClass.kt deleted file mode 100644 index 4ffa7890dda..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/privateClass.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -private class S { - fun a(): String { - return "K" - } -} - -// This function exposes S which is a private class (package-private in the byte code) -// It can be accessed outside the `test` package, which may lead to IllegalAccessError. -// This behavior may be changed later -internal inline fun call(s: () -> String): String { - val s = test() - return s() + test2(s) -} - -private fun test(): S { - return S() -} - -private fun test2(s: S): String { - return s.a() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return call { - "O" - } -} diff --git a/backend.native/tests/external/codegen/boxInline/private/privateClassExtensionLambda.kt b/backend.native/tests/external/codegen/boxInline/private/privateClassExtensionLambda.kt deleted file mode 100644 index 03a5c694d58..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/privateClassExtensionLambda.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -private class S { - fun a(): String { - return "K" - } - - // This function exposes S which is a private class (package-private in the byte code) - // It can be accessed outside the `test` package, which may lead to IllegalAccessError. - // This behavior may be changed later - internal inline fun call(s: S.() -> String): String { - return call2(s) - } -} - -@Suppress("PRIVATE_CLASS_MEMBER_FROM_INLINE", "EXPOSED_PARAMETER_TYPE", "EXPOSED_RECEIVER_TYPE") -internal inline fun S.call2(s: S.() -> String): String { - return s() + a() -} - -internal fun call(): String { - return S().call { - "O" - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return call() -} diff --git a/backend.native/tests/external/codegen/boxInline/private/privateInInlineInMultiFileFacade.kt b/backend.native/tests/external/codegen/boxInline/private/privateInInlineInMultiFileFacade.kt deleted file mode 100644 index c62ead81dfc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/privateInInlineInMultiFileFacade.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME -@file:kotlin.jvm.JvmMultifileClass -@file:kotlin.jvm.JvmName("TestKt") -package test - -private val prop = "O" - -private fun test() = "K" - -inline internal fun inlineFun(): String { - return prop + test() -} - -class A () { - fun call() = inlineFun() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return A().call(); -} diff --git a/backend.native/tests/external/codegen/boxInline/private/privateInline.kt b/backend.native/tests/external/codegen/boxInline/private/privateInline.kt deleted file mode 100644 index 13c632f2e17..00000000000 --- a/backend.native/tests/external/codegen/boxInline/private/privateInline.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -private val prop = "O" - -private fun test() = "K" - -inline internal fun inlineFun(): String { - return prop + test() -} - -class A () { - fun call() = inlineFun() -} - -// FILE: 2.kt - -import test.* -fun box(): String { - return A().call(); -} diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndInc.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndInc.kt deleted file mode 100644 index ca1708d8003..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndInc.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt -package test - -var result = 1 - -inline var z: Int - get() = result - set(value) { - result = value - } - -// FILE: 2.kt -import test.* - -fun box(): String { - z += 1 - if (z != 2) return "fail 1: $z" - - var p = z++ - if (result != 3) return "fail 2: $result" - if (p != 2) return "fail 3: $p" - - p = ++z - if (result != 4) return "fail 4: $result" - if (p != 4) return "fail 5: $p" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClass.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClass.kt deleted file mode 100644 index 036922d341c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClass.kt +++ /dev/null @@ -1,32 +0,0 @@ -// FILE: 1.kt -package test - -class A { - var result = 1 - - inline var z: Int - get() = result - set(value) { - result = value - } - -} - -// FILE: 2.kt -import test.* - -fun box(): String { - val a = A() - a.z += 1 - if (a.z != 2) return "fail 1: $a.z" - - var p = a.z++ - if (a.z != 3) return "fail 2: $a.z" - if (p != 2) return "fail 3: $p" - - p = ++a.z - if (a.z != 4) return "fail 4: $a.z" - if (p != 4) return "fail 5: $p" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClassViaConvention.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClassViaConvention.kt deleted file mode 100644 index 502ba5a9892..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncInClassViaConvention.kt +++ /dev/null @@ -1,42 +0,0 @@ -// FILE: 1.kt -package test - -class Test(var result: Int) - -class A { - var result = Test(1) - - inline var z: Test - get() = result - set(value) { - result = value - } -} - -operator fun Test.plus(p: Int): Test { - return Test(result + p) -} - -operator fun Test.inc(): Test { - return Test(result + 1) -} - -// FILE: 2.kt -import test.* - -fun box(): String { - val a = A() - a.z = Test(1) - a.z += 1 - if (a.result.result != 2) return "fail 1: ${a.result.result}" - - var p = a.z++ - if (a.result.result != 3) return "fail 2: ${a.result.result}" - if (p.result != 2) return "fail 3: ${p.result}" - - p = ++a.z - if (a.result.result != 4) return "fail 4: ${a.result.result}" - if (p.result != 4) return "fail 5: ${p.result}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtension.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtension.kt deleted file mode 100644 index 9b8cda27406..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtension.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt -package test - -var result = 1 - -inline var Int.z: Int - get() = result - set(value) { - result = value + this - } - -// FILE: 2.kt -import test.* - -fun box(): String { - 1.z += 0 - if (result != 2) return "fail 1: $result" - - var p = 1.z++ - if (result != 4) return "fail 2: $result" - if (p != 2) return "fail 3: $p" - - p = ++1.z - if (result != 6) return "fail 4: $result" - if (p != 6) return "fail 5: $p" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtensionInClass.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtensionInClass.kt deleted file mode 100644 index 1bc3daafeea..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncOnExtensionInClass.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt -package test - -class A { - var result = 1 - - inline var Int.z: Int - get() = result - set(value) { - result = value + this - } - -} - -// FILE: 2.kt -import test.* - - -fun box(): String { - with(A()) { - 1.z += 0 - if (1.z != 2) return "fail 1: $result" - - var p = 1.z++ - if (1.z != 4) return "fail 2: $result" - if (p != 2) return "fail 3: $p" - - p = ++1.z - if (1.z != 6) return "fail 4: $result" - if (p != 6) return "fail 5: $p" - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt b/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt deleted file mode 100644 index b02eef4c149..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt -package test - -class Test(var result: Int) - -var result = Test(1) - -inline var z: Test - get() = result - set(value) { - result = value - } - -operator fun Test.plus(p: Int): Test { - return Test(result + p) -} - -operator fun Test.inc(): Test { - return Test(result + 1) -} - -// FILE: 2.kt -import test.* - -fun box(): String { - z = Test(1) - z += 1 - if (result.result != 2) return "fail 1: ${result.result}" - - var p = z++ - if (result.result != 3) return "fail 2: ${result.result}" - if (p.result != 2) return "fail 3: ${p.result}" - - p = ++z - if (result.result != 4) return "fail 4: ${result.result}" - if (p.result != 4) return "fail 5: ${p.result}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/property.kt b/backend.native/tests/external/codegen/boxInline/property/property.kt deleted file mode 100644 index 3265987a72b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/property.kt +++ /dev/null @@ -1,162 +0,0 @@ -// PROPERTY_NOT_USED: p1 -// PROPERTY_NOT_READ_FROM: p2 -// PROPERTY_NOT_WRITTEN_TO: p3 -// CHECK_NOT_CALLED: get_p4 -// CHECK_NOT_CALLED: set_p4 -// CHECK_NOT_CALLED: get_p5 -// CHECK_NOT_CALLED: set_p6 -// PROPERTY_NOT_USED: p7 -// PROPERTY_NOT_READ_FROM: p8 -// PROPERTY_NOT_WRITTEN_TO: p9 -// CHECK_NOT_CALLED: get_p10_s8ev3o$ -// CHECK_NOT_CALLED: set_p10_rksjo2$ -// CHECK_NOT_CALLED: get_p11_s8ev3o$ -// CHECK_NOT_CALLED: set_p12_rksjo2$ -// CHECK_NOT_CALLED: get_p13 -// CHECK_NOT_CALLED: set_p13 -// CHECK_NOT_CALLED: get_p14 -// CHECK_NOT_CALLED: set_p15 - -// FILE: 1.kt -package test - -var a = 0 - -inline var p1: Int - get() = a + 10000 - set(v: Int) { - a = v + 100 - } - -var p2: Int - inline get() = a + 20000 - set(v: Int) { - a = v + 200 - } - -var p3: Int - get() = a + 30000 - inline set(v: Int) { - a = v + 300 - } - -inline var Int.p4: Int - get() = this * 100 + a + 40000 - set(v: Int) { - a = this + v + 400 - } - -var Int.p5: Int - inline get() = this * 100 + a + 50000 - set(v: Int) { - a = this + v + 500 - } - -var Int.p6: Int - get() = this * 100 + a + 60000 - inline set(v: Int) { - a = this + v + 600 - } - -class A { - inline var p7: Int - get() = a + 70000 - set(v: Int) { - a = v + 700 - } - - var p8: Int - inline get() = a + 80000 - set(v: Int) { - a = v + 800 - } - - var p9: Int - get() = a + 90000 - inline set(v: Int) { - a = v + 900 - } - - inline var Int.p10: Int - get() = this * 100 + a + 100000 - set(v: Int) { - a = this + v + 1000 - } - - var Int.p11: Int - inline get() = this * 100 + a + 110000 - set(v: Int) { - a = this + v + 1100 - } - - var Int.p12: Int - get() = this * 100 + a + 120000 - inline set(v: Int) { - a = this + v + 1200 - } -} - -inline var A.p13: Int - get() = a + 130000 - set(v: Int) { - a = v + 1300 - } - -var A.p14: Int - inline get() = a + 140000 - set(v: Int) { - a = v + 1400 - } - -var A.p15: Int - get() = a + 150000 - inline set(v: Int) { - a = v + 1500 - } - -// FILE: 2.kt -import test.* - -fun box(): String { - p1 = 1 - if (p1 != 10101) return "test1: $p1" - p2 = 2 - if (p2 != 20202) return "test2: $p2" - p3 = 3 - if (p3 != 30303) return "test3: $p3" - - 4000000.p4 = 4 - if (4000000.p4 != 404040404) return "test4: ${4000000.p4}" - 5000000.p5 = 5 - if (5000000.p5 != 505050505) return "test5: ${5000000.p5}" - 6000000.p6 = 6 - if (6000000.p6 != 606060606) return "test6: ${6000000.p6}" - - - val a = A() - - a.p7 = 7 - if (a.p7 != 70707) return "test7: ${a.p7}" - a.p8 = 8 - if (a.p8 != 80808) return "test8: ${a.p8}" - a.p9 = 9 - if (a.p9 != 90909) return "test9: ${a.p9}" - - with (a) { - 10000000.p10 = 10 - if (10000000.p10 != 1010101010) return "test10: ${10000000.p10}" - 11000000.p11 = 11 - if (11000000.p11 != 1111111111) return "test11: ${11000000.p11}" - 12000000.p12 = 12 - if (12000000.p12 != 1212121212) return "test12: ${12000000.p12}" - } - - a.p13 = 13 - if (a.p13 != 131313) return "test13: ${a.p13}" - a.p14 = 14 - if (a.p14 != 141414) return "test14: ${a.p14}" - a.p15 = 15 - if (a.p15 != 151515) return "test15: ${a.p15}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/reifiedVal.kt b/backend.native/tests/external/codegen/boxInline/property/reifiedVal.kt deleted file mode 100644 index f88d11b18fc..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/reifiedVal.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME -// WITH_REFLECT -// FILE: 1.kt -package test - -inline val T.value: String - get() = T::class.simpleName!! - -// FILE: 2.kt -import test.* - -class OK - -fun box(): String { - return OK().value ?: "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/reifiedVar.kt b/backend.native/tests/external/codegen/boxInline/property/reifiedVar.kt deleted file mode 100644 index ace575f220f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/reifiedVar.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_REFLECT -// FILE: 1.kt -package test - -var bvalue: String = "" - -inline var T.value: String - get() = T::class.simpleName!! + bvalue - set(p: String) { - bvalue = p - } - -// FILE: 2.kt -import test.* - -class O - -fun box(): String { - val o = O() - val value1 = o.value - if (value1 != "O") return "fail 1: $value1" - - o.value = "K" - return o.value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/simple.kt b/backend.native/tests/external/codegen/boxInline/property/simple.kt deleted file mode 100644 index c8a6f4dff07..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/simple.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -package test - -var value: Int = 0 - -inline var z: Int - get() = ++value - set(p: Int) { value = p } - -// FILE: 2.kt -import test.* - -fun box(): String { - val v = z - if (value != 1) return "fail 1: $value" - - z = v + 2 - - if (value != 3) return "fail 2: $value" - var p = z - - if (value != 4) return "fail 3: $value" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/property/simpleExtension.kt b/backend.native/tests/external/codegen/boxInline/property/simpleExtension.kt deleted file mode 100644 index 5a9db92386c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/property/simpleExtension.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -package test - -var value: Int = 0 - -inline var Int.z: Int - get() = this + ++value - set(p: Int) { value = p + this} - -// FILE: 2.kt -import test.* - -fun box(): String { - val v = 11.z - if (v != 12) return "fail 1: $v" - - 11.z = v + 2 - - if (value != 25) return "fail 2: $value" - var p = 11.z - - if (p != 37) return "fail 3: $p" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/reified/capturedLambda.kt b/backend.native/tests/external/codegen/boxInline/reified/capturedLambda.kt deleted file mode 100644 index baab480f19f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/capturedLambda.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun foo() = bar() {"OK"} -inline fun bar(crossinline y: () -> String) = { - null is E - run(y) -} - -public inline fun call(f: () -> T): T = f() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -val x: () -> String = foo() - -fun box(): String { - return x() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/capturedLambda2.kt b/backend.native/tests/external/codegen/boxInline/reified/capturedLambda2.kt deleted file mode 100644 index dcc09a82265..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/capturedLambda2.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt -// WITH_REFLECT -package test - -inline fun bar(crossinline tasksFactory: () -> T) = { - null is R - run(tasksFactory) -} - -public inline fun call(f: () -> T): T = f() - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -inline fun foo() = bar() {"OK"} - -fun box(): String { - return foo()() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/chain.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/chain.kt deleted file mode 100644 index b9078dc2809..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/chain.kt +++ /dev/null @@ -1,51 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -class A -class B - -inline fun Any?.foo(): T = this as T - -inline fun Any?.foo2(): Y? = foo() - -inline fun Any?.foo3(): Z? = foo2() - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo3() != null) return "fail 1" - if (null.foo3() != null) return "fail 2" - - if (null.foo3() != null) return "fail 3" - if (null.foo3() != null) return "fail 4" - - val a = A() - - if (a.foo3() != a) return "fail 5" - if (a.foo3() != a) return "fail 6" - - if (a.foo3() != a) return "fail 7" - if (a.foo3() != a) return "fail 8" - - val b = B() - - failClassCast { b.foo3(); return "failTypeCast 9" } - failClassCast { b.foo3(); return "failTypeCast 10" } - - return "OK" -} - -inline fun failClassCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - throw e - } - catch (e: ClassCastException) { - - } -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/kt8043.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/kt8043.kt deleted file mode 100644 index 7e4425eff4d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/kt8043.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun T.castTo(): R = this as R - -// FILE: 2.kt - -import test.* - -fun case1(): Int = - null.castTo() - -fun box(): String { - failTypeCast { case1(); return "failTypeCast 9" } - return "OK" -} - -inline fun failTypeCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - - } -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/maxStack.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/maxStack.kt deleted file mode 100644 index 6854bef017e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/maxStack.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -class A - -fun call(a: String, b: String, c: String, d: String, e: String, f: Any) { - -} - -inline fun Any?.foo(): T { - call("1", "2", "3", "4", "5", this as T) - return this as T -} - -// FILE: 2.kt - -import test.* - - - -fun box(): String { - val a = A() - if (a.foo() != a) return "failTypeCast 5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/nullable.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/nullable.kt deleted file mode 100644 index 53bc4865eb4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/nullable.kt +++ /dev/null @@ -1,56 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -class A -class B - -inline fun Any?.foo(): T? = this as T? - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo() != null) return "failTypeCast 1" - if (null.foo() != null) return "failTypeCast 2" - - if (null.foo() != null) return "failTypeCast 3" - if (null.foo() != null) return "failTypeCast 4" - - val a = A() - - if (a.foo() != a) return "failTypeCast 5" - if (a.foo() != a) return "failTypeCast 6" - - if (a.foo() != a) return "failTypeCast 7" - if (a.foo() != a) return "failTypeCast 8" - - val b = B() - - failClassCast { b.foo(); return "failTypeCast 9" } - failClassCast { b.foo(); return "failTypeCast 10" } - - return "OK" -} - -inline fun failTypeCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - - } -} - -inline fun failClassCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - throw e - } - catch (e: ClassCastException) { - - } -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/simple.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/simple.kt deleted file mode 100644 index 34008fd0b49..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/simple.kt +++ /dev/null @@ -1,56 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -class A -class B - -inline fun Any?.foo(): T = this as T - -// FILE: 2.kt - -import test.* - -fun box(): String { - failTypeCast { null.foo(); return "failTypeCast 1" } - if (null.foo() != null) return "failTypeCast 2" - - failTypeCast { null.foo(); return "failTypeCast 3" } - if (null.foo() != null) return "failTypeCast 4" - - val a = A() - - if (a.foo() != a) return "failTypeCast 5" - if (a.foo() != a) return "failTypeCast 6" - - if (a.foo() != a) return "failTypeCast 7" - if (a.foo() != a) return "failTypeCast 8" - - val b = B() - - failClassCast { b.foo(); return "failTypeCast 9" } - failClassCast { b.foo(); return "failTypeCast 10" } - - return "OK" -} - -inline fun failTypeCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - - } -} - -inline fun failClassCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - throw e - } - catch (e: ClassCastException) { - - } -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/checkCast/simpleSafe.kt b/backend.native/tests/external/codegen/boxInline/reified/checkCast/simpleSafe.kt deleted file mode 100644 index 14a08dcf82d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/checkCast/simpleSafe.kt +++ /dev/null @@ -1,56 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -class A -class B - -inline fun Any?.foo(): T? = this as? T - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo() != null) return "failTypeCast 1" - if (null.foo() != null) return "failTypeCast 2" - - if (null.foo() != null) return "failTypeCast 3" - if (null.foo() != null) return "failTypeCast 4" - - val a = A() - - if (a.foo() != a) return "failTypeCast 5" - if (a.foo() != a) return "failTypeCast 6" - - if (a.foo() != a) return "failTypeCast 7" - if (a.foo() != a) return "failTypeCast 8" - - val b = B() - - if (b.foo() != null) return "fail 9" - if (b.foo() != null) return "fail 10" - - return "OK" -} - -inline fun failTypeCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - - } -} - -inline fun failClassCast(s: () -> Unit) { - try { - s() - } - catch (e: TypeCastException) { - throw e - } - catch (e: ClassCastException) { - - } -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/chain.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/chain.kt deleted file mode 100644 index 21e8f69b22b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/chain.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -class OK -class FAIL - -inline fun inlineFun(lambda: () -> String = { T::class.java.simpleName }): String { - return lambda() -} - -inline fun inlineFun2(): String { - return inlineFun() -} - -// FILE: 2.kt - -import test.* - - - -fun box(): String { - return inlineFun2() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested.kt deleted file mode 100644 index 06706217ad3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -inline fun inlineFun(p: String, lambda: () -> String = { { p + T::class.java.simpleName } () }): String { - return lambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -class K - -fun box(): String { - return inlineFun("O") -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2.kt deleted file mode 100644 index f7c24a3edbb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -inline fun inlineFun (p: String, crossinline lambda: () -> String = { { p + T::class.java.simpleName } () }): String { - return { - lambda() - } () -} - -// FILE: 2.kt - -import test.* - -class K - -fun box(): String { - return inlineFun("O") -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2Static.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2Static.kt deleted file mode 100644 index 71fc9cb09b2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nested2Static.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -inline fun inlineFun(crossinline lambda: () -> String = { { T::class.java.simpleName } () }): String { - return { - lambda() - } () -} - -// FILE: 2.kt - -import test.* - -class OK - -fun box(): String { - return inlineFun() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nestedStatic.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nestedStatic.kt deleted file mode 100644 index 2749745e5eb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/nestedStatic.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -inline fun inlineFun(lambda: () -> String = { { T::class.java.simpleName } () }): String { - return lambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -class OK - -fun box(): String { - return inlineFun() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/simple.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/simple.kt deleted file mode 100644 index 82d5b44137f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/simple.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -inline fun inlineFun(lambda: () -> String = { T::class.java.simpleName }): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -class OK - -fun box(): String { - return inlineFun() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChain.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChain.kt deleted file mode 100644 index ded2dd12714..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChain.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -class K - -inline fun inlineFun(p: String, lambda: () -> String = { p + T::class.java.simpleName }): String { - return lambda() -} - -inline fun inlineFun2(p: String): String { - return inlineFun(p) -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun2("O") -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChainStatic.kt b/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChainStatic.kt deleted file mode 100644 index c725569f44f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/defaultLambda/transitiveChainStatic.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -//WITH_RUNTIME -package test - -class OK -class FAIL - -inline fun inlineFun(lambda: () -> String = { T::class.java.simpleName }): String { - return lambda() -} - -inline fun inlineFun2(): String { - return inlineFun() -} - -// FILE: 2.kt - -import test.* - - - -fun box(): String { - return inlineFun2() -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/isCheck/chain.kt b/backend.native/tests/external/codegen/boxInline/reified/isCheck/chain.kt deleted file mode 100644 index ae13d3c44ae..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/isCheck/chain.kt +++ /dev/null @@ -1,39 +0,0 @@ -// FILE: 1.kt - -package test - -class A -class B - -inline fun Any?.foo() = this is T - -inline fun Any?.foo2() = foo() - -inline fun Any?.foo3() = foo2() - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo3() != true) return "fail 1" - if (null.foo3() != true) return "fail 2" - - if (null.foo3() != true) return "fail 3" - if (null.foo3() != true) return "fail 4" - - val a = A() - - if (a.foo3() != true) return "fail 5" - if (a.foo3() != true) return "fail 6" - - if (a.foo3() != true) return "fail 7" - if (a.foo3() != true) return "fail 8" - - val b = B() - - if (b.foo3() != false) return "fail 9" - if (b.foo3() != false) return "fail 10" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/isCheck/nullable.kt b/backend.native/tests/external/codegen/boxInline/reified/isCheck/nullable.kt deleted file mode 100644 index e916456a979..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/isCheck/nullable.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -class A -class B - -inline fun Any?.foo() = this is T? - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo() != true) return "fail 1" - if (null.foo() != true) return "fail 2" - - if (null.foo() != true) return "fail 3" - if (null.foo() != true) return "fail 4" - - val a = A() - - if (a.foo() != true) return "fail 5" - if (a.foo() != true) return "fail 6" - - if (a.foo() != true) return "fail 7" - if (a.foo() != true) return "fail 8" - - val b = B() - - if (b.foo() != false) return "fail 9" - if (b.foo() != false) return "fail 10" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/isCheck/simple.kt b/backend.native/tests/external/codegen/boxInline/reified/isCheck/simple.kt deleted file mode 100644 index 988f2538eaa..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/isCheck/simple.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -class A -class B - -inline fun Any?.foo() = this is T - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (null.foo() != false) return "fail 1" - if (null.foo() != true) return "fail 2" - - if (null.foo() != false) return "fail 3" - if (null.foo() != true) return "fail 4" - - val a = A() - - if (a.foo() != true) return "fail 5" - if (a.foo() != true) return "fail 6" - - if (a.foo() != true) return "fail 7" - if (a.foo() != true) return "fail 8" - - val b = B() - - if (b.foo() != false) return "fail 9" - if (b.foo() != false) return "fail 10" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt11081.kt b/backend.native/tests/external/codegen/boxInline/reified/kt11081.kt deleted file mode 100644 index f134d392523..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt11081.kt +++ /dev/null @@ -1,44 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -open class TypeRef { - val type = target() - - private fun target(): String { - val thisClass = this.javaClass - val superClass = thisClass.genericSuperclass - - return superClass.toString() - } -} - - - -inline fun typeWithMessage(message: String = "Hello"): String { - val type = object : TypeRef() {} - val target = type.type - - return message + " " + target -} - -// FILE: 2.kt - -import test.* - -fun specifyOptionalArgument() = typeWithMessage>("Hello") - -fun useDefault() = typeWithMessage>() - -fun box(): String { - val specifyOptionalArgument = specifyOptionalArgument() - val useDefault = useDefault() - - if (useDefault != specifyOptionalArgument) return "fail: $useDefault != $specifyOptionalArgument" - - val type = typeWithMessage>("") - if (type != " test.TypeRef>") return "fail 2: $type" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt11677.kt b/backend.native/tests/external/codegen/boxInline/reified/kt11677.kt deleted file mode 100644 index 78d0fa05a7e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt11677.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// FULL_JDK -// WITH_REFLECT - -package test - -import java.lang.reflect.ParameterizedType -import java.lang.reflect.Type - -open class TypeLiteral { - val type: Type - get() = (javaClass.genericSuperclass as ParameterizedType).getActualTypeArguments()[0] -} - -// normal inline function works fine -inline fun typeLiteral(): TypeLiteral = object : TypeLiteral() {} - -// nested lambda loses reification of T -inline fun brokenTypeLiteral(): TypeLiteral = "".run { typeLiteral() } - -// FILE: 2.kt - -import test.* - -fun box(): String { - val type1 = typeLiteral>().type.toString() - if (type1 != "java.util.List") return "fail 1: $type1" - - val type2 = brokenTypeLiteral>().type.toString() - if (type2 != "java.util.List") return "fail 2: $type2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt15997.kt b/backend.native/tests/external/codegen/boxInline/reified/kt15997.kt deleted file mode 100644 index 1dab7b85236..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt15997.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FILE: 1.kt -// FULL_JDK -// WITH_REFLECT -// IGNORE_BACKEND: NATIVE -package test - -import kotlin.properties.Delegates -import kotlin.properties.ReadWriteProperty - -var result = "fail" - -inline fun crashMe(): ReadWriteProperty { - return Delegates.observable(Unit, { a, b, c -> result = T::class.java.simpleName }) -} - - -// FILE: 2.kt -import test.* - - -class OK { - var value by crashMe() -} - -fun box(): String { - OK().value = Unit - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt15997_2.kt b/backend.native/tests/external/codegen/boxInline/reified/kt15997_2.kt deleted file mode 100644 index 04301fc681c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt15997_2.kt +++ /dev/null @@ -1,37 +0,0 @@ -// FILE: 1.kt -// FULL_JDK -// WITH_REFLECT -// IGNORE_BACKEND: NATIVE -package test - -import kotlin.properties.Delegates -import kotlin.properties.ReadWriteProperty -import kotlin.properties.ObservableProperty -import kotlin.reflect.KProperty - -var result = "fail" - -public inline fun myObservable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Unit): - ReadWriteProperty = object : ObservableProperty(initialValue) { - override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) = onChange(property, oldValue, newValue) -} - - -//samely named reified parameter (T) as in myObservable -inline fun crashMe(): ReadWriteProperty { - return myObservable(Unit, { a, b, c -> result = T::class.java.simpleName }) -} - - -// FILE: 2.kt -import test.* - - -class OK { - var value by crashMe() -} - -fun box(): String { - OK().value = Unit - return result -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt6988.kt b/backend.native/tests/external/codegen/boxInline/reified/kt6988.kt deleted file mode 100644 index 5175a8696e5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt6988.kt +++ /dev/null @@ -1,27 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface Call { - fun call(): T -} - -public inline fun Any.inlineMeIfYouCan() : () -> Call = { - object : Call { - override fun call() = T::class.java.newInstance() - } -} - -// FILE: 2.kt - -import test.* - -public class A() - -fun box(): String { - val s = "yo".inlineMeIfYouCan()().call() - if (s !is A) return "fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt6988_2.kt b/backend.native/tests/external/codegen/boxInline/reified/kt6988_2.kt deleted file mode 100644 index 78c9eca4e82..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt6988_2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - - -public inline fun Any.inlineMeIfYouCan() : () -> Runnable = { - object : Runnable { - override fun run() { - T::class.java.newInstance() - } - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - "yo".inlineMeIfYouCan()().run() - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt6990.kt b/backend.native/tests/external/codegen/boxInline/reified/kt6990.kt deleted file mode 100644 index ca0896cdc92..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt6990.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -public inline fun inlineMeIfYouCan(): String? = - { - f { - T::class.java.getName() - } - }() - -inline fun f(x: () -> String) = x() - -// FILE: 2.kt - -import test.* - -class OK - -fun box(): String { - return inlineMeIfYouCan()!! -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt7017.kt b/backend.native/tests/external/codegen/boxInline/reified/kt7017.kt deleted file mode 100644 index c5bdcbad2af..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt7017.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun test(x: Any): Boolean { - val x = object { - val y = x is T - } - - return x.y -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - if (!test("OK")) return "fail 1" - - if (test("OK")) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt8047.kt b/backend.native/tests/external/codegen/boxInline/reified/kt8047.kt deleted file mode 100644 index 78e6e09220c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt8047.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun f(x : () -> Unit) { - object { init { arrayOf() } } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - f() {} - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt9637.kt b/backend.native/tests/external/codegen/boxInline/reified/kt9637.kt deleted file mode 100644 index 67709afaf70..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt9637.kt +++ /dev/null @@ -1,37 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -import java.util.* -import kotlin.reflect.KClass - -val valuesInjectFnc = HashMap, Any>() - -inline fun injectFnc(): Lazy> = lazy(LazyThreadSafetyMode.NONE) { - (valuesInjectFnc[T::class] ?: throw Exception("no inject ${T::class.simpleName}")) as Function0 -} - -inline fun registerFnc(noinline value: Function0) { - valuesInjectFnc[T::class] = value -} - -public class Box - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -class Boxer { - val box: () -> Box by injectFnc() -} - -fun box(): String { - val box = Box() - registerFnc { box } - val prop = Boxer().box - if (prop() != box) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/kt9637_2.kt b/backend.native/tests/external/codegen/boxInline/reified/kt9637_2.kt deleted file mode 100644 index c73c2638623..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/kt9637_2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -import kotlin.reflect.KClass - -inline fun injectFnc(): KClass = { - T::class -} () - -public class Box - -// FILE: 2.kt - -import test.* - -fun box(): String { - val boxClass = injectFnc() - if (boxClass != Box::class) return "fail 1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/reified/packages.kt b/backend.native/tests/external/codegen/boxInline/reified/packages.kt deleted file mode 100644 index 759f97496c3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/reified/packages.kt +++ /dev/null @@ -1,40 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -public abstract class A - -inline fun foo1(): A { - return object : A() { - - } -} - -fun bar(x: T, block: (T) -> Boolean): Boolean = block(x) - -inline fun foo2(x: Any): Boolean { - return bar(x) { it is T } -} - -inline fun foo3(x: Any, y: Any): Boolean { - return bar(x) { it is T && y is T } -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - val x = foo1().javaClass.getGenericSuperclass()?.toString() - if (x != "test.A") return "fail 1: " + x - - if (!foo2("abc")) return "fail 2" - if (foo2("abc")) return "fail 3" - - if (!foo3("abc", "cde")) return "fail 4" - if (foo3("abc", 1)) return "fail 5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/inProjectionSubstitution.kt b/backend.native/tests/external/codegen/boxInline/signature/inProjectionSubstitution.kt deleted file mode 100644 index 4f99cb5b321..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/inProjectionSubstitution.kt +++ /dev/null @@ -1,35 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface F { - fun test(p: T) : Int -} - -inline fun Array.copyOfRange1(crossinline toIndex: () -> Int) = - object : F { - override fun test(p: T): Int { - return toIndex() - } - } - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* -import java.util.* - -public fun Array.slice1() = copyOfRange1 { 1 } - -fun box(): String { - val comparable = arrayOf("123").slice1() - val method = comparable.javaClass.getMethod("test", Any::class.java) - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 1) return "fail 1: ${genericParameterTypes.size}" - var name = (genericParameterTypes[0] as Class<*>).name - if (name != "java.lang.Object") return "fail 2: ${name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/outProjectionSubstitution.kt b/backend.native/tests/external/codegen/boxInline/signature/outProjectionSubstitution.kt deleted file mode 100644 index e57dd7b698d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/outProjectionSubstitution.kt +++ /dev/null @@ -1,35 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface F { - fun test(p: T) : Int -} - -inline fun Array.copyOfRange1(crossinline toIndex: () -> Int) = - object : F { - override fun test(p: T): Int { - return toIndex() - } - } - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* -import java.util.* - -public fun Array.slice1() = copyOfRange1 { 1 } - -fun box(): String { - val comparable = arrayOf("123").slice1() - val method = comparable.javaClass.getMethod("test", Any::class.java) - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 1) return "fail 1: ${genericParameterTypes.size}" - var name = (genericParameterTypes[0] as Class<*>).name - if (name != "java.lang.CharSequence") return "fail 2: ${name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/recursion.kt b/backend.native/tests/external/codegen/boxInline/signature/recursion.kt deleted file mode 100644 index 994f742f1d2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/recursion.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - - -inline fun stub() { - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* -import java.util.* - - -class I(val s: A) -class A(val elements: List>) { - val p = elements.sortedBy { it.hashCode() } -} - -fun box(): String { - - A(listOf(I("1"), I("2"), I("3"))).p - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/sameFormalParameterName.kt b/backend.native/tests/external/codegen/boxInline/signature/sameFormalParameterName.kt deleted file mode 100644 index 3c55345fabd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/sameFormalParameterName.kt +++ /dev/null @@ -1,44 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -class B - -interface A { - fun aTest(p: T): B -} - -open class Test { - - inline fun test(crossinline z: () -> Int) = object : A { - override fun aTest(p: T): B { - z() - return B() - } - } - - fun callInline() = test { 1 } -} - -// FILE: 2.kt - -// NO_CHECK_LAMBDA_INLINING -// FULL_JDK - -import test.* -import java.util.* - - -fun box(): String { - val result = Test().callInline() - val method = result.javaClass.getMethod("aTest", Any::class.java) - val genericReturnType = method.genericReturnType - if (genericReturnType.toString() != "test.B") return "fail 1: ${genericReturnType}" - - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 1) return "fail 2: ${genericParameterTypes.size}" - if (genericParameterTypes[0].toString() != "T") return "fail 3: ${genericParameterTypes[0]}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/sameReifiedFormalParameterName.kt b/backend.native/tests/external/codegen/boxInline/signature/sameReifiedFormalParameterName.kt deleted file mode 100644 index cf3ba13eb87..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/sameReifiedFormalParameterName.kt +++ /dev/null @@ -1,44 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -class B - -interface A { - fun aTest(p: T): B -} - -open class Test { - - inline fun test(crossinline z: () -> Int) = object : A { - override fun aTest(p: T): B { - z() - return B() - } - } - - fun callInline() = test { 1 } -} - -// FILE: 2.kt - -// NO_CHECK_LAMBDA_INLINING -// FULL_JDK - -import test.* -import java.util.* - - -fun box(): String { - val result = Test().callInline() - val method = result.javaClass.getMethod("aTest", Any::class.java) - val genericReturnType = method.genericReturnType - if (genericReturnType.toString() != "test.B") return "fail 1: ${genericReturnType}" - - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 1) return "fail 2: ${genericParameterTypes.size}" - if (genericParameterTypes[0].toString() != "T") return "fail 3: ${genericParameterTypes[0]}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/starProjectionSubstitution.kt b/backend.native/tests/external/codegen/boxInline/signature/starProjectionSubstitution.kt deleted file mode 100644 index 96187ebc740..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/starProjectionSubstitution.kt +++ /dev/null @@ -1,35 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface F { - fun test(p: T) : Int -} - -inline fun Array.copyOfRange1(crossinline toIndex: () -> Int) = - object : F { - override fun test(p: T): Int { - return toIndex() - } - } - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* -import java.util.* - -public fun Array<*>.slice1() = copyOfRange1 { 1 } - -fun box(): String { - val comparable = arrayOf("123").slice1() - val method = comparable.javaClass.getMethod("test", Any::class.java) - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 1) return "fail 1: ${genericParameterTypes.size}" - var name = (genericParameterTypes[0] as Class<*>).name - if (name != "java.lang.Object") return "fail 2: ${name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/typeParameterInLambda.kt b/backend.native/tests/external/codegen/boxInline/signature/typeParameterInLambda.kt deleted file mode 100644 index 3b6dd00caca..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/typeParameterInLambda.kt +++ /dev/null @@ -1,39 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -open class Test { - - inline fun test(z: () -> () -> Y) = z() - - fun callInline(p: T) = test { - { - p - } - } -} - -// FILE: 2.kt - -// NO_CHECK_LAMBDA_INLINING -// FULL_JDK - -import test.* -import java.util.* - - -fun box(): String { - val result = Test().callInline("test") - - val method = result.javaClass.getMethod("invoke") - val genericReturnType = method.genericReturnType - if (genericReturnType.toString() != "T") return "fail 1: $genericReturnType" - - val method2 = Test::class.java.getMethod("callInline", Any::class.java) - val genericParameterType = method2.genericParameterTypes.firstOrNull() - - if (genericParameterType != genericReturnType) return "fail 2: $genericParameterType != $genericReturnType" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution.kt b/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution.kt deleted file mode 100644 index c984969c540..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution.kt +++ /dev/null @@ -1,55 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -import java.util.* - -open class CustomerService { - - fun comparator() = object : Comparator { - override fun compare(o1: T, o2: T): Int { - throw UnsupportedOperationException() - } - } - - inline fun comparator(crossinline z: () -> Int) = object : Comparator { - - override fun compare(o1: T, o2: T): Int { - return z() - } - - } - - fun callInline() = comparator { 1 } - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING - -import test.* -import java.util.* - -fun box(): String { - - val comparable = CustomerService().comparator() - val method = comparable.javaClass.getMethod("compare", Any::class.java, Any::class.java) - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 2) return "fail 1: ${genericParameterTypes.size}" - if (genericParameterTypes[0].toString() != "T") return "fail 2: ${genericParameterTypes[0]}" - if (genericParameterTypes[1].toString() != "T") return "fail 3: ${genericParameterTypes[1]}" - - - val comparable2 = CustomerService().callInline() - val method2 = comparable2.javaClass.getMethod("compare", Any::class.java, Any::class.java) - val genericParameterTypes2 = method2.genericParameterTypes - if (genericParameterTypes2.size != 2) return "fail 4: ${genericParameterTypes2.size}" - var name = (genericParameterTypes2[0] as Class<*>).name - if (name != "java.lang.String") return "fail 5: ${name}" - name = (genericParameterTypes2[1] as Class<*>).name - if (name != "java.lang.String") return "fail 6: ${name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution2.kt b/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution2.kt deleted file mode 100644 index 1c2913acf18..00000000000 --- a/backend.native/tests/external/codegen/boxInline/signature/typeParametersSubstitution2.kt +++ /dev/null @@ -1,55 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -interface MComparator { - fun compare(o1: T, o2: T): Int -} - -open class CustomerService { - - fun comparator() = object : MComparator { - override fun compare(o1: T, o2: T): Int { - throw UnsupportedOperationException() - } - } - - inline fun comparator(crossinline z: () -> Int) = object : MComparator { - - override fun compare(o1: T, o2: T): Int { - return z() - } - } - - fun callInline() = comparator { 1 } - -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - - val comparable = CustomerService().comparator() - val method = comparable.javaClass.getMethod("compare", Any::class.java, Any::class.java) - val genericParameterTypes = method.genericParameterTypes - if (genericParameterTypes.size != 2) return "fail 1: ${genericParameterTypes.size}" - if (genericParameterTypes[0].toString() != "T") return "fail 2: ${genericParameterTypes[0]}" - if (genericParameterTypes[1].toString() != "T") return "fail 3: ${genericParameterTypes[1]}" - - - val comparable2 = CustomerService().callInline() - val method2 = comparable2.javaClass.getMethod("compare", Any::class.java, Any::class.java) - val genericParameterTypes2 = method2.genericParameterTypes - if (genericParameterTypes2.size != 2) return "fail 1: ${genericParameterTypes2.size}" - - var name = (genericParameterTypes2[0] as Class<*>).name - if (name != "java.lang.String") return "fail 5: ${name}" - name = (genericParameterTypes2[1] as Class<*>).name - if (name != "java.lang.String") return "fail 6: ${name}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/classObject.kt b/backend.native/tests/external/codegen/boxInline/simple/classObject.kt deleted file mode 100644 index 5550e6e906b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/classObject.kt +++ /dev/null @@ -1,44 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inline(s: () -> String): String { - return s() -} - -class InlineAll { - - inline fun inline(s: () -> String): String { - return s() - } - - companion object { - inline fun inline(s: () -> String): String { - return s() - } - } -} - -// FILE: 2.kt - -import test.* - -fun testClassObjectCall(): String { - return InlineAll.inline({"classobject"}) -} - -fun testInstanceCall(): String { - val inlineX = InlineAll() - return inlineX.inline({"instance"}) -} - -fun testPackageCall(): String { - return inline({"package"}) -} - -fun box(): String { - if (testClassObjectCall() != "classobject") return "test1: ${testClassObjectCall()}" - if (testInstanceCall() != "instance") return "test2: ${testInstanceCall()}" - if (testPackageCall() != "package") return "test3: ${testPackageCall()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/destructuring.kt b/backend.native/tests/external/codegen/boxInline/simple/destructuring.kt deleted file mode 100644 index ea489b8e8d7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/destructuring.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: 1.kt -package test - -inline fun foo(x: (Int, Station) -> Unit) { - x(1, Station(null, "", 1)) -} - -data class Station( - val id: String?, - val name: String, - val distance: Int) - - -// FILE: 2.kt -import test.* - -fun box(): String { - foo { i, (a1, a2, a3) -> i + a3 } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/simple/destructuringIndexClash.kt b/backend.native/tests/external/codegen/boxInline/simple/destructuringIndexClash.kt deleted file mode 100644 index eeb9f2bfefb..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/destructuringIndexClash.kt +++ /dev/null @@ -1,35 +0,0 @@ -// for android -// FILE: 1.kt -package test - -var res = "fail" - -inline fun foo(x: (Int, Station) -> Unit) { - x(1, Station("a", "b", "c")) - res = "O" -} - -inline fun foo2(x: (Int, StationInt) -> Unit) { - x(1, StationInt(1, 2, 3)) - res += "K" -} - -data class Station( - val id: String, - val name: String, - val distance: String) - -data class StationInt( - val id: Int, - val name: Int, - val distance: Int) - - -// FILE: 2.kt -import test.* - -fun box(): String { - foo { i, (a1, a2, a3) -> a3 + i } - foo2 { i, (a1, a2, a3) -> i + a3 } - return res -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/simple/extension.kt b/backend.native/tests/external/codegen/boxInline/simple/extension.kt deleted file mode 100644 index ad48f1b993f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/extension.kt +++ /dev/null @@ -1,71 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -inline fun Inline.calcExt(s: (Int) -> Int, p: Int) : Int { - return s(p) -} - -inline fun Inline.calcExt2(s: Int.() -> Int, p: Int) : Int { - return p.s() -} - -class InlineX(val value : Int) {} - -class Inline(val res: Int) { - - inline fun InlineX.calcInt(s: (Int, Int) -> Int) : Int { - return s(res, this.value) - } - - inline fun Double.calcDouble(s: (Int, Double) -> Double) : Double { - return s(res, this) - } - - fun doWork(l : InlineX) : Int { - return l.calcInt({ a: Int, b: Int -> a + b}) - } - - fun doWorkWithDouble(s : Double) : Double { - return s.calcDouble({ a: Int, b: Double -> a + b}) - } - -} - -// FILE: 2.kt - -fun test1(): Int { - val inlineX = Inline(9) - return inlineX.calcExt({ z: Int -> z}, 25) -} - -fun test2(): Int { - val inlineX = Inline(9) - return inlineX.calcExt2(fun Int.(): Int = this, 25) -} - -fun test3(): Int { - val inlineX = Inline(9) - return inlineX.doWork(InlineX(11)) -} - -fun test4(): Double { - val inlineX = Inline(9) - return inlineX.doWorkWithDouble(11.0) -} - -fun test5(): Double { - val inlineX = Inline(9) - with(inlineX) { - 11.0.calcDouble{ a: Int, b: Double -> a + b} - } - return inlineX.doWorkWithDouble(11.0) -} - -fun box(): String { - if (test1() != 25) return "test1: ${test1()}" - if (test2() != 25) return "test2: ${test2()}" - if (test3() != 20) return "test3: ${test3()}" - if (test4() != 20.0) return "test4: ${test4()}" - if (test5() != 20.0) return "test5: ${test5()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/extensionLambda.kt b/backend.native/tests/external/codegen/boxInline/simple/extensionLambda.kt deleted file mode 100644 index 4360dda4d25..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/extensionLambda.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun String.test(default: T, cb: String.(T) -> T): T = cb(default) - -// FILE: 2.kt - -import test.* - -fun box(): String { - val p = "".test(50.0) { - it - } - - return if (p == 50.0) "OK" else "fail $p" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/funImportedFromObject.kt b/backend.native/tests/external/codegen/boxInline/simple/funImportedFromObject.kt deleted file mode 100644 index 6d1a9f4d4be..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/funImportedFromObject.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -object Host { - // private final foo()V - inline fun foo(): String { - return "OK" - } -} - - -// FILE: 2.kt - -import test.Host.foo - -fun box(): String { - return foo() -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/params.kt b/backend.native/tests/external/codegen/boxInline/simple/params.kt deleted file mode 100644 index 000719a13ae..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/params.kt +++ /dev/null @@ -1,50 +0,0 @@ -// FILE: 1.kt - -class Inline() { - - inline fun foo1Int(s : (l: Int) -> Int, param: Int) : Int { - return s(param) - } - - inline fun foo1Double(param: Double, s : (l: Double) -> Double) : Double { - return s(param) - } - - inline fun foo2Param(param1: Double, s : (i: Int, l: Double) -> Double, param2: Int) : Double { - return s(param2, param1) - } -} - -// FILE: 2.kt - -fun test1(): Int { - val inlineX = Inline() - return inlineX.foo1Int({ z: Int -> z}, 25) -} - -fun test2(): Double { - val inlineX = Inline() - return inlineX.foo1Double(25.0, { z: Double -> z}) -} - -fun test3(): Double { - val inlineX = Inline() - return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2}, 10) -} - -fun test3WithCaptured(): Double { - val inlineX = Inline() - var c = 11.0; - return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2 + c}, 10) -} - - -fun box(): String { - if (test1() != 25) return "test1: ${test1()}" - if (test2() != 25.0) return "test2: ${test2()}" - if (test3() != 25.0) return "test3: ${test3()}" - if (test3WithCaptured() != 36.0) return "test3WithCaptured: ${test3WithCaptured()}" - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/propImportedFromObject.kt b/backend.native/tests/external/codegen/boxInline/simple/propImportedFromObject.kt deleted file mode 100644 index e04e10eefbd..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/propImportedFromObject.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// WITH_RUNTIME -// FILE: 1.kt - -package test - -object Host { - - inline val T.foo: String - get() = T::class.java.simpleName -} - -// FILE: 2.kt - -import test.Host.foo - -class OK - -fun box(): String { - return OK().foo -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/rootConstructor.kt b/backend.native/tests/external/codegen/boxInline/simple/rootConstructor.kt deleted file mode 100644 index 1af43ae7c06..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/rootConstructor.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt - -package test - - -inline fun doWork(crossinline job: ()-> R) : R { - return notInline({job()}) -} - -fun notInline(job: ()-> R) : R { - return job() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -val s = doWork({11}) - -fun box(): String { - if (s != 11) return "test1: ${s}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/safeCall.kt b/backend.native/tests/external/codegen/boxInline/simple/safeCall.kt deleted file mode 100644 index a89a92c1ad6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/safeCall.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -class W(val value: Any) - -inline fun W.safe(body : Any.() -> Unit) { - this.value?.body() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - W("OK").safe { - result = this as String - } - - return result -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/severalClosures.kt b/backend.native/tests/external/codegen/boxInline/simple/severalClosures.kt deleted file mode 100644 index a69bacf4572..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/severalClosures.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -class Inline() { - - inline fun foo1(closure1 : (l: Int) -> Int, param1: Int, closure2 : (l: Double) -> Double, param2: Double) : Double { - return closure1(param1) + closure2(param2) - } - - inline fun foo2(closure1 : (Int, Int) -> Int, param1: Int, closure2 : (Double, Int, Int) -> Double, param2: Double, param3: Int) : Double { - return closure1(param1, param3) + closure2(param2, param1, param3) - } -} - -// FILE: 2.kt - -fun test1(): Double { - val inlineX = Inline() - return inlineX.foo1({ z: Int -> z}, 25, { z: Double -> z}, 11.5) -} - -fun test1WithCaptured(): Double { - val inlineX = Inline() - var d = 0.0; - return inlineX.foo1({ z: Int -> d = 1.0; z}, 25, { z: Double -> z + d}, 11.5) -} - -fun test2(): Double { - val inlineX = Inline() - return inlineX.foo2({ z: Int, p: Int -> z + p}, 25, { x: Double, y: Int, z: Int -> z + x + y}, 11.5, 2) -} - -fun box(): String { - if (test1() != 36.5) return "test1: ${test1()}" - if (test1WithCaptured() != 37.5) return "test1WithCaptured: ${test1WithCaptured()}" - if (test2() != 65.5) return "test2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/severalUsage.kt b/backend.native/tests/external/codegen/boxInline/simple/severalUsage.kt deleted file mode 100644 index 754133dd75c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/severalUsage.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: 1.kt - -public inline fun runTest(f: () -> R): R { - return f() -} - -public inline fun minByTest(f: (Int) -> R): R { - var minValue = f(1) - val v = f(1) - return v -} - -// FILE: 2.kt - -fun box(): String { - val result = runTest{minByTest { it }} - - if (result != 1) return "test1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleDouble.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleDouble.kt deleted file mode 100644 index 316cb18da5a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleDouble.kt +++ /dev/null @@ -1,76 +0,0 @@ -// FILE: 1.kt - -class InlineDouble(val res : Double) { - - inline fun foo(s : () -> Double) : Double { - val f = "fooStart" - val z = s() - return z - } - - inline fun foo11(s : (l: Double) -> Double) : Double { - return s(11.0) - } - - inline fun fooRes(s : (l: Double) -> Double) : Double { - val z = s(res) - return z - } - - inline fun fooRes2(s : (l: Double, t: Double) -> Double) : Double { - val f = "fooRes2Start" - val z = s(1.0, 11.0) - return z - } -} - -// FILE: 2.kt - -fun test0Param(): Double { - val inlineX = InlineDouble(10.0) - return inlineX.foo({ -> 1.0}) -} - -fun test1Param(): Double { - val inlineX = InlineDouble(10.0) - return inlineX.foo11({ z: Double -> z}) -} - -fun test1ParamCaptured(): Double { - val s = 100.0 - val inlineX = InlineDouble(10.0) - return inlineX.foo11({ z: Double -> s}) -} - -fun test1ParamMissed() : Double { - val inlineX = InlineDouble(10.0) - return inlineX.foo11({ z: Double -> 111.0}) -} - -fun test1ParamFromCallContext() : Double { - val inlineX = InlineDouble(1000.0) - return inlineX.fooRes({ z: Double -> z}) -} - -fun test2Params() : Double { - val inlineX = InlineDouble(1000.0) - return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * y + 3.0 * z}) -} - -fun test2ParamsWithCaptured() : Double { - val inlineX = InlineDouble(1000.0) - val s = 9.0 - var t = 1.0 - return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * s + t}) -} - -fun box(): String { - if (test0Param() != 1.0) return "test0Param" - if (test1Param() != 11.0) return "test1Param()" - if (test1ParamCaptured() != 100.0) return "testtest1ParamCaptured()" - if (test1ParamMissed() != 111.0) return "test1ParamMissed()" - if (test1ParamFromCallContext() != 1000.0) return "test1ParamFromCallContext()" - if (test2Params() != 35.0) return "test2Params()" - if (test2ParamsWithCaptured() != 19.0) return "test2ParamsWithCaptured()" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleEnum.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleEnum.kt deleted file mode 100644 index 2c775f9ea5a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleEnum.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -enum class MyEnum { - K; - - //TODO: KT-4693 - inline fun doSmth(a: T) : String { - return a.toString() + K.name - } -} - -// FILE: 2.kt - -import test.* - -fun test1(): String { - return MyEnum.K.doSmth("O") -} - -fun box(): String { - val result = test1() - if (result != "OK") return "fail1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleGenerics.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleGenerics.kt deleted file mode 100644 index 93a57927f0b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleGenerics.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun doSmth(a: T) : String { - return a.toString() -} - -// FILE: 2.kt - -import test.* - -fun test1(s: Long): String { - return doSmth(s) -} - -fun box(): String { - val result = test1(11.toLong()) - if (result != "11") return "fail1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleInt.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleInt.kt deleted file mode 100644 index 19076887294..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleInt.kt +++ /dev/null @@ -1,76 +0,0 @@ -// FILE: 1.kt - -class Inline(val res : Int) { - - inline fun foo(s : () -> Int) : Int { - val f = "fooStart" - val z = s() - return z - } - - inline fun foo11(s : (l: Int) -> Int) : Int { - return s(11) - } - - inline fun fooRes(s : (l: Int) -> Int) : Int { - val z = s(res) - return z - } - - inline fun fooRes2(s : (l: Int, t: Int) -> Int) : Int { - val f = "fooRes2Start" - val z = s(1, 11) - return z - } -} - -// FILE: 2.kt - -fun test0Param(): Int { - val inlineX = Inline(10) - return inlineX.foo({ -> 1}) -} - -fun test1Param(): Int { - val inlineX = Inline(10) - return inlineX.foo11({ z: Int -> z}) -} - -fun test1ParamCaptured(): Int { - val s = 100 - val inlineX = Inline(10) - return inlineX.foo11({ z: Int -> s}) -} - -fun test1ParamMissed() : Int { - val inlineX = Inline(10) - return inlineX.foo11({ z: Int -> 111}) -} - -fun test1ParamFromCallContext() : Int { - val inlineX = Inline(1000) - return inlineX.fooRes({ z: Int -> z}) -} - -fun test2Params() : Int { - val inlineX = Inline(1000) - return inlineX.fooRes2({ y: Int, z: Int -> 2 * y + 3 * z}) -} - -fun test2ParamsWithCaptured() : Int { - val inlineX = Inline(1000) - val s = 9 - var t = 1 - return inlineX.fooRes2({ y: Int, z: Int -> 2 * s + t}) -} - -fun box(): String { - if (test0Param() != 1) return "test0Param: ${test0Param()}" - if (test1Param() != 11) return "test1Param: ${test1Param()}" - if (test1ParamCaptured() != 100) return "test1ParamCaptured: ${test1ParamCaptured()}" - if (test1ParamMissed() != 111) return "test1ParamMissed: ${test1ParamMissed()}" - if (test1ParamFromCallContext() != 1000) return "test1ParamFromCallContext: ${test1ParamFromCallContext()}" - if (test2Params() != 35) return "test2Params: ${test2Params()}" - if (test2ParamsWithCaptured() != 19) return "test2ParamsWithCaptured: ${test2ParamsWithCaptured()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleLambda.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleLambda.kt deleted file mode 100644 index f69146fa4ed..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleLambda.kt +++ /dev/null @@ -1,40 +0,0 @@ -// FILE: 1.kt - -package test - -public class Data() - -public inline fun T.use(block: (T)-> R) : R { - return block(this) -} - -public inline fun use2() : Int { - val s = 100 - return s -} - -// FILE: 2.kt - -import test.* - -class Z {} - -fun test1() : Int { - val input = Z() - return input.use{ - 100 - } -} - -fun test2() : Int { - val x = 1000 - return use2() + x -} - - -fun box(): String { - if (test1() != 100) return "test1: ${test1()}" - if (test2() != 1100) return "test1: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/simpleObject.kt b/backend.native/tests/external/codegen/boxInline/simple/simpleObject.kt deleted file mode 100644 index 0ebf0496802..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/simpleObject.kt +++ /dev/null @@ -1,77 +0,0 @@ -// FILE: 1.kt - -class InlineString(val res : String) { - - inline fun foo(s : () -> String) : String { - val f = "fooStart" - val z = s() - return z - } - - inline fun foo11(s : (l: String) -> String) : String { - return s("11") - } - - inline fun fooRes(s : (l: String) -> String) : String { - val z = s(res) - return z - } - - inline fun fooRes2(s : (l: String, t: String) -> String) : String { - val f = "fooRes2Start" - val z = s("1", "11") - return z - } -} - -// FILE: 2.kt - -fun test0Param(): String { - val inlineX = InlineString("10") - return inlineX.foo({ -> "1"}) -} - -fun test1Param(): String { - val inlineX = InlineString("10") - return inlineX.foo11({ z: String -> z}) -} - -fun test1ParamCaptured(): String { - val s = "100" - val inlineX = InlineString("10") - return inlineX.foo11({ z: String -> s}) -} - -fun test1ParamMissed() : String { - val inlineX = InlineString("10") - return inlineX.foo11({ z: String -> "111"}) -} - -fun test1ParamFromCallContext() : String { - val inlineX = InlineString("1000") - return inlineX.fooRes({ z: String -> z}) -} - -fun test2Params() : String { - val inlineX = InlineString("1000") - return inlineX.fooRes2({ y: String, z: String -> y + "0" + z}) -} - -fun test2ParamsWithCaptured() : String { - val inlineX = InlineString("1000") - val s = "9" - var t = "1" - return inlineX.fooRes2({ y: String, z: String -> s + t}) -} - -fun box(): String { - if (test0Param() != "1") return "test0Param: ${test0Param()}" - if (test1Param() != "11") return "test1Param: ${test1Param()}" - if (test1ParamCaptured() != "100") return "test1ParamCaptured: ${test1ParamCaptured()}" - if (test1ParamMissed() != "111") return "test1ParamMissed: ${test1ParamMissed()}" - if (test1ParamFromCallContext() != "1000") return "test1ParamFromCallContext: ${test1ParamFromCallContext()}" - if (test2Params() != "1011") return "test2Params: ${test2Params()}" - if (test2ParamsWithCaptured() != "91") return "test2ParamsWithCaptured: ${test2ParamsWithCaptured()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/simple/vararg.kt b/backend.native/tests/external/codegen/boxInline/simple/vararg.kt deleted file mode 100644 index 4f75fcfe224..00000000000 --- a/backend.native/tests/external/codegen/boxInline/simple/vararg.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test - -inline fun doSmth(vararg a: String) : String { - return a.foldRight("", { a, b -> a + b}) -} - -// FILE: 2.kt - -import test.* - -fun test1(): String { - return doSmth("O", "K") -} - -fun box(): String { - val result = test1() - if (result != "OK") return "fail1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/kt19175.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/kt19175.kt deleted file mode 100644 index 2622e875a44..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/kt19175.kt +++ /dev/null @@ -1,79 +0,0 @@ -// FILE: 1.kt -package test - -abstract class Introspector { - abstract inner class SchemaRetriever(val transaction: String) { - inline fun inSchema(crossinline modifier: (String) -> Unit) = - { modifier.invoke(transaction) }() - } -} - -// FILE: 2.kt -import test.* - -var result = "fail" - -class IntrospectorImpl() : Introspector() { - inner class SchemaRetriever(transaction: String) : Introspector.SchemaRetriever(transaction) { - internal fun retrieve() { - inSchema { schema -> result = schema } - } - } -} - -fun box(): String { - IntrospectorImpl().SchemaRetriever("OK").retrieve() - - return result -} - - -// FILE: 1.smap - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/Introspector$SchemaRetriever$inSchema$1 -*L -1#1,11:1 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -IntrospectorImpl$SchemaRetriever -+ 2 1.kt -test/Introspector$SchemaRetriever -*L -1#1,21:1 -7#2:22 -*E -*S KotlinDebug -*F -+ 1 2.kt -IntrospectorImpl$SchemaRetriever -*L -9#1:22 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/Introspector$SchemaRetriever$inSchema$1 -+ 2 2.kt -IntrospectorImpl$SchemaRetriever -*L -1#1,11:1 -9#2:12 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambda.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambda.kt deleted file mode 100644 index 3f82fde796e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambda.kt +++ /dev/null @@ -1,79 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return { - init() - }() -} - -// FILE: 2.kt - -import builders.* - -//NO_CHECK_LAMBDA_INLINING -fun test(): String { - var res = "Fail" - - call { - res = "OK" - } - - return res -} - - -fun box(): String { - return test() -} - -// FILE: 1.smap - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -builders/_1Kt$call$1 -*L -1#1,11:1 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,21:1 -6#2:22 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -9#1:22 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -builders/_1Kt$call$1 -+ 2 2.kt -_2Kt -*L -1#1,11:1 -10#2,2:12 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt deleted file mode 100644 index f7169da1615..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnCallSite.kt +++ /dev/null @@ -1,55 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return init() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 2.kt - -import builders.* - - -fun test(): String { - var res = "Fail" - - call { - { - res = "OK" - }() - } - - return res -} - - -fun box(): String { - return test() -} - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,23:1 -6#2:24 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -9#1:24 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.kt deleted file mode 100644 index e2f10bcb355..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.kt +++ /dev/null @@ -1,87 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return init() -} - -// FILE: 2.kt - -import builders.* - - -inline fun test(): String { - var res = "Fail" - - call { - { - res = "OK" - }() - } - - return res -} - - -fun box(): String { - return test() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 1.smap - -// FILE: 2.smap - -//TODO -//7#1,3:26 -//10#1,6:30 - could be merged in one big interval due preprocessing of inline function - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,24:1 -7#1,3:26 -10#1,6:30 -6#2:25 -6#2:29 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -20#1,3:26 -20#1,6:30 -9#1:25 -20#1:29 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$test$1$1 -*L -1#1,24:1 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$test$1$1 -*L -1#1,24:1 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/object.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/object.kt deleted file mode 100644 index 0e9302a1c7f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/object.kt +++ /dev/null @@ -1,82 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return object { - fun run () { - init() - } - }.run() -} - -// FILE: 2.kt - -import builders.* - - -fun test(): String { - var res = "Fail" - - call { - res = "OK" - } - - return res -} - - -fun box(): String { - return test() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 1.smap - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -builders/_1Kt$call$1 -*L -1#1,13:1 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,22:1 -6#2,5:23 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -9#1,5:23 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -builders/_1Kt$call$1 -+ 2 2.kt -_2Kt -*L -1#1,13:1 -10#2,2:14 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnCallSite.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnCallSite.kt deleted file mode 100644 index 4b9ff66f07c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnCallSite.kt +++ /dev/null @@ -1,58 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return init() -} - -// FILE: 2.kt - -import builders.* - - -fun test(): String { - var res = "Fail" - - call { - object { - fun run () { - res = "OK" - } - }.run() - } - - return res -} - - -fun box(): String { - return test() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 1.smap - -// FILE: 2.smap - -//SMAP -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,26:1 -6#2:27 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -9#1:27 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.kt deleted file mode 100644 index 8f2143a5718..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.kt +++ /dev/null @@ -1,88 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return init() -} - -// FILE: 2.kt - -import builders.* - - -inline fun test(): String { - var res = "Fail" - - call { - object { - fun run () { - res = "OK" - } - }.run() - } - - return res -} - - -fun box(): String { - return test() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 1.smap - -// FILE: 2.smap - -//7#1,3:28 -//10#1,8:32 - could be merged in one big interval due preprocessing of inline function - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,26:1 -7#1,3:28 -10#1,8:32 -6#2:27 -6#2:31 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -22#1,3:28 -22#1,8:32 -9#1:27 -22#1:31 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$test$1$1 -*L -1#1,26:1 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$test$1$1 -*L -1#1,26:1 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite2.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite2.kt deleted file mode 100644 index 5e91d05e299..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSite2.kt +++ /dev/null @@ -1,84 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun call(crossinline init: () -> Unit) { - return init() -} - -inline fun test(): String { - var res = "Fail" - - call { - object { - fun run () { - res = "OK" - } - }.run() - } - - return res -} - -// FILE: 2.kt - -import builders.* - - -fun box(): String { - return test() -} -//NO_CHECK_LAMBDA_INLINING - -// FILE: 1.sxmap - -//TODO SHOULD BE LESS - -SXMAP -objectOnInlineCallSite2.2.kt -Kotlin -*S Kotlin -*F -+ 1 objectOnInlineCallSite2.2.kt -builders/BuildersPackage -*L -1#1,42:1 -*E - -SXMAP -objectOnInlineCallSite2.2.kt -Kotlin -*S Kotlin -*F -+ 1 objectOnInlineCallSite2.2.kt -builders/BuildersPackage$objectOnInlineCallSite2_2$HASH$test$1$1 -*L -1#1,42:1 -*E - -// FILE: 2.sxmap - -SXMAP -objectOnInlineCallSite2.1.kt -Kotlin -*S Kotlin -*F -+ 1 objectOnInlineCallSite2.1.kt -_DefaultPackage -+ 2 objectOnInlineCallSite2.2.kt -builders/BuildersPackage -*L -1#1,32:1 -8#2,11:33 -*E - -SXMAP -objectOnInlineCallSite2.2.kt -Kotlin -*S Kotlin -*F -+ 1 objectOnInlineCallSite2.2.kt -builders/BuildersPackage$objectOnInlineCallSite2_2$HASH$test$1$1 -*L -1#1,42:1 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt deleted file mode 100644 index 14e7104860c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt +++ /dev/null @@ -1,34 +0,0 @@ -// FILE: 1.kt - -package builders -//TODO there is a bug in asm it's skips linenumber on same line on reading bytecode -inline fun call(crossinline init: () -> Unit) { - "1"; return init() -} - -inline fun test(crossinline p: () -> String): String { - var res = "Fail" - - call { - object { - fun run () { - res = p() - } - }.run() - } - - return res -} -//TODO SHOULD BE LESS - -// FILE: 2.kt - -import builders.* - - -fun box(): String { - return test{"OK"} -} -//NO_CHECK_LAMBDA_INLINING - -//TODO diff --git a/backend.native/tests/external/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt b/backend.native/tests/external/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt deleted file mode 100644 index cb9a25229c6..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt +++ /dev/null @@ -1,79 +0,0 @@ -//FILE: 1.kt -package test - -inline fun annotatedWith2(crossinline predicate: () -> Boolean) = - { any { predicate() } }() - - -inline fun annotatedWith(crossinline predicate: () -> Boolean) = - annotatedWith2 { predicate() } - - -inline fun any(s: () -> Boolean) { - s() -} - - -//FILE: 2.kt -import test.* - -fun box(): String { - var result = "fail" - - annotatedWith { result = "OK"; true } - - return result -} - - -inline fun test(z: () -> Unit) { - z() -} - - -// FILE: 2.smap -//*L -//1#1,15:1 -//17#1:19 - - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,18:1 -9#2:19 -5#2:20 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -7#1:19 -7#1:20 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$annotatedWith2$1 -+ 2 1.kt -test/_1Kt -+ 3 2.kt -_2Kt -*L -1#1,17:1 -13#2,2:18 -9#2:20 -7#3:21 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/assertion.kt b/backend.native/tests/external/codegen/boxInline/smap/assertion.kt deleted file mode 100644 index f36b0005a6d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/assertion.kt +++ /dev/null @@ -1,75 +0,0 @@ -// FILE: 1.kt - -package test - -public val MASSERTIONS_ENABLED: Boolean = true - -public inline fun massert(value: Boolean, lazyMessage: () -> String) { - if (MASSERTIONS_ENABLED) { - if (!value) { - val message = lazyMessage() - throw AssertionError(message) - } - } -} - - -public inline fun massert(value: Boolean, message: Any = "Assertion failed") { - if (MASSERTIONS_ENABLED) { - if (!value) { - throw AssertionError(message) - } - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - massert(true) - massert(true) { - "test" - } - - return "OK" -} - -// FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,25:1 -18#1,6:26 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,14:1 -17#2,7:15 -8#2,7:22 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1,7:15 -7#1,7:22 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/classFromDefaultPackage.kt b/backend.native/tests/external/codegen/boxInline/smap/classFromDefaultPackage.kt deleted file mode 100644 index 8e1691d5627..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/classFromDefaultPackage.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -class A { - inline fun foo() {} -} - -// FILE: 2.kt - -fun box(): String { - A().foo() - - return "OK" -} - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -A -*L -1#1,9:1 -4#2:10 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -4#1:10 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/defaultFunction.kt b/backend.native/tests/external/codegen/boxInline/smap/defaultFunction.kt deleted file mode 100644 index 55690f78727..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/defaultFunction.kt +++ /dev/null @@ -1,41 +0,0 @@ -// FILE: 1.kt -package test - -inline fun inlineFun(capturedParam: String, noinline lambda: () -> String = { capturedParam }): String { - return lambda() -} - -// FILE: 2.kt -//NO_CHECK_LAMBDA_INLINING -import test.* - -fun box(): String { - return inlineFun("OK") -} - -// FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,8:1 -5#1:9 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$inlineFun$1 -*L -1#1,8:1 -*E - -// FILE: 2.TODO \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/nested.kt b/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/nested.kt deleted file mode 100644 index c017cf99481..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/nested.kt +++ /dev/null @@ -1,91 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(capturedParam: String, crossinline lambda: () -> String = { capturedParam }): String { - return { - lambda() - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun("OK") -} - -// FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,12:1 -7#1:13 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$inlineFun$2 -*L -1#1,12:1 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$inlineFun$1 -*L -1#1,12:1 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,9:1 -6#2,2:10 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1,2:10 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$inlineFun$2 -+ 2 1.kt -test/_1Kt$inlineFun$1 -*L -1#1,12:1 -6#2:13 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/simple.kt b/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/simple.kt deleted file mode 100644 index cc11d7cb7b2..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/defaultLambda/simple.kt +++ /dev/null @@ -1,64 +0,0 @@ -// FILE: 1.kt -// LANGUAGE_VERSION: 1.2 -// SKIP_INLINE_CHECK_IN: inlineFun$default -package test - -inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedParam }): String { - return lambda() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun("OK") -} - -// FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,10:1 -7#1:11 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$inlineFun$1 -*L -1#1,10:1 -*E - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,9:1 -6#2,2:10 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1,2:10 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmap.kt b/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmap.kt deleted file mode 100644 index 8ee31295455..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmap.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test -inline fun stub() { - -} - -// FILE: 2.kt - -fun box(): String { - return "KO".reversed() -} - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -*L -1#1,7:1 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt b/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt deleted file mode 100644 index c749d0b31cf..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME -package test -inline fun stub() { - -} -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@kotlin.internal.InlineOnly -inline val prop: String - get() = "OK" - -// FILE: 2.kt -import test.* - -fun box(): String { - return prop -} - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -*L -1#1,8:1 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reified.kt b/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reified.kt deleted file mode 100644 index 64b93289a45..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reified.kt +++ /dev/null @@ -1,40 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -inline fun className() = T::class.java.simpleName - -// FILE: 2.kt - -import test.* - -fun box(): String { - val z = className() - if (z != "String") return "fail: $z" - - return "OK" -} - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,12:1 -6#2:13 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1:13 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt b/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt deleted file mode 100644 index acc1f728a0b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt +++ /dev/null @@ -1,40 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_REFLECT -package test - -inline val T.className: String; get() = T::class.java.simpleName - -// FILE: 2.kt - -import test.* - -fun box(): String { - val z = "OK".className - if (z != "String") return "fail: $z" - - return "OK" -} - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,12:1 -6#2:13 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1:13 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/newsmap/differentMapping.kt b/backend.native/tests/external/codegen/boxInline/smap/newsmap/differentMapping.kt deleted file mode 100644 index 827b03b864d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/newsmap/differentMapping.kt +++ /dev/null @@ -1,54 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun test(s: () -> Unit) { - val z = 1; - s() - val x = 1; -} - - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - test { - result = "O" - } - - test { - result += "K" - } - - return result -} - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,18:1 -6#2,4:19 -6#2,4:23 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -7#1,4:19 -11#1,4:23 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt b/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt deleted file mode 100644 index 1f2d9ae0f9f..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInInlineFunLambda.kt +++ /dev/null @@ -1,94 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun myrun(s: () -> Unit) { - val z = "myrun" - s() -} - -inline fun test(crossinline s: () -> Unit) { - { - val z = 1; - myrun(s) - val x = 1; - }() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - - test { - result = "OK" - } - - return result -} - - -// FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$test$1 -+ 2 1.kt -test/_1Kt -*L -1#1,18:1 -6#2,3:19 -*E -*S KotlinDebug -*F -+ 1 1.kt -test/_1Kt$test$1 -*L -13#1,3:19 -*E - - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,16:1 -11#2,6:17 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -8#1,6:17 -*E - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt$test$1 -+ 2 1.kt -test/_1Kt -+ 3 2.kt -_2Kt -*L -1#1,18:1 -6#2,3:19 -9#3,2:22 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambda.kt b/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambda.kt deleted file mode 100644 index 593cc2ea506..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambda.kt +++ /dev/null @@ -1,80 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -package test - -inline fun test(s: () -> Unit) { - val z = 1; - s() - val x = 1; -} - -inline fun test2(s: () -> String): String { - val z = 1; - val res = s() - return res -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - var result = "fail" - - test { - { - result = test2 { - "OK" - } - }() - } - - return result -} - - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,20:1 -6#2,4:21 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -8#1,4:21 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$box$1$1 -+ 2 1.kt -test/_1Kt -*L -1#1,20:1 -12#2,3:21 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt$box$1$1 -*L -10#1,3:21 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambdaSameFileInline.kt b/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambdaSameFileInline.kt deleted file mode 100644 index f5a7c59925b..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/newsmap/mappingInSubInlineLambdaSameFileInline.kt +++ /dev/null @@ -1,80 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING -// FILE: 1.kt -package test - -inline fun test(s: () -> Unit) { - val z = 1; - s() - val x = 1; -} - -// FILE: 2.kt - -import test.* - -inline fun test2(s: () -> String): String { - val z = 1; - val res = s() - return res -} - -fun box(): String { - var result = "fail" - - test { - { - result = test2 { - "OK" - } - }() - } - - return result -} - - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -test/_1Kt -*L -1#1,26:1 -6#2,4:27 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -14#1,4:27 -*E - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$box$1$1 -+ 2 2.kt -_2Kt -*L -1#1,26:1 -6#2,3:27 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt$box$1$1 -*L -16#1,3:27 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/oneFile.kt b/backend.native/tests/external/codegen/boxInline/smap/oneFile.kt deleted file mode 100644 index b68666e3677..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/oneFile.kt +++ /dev/null @@ -1,43 +0,0 @@ -// FILE: 1.kt - -package zzz - -inline fun nothing() {} - -// FILE: 2.kt - -fun box(): String { - return test { - "K" - } -} - -inline fun test(p: () -> String): String { - var pd = "" - pd = "O" - return pd + p() -} - -// FILE: 1.smap - -// FILE: 2.smap - -//TODO should be empty -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -*L -1#1,15:1 -10#1,3:16 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -4#1,3:16 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineComponent.kt b/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineComponent.kt deleted file mode 100644 index 53ec690a6a9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineComponent.kt +++ /dev/null @@ -1,46 +0,0 @@ -// FILE: 1.kt - -package zzz - -public class A(val a: Int, val b: Int) - -operator inline fun A.component1() = a - -operator inline fun A.component2() = b - -// FILE: 2.kt - -import zzz.* - -fun box(): String { - var (p, l) = A(1, 11) - - return if (p == 1 && l == 11) "OK" else "fail: $p" -} - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -zzz/_1Kt -*L -1#1,11:1 -7#2:12 -9#2:13 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -6#1:12 -6#1:13 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineIterator.kt b/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineIterator.kt deleted file mode 100644 index e2453a51e19..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/resolve/inlineIterator.kt +++ /dev/null @@ -1,45 +0,0 @@ -// FILE: 1.kt - -package zzz - -public class A(val p: Int) - -operator inline fun A.iterator() = (1..p).iterator() - -// FILE: 2.kt - -import zzz.* - -fun box(): String { - var p = 0 - for (i in A(5)) { - p += i - } - - return if (p == 15) "OK" else "fail: $p" -} - -// FILE: 1.smap - -// FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -zzz/_1Kt -*L -1#1,14:1 -7#2:15 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -7#1:15 -*E diff --git a/backend.native/tests/external/codegen/boxInline/smap/smap.kt b/backend.native/tests/external/codegen/boxInline/smap/smap.kt deleted file mode 100644 index 77ef4128490..00000000000 --- a/backend.native/tests/external/codegen/boxInline/smap/smap.kt +++ /dev/null @@ -1,118 +0,0 @@ -// FILE: 1.kt - -package builders - -inline fun init(init: () -> Unit) { - init() -} - -inline fun initTag2(init: () -> Unit) { - val p = 1; - init() -} -//{val p = initTag2(init); return p} to remove difference in linenumber processing through MethodNode and MethodVisitor should be: = initTag2(init) -inline fun head(init: () -> Unit) { val p = initTag2(init); return p} - - -inline fun html(init: () -> Unit) { - return init(init) -} - -// FILE: 2.kt - -import builders.* - - -inline fun test(): String { - var res = "Fail" - - html { - head { - res = "OK" - } - } - - return res -} - - -fun box(): String { - var expected = test(); - - return expected -} - -// FILE: 1.smap - -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -builders/_1Kt -*L -1#1,21:1 -10#1,3:22 -6#1,2:25 -*E -*S KotlinDebug -*F -+ 1 1.kt -builders/_1Kt -*L -14#1,3:22 -18#1,2:25 -*E - -// FILE: 2.smap - - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -+ 2 1.kt -builders/_1Kt -*L -1#1,25:1 -7#1,3:40 -10#1:45 -11#1,2:49 -13#1:52 -15#1:54 -18#2:26 -6#2,9:27 -10#2,3:36 -7#2:39 -18#2:43 -6#2:44 -14#2:46 -10#2,2:47 -12#2:51 -7#2:53 -*E -*S KotlinDebug -*F -+ 1 2.kt -_2Kt -*L -20#1,3:40 -20#1:45 -20#1,2:49 -20#1:52 -20#1:54 -9#1:26 -9#1,9:27 -9#1,3:36 -9#1:39 -20#1:43 -20#1:44 -20#1:46 -20#1,2:47 -20#1:51 -20#1:53 -*E \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/special/identityCheck.kt b/backend.native/tests/external/codegen/boxInline/special/identityCheck.kt deleted file mode 100644 index ae0a46df1d3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/identityCheck.kt +++ /dev/null @@ -1,33 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun doSmth(a: T) : Boolean { - return a === a -} - -// FILE: 2.kt - -import test.* - -fun test1(s: Long): Boolean { - return doSmth(s) -} - -fun test2(s: Int): Boolean { - return doSmth(s) -} - -inline fun test3(s: T): Boolean { - return doSmth(s) -} - -fun box(): String { - if (!test1(11111.toLong())) return "fail 1" - if (!test2(11111)) return "fail 2" - if (!test3(11111)) return "fail 3.1" - if (!test3("11111")) return "fail 3.2" - if (!test3(11111.3)) return "fail 3.3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/special/ifBranches.kt b/backend.native/tests/external/codegen/boxInline/special/ifBranches.kt deleted file mode 100644 index 6deb024f053..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/ifBranches.kt +++ /dev/null @@ -1,73 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun runIf(f: (T) -> T, start: T, stop: T, secondStart: T) : T { - if (f(start) == stop) { - return f(start) - } - return f(secondStart) -} - - -inline fun runIf2(f: (T) -> T, start: T, stop: T, secondStart: T) : T { - val result = f(start) - if (result == stop) { - return result - } - return f(secondStart) -} - -inline fun runIfElse(f: (T) -> T, start: T, stop: T, secondStart: T) : T { - if (f(start) == stop) { - return f(start) - } else { - return f(secondStart) - } -} - -// FILE: 2.kt - -import test.* - -fun testIf(): String { - if (runIf({it}, 11, 11, 12) != 11) return "testIf 1 test fail" - if (runIf({it}, 11, 1, 12) != 12) return "testIf 2 test fail" - - if (runIf({if (it == 11) it else 12}, 11, 11, 0) != 11) return "testIf 3 test fail" - if (runIf({if (it == 11) it else 12}, 11, 1, 0) != 12) return "testIf 4 test fail" - - return "OK" -} - -fun testIf2(): String { - if (runIf2({it}, 11, 11, 12) != 11) return "testIf2 1 test fail" - if (runIf2({it}, 11, 1, 12) != 12) return "testIf2 2 test fail" - - if (runIf2({if (it == 11) it else 12}, 11, 11, 0) != 11) return "testIf2 3 test fail" - if (runIf2({if (it == 11) it else 12}, 11, 1, 0) != 12) return "testIf2 4 test fail" - - return "OK" -} - -fun testIfElse(): String { - if (runIfElse({it}, 11, 11, 12) != 11) return "testIfElse 1 test fail" - if (runIfElse({it}, 11, 1, 12) != 12) return "testIfElse 2 test fail" - - if (runIfElse({if (it == 11) it else 12}, 11, 11, 0) != 11) return "testIfElse 3 test fail" - if (runIfElse({if (it == 11) it else 12}, 11, 1, 0) != 12) return "testIfElse 4 test fail" - return "OK" -} - -fun box(): String { - var result = testIf() - if (result != "OK") return "fail1: ${result}" - - result = testIf2() - if (result != "OK") return "fail2: ${result}" - - result = testIfElse() - if (result != "OK") return "fail2: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/special/iinc.kt b/backend.native/tests/external/codegen/boxInline/special/iinc.kt deleted file mode 100644 index 9df58ac0af5..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/iinc.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt - -public inline fun Int.times2(body : () -> Unit) { - var count = this; - while (count > 0) { - body() - count-- - } -} - -// FILE: 2.kt - -fun test1(): Int { - var s = 0; - 2.times2 { - s++ - } - return s; -} - -fun box(): String { - if (test1() != 2) return "test1: ${test1()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/special/inlineChain.kt b/backend.native/tests/external/codegen/boxInline/special/inlineChain.kt deleted file mode 100644 index 9c24a59c100..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/inlineChain.kt +++ /dev/null @@ -1,43 +0,0 @@ -// FILE: 1.kt - -class My - -inline fun T.perform(job: (T)-> R) : R { - return job(this) -} - - -inline fun My.someWork(job: (String) -> Any): Unit { - this.perform { - job("OK") - } -} - -inline fun My.doWork (closure : (param : String) -> Unit) : Unit { - this.someWork(closure) -} - -inline fun My.doPerform (closure : (param : My) -> Int) : Int { - return perform(closure) -} - -// FILE: 2.kt - -fun test1(): String { - val inlineX = My() - var d = ""; - inlineX.doWork({ z: String -> d = z; z}) - return d -} - -fun test2(): Int { - val inlineX = My() - return inlineX.perform({ z: My -> 11}) -} - -fun box(): String { - if (test1() != "OK") return "test1: ${test1()}" - if (test2() != 11) return "test1: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains.kt b/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains.kt deleted file mode 100644 index 1d368d6595e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains.kt +++ /dev/null @@ -1,19 +0,0 @@ -// NO_CHECK_LAMBDA_INLINING - -// FILE: 1.kt -inline fun test(noinline foo: () -> String, noinline bar: () -> String): String { - var vfoo = foo - var vbar = bar - var vres = foo - for (i in 1 .. 4) { - vres = vbar - vbar = vfoo - vfoo = vres - } - return vres() -} - - -// FILE: 2.kt -fun box(): String = - test({ "OK" }, { "wrong lambda" }) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains2.kt b/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains2.kt deleted file mode 100644 index 9e0289e38d0..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/loopInStoreLoadChains2.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt -inline fun cycle(p: String): String { - var z = p - var x = z - for (i in 1..4) { - z = x - x = z - } - return z -} - -inline fun test(crossinline foo: String.() -> String): String { - val cycle = cycle("123"); - - { - cycle.foo() - }() - - - return cycle.foo() -} - - -// FILE: 2.kt -fun box(): String = test { "OK" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/special/plusAssign.kt b/backend.native/tests/external/codegen/boxInline/special/plusAssign.kt deleted file mode 100644 index 840e4ae2958..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/plusAssign.kt +++ /dev/null @@ -1,26 +0,0 @@ -// FILE: 1.kt - -package test - -public class Z(public var s: Int) - -operator inline fun Z.plusAssign(lambda: () -> Int) { - this.s += lambda() -} - -// FILE: 2.kt - -import test.* - -fun test1(s: Int): Int { - val z = Z(s) - z += {s} - return z.s -} - -fun box(): String { - val result = test1(11) - if (result != 22) return "fail1: ${result}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/special/stackHeightBug.kt b/backend.native/tests/external/codegen/boxInline/special/stackHeightBug.kt deleted file mode 100644 index 21de6838e34..00000000000 --- a/backend.native/tests/external/codegen/boxInline/special/stackHeightBug.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun mfun(f: () -> R) { - f() - f() -} - -public inline fun String.toLowerCase2() : String = "" - -// FILE: 2.kt - -import test.* - -fun box(): String { - mfun{ "".toLowerCase2() } - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/elvis.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/elvis.kt deleted file mode 100644 index 6e4d98a72b9..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/elvis.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt -fun foo(x: Any?, y: Any?) = null - -inline fun test(value: Any?): String? { - return foo(null, value ?: return null) -} - -// FILE: 2.kt -fun box(): String = - test(null) ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/ifThenElse.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/ifThenElse.kt deleted file mode 100644 index 0e59babfb80..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/ifThenElse.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt -fun foo(x: Any?, y: Any?) = null - -inline fun test(value: Any?): String? { - return foo(null, if (value != null) value else return null) -} - -// FILE: 2.kt -fun box(): String = - test(null) ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt11499.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt11499.kt deleted file mode 100644 index 1194efbfdc3..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt11499.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: 1.kt -object CrashMe { - fun crash(value: T): T? = null -} - -internal inline fun crashMe(value: T?): T? { - return CrashMe.crash(value ?: return null) -} - -// FILE: 2.kt -fun box(): String = - crashMe(null) ?: "OK" diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591.kt deleted file mode 100644 index c9a891f0e7d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591.kt +++ /dev/null @@ -1,7 +0,0 @@ -// FILE: 1.kt -inline fun alwaysOk(s: String, fn: (String) -> String): String { - return fn(return "OK") -} - -// FILE: 2.kt -fun box() = alwaysOk("what?") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591a.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591a.kt deleted file mode 100644 index adb5010e8c7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591a.kt +++ /dev/null @@ -1,7 +0,0 @@ -// FILE: 1.kt -inline fun alwaysOk(s: String, fn: (String) -> String): String { - try { return fn(return "fail") } finally { fn(return "OK") } -} - -// FILE: 2.kt -fun box() = alwaysOk("what?") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591b.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591b.kt deleted file mode 100644 index 672946db11d..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/kt17591b.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt -inline fun alwaysOk(s: String, fn: (String) -> String): String { - try { - throw Exception() - } - catch(e: Exception) { - fn(return "fail") - } - finally { - fn(return "OK") - } -} - -// FILE: 2.kt -fun box() = alwaysOk("what?") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack1.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack1.kt deleted file mode 100644 index 08d6a84c259..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack1.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt -fun foo1(x: Long, xx: Int, y: Any?) = null - -inline fun test1(value: Any?): String? { - return foo1(0L, 0, value ?: return null) -} - -// FILE: 2.kt -fun box(): String = - test1(null) ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack2.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack2.kt deleted file mode 100644 index 22268ac2f98..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack2.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt -fun foo2(x: Int, xx: Long, y: Any?) = null - -inline fun test2(value: Any?): String? { - return foo2(0, 0L, value ?: return null) -} - -// FILE: 2.kt -fun box(): String = - test2(null) ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack3.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack3.kt deleted file mode 100644 index 64a61b6f014..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/mixedTypesOnStack3.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FILE: 1.kt -fun foo3(x: Int, xx: Long, xxx: Int, y: Any?) = null - -inline fun test3(value: Any?): String? { - return foo3(0, 0L, 0, value ?: return null) -} - -// FILE: 2.kt -fun box(): String = - test3(null) ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn1.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn1.kt deleted file mode 100644 index 1f1779b04fe..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn1.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt -inline fun run(f: () -> Unit) = f() -inline fun withAny(f: Any.() -> Unit) = Any().f() - -// FILE: 2.kt -fun foo(x: Any?, y: Any?) {} - -fun box(): String { - run outer@{ - withAny inner@{ - foo(null, null ?: return@outer) - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn2.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn2.kt deleted file mode 100644 index 10b2f78b209..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn2.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: 1.kt -inline fun run(f: () -> Unit) = f() -inline fun withAny(f: Any.() -> Unit) = Any().f() - -// FILE: 2.kt -fun foo(x: Any?, y: Any?) {} - -fun box(): String { - run outer@{ - withAny inner@{ - foo(null, null ?: return@inner) - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn3.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn3.kt deleted file mode 100644 index 53330c09d22..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/nonLocalReturn3.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -inline fun run(f: () -> Unit) = f() -inline fun withAny(f: Any.() -> Unit) = Any().f() -inline fun foo(x: Any?, y: Any?, f: () -> Unit) = f() - -// FILE: 2.kt - -fun box(): String { - run outer@{ - withAny inner@{ - foo(null, 0 ?: return@outer) { - foo(null, null ?: return@inner) {} - } - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/returnLong.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/returnLong.kt deleted file mode 100644 index 2f5cdbc9a0a..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/returnLong.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: 1.kt -fun foo(x: Any?, y: Any?) = 0L - -inline fun test(value: Any?): Long { - return foo(null, value ?: return 1L) -} - -// FILE: 2.kt -fun box(): String { - val t = test(null) - return if (t == 1L) "OK" else "fail: t=$t" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/stackOnReturn/tryFinally.kt b/backend.native/tests/external/codegen/boxInline/stackOnReturn/tryFinally.kt deleted file mode 100644 index 6b5b4ec2f30..00000000000 --- a/backend.native/tests/external/codegen/boxInline/stackOnReturn/tryFinally.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: 1.kt -fun foo(x: Any?, y: Any?) = null - -var finallyFlag = false - -inline fun test(value: Any?): String? { - try { - return foo(null, value ?: return null) - } - finally { - finallyFlag = true - } -} - -// FILE: 2.kt -fun box(): String = - test(null) ?: if (finallyFlag) "OK" else "finallyFlag not set" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/constField.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/constField.kt deleted file mode 100644 index 7900725284c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/constField.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: 1.kt - -package test - -private const val packageProp = "O" - -internal inline fun packageInline(p: (String) -> String): String { - return p(packageProp) -} - -internal fun samePackageCall(): String { - return packageInline { it + "K"} -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val packageResult = packageInline { it + "K" } - if (packageResult != "OK") return "package inline fail: $packageResult" - - val samePackageResult = samePackageCall() - if (samePackageResult != "OK") return "same package inline fail: $samePackageResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/packagePrivateMembers.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/packagePrivateMembers.kt deleted file mode 100644 index 30bef9d6bc8..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/packagePrivateMembers.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FILE: 1.kt - -package test - -private val packageProp = "O" - -private fun packageFun() = "K" - -internal inline fun packageInline(p: (String, String) -> String): String { - return p(packageProp, packageFun()) -} - -internal fun samePackageCall(): String { - return packageInline { s, s2 -> s + s2 } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - val packageResult = packageInline { a, b -> a + b } - if (packageResult != "OK") return "package inline fail: $packageResult" - - val samePackageResult = samePackageCall() - if (samePackageResult != "OK") return "same package inline fail: $samePackageResult" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/propertyModifiers.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/propertyModifiers.kt deleted file mode 100644 index a389f36bb3c..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/propertyModifiers.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -package test - -class P { - private val FOO_PRIVATE = "OK" - - final val FOO_FINAL = "OK" - - private inline fun fooPrivate(): String { - return FOO_PRIVATE - } - - private inline fun fooFinal(): String { - return FOO_FINAL - } - - fun testPrivate(): String { - return fooPrivate() - } - - fun testFinal(): String { - return fooFinal() - } -} - -// FILE: 2.kt - -import test.* - -fun box() : String { - val p = P() - - if (p.testPrivate() != "OK") return "fail 1 ${p.testPrivate()}" - - if (p.testFinal() != "OK") return "fail 2 ${p.testFinal()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembers.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembers.kt deleted file mode 100644 index 21bcb3291ee..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembers.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -open class P { - protected open val FOO = "O" - - protected open fun test() = "K" - - inline fun protectedProp(): String { - return FOO - } - - inline fun protectedFun(): String { - return test() - } -} - -// FILE: 2.kt - -import test.* - -class A: P() { - override val FOO: String - get() = "fail" - - override fun test(): String { - return "fail" - } -} - -fun box() : String { - val p = P() - return p.protectedProp() + p.protectedFun() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembersFromSuper.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembersFromSuper.kt deleted file mode 100644 index 93daa050549..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/protectedMembersFromSuper.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -package test - -open class Base { - protected open val FOO = "O" - - protected open fun test() = "K" -} - -open class P : Base() { - - inline fun protectedProp(): String { - return FOO - } - - inline fun protectedFun(): String { - return test() - } -} - -// FILE: 2.kt - -import test.* - -class A: P() { - override val FOO: String - get() = "fail" - - override fun test(): String { - return "fail" - } -} - -fun box() : String { - val p = P() - return p.protectedProp() + p.protectedFun() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superCall.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superCall.kt deleted file mode 100644 index 98cf3d927ed..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superCall.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: 1.kt - -package test - -open class A { - open fun test() = "OK" -} - -object X : A() { - override fun test(): String { - return "fail" - } - - inline fun doTest(): String { - return super.test() - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return X.doTest() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superProperty.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superProperty.kt deleted file mode 100644 index e5f900da71e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/superProperty.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: 1.kt - -package test - -open class A { - open val test = "OK" -} - -object X : A() { - override val test: String - get() = "fail" - - inline fun doTest(): String { - return super.test - } -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return X.doTest() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.kt deleted file mode 100644 index 1650f38adf4..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccess.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -class A { - - private val prop : String = "O" - get() = call {field + "K" } - - private val prop2 : String = "O" - get() = call { call {field + "K" } } - - fun test1(): String { - return prop - } - - fun test2(): String { - return prop2 - } - -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt deleted file mode 100644 index ff03266a302..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/directFieldAccessInCrossInline.kt +++ /dev/null @@ -1,36 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(crossinline s: () -> String): String { - return { s() } () -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -class A { - - private val prop : String = "O" - get() = call {field + "K" } - - private val prop2 : String = "O" - get() = call { call {field + "K" } } - - fun test1(): String { - return prop - } - - fun test2(): String { - return prop2 - } - -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.kt deleted file mode 100644 index b5a5f5fce47..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateCall.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(s: () -> String): String { - return s() -} - -// FILE: 2.kt - -import test.* - -class A { - - private fun method() = "O" - - private val prop = "K" - - fun test1(): String { - return call { - method() + prop - } - } - - fun test2(): String { - return call { - call { - method() + prop - } - } - } -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt deleted file mode 100644 index 4bf507eea06..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/privateInCrossInline.kt +++ /dev/null @@ -1,41 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(crossinline s: () -> String): String { - return { - s() - }() -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -class A { - - private fun method() = "O" - - private val prop = "K" - - fun test1(): String { - return call { - method() + prop - } - } - - fun test2(): String { - return call { - call { - method() + prop - } - } - } -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.kt deleted file mode 100644 index 6d8aca2ae52..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superCall.kt +++ /dev/null @@ -1,45 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(s: () -> String): String { - return s() -} - -open class Base { - - protected open fun method(): String = "O" - - protected open val prop = "K" -} - -// FILE: 2.kt - -import test.* - -class A : Base() { - - override fun method() = "fail method" - - override val prop = "fail property" - - fun test1(): String { - return call { - super.method() + super.prop - } - } - - fun test2(): String { - return call { - call { - super.method() + super.prop - } - } - } -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt b/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt deleted file mode 100644 index 4c5559410c1..00000000000 --- a/backend.native/tests/external/codegen/boxInline/syntheticAccessors/withinInlineLambda/superInCrossInline.kt +++ /dev/null @@ -1,48 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun call(crossinline s: () -> String): String { - return { - s() - }() -} - -open class Base { - - protected open fun method(): String = "O" - - protected open val prop = "K" -} - -// FILE: 2.kt - -//NO_CHECK_LAMBDA_INLINING -import test.* - -class A : Base() { - - override fun method() = "fail method" - - override val prop = "fail property" - - fun test1(): String { - return call { - super.method() + super.prop - } - } - - fun test2(): String { - return call { - call { - super.method() + super.prop - } - } - } -} - -fun box(): String { - val a = A() - if (a.test1() != "OK") return "fail 1: ${a.test1()}" - return a.test2() -} diff --git a/backend.native/tests/external/codegen/boxInline/trait/trait.kt b/backend.native/tests/external/codegen/boxInline/trait/trait.kt deleted file mode 100644 index cd85fac3b3e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/trait/trait.kt +++ /dev/null @@ -1,44 +0,0 @@ -// FILE: 1.kt - -package test - -interface InlineTrait { - - private inline fun privateInline(s: () -> String): String { - return s() - } - - fun testPrivateInline(): String { - return privateInline { "private" } - } - - fun testPrivateInline2(): String { - return privateInline { "private2" } - } - - companion object { - inline final fun finalInline(s: () -> String): String { - return s() - } - } -} - -class Z : InlineTrait { - -} - -// FILE: 2.kt - -import test.* - -fun testClassObject(): String { - return InlineTrait.finalInline({ "classobject" }) -} - -fun box(): String { - if (Z().testPrivateInline() != "private") return "test1: ${Z().testPrivateInline()}" - if (Z().testPrivateInline2() != "private2") return "test2: ${Z().testPrivateInline2()}" - if (testClassObject() != "classobject") return "test3: ${testClassObject()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/kt5863.kt b/backend.native/tests/external/codegen/boxInline/tryCatchFinally/kt5863.kt deleted file mode 100644 index 93c27ff3be7..00000000000 --- a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/kt5863.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: 1.kt - -inline fun performWithFinally(finally: () -> R) : R { - try { - throw RuntimeException("1") - } catch (e: RuntimeException) { - throw RuntimeException("2") - } finally { - return finally() - } -} - -// FILE: 2.kt - -inline fun test2Inline() = performWithFinally { "OK" } - -fun box(): String { - return test2Inline() -} diff --git a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch.kt b/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch.kt deleted file mode 100644 index b4e0f13f2ac..00000000000 --- a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch.kt +++ /dev/null @@ -1,66 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt - -class My(val value: Int) - -inline fun T.perform(job: (T)-> R) : R { - return job(this) -} - -public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) - -// FILE: 2.kt - -fun test1() : Int { - val inlineX = My(111) - var result = 0 - val res = inlineX.perform{ - - try { - throw RuntimeException() - } catch (e: RuntimeException) { - result = -1 - } - result - } - - return result -} - -fun test11() : Int { - val inlineX = My(111) - val res = inlineX.perform{ - try { - throw RuntimeException() - } catch (e: RuntimeException) { - -1 - } - } - - return res -} - -fun test2() : Int { - try { - val inlineX = My(111) - var result = 0 - val res = inlineX.perform{ - try { - throw RuntimeException("-1") - } catch (e: RuntimeException) { - throw RuntimeException("-2") - } - } - return result - } catch (e: RuntimeException) { - return e.message!!.toInt2()!! - } -} - -fun box(): String { - if (test1() != -1) return "test1: ${test1()}" - if (test11() != -1) return "test11: ${test11()}" - if (test2() != -2) return "test2: ${test2()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch2.kt b/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch2.kt deleted file mode 100644 index 9d80c724d68..00000000000 --- a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatch2.kt +++ /dev/null @@ -1,132 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt - -class My(val value: Int) - -inline fun T.performWithFail(job: (T)-> R, failJob : (T) -> R) : R { - try { - return job(this) - } catch (e: RuntimeException) { - return failJob(this) - } -} - -inline fun T.performWithFail2(job: (T)-> R, failJob : (e: RuntimeException, T) -> R) : R { - try { - return job(this) - } catch (e: RuntimeException) { - return failJob(e, this) - } -} - -public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) - -// FILE: 2.kt - -fun test1(): Int { - val res = My(111).performWithFail( - { - throw RuntimeException() - }, { - it.value - }) - return res -} - -fun test11(): Int { - val res = My(111).performWithFail2( - { - try { - throw RuntimeException("1") - } catch (e: RuntimeException) { - throw RuntimeException("2") - } - }, - { ex, thizz -> - if (ex.message == "2") { - thizz.value - } else { - -11111 - } - }) - return res -} - -fun test2(): Int { - val res = My(111).performWithFail( - { - it.value - }, - { - it.value + 1 - }) - return res -} - -fun test22(): Int { - val res = My(111).performWithFail2( - { - try { - throw RuntimeException("1") - } catch (e: RuntimeException) { - it.value - 111 - } - }, - { ex, thizz -> - -11111 - }) - - return res -} - - -fun test3(): Int { - try { - val res = My(111).performWithFail( - { - throw RuntimeException("-1") - }, { - throw RuntimeException("-2") - }) - return res - } catch (e: RuntimeException) { - return e.message?.toInt2()!! - } -} - -fun test33(): Int { - try { - val res = My(111).performWithFail2( - { - try { - throw RuntimeException("-1") - } catch (e: RuntimeException) { - throw RuntimeException("-2") - } - }, - { ex, thizz -> - if (ex.message == "-2") { - throw RuntimeException("-3") - } else { - -11111 - } - }) - return res - } catch (e: RuntimeException) { - return e.message!!.toInt2()!! - } -} - -fun box(): String { - if (test1() != 111) return "test1: ${test1()}" - if (test11() != 111) return "test11: ${test11()}" - - if (test2() != 111) return "test2: ${test2()}" - if (test22() != 111) return "test22: ${test22()}" - - if (test3() != -2) return "test3: ${test3()}" - if (test33() != -3) return "test33: ${test33()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt b/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt deleted file mode 100644 index ada4876e5cf..00000000000 --- a/backend.native/tests/external/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt +++ /dev/null @@ -1,101 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: 1.kt -// WITH_RUNTIME - -class My(val value: Int) - -inline fun T.performWithFinally(job: (T)-> R, finally: (T) -> R) : R { - try { - return job(this) - } finally { - return finally(this) - } -} - -inline fun T.performWithFailFinally(job: (T)-> R, failJob : (e: RuntimeException, T) -> R, finally: (T) -> R) : R { - try { - return job(this) - } catch (e: RuntimeException) { - return failJob(e, this) - } finally { - return finally(this) - } -} - -inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) - -// FILE: 2.kt - -fun test1(): Int { - - var res = My(111).performWithFinally( - { - 1 - }, { - it.value - }) - return res -} - -fun test11(): Int { - var result = -1; - val res = My(111).performWithFinally( - { - try { - result = it.value - throw RuntimeException("1") - } catch (e: RuntimeException) { - ++result - throw RuntimeException("2") - } - }, - { - ++result - }) - return res -} - -fun test2(): Int { - var res = My(111).performWithFinally( - { - throw RuntimeException("1") - }, - { - it.value - }) - - - return res -} - -fun test3(): Int { - try { - var result = -1; - val res = My(111).performWithFailFinally( - { - result = it.value; - throw RuntimeException("-1") - }, - { e, z -> - ++result - throw RuntimeException("-2") - }, - { - ++result - }) - return res - } catch (e: RuntimeException) { - return e.message?.toInt()!! - } -} - -fun box(): String { - if (test1() != 111) return "test1: ${test1()}" - if (test11() != 113) return "test11: ${test11()}" - - if (test2() != 111) return "test2: ${test2()}" - - if (test3() != 113) return "test3: ${test3()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt b/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt deleted file mode 100644 index c5b4c61339e..00000000000 --- a/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(vararg constraints: String, init: String.() -> String): String { - return "O".init() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun { - this + "K" - } -} - diff --git a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt deleted file mode 100644 index 4e4f5cbd8df..00000000000 --- a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt - -package test - -inline fun inlineFun(vararg constraints: String, receiver: String = "O", init: String.() -> String): String { - return receiver.init() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun { - this + "K" - } -} - diff --git a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt deleted file mode 100644 index 3dc7ee6f693..00000000000 --- a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: 1.kt -// WITH_RUNTIME - -package test -inline fun inlineFun(vararg constraints: String, receiver: String = "K", init: String.() -> String): String { - return (constraints.joinToString() + receiver).init() -} - -// FILE: 2.kt - -import test.* - -fun box(): String { - return inlineFun("O") { - this - } -} - diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/annotationInInterface.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/annotationInInterface.kt deleted file mode 100644 index 636b1c5be0f..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/annotationInInterface.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package a - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann - -interface Tr { - @Ann - fun foo() {} -} - -// FILE: B.kt - -class C : a.Tr - -fun box(): String { - val method = C::class.java.getDeclaredMethod("foo") - val annotations = method.getDeclaredAnnotations().joinToString("\n") - if (annotations != "@a.Ann()") { - return "Fail: $annotations" - } - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/annotationsOnTypeAliases.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/annotationsOnTypeAliases.kt deleted file mode 100644 index 64d76c8222d..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/annotationsOnTypeAliases.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -package a - -import kotlin.annotation.AnnotationTarget.* -import kotlin.annotation.AnnotationRetention.* -import java.lang.Class - -@Target(TYPEALIAS) -@Retention(RUNTIME) -annotation class Ann(val x: Int) - -@Ann(2) -typealias TA = Any - -// FILE: B.kt -import a.Ann - -fun Class<*>.assertHasDeclaredMethodWithAnn() { - if (!declaredMethods.any { it.isSynthetic && it.getAnnotation(Ann::class.java) != null }) { - throw java.lang.AssertionError("Class ${this.simpleName} has no declared method with annotation @Ann") - } -} - -fun box(): String { - Class.forName("a.AKt").assertHasDeclaredMethodWithAnn() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt deleted file mode 100644 index ae838b1598a..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun foo(): String = "OK" -const val constOK: String = "OK" -val valOK: String = "OK" -var varOK: String = "Hmmm?" - -// FILE: B.kt - -import a.* - -fun box(): String { - if (foo() != "OK") return "Fail function" - if (constOK != "OK") return "Fail const" - if (valOK != "OK") return "Fail val" - varOK = "OK" - if (varOK != "OK") return "Fail var" - return varOK -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/classInObject.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/classInObject.kt deleted file mode 100644 index 28cf854a951..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/classInObject.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: A.kt - -package a - -object CartRoutes { - class RemoveOrderItem { - val result = "OK" - } -} - -// FILE: B.kt - -import a.CartRoutes - -fun box(): String { - val r = CartRoutes.RemoveOrderItem() - return r.result -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectInEnum.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectInEnum.kt deleted file mode 100644 index 23b2ba03385..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectInEnum.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: A.kt - -package library - -public enum class EnumClass { - ENTRY; - - public companion object { - public fun entry(): EnumClass = ENTRY - } -} - -// FILE: B.kt - -import library.EnumClass - -fun box(): String { - return if (EnumClass.entry() != EnumClass.ENTRY) "Fail" else "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectMember.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectMember.kt deleted file mode 100644 index deda85e7ded..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/companionObjectMember.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: A.kt - -class A { - companion object { - fun foo() = 42 - val bar = "OK" - } -} - -// FILE: B.kt - -fun box(): String { - if (A.foo() != 42) return "Fail foo" - return A.bar -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt deleted file mode 100644 index b9f29dc33f6..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt +++ /dev/null @@ -1,28 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -annotation class A - -@A -const val OK: String = "OK" - -// FILE: B.kt - -import a.OK - -fun box(): String { - val okRef = ::OK - - // TODO: see KT-10892 -// val annotations = okRef.annotations -// val numAnnotations = annotations.size -// if (numAnnotations != 1) { -// throw AssertionError("Failed, annotations: $annotations") -// } - - val result = okRef.get() - return result -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/constructorVararg.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/constructorVararg.kt deleted file mode 100644 index b618feba70e..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/constructorVararg.kt +++ /dev/null @@ -1,14 +0,0 @@ -// FILE: A.kt - -class A(vararg s: String) { - -} - -// FILE: B.kt - -fun box(): String { - A() - A("a") - A("a", "b") - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/coroutinesBinary.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/coroutinesBinary.kt deleted file mode 100644 index a6b75c53561..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/coroutinesBinary.kt +++ /dev/null @@ -1,35 +0,0 @@ -// FILE: A.kt -// WITH_RUNTIME -package a - -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere() = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), object : Continuation { - override val context: CoroutineContext = EmptyCoroutineContext - override fun resume(value: Unit) {} - - override fun resumeWithException(exception: Throwable) {} - }) -} - -// FILE: B.kt -import a.builder - -fun box(): String { - var result = "" - - builder { - result = suspendHere() - } - - return result -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/defaultConstructor.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/defaultConstructor.kt deleted file mode 100644 index 8cbbab06504..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/defaultConstructor.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: A.kt - -package aaa - -class A(val a: Int = 1) - -// FILE: B.kt - -fun box(): String { - aaa.A() - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/doublyNestedClass.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/doublyNestedClass.kt deleted file mode 100644 index 12ceef419a4..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/doublyNestedClass.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: A.kt - -package aaa - -class A { - class B { - class O { - val s = "OK" - } - } -} - -// FILE: B.kt - -fun box(): String { - val str = aaa.A.B.O().s - return str -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/enum.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/enum.kt deleted file mode 100644 index aedb880cdbc..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/enum.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: A.kt - -package aaa - -enum class E { - TRIVIAL_ENTRY, - SUBCLASS { } -} - -// FILE: B.kt - -import aaa.E - -fun box(): String { - if (E.TRIVIAL_ENTRY == E.SUBCLASS) return "Fail" - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/inlinedConstants.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/inlinedConstants.kt deleted file mode 100644 index a772f317ddf..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/inlinedConstants.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package constants - -public const val b: Byte = 100 -public const val s: Short = 20000 -public const val i: Int = 2000000 -public const val l: Long = 2000000000000L -public const val f: Float = 3.14f -public const val d: Double = 3.14 -public const val bb: Boolean = true -public const val c: Char = '\u03c0' // pi symbol - -public const val str: String = ":)" - -@Retention(AnnotationRetention.RUNTIME) -public annotation class AnnotationClass(public val value: String) - -// FILE: B.kt - -import constants.* - -@AnnotationClass("$b $s $i $l $f $d $bb $c $str") -class DummyClass() - -fun box(): String { - val klass = DummyClass::class.java - val annotationClass = AnnotationClass::class.java - val annotation = klass.getAnnotation(annotationClass)!! - val value = annotation.value - require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", { "Annotation value: $value" }) - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/innerClassConstructor.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/innerClassConstructor.kt deleted file mode 100644 index 410cc603f89..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/innerClassConstructor.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: A.kt - -package second - -public class Outer() { - inner class Inner(test: String) -} - -// FILE: B.kt - -//test for KT-3702 Inner class constructor cannot be invoked in override function with receiver -import second.Outer - -fun Outer.testExt() { - Inner("test") -} - -fun box(): String { - Outer().testExt() - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmField.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmField.kt deleted file mode 100644 index bd67d07401c..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmField.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -open class A { - @JvmField public val publicField = "1"; - @JvmField internal val internalField = "2"; - @JvmField protected val protectedfield = "3"; -} - -open class B : A() { - -} - -// FILE: B.kt - -open class C : B() { - fun test(): String { - return super.publicField + super.internalField + super.protectedfield - } -} - -fun box(): String { - C().test() - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmFieldInConstructor.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmFieldInConstructor.kt deleted file mode 100644 index a04bebca35a..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmFieldInConstructor.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -open class A(@JvmField public val publicField: String = "1", - @JvmField internal val internalField: String = "2", - @JvmField protected val protectedfield: String = "3") - -open class B : A() - -// FILE: B.kt - -open class C : B() { - fun test(): String { - return super.publicField + super.internalField + super.protectedfield - } -} - -fun box(): String { - C().test() - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmNames.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmNames.kt deleted file mode 100644 index 9d3c1c411eb..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmNames.kt +++ /dev/null @@ -1,31 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package lib - -@JvmName("bar") -fun foo() = "foo" - -var v: Int = 1 - @JvmName("vget") - get - @JvmName("vset") - set - -fun consumeInt(x: Int) {} - -class A { - val OK: String = "OK" - @JvmName("OK") get -} - -// FILE: B.kt - -import lib.* - -fun box(): String { - foo() - v = 1 - consumeInt(v) - return A().OK -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageName.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageName.kt deleted file mode 100644 index 8a351766474..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageName.kt +++ /dev/null @@ -1,26 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -// LANGUAGE_VERSION: 1.2 - -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@file:JvmPackageName("bar") -package foo - -fun f() = "OK" - -var v: Int = 1 - -inline fun i(block: () -> Unit) = block() - -// FILE: B.kt -// LANGUAGE_VERSION: 1.2 - -import foo.* - -fun box(): String { - v = 2 - if (v != 2) return "Fail" - i { v = 3 } - if (v != 3) return "Fail" - return f() -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt deleted file mode 100644 index 65d9f3365ab..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -// LANGUAGE_VERSION: 1.2 - -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@file:JvmPackageName("bar") - -fun f() = "OK" - -var v: Int = 1 - -// FILE: B.kt -// LANGUAGE_VERSION: 1.2 - -fun box(): String { - v = 2 - if (v != 2) return "Fail" - return f() -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt deleted file mode 100644 index d5aa6ce0906..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -// LANGUAGE_VERSION: 1.2 - -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@file:JvmPackageName("bar") -@file:JvmName("Baz") -package foo - -fun f() = "OK" - -var v: Int = 1 - -// FILE: B.kt -// LANGUAGE_VERSION: 1.2 - -import foo.* - -fun box(): String { - v = 2 - if (v != 2) return "Fail" - return f() -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmStaticInObject.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/jvmStaticInObject.kt deleted file mode 100644 index 4fc82fe64ae..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/jvmStaticInObject.kt +++ /dev/null @@ -1,17 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package aaa - -import kotlin.jvm.* - -public object TestObject { - @JvmStatic - public val test: String = "OK" -} - -// FILE: B.kt - -fun box(): String { - return aaa.TestObject.test -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt deleted file mode 100644 index 4091b9e500c..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt +++ /dev/null @@ -1,54 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package a - -const val i = 2 -const val s = 2.toShort() -const val f = 2.0.toFloat() -const val d = 2.0 -const val l = 2L -const val b = 2.toByte() -const val bool = true -const val c = 'c' -const val str = "str" - -const val i2 = i -const val s2 = s -const val f2 = f -const val d2 = d -const val l2 = l -const val b2 = b -const val bool2 = bool -const val c2 = c -const val str2 = str - -// FILE: B.kt - -import a.* - -@Ann(i, s, f, d, l, b, bool, c, str) -class MyClass1 - -@Ann(i2, s2, f2, d2, l2, b2, bool2, c2, str2) -class MyClass2 - -@Retention(AnnotationRetention.RUNTIME) -annotation class Ann( - val i: Int, - val s: Short, - val f: Float, - val d: Double, - val l: Long, - val b: Byte, - val bool: Boolean, - val c: Char, - val str: String -) - -fun box(): String { - // Trigger annotation loading - (MyClass1() as java.lang.Object).getClass().getAnnotations() - (MyClass2() as java.lang.Object).getClass().getAnnotations() - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012.kt deleted file mode 100644 index 71da17120c4..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: A.kt -package test - -var property = "fail" - private set - -fun test() { - property = "OK" -} - -// FILE: B.kt - -import test.* - -fun box(): String { - test() - return property -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012_multi.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012_multi.kt deleted file mode 100644 index 4fb57e5ea21..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/kt14012_multi.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -@file:JvmName("TTest") -@file:JvmMultifileClass -package test - -var property = "fail" - private set - -fun test() { - property = "OK" -} - -// FILE: B.kt - -import test.* - -fun box(): String { - test() - return property -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassInlineFunctionAccessingProperty.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassInlineFunctionAccessingProperty.kt deleted file mode 100644 index c0eeb761349..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassInlineFunctionAccessingProperty.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -@file:[JvmName("Test") JvmMultifileClass] - -val property = "K" - -inline fun K(body: () -> String): String = - body() + property - -// FILE: B.kt - -fun box(): String { - return K { "O" } -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassWithTypealias.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassWithTypealias.kt deleted file mode 100644 index f7ed63a5c3f..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/multifileClassWithTypealias.kt +++ /dev/null @@ -1,16 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -@file:[JvmName("Test") JvmMultifileClass] - -typealias S = String -typealias LS = List - -// FILE: B.kt - -import java.util.Arrays - -fun box(): S { - val l: LS = Arrays.asList("OK") - return l[0] -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedClass.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/nestedClass.kt deleted file mode 100644 index 52d14e6357d..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: A.kt - -package aaa - -class A { - class O { - val s = "OK" - } -} - -// FILE: B.kt - -fun box(): String { - return aaa.A.O().s -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedEnum.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/nestedEnum.kt deleted file mode 100644 index 678e8d191a0..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedEnum.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: A.kt - -package aaa - -class A { - enum class E { - A - } -} - -// FILE: B.kt - -fun box(): String { - val str = aaa.A.E.A - if (str.toString() != "A") { - return "Fail $str" - } - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedObject.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/nestedObject.kt deleted file mode 100644 index a338168c8fd..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/nestedObject.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: A.kt - -package aaa - -class A { - object O { - val s = "OK" - } -} - -// FILE: B.kt - -fun box(): String { - return aaa.A.O.s -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/platformTypes.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/platformTypes.kt deleted file mode 100644 index fe835c0fa2e..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/platformTypes.kt +++ /dev/null @@ -1,37 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package test - -import java.util.* - -fun printStream() = System.out -fun list() = Collections.emptyList() -fun array(a: Array) = Arrays.copyOf(a, 2) - -// FILE: B.kt - -import java.io.PrintStream -import java.util.ArrayList -import test.* - -// To check that flexible types are loaded -class Inv -fun inv(t: T): Inv = Inv() - -fun box(): String { - printStream().checkError() - val p: Inv = inv(printStream()) - val p1: Inv = inv(printStream()) - - list().size - val l: Inv> = inv(list()) - val l1: Inv?> = inv(list()) - - val a = array(arrayOfNulls(1) as Array) - a[0] = 1 - val a1: Inv> = inv(a) - val a2: Inv?> = inv(a) - - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/propertyReference.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/propertyReference.kt deleted file mode 100644 index 35bdea51241..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/propertyReference.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: A.kt - -package a - -public var topLevel: Int = 42 - -public val String.extension: Long - get() = length.toLong() - -// FILE: B.kt - -import a.* - -fun box(): String { - val f = ::topLevel - val x1 = f.get() - if (x1 != 42) return "Fail x1: $x1" - f.set(239) - val x2 = f.get() - if (x2 != 239) return "Fail x2: $x2" - - val g = String::extension - val y1 = g.get("abcde") - if (y1 != 5L) return "Fail y1: $y1" - - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/recursiveGeneric.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/recursiveGeneric.kt deleted file mode 100644 index be9960edac6..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/recursiveGeneric.kt +++ /dev/null @@ -1,27 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt - -package a - -interface Rec> { - fun t(): T -} - -interface Super { - fun foo(p: Rec<*, *>) = p.t() -} - -// FILE: B.kt - -import a.* - -fun box(): String { - val declaredMethod = Super::class.java.getDeclaredMethod("foo", Rec::class.java) - val genericString = declaredMethod.toGenericString() - if (genericString != "public abstract a.Rec a.Super.foo(a.Rec)") return "Fail: $genericString" - return "OK" -} - -fun test(s: Super, p: Rec<*, *>) { - s.foo(p).t().t().t() -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/sealedClass.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/sealedClass.kt deleted file mode 100644 index dff0e486a51..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/sealedClass.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: A.kt - -package a - -sealed class Empty - -sealed class OnlyNested { - class Nested : OnlyNested() -} - -sealed class NestedAndTopLevel { - class Nested : NestedAndTopLevel() -} -class TopLevel : NestedAndTopLevel() - -// FILE: B.kt - -import a.* - -// This test checks that we correctly load subclasses of a compiled sealed class from binaries. -// It's not a diagnostic test because there are no diagnostic tests where resolution is performed against compiled Kotlin binaries - -fun empty(e: Empty): String = when (e) { - else -> "1" -} - -fun onlyNested(on: OnlyNested): String = when (on) { - is OnlyNested.Nested -> "2" -} - -fun nestedAndTopLevel(natl: NestedAndTopLevel): String = when (natl) { - is NestedAndTopLevel.Nested -> "3" - is TopLevel -> "4" -} - -fun box(): String { - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/secondaryConstructors.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/secondaryConstructors.kt deleted file mode 100644 index 4fa277472d8..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/secondaryConstructors.kt +++ /dev/null @@ -1,38 +0,0 @@ -// FILE: A.kt - -open class A { - val prop: String - constructor(x1: String, x2: String = "abc") { - prop = "$x1#$x2" - } - constructor(x1: Long) { - prop = "$x1" - } -} - -// FILE: B.kt - -class B1() : A("123") { - constructor(x1: Int): this() {} -} - -class B2 : A { - constructor(x1: String): super(x1) {} - constructor(): this("empty") {} - constructor(x1: Int): super(x1.toLong()) {} -} - -fun box(): String { - val b1 = B1() - if (b1.prop != "123#abc") return "fail1: ${b1.prop}" - val b2 = B1(456) - if (b2.prop != "123#abc") return "fail2: ${b2.prop}" - val b3 = B2("cde") - if (b3.prop != "cde#abc") return "fail3: ${b3.prop}" - val b4 = B2() - if (b4.prop != "empty#abc") return "fail4: ${b4.prop}" - val b5 = B2(789) - if (b5.prop != "789") return "fail5: ${b5.prop}" - - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/simple.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/simple.kt deleted file mode 100644 index 2a74fe2aba4..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/simple.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: A.kt - -package aaa - -fun hello() = 17 - -// FILE: B.kt - -fun box(): String { - val h = aaa.hello() - if (h != 17) { - throw Exception() - } - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/simpleValAnonymousObject.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/simpleValAnonymousObject.kt deleted file mode 100644 index 4d6fc957ea0..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/simpleValAnonymousObject.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FILE: A.kt - -package pkg - -interface ClassA { - companion object { - val DEFAULT = object : ClassA { - override fun toString() = "OK" - } - } -} - -// FILE: B.kt - -import pkg.ClassA - -fun box(): String { - val obj = ClassA.DEFAULT - return obj.toString() -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/starImportEnum.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/starImportEnum.kt deleted file mode 100644 index 74d9dea8fa5..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/starImportEnum.kt +++ /dev/null @@ -1,22 +0,0 @@ -// FILE: A.kt - -package aaa - -enum class E { - TRIVIAL_ENTRY, - SUBCLASS { }; - - class Nested { - fun fortyTwo() = 42 - } -} - -// FILE: B.kt - -import aaa.E.* - -fun box(): String { - if (TRIVIAL_ENTRY == SUBCLASS) return "Fail 1" - if (Nested().fortyTwo() != 42) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/targetedJvmName.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/targetedJvmName.kt deleted file mode 100644 index 3ae0ab843ff..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/targetedJvmName.kt +++ /dev/null @@ -1,15 +0,0 @@ -// IGNORE_BACKEND: NATIVE -// FILE: A.kt -package lib - -@set:JvmName("renamedSetFoo") -@get:JvmName("renamedGetFoo") -var foo = "not set" - -// FILE: B.kt -import lib.* - -fun box(): String { - foo = "OK" - return foo -} \ No newline at end of file diff --git a/backend.native/tests/external/compileKotlinAgainstKotlin/typeAliasesKt13181.kt b/backend.native/tests/external/compileKotlinAgainstKotlin/typeAliasesKt13181.kt deleted file mode 100644 index 101c79e0cbd..00000000000 --- a/backend.native/tests/external/compileKotlinAgainstKotlin/typeAliasesKt13181.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: A.kt -typealias Bar = (T) -> String - -class Foo(val t: T) { - - fun baz(b: Bar) = b(t) -} - -// FILE: B.kt -class FooTest { - fun baz(): String { - val b: Bar = { "OK" } - return Foo("").baz(b) - } -} - -fun box(): String = - FooTest().baz() \ No newline at end of file

(val p: P) - -class Host { - fun t() {} - val v = "OK" -} - -fun box(): String { - Generic(Host()).p::class - (Generic(Host()).p::t)() - return (Generic(Host()).p::v)() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/inline/simple.kt b/backend.native/tests/external/codegen/box/callableReference/bound/inline/simple.kt deleted file mode 100644 index ab672b23ac4..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/inline/simple.kt +++ /dev/null @@ -1,5 +0,0 @@ -inline fun foo(x: () -> String) = x() - -fun String.id() = this - -fun box() = foo("OK"::id) diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/inline/simpleVal.kt b/backend.native/tests/external/codegen/box/callableReference/bound/inline/simpleVal.kt deleted file mode 100644 index fea3e21c688..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/inline/simpleVal.kt +++ /dev/null @@ -1,8 +0,0 @@ -inline fun go(f: () -> String) = f() - -fun String.id(): String = this - -fun box(): String { - val x = "OK" - return go(x::id) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt b/backend.native/tests/external/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt deleted file mode 100644 index f03245fd2f5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - var state = 0 - val name = (state++)::toString.name - if (name != "toString") return "Fail 1: $name" - if (state != 1) return "Fail 2: $state" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/kt12738.kt b/backend.native/tests/external/codegen/box/callableReference/bound/kt12738.kt deleted file mode 100644 index 4d0e0c85c47..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/kt12738.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun get(t: T): () -> String { - return t::toString -} - -fun box(): String { - if (get(null).invoke() != "null") return "Fail null" - - return get("OK").invoke() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/kt15446.kt b/backend.native/tests/external/codegen/box/callableReference/bound/kt15446.kt deleted file mode 100644 index 8270b90eb95..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/kt15446.kt +++ /dev/null @@ -1,14 +0,0 @@ -//WITH_RUNTIME -fun box(): String { - val a = intArrayOf(1, 2) - val b = arrayOf("OK") - if ((a::component2)() != 2) { - return "fail" - } - - if ((a::get)(1) != 2) { - return "fail" - } - - return (b::get)(0) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/localUnitFunction.kt b/backend.native/tests/external/codegen/box/callableReference/bound/localUnitFunction.kt deleted file mode 100644 index dcb5c44738b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/localUnitFunction.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME - -fun box(): String { - fun foo(): Unit {} - assert(Unit.javaClass.equals(foo().javaClass)) - assert(Unit.javaClass.equals(foo()::class.java)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/multiCase.kt b/backend.native/tests/external/codegen/box/callableReference/bound/multiCase.kt deleted file mode 100644 index 77bc92f95b6..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/multiCase.kt +++ /dev/null @@ -1,52 +0,0 @@ -class A(var v: Int) { - fun f(x: Int) = x * v -} - -fun A.g(x: Int) = x * f(x); - -var A.w: Int - get() = 1000 * v - set(c: Int) { - v = c + 10 - } - -@kotlin.native.ThreadLocal -object F { - var u = 0 -} - -fun box(): String { - val a = A(5) - - val av = a::v - if (av() != 5) return "fail1: ${av()}" - if (av.get() != 5) return "fail2: ${av.get()}" - av.set(7) - if (a.v != 7) return "fail3: ${a.v}" - - val af = a::f - if (af(10) != 70) return "fail4: ${af(10)}" - - val ag = a::g - if (ag(10) != 700) return "fail5: ${ag(10)}" - - val aw = a::w - if (aw() != 7000) return "fail6: ${aw()}" - if (aw.get() != 7000) return "fail7: ${aw.get()}" - aw.set(5) - if (a.v != 15) return "fail8: ${a.v}" - - val fu = F::u - if (fu() != 0) return "fail9: ${fu()}" - if (fu.get() != 0) return "fail10: ${fu.get()}" - fu.set(8) - if (F.u != 8) return "fail11: ${F.u}" - - val x = 100 - - fun A.lf() = v * x; - val alf = a::lf - if (alf() != 1500) return "fail9: ${alf()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/nullReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/bound/nullReceiver.kt deleted file mode 100644 index 0111a54d58b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/nullReceiver.kt +++ /dev/null @@ -1,4 +0,0 @@ -val String?.ok: String - get() = "OK" - -fun box() = (null::ok).get() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/objectReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/bound/objectReceiver.kt deleted file mode 100644 index a03203792d5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/objectReceiver.kt +++ /dev/null @@ -1,5 +0,0 @@ -object Singleton { - fun ok() = "OK" -} - -fun box() = (Singleton::ok)() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/primitiveReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/bound/primitiveReceiver.kt deleted file mode 100644 index 2773e0cdcd1..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/primitiveReceiver.kt +++ /dev/null @@ -1,26 +0,0 @@ -fun Boolean.foo() = 1 -fun Byte.foo() = 2 -fun Short.foo() = 3 -fun Int.foo() = 4 -fun Long.foo() = 5 -fun Char.foo() = 6 -fun Float.foo() = 7 -fun Double.foo() = 8 - -fun testRef(name: String, f: () -> Int, expected: Int) { - val actual = f() - if (actual != expected) throw AssertionError("$name: $actual != $expected") -} - -fun box(): String { - testRef("Boolean", true::foo, 1) - testRef("Byte", 1.toByte()::foo, 2) - testRef("Short", 1.toShort()::foo, 3) - testRef("Int", 1::foo, 4) - testRef("Long", 1L::foo, 5) - testRef("Char", '1'::foo, 6) - testRef("Float", 1.0F::foo, 7) - testRef("Double", 1.0::foo, 8) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/simpleFunction.kt b/backend.native/tests/external/codegen/box/callableReference/bound/simpleFunction.kt deleted file mode 100644 index 15fae151f5f..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/simpleFunction.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - val f = "KOTLIN"::get - return "${f(1)}${f(0)}" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/simpleProperty.kt b/backend.native/tests/external/codegen/box/callableReference/bound/simpleProperty.kt deleted file mode 100644 index c271b1c6418..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/simpleProperty.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - val f = "kotlin"::length - val result = f.get() - return if (result == 6) "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt deleted file mode 100644 index c48830488c4..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt +++ /dev/null @@ -1,15 +0,0 @@ -class B - -fun B.magic() { -} - -fun boom(a: Any) { - when (a) { - is B -> run(a::magic) - } -} - -fun box(): String { - boom(B()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt b/backend.native/tests/external/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt deleted file mode 100644 index b8be5402715..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: A.java - -public class A { - private final String field; - - public A(String field) { - this.field = field; - } - - public CharSequence getFoo() { return field; } -} - -// FILE: test.kt - -fun box(): String { - with (A("OK")) { - val k = foo::toString - return k() - } -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/abstractClassMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/abstractClassMember.kt deleted file mode 100644 index 515b25914d0..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/abstractClassMember.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class A { - abstract fun foo(): String -} - -class B : A() { - override fun foo() = "OK" -} - -fun box(): String = (A::foo)(B()) diff --git a/backend.native/tests/external/codegen/box/callableReference/function/booleanNotIntrinsic.kt b/backend.native/tests/external/codegen/box/callableReference/function/booleanNotIntrinsic.kt deleted file mode 100644 index 213c8d88996..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/booleanNotIntrinsic.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - if ((Boolean::not)(true) != false) return "Fail 1" - if ((Boolean::not)(false) != true) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromClass.kt deleted file mode 100644 index 3ed816ee504..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromClass.kt +++ /dev/null @@ -1,11 +0,0 @@ -class A { - fun foo(k: Int) = k - - fun result() = (A::foo)(this, 111) -} - -fun box(): String { - val result = A().result() - if (result != 111) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromExtension.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromExtension.kt deleted file mode 100644 index 9619233c943..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromExtension.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - fun o() = 111 - fun k(k: Int) = k -} - -fun A.foo() = (A::o)(this) + (A::k)(this, 222) - -fun box(): String { - val result = A().foo() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringNoArgs.kt deleted file mode 100644 index 4ea10740594..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringNoArgs.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - fun foo() = "OK" -} - -fun box(): String { - val x = A::foo - return x(A()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt deleted file mode 100644 index acdf2f897d5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - fun foo(result: String) = result -} - -fun box(): String { - val x = A::foo - return x(A(), "OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt deleted file mode 100644 index 37ebbdb72eb..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - var result = "Fail" - - fun foo() { - result = "OK" - } -} - -fun box(): String { - val a = A() - val x = A::foo - x(a) - return a.result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt deleted file mode 100644 index 3b280c28f34..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - var result = "Fail" - - fun foo(newResult: String) { - result = newResult - } -} - -fun box(): String { - val a = A() - val x = A::foo - x(a, "OK") - return a.result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelNoArgs.kt deleted file mode 100644 index db7b7fd01ef..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelNoArgs.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A { - var result = "OK" -} - -fun box() = (::A)().result diff --git a/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelOneStringArg.kt deleted file mode 100644 index 63a861dbcf4..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/constructorFromTopLevelOneStringArg.kt +++ /dev/null @@ -1,3 +0,0 @@ -class A(val result: String) - -fun box() = (::A)("OK").result diff --git a/backend.native/tests/external/codegen/box/callableReference/function/enumValueOfMethod.kt b/backend.native/tests/external/codegen/box/callableReference/function/enumValueOfMethod.kt deleted file mode 100644 index 21a53adfff3..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/enumValueOfMethod.kt +++ /dev/null @@ -1,9 +0,0 @@ -enum class E { - ENTRY -} - -fun box(): String { - val f = E::valueOf - val result = f("ENTRY") - return if (result == E.ENTRY) "OK" else "Fail $result" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/equalsIntrinsic.kt b/backend.native/tests/external/codegen/box/callableReference/function/equalsIntrinsic.kt deleted file mode 100644 index c83a188802d..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/equalsIntrinsic.kt +++ /dev/null @@ -1,3 +0,0 @@ -class A - -fun box() = if ((A::equals)(A(), A())) "Fail" else "OK" diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromClass.kt deleted file mode 100644 index 0248c2f9f2c..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromClass.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - fun result() = (A::foo)(this, "OK") -} - -fun A.foo(x: String) = x - -fun box() = A().result() diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromExtension.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromExtension.kt deleted file mode 100644 index 103ceee5cbc..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromExtension.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A - -fun A.foo() = (A::bar)(this, "OK") - -fun A.bar(x: String) = x - -fun box() = A().foo() diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringNoArgs.kt deleted file mode 100644 index b5fd42ad9c6..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringNoArgs.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A - -fun A.foo() = "OK" - -fun box(): String { - val x = A::foo - return x(A()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringOneStringArg.kt deleted file mode 100644 index 69db0311a69..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelStringOneStringArg.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A - -fun A.foo(result: String) = result - -fun box(): String { - val x = A::foo - return x(A(), "OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitNoArgs.kt deleted file mode 100644 index b590ad2ec91..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitNoArgs.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - var result = "Fail" -} - -fun A.foo() { - result = "OK" -} - -fun box(): String { - val a = A() - val x = A::foo - x(a) - return a.result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt deleted file mode 100644 index aa9d5505bbf..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - var result = "Fail" -} - -fun A.foo(newResult: String) { - result = newResult -} - -fun box(): String { - val a = A() - val x = A::foo - x(a, "OK") - return a.result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferenceArguments.kt b/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferenceArguments.kt deleted file mode 100644 index e6d290e4bbc..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferenceArguments.kt +++ /dev/null @@ -1,29 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo(x: T): R = TODO() -fun fooReturnInt(x: T): Int = 1 - -inline fun check(x: T, y: R, f: (T) -> R, tType: String, rType: String) { - assertEquals(tType, T::class.simpleName) - assertEquals(rType, R::class.simpleName) -} - -inline fun 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", "Any") - - check(Int::toString, ::foo, "Int", "String") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithNullableTypes.kt b/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithNullableTypes.kt deleted file mode 100644 index 5feb3593e9d..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithNullableTypes.kt +++ /dev/null @@ -1,30 +0,0 @@ -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo(x: T): R = TODO() - -inline fun bar(x: T, y: R, f: (T) -> R, tType: String, rType: String): Pair { - assertEquals(tType, T::class.simpleName) - assertEquals(rType, R::class.simpleName) - return Pair(x, y) -} - -data class Pair(val a: A, val b: B) - -fun box(): String { - bar(1, "", ::foo, "Int", "String") - - val s1: Pair = bar(1, "", ::foo, "Int", "String") - val (a: Int, b: String?) = bar(1, "", ::foo, "Int", "String") - - val ns: String? = null - bar(ns, ns, ::foo, "String", "String") - - val s2: Pair = bar(null, null, ::foo, "Int", "String") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithOverload.kt b/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithOverload.kt deleted file mode 100644 index cb7ab6e616f..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/genericCallableReferencesWithOverload.kt +++ /dev/null @@ -1,23 +0,0 @@ -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// WITH_REFLECT - -import kotlin.test.assertEquals - -fun foo(x: Int?) {} -fun foo(y: String?) {} -fun foo(z: Boolean) {} - -inline fun bar(f: (T) -> Unit, tType: String): T? { - assertEquals(tType, T::class.simpleName) - return null -} - -fun box(): String { - val a1: Int? = bar(::foo, "Int") - val a2: String? = bar(::foo, "String") - val a3: Boolean? = bar(::foo, "Boolean") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/genericMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/genericMember.kt deleted file mode 100644 index 25dabc055f2..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/genericMember.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A(val t: T) { - fun foo(): T = t -} - -fun box() = (A::foo)(A("OK")) diff --git a/backend.native/tests/external/codegen/box/callableReference/function/genericWithDependentType.kt b/backend.native/tests/external/codegen/box/callableReference/function/genericWithDependentType.kt deleted file mode 100644 index 79959ec1436..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/genericWithDependentType.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -class Wrapper(val value: T) - -fun box(): String { - val ls = listOf("OK").map(::Wrapper) - return ls[0].value -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/getArityViaFunctionImpl.kt b/backend.native/tests/external/codegen/box/callableReference/function/getArityViaFunctionImpl.kt deleted file mode 100644 index 2ee3d4f4543..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/getArityViaFunctionImpl.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE -// IGNORE_LIGHT_ANALYSIS - -// WITH_RUNTIME - -import kotlin.test.assertEquals -import kotlin.jvm.internal.FunctionBase - -fun test(f: Function<*>, arity: Int) { - assertEquals(arity, (f as FunctionBase).getArity()) -} - -fun foo(s: String, i: Int) {} -class A { - fun bar(s: String, i: Int) {} -} -fun Double.baz(s: String, i: Int) {} - -fun box(): String { - test(::foo, 2) - test(A::bar, 3) - test(Double::baz, 3) - - test(::box, 0) - - fun local(x: Int) {} - test(::local, 1) - - test(fun(s: String) = s, 1) - test(fun(){}, 0) - test({}, 0) - test({x: Int -> x}, 1) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt b/backend.native/tests/external/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt deleted file mode 100644 index 35fa6ffc598..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt +++ /dev/null @@ -1,20 +0,0 @@ -abstract class A { - inner class InnerInA { - fun returnOk() = "OK" - } -} - -class B : A() - -fun foo(a: A): String { - if (a is B) { - val v = a::InnerInA - return v().returnOk() - } - - return "error" -} - -fun box(): String { - return foo(B()) -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromClass.kt deleted file mode 100644 index 31bb102ee62..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - inner class Inner { - val o = 111 - val k = 222 - } - - fun result() = (A::Inner)(this).o + (A::Inner)(this).k -} - -fun box(): String { - val result = A().result() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromExtension.kt b/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromExtension.kt deleted file mode 100644 index bcde4b24cae..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromExtension.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - inner class Inner { - val o = 111 - val k = 222 - } -} - -fun A.foo() = (A::Inner)(this).o + (A::Inner)(this).k - -fun box(): String { - val result = A().foo() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelNoArgs.kt deleted file mode 100644 index 577eb19e7af..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelNoArgs.kt +++ /dev/null @@ -1,12 +0,0 @@ -class A { - inner class Inner { - val o = 111 - val k = 222 - } -} - -fun box(): String { - val result = (A::Inner)((::A)()).o + (A::Inner)(A()).k - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt deleted file mode 100644 index 0eb2b831a2b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A { - inner class Inner(val result: Int) -} - -fun box(): String { - val result = (A::Inner)((::A)(), 111).result + (A::Inner)(A(), 222).result - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt b/backend.native/tests/external/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt deleted file mode 100644 index 5dc1ab5fe50..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt +++ /dev/null @@ -1,16 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// KT-5123 - -import java.util.Collections -import java.util.ArrayList - -fun box(): String { - val numbers = ArrayList() - numbers.add(1) - numbers.add(2) - numbers.add(3) - (Collections::rotate)(numbers, 1) - return if ("$numbers" == "[3, 1, 2]") "OK" else "Fail $numbers" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/captureOuter.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/captureOuter.kt deleted file mode 100644 index e653f8f0574..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/captureOuter.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Outer { - val result = "OK" - - inner class Inner { - fun foo() = result - } -} - -fun box(): String { - val f = Outer.Inner::foo - return f(Outer().Inner()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/classMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/classMember.kt deleted file mode 100644 index 72bb8af6e81..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/classMember.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - class Local { - fun foo() = "OK" - } - - val ref = Local::foo - return ref(Local()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/closureWithSideEffect.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/closureWithSideEffect.kt deleted file mode 100644 index e58484c9479..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/closureWithSideEffect.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var result = "Fail" - - fun changeToOK() { result = "OK" } - - val ok = ::changeToOK - ok() - return result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/constructor.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/constructor.kt deleted file mode 100644 index 291af016082..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/constructor.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - class A { - val result = "OK" - } - - return (::A)().result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/constructorWithInitializer.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/constructorWithInitializer.kt deleted file mode 100644 index 0e8c0a25839..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/constructorWithInitializer.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - class A { - var result: String = "Fail"; - init { - result = "OK" - } - } - - return (::A)().result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/enumExtendsTrait.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/enumExtendsTrait.kt deleted file mode 100644 index 5ae74283aee..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/enumExtendsTrait.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface Named { - val name: String -} - -enum class E : Named { - OK -} - -fun box(): String { - return E.OK.name -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/equalsHashCode.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/equalsHashCode.kt deleted file mode 100644 index 1e92227328f..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/equalsHashCode.kt +++ /dev/null @@ -1,13 +0,0 @@ -// IGNORE_BACKEND: JS - -fun box(): String { - fun bar() {} - fun baz() {} - - if (!::bar.equals(::bar)) return "Fail 1" - if (::bar.hashCode() != ::bar.hashCode()) return "Fail 2" - - if (::bar == ::baz) return "Fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/extension.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/extension.kt deleted file mode 100644 index 3919a320e81..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/extension.kt +++ /dev/null @@ -1,6 +0,0 @@ -class A - -fun box(): String { - fun A.foo() = "OK" - return (A::foo)(A()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToLocalClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToLocalClass.kt deleted file mode 100644 index 43537f177e9..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToLocalClass.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - class A - fun A.foo() = "OK" - return (A::foo)((::A)()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToPrimitive.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToPrimitive.kt deleted file mode 100644 index 9cb84f4df07..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionToPrimitive.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - fun Int.is42With(that: Int) = this + 2 * that == 42 - return if ((Int::is42With)(16, 13)) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionWithClosure.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/extensionWithClosure.kt deleted file mode 100644 index cbbbcd219b1..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/extensionWithClosure.kt +++ /dev/null @@ -1,11 +0,0 @@ -class A - -fun box(): String { - var result = "Fail" - - fun A.ext() { result = "OK" } - - val f = A::ext - f(A()) - return result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/genericMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/genericMember.kt deleted file mode 100644 index 12e60f50480..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/genericMember.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - class Id { - fun invoke(t: T) = t - } - - val ref = Id::invoke - return ref(Id(), "OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/localClassMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/localClassMember.kt deleted file mode 100644 index 98f62fb5b40..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/localClassMember.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val result = "OK" - - class Local { - fun foo() = result - } - - val member = Local::foo - val instance = Local() - return member(instance) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/localFunctionName.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/localFunctionName.kt deleted file mode 100644 index 361ba4c3ce3..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/localFunctionName.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - fun OK() {} - - return ::OK.name -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/localLocal.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/localLocal.kt deleted file mode 100644 index a34a24395b6..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/localLocal.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - fun foo(): String { - fun bar() = "OK" - val ref = ::bar - return ref() - } - - val ref = ::foo - return ref() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/recursiveClosure.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/recursiveClosure.kt deleted file mode 100644 index 75ca4009a47..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/recursiveClosure.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo(until: Int): String { - fun bar(x: Int): String = - if (x == until) "OK" else bar(x + 1) - return (::bar)(0) -} - -fun box() = foo(10) diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/simple.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/simple.kt deleted file mode 100644 index 789703872db..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/simple.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - fun foo() = "OK" - return (::foo)() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/simpleClosure.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/simpleClosure.kt deleted file mode 100644 index 5aeb154fbdd..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/simpleClosure.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val result = "OK" - - fun foo() = result - - return (::foo)() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/simpleWithArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/simpleWithArg.kt deleted file mode 100644 index e45fce85e2e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/simpleWithArg.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - fun foo(s: String) = s - return (::foo)("OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/local/unitWithSideEffect.kt b/backend.native/tests/external/codegen/box/callableReference/function/local/unitWithSideEffect.kt deleted file mode 100644 index 5da17e9d5e5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/local/unitWithSideEffect.kt +++ /dev/null @@ -1,15 +0,0 @@ -var state = 23 - -fun box(): String { - fun incrementState(inc: Int) { - state += inc - } - - val inc = ::incrementState - inc(12) - inc(-5) - inc(27) - inc(-15) - - return if (state == 42) "OK" else "Fail $state" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromClass.kt deleted file mode 100644 index 8e0439f4f03..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - class Nested { - val o = 111 - val k = 222 - } - - fun result() = (::Nested)().o + (A::Nested)().k -} - -fun box(): String { - val result = A().result() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt deleted file mode 100644 index f99dd41ae86..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - class Nested { - val result = "OK" - } -} - -fun box() = (A::Nested)().result diff --git a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt deleted file mode 100644 index 3f0c03c67f3..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A { - class Nested(val result: String) -} - -fun box() = (A::Nested)("OK").result diff --git a/backend.native/tests/external/codegen/box/callableReference/function/newArray.kt b/backend.native/tests/external/codegen/box/callableReference/function/newArray.kt deleted file mode 100644 index b27d4e68ac9..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/newArray.kt +++ /dev/null @@ -1,13 +0,0 @@ -private fun upcast(value: T): T = value - -fun box(): String { - upcast<(Int)->ByteArray>(::ByteArray)(10) - upcast<(Int)->IntArray>(::IntArray)(10) - upcast<(Int)->ShortArray>(::ShortArray)(10) - upcast<(Int)->LongArray>(::LongArray)(10) - upcast<(Int)->DoubleArray>(::DoubleArray)(10) - upcast<(Int)->FloatArray>(::FloatArray)(10) - upcast<(Int)->BooleanArray>(::BooleanArray)(10) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/overloadedFun.kt b/backend.native/tests/external/codegen/box/callableReference/function/overloadedFun.kt deleted file mode 100644 index 569ef57a1bb..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/overloadedFun.kt +++ /dev/null @@ -1,27 +0,0 @@ -fun foo(): String = "foo1" -fun foo(i: Int): String = "foo2" - -val f1: () -> String = ::foo -val f2: (Int) -> String = ::foo - -fun foo1() {} -fun foo2(i: Int) {} - -fun bar(f: () -> Unit): String = "bar1" -fun bar(f: (Int) -> Unit): String = "bar2" - -fun box(): String { - val x1 = f1() - if (x1 != "foo1") return "Fail 1: $x1" - - val x2 = f2(0) - if (x2 != "foo2") return "Fail 2: $x2" - - val y1 = bar(::foo1) - if (y1 != "bar1") return "Fail 3: $y1" - - val y2 = bar(::foo2) - if (y2 != "bar2") return "Fail 4: $y2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/overloadedFunVsVal.kt b/backend.native/tests/external/codegen/box/callableReference/function/overloadedFunVsVal.kt deleted file mode 100644 index 5dec6776f45..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/overloadedFunVsVal.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -import kotlin.reflect.* - -class A { - val x = 1 - fun x(): String = "OK" -} - -val f1: KProperty1 = A::x -val f2: (A) -> String = A::x - -fun box(): String { - val a = A() - - val x1 = f1.get(a) - if (x1 != 1) return "Fail 1: $x1" - - return f2(a) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/privateClassMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/privateClassMember.kt deleted file mode 100644 index f99ac7e3ad6..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/privateClassMember.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A { - private fun foo() = "OK" - - fun bar() = (A::foo)(this) -} - -fun box() = A().bar() diff --git a/backend.native/tests/external/codegen/box/callableReference/function/sortListOfStrings.kt b/backend.native/tests/external/codegen/box/callableReference/function/sortListOfStrings.kt deleted file mode 100644 index 5672692f9a8..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/sortListOfStrings.kt +++ /dev/null @@ -1,14 +0,0 @@ -// WITH_RUNTIME - -fun sort(list: MutableList, comparator: (String, String) -> Int) { - list.sortWith(Comparator(comparator)) -} - -fun compare(s1: String, s2: String) = s1.compareTo(s2) - -fun box(): String { - val l = mutableListOf("d", "b", "c", "e", "a") - sort(l, ::compare) - if (l != listOf("a", "b", "c", "d", "e")) return "Fail: $l" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/specialCalls.kt b/backend.native/tests/external/codegen/box/callableReference/function/specialCalls.kt deleted file mode 100644 index bfebd392d74..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/specialCalls.kt +++ /dev/null @@ -1,29 +0,0 @@ -fun baz(i: Int) = i -fun bar(x: T): T = x - -fun nullableFun(): ((Int) -> Int)? = null - -fun box(): String { - val x1: (Int) -> Int = bar(if (true) ::baz else ::baz) - val x2: (Int) -> Int = bar(nullableFun() ?: ::baz) - val x3: (Int) -> Int = bar(::baz ?: ::baz) - - val i = 0 - val x4: (Int) -> Int = bar(when (i) { - 10 -> ::baz - 20 -> ::baz - else -> ::baz - }) - - val x5: (Int) -> Int = bar(::baz!!) - - if (x1(1) != 1) return "fail 1" - if (x2(1) != 1) return "fail 2" - if (x3(1) != 1) return "fail 3" - if (x4(1) != 1) return "fail 4" - if (x5(1) != 1) return "fail 5" - - if ((if (true) ::baz else ::baz)(1) != 1) return "fail 6" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromClass.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromClass.kt deleted file mode 100644 index b8ad1d624bb..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromClass.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo(o: Int, k: Int) = o + k - -class A { - fun bar() = (::foo)(111, 222) -} - -fun box(): String { - val result = A().bar() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromExtension.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromExtension.kt deleted file mode 100644 index f86acf08a0a..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromExtension.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo(o: Int, k: Int) = o + k - -class A - -fun A.bar() = (::foo)(111, 222) - -fun box(): String { - val result = A().bar() - if (result != 333) return "Fail $result" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringNoArgs.kt deleted file mode 100644 index b7f56d6be82..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringNoArgs.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun foo() = "OK" - -fun box(): String { - val x = ::foo - return x() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt deleted file mode 100644 index 78cb93f0873..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun foo(x: String) = x - -fun box(): String { - val x = ::foo - return x("OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt deleted file mode 100644 index a388ed73d4e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt +++ /dev/null @@ -1,11 +0,0 @@ -var result = "Fail" - -fun foo() { - result = "OK" -} - -fun box(): String { - val x = ::foo - x() - return result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt deleted file mode 100644 index a15697e48b4..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt +++ /dev/null @@ -1,11 +0,0 @@ -var result = "Fail" - -fun foo(newResult: String) { - result = newResult -} - -fun box(): String { - val x = ::foo - x("OK") - return result -} diff --git a/backend.native/tests/external/codegen/box/callableReference/function/traitImplMethodWithClassReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/function/traitImplMethodWithClassReceiver.kt deleted file mode 100644 index 9171f0b094b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/traitImplMethodWithClassReceiver.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface T { - fun foo() = "OK" -} - -class B : T { - inner class C { - fun bar() = (T::foo)(this@B) - } -} - -fun box() = B().C().bar() diff --git a/backend.native/tests/external/codegen/box/callableReference/function/traitMember.kt b/backend.native/tests/external/codegen/box/callableReference/function/traitMember.kt deleted file mode 100644 index 88cf738eaa7..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/function/traitMember.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface A { - fun foo(): String -} - -class B : A { - override fun foo() = "OK" -} - -fun box() = (A::foo)(B()) diff --git a/backend.native/tests/external/codegen/box/callableReference/property/accessViaSubclass.kt b/backend.native/tests/external/codegen/box/callableReference/property/accessViaSubclass.kt deleted file mode 100644 index eb2a0728db2..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/accessViaSubclass.kt +++ /dev/null @@ -1,9 +0,0 @@ -abstract class Base { - val result = "OK" -} - -class Derived : Base() - -fun box(): String { - return (Base::result).get(Derived()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/delegated.kt b/backend.native/tests/external/codegen/box/callableReference/property/delegated.kt deleted file mode 100644 index 00b880be84e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/delegated.kt +++ /dev/null @@ -1,24 +0,0 @@ -import kotlin.reflect.KProperty - -val four: Int by NumberDecrypter - -class A { - val two: Int by NumberDecrypter -} - -object NumberDecrypter { - operator fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) { - "four" -> 4 - "two" -> 2 - else -> throw AssertionError() - } -} - -fun box(): String { - val x = ::four.get() - if (x != 4) return "Fail x: $x" - val a = A() - val y = A::two.get(a) - if (y != 2) return "Fail y: $y" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/delegatedMutable.kt b/backend.native/tests/external/codegen/box/callableReference/property/delegatedMutable.kt deleted file mode 100644 index 71ae9e81aa6..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/delegatedMutable.kt +++ /dev/null @@ -1,25 +0,0 @@ -import kotlin.reflect.KProperty - -var result: String by Delegate - -@kotlin.native.ThreadLocal -object Delegate { - var value = "lol" - - operator fun getValue(instance: Any?, data: KProperty<*>): String { - return value - } - - operator fun setValue(instance: Any?, data: KProperty<*>, newValue: String) { - value = newValue - } -} - -fun box(): String { - val f = ::result - if (f.get() != "lol") return "Fail 1: {$f.get()}" - Delegate.value = "rofl" - if (f.get() != "rofl") return "Fail 2: {$f.get()}" - f.set("OK") - return f.get() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/enumNameOrdinal.kt b/backend.native/tests/external/codegen/box/callableReference/property/enumNameOrdinal.kt deleted file mode 100644 index 10ccfbdee1e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/enumNameOrdinal.kt +++ /dev/null @@ -1,11 +0,0 @@ -enum class E { - I -} - -fun box(): String { - val i = (E::name).get(E.I) - if (i != "I") return "Fail $i" - val n = (E::ordinal).get(E.I) - if (n != 0) return "Fail $n" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/extensionToArray.kt b/backend.native/tests/external/codegen/box/callableReference/property/extensionToArray.kt deleted file mode 100644 index 455b69ae0cf..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/extensionToArray.kt +++ /dev/null @@ -1,6 +0,0 @@ -val Array.firstElement: String get() = get(0) - -fun box(): String { - val p = Array::firstElement - return p.get(arrayOf("OK", "Fail")) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/genericProperty.kt b/backend.native/tests/external/codegen/box/callableReference/property/genericProperty.kt deleted file mode 100644 index 63de5fccffe..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/genericProperty.kt +++ /dev/null @@ -1,22 +0,0 @@ -// IGNORE_BACKEND: NATIVE -//For KT-6020 -import kotlin.reflect.KProperty1 -import kotlin.reflect.KMutableProperty1 -import kotlin.reflect.KProperty - -class Value(var value: T = null as T, var text: String? = null) - -val Value.additionalText by DVal(Value::text) //works - -val Value.additionalValue by DVal(Value::value) //not work - -class DVal>(val kmember: P) { - operator fun getValue(t: T, p: KProperty<*>): R { - return kmember.get(t) - } -} - -fun box(): String { - val p = Value("O", "K") - return p.additionalValue + p.additionalText -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/invokePropertyReference.kt b/backend.native/tests/external/codegen/box/callableReference/property/invokePropertyReference.kt deleted file mode 100644 index 617732ae7f0..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/invokePropertyReference.kt +++ /dev/null @@ -1,31 +0,0 @@ -var state = "" - -var topLevel: Int - get() { - state += "1" - return 42 - } - set(value) { - throw AssertionError("Nooo") - } - -class A { - val member: String - get() { - state += "2" - return "42" - } -} - -val A.ext: Any - get() { - state += "3" - return this - } - -fun box(): String { - (::topLevel)() - (A::member)(A()) - (A::ext)(A()) - return if (state == "123") "OK" else "Fail $state" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/javaBeanConvention.kt b/backend.native/tests/external/codegen/box/callableReference/property/javaBeanConvention.kt deleted file mode 100644 index 0030d8026c3..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/javaBeanConvention.kt +++ /dev/null @@ -1,14 +0,0 @@ -// Name of the getter should be 'getaBcde' according to JavaBean conventions -var aBcde: Int = 239 - -fun box(): String { - val x = (::aBcde).get() - if (x != 239) return "Fail x: $x" - - (::aBcde).set(42) - - val y = (::aBcde).get() - if (y != 42) return "Fail y: $y" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kClassInstanceIsInitializedFirst.kt b/backend.native/tests/external/codegen/box/callableReference/property/kClassInstanceIsInitializedFirst.kt deleted file mode 100644 index 5ce636926d5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kClassInstanceIsInitializedFirst.kt +++ /dev/null @@ -1,13 +0,0 @@ -import kotlin.reflect.KProperty1 - -class A { - companion object { - val ref: KProperty1 = A::foo - } - - val foo: String = "OK" -} - -fun box(): String { - return A.ref.get(A()) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt12044.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt12044.kt deleted file mode 100644 index ea43b14b545..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt12044.kt +++ /dev/null @@ -1,12 +0,0 @@ -// KT-12044 Assertion "Rewrite at slice LEXICAL_SCOPE" for 'if' with property references - -fun box(): String { - data class Pair(val first: F, val second: S) - val (x, y) = - Pair(1, - if (1 == 1) - Pair::first - else - Pair::second) - return y.get(Pair("OK", "Fail")) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt12982_protectedPropertyReference.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt12982_protectedPropertyReference.kt deleted file mode 100644 index 7cabd9c6d65..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt12982_protectedPropertyReference.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Foo { - protected var x = 0 - - fun getX() = Foo::x -} - -fun box(): String { - val x = Foo().getX() - val foo = Foo() - x.set(foo, 42) - return if (x.get(foo) == 42) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt14330.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt14330.kt deleted file mode 100644 index 43969a5fd1a..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt14330.kt +++ /dev/null @@ -1,8 +0,0 @@ -data class Foo(var bar: Int?) - -fun box(): String { - val receiver = Foo(1) - Foo::bar.set(receiver, null) - return if (receiver.bar == null) "OK" else "fail ${receiver.bar}" - -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt14330_2.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt14330_2.kt deleted file mode 100644 index d0acfccb0bd..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt14330_2.kt +++ /dev/null @@ -1,14 +0,0 @@ -var recivier : Any? = "fail" -var value2 : Any? = "fail2" - -var T.bar : T - get() = this - set(value) { recivier = this; value2 = value} - - -fun box(): String { - String?::bar.set(null, null) - if (recivier != null) "fail 1: ${recivier}" - if (value2 != null) "fail 2: ${value2}" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt15447.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt15447.kt deleted file mode 100644 index d1d9a817df9..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt15447.kt +++ /dev/null @@ -1,12 +0,0 @@ -//WITH_RUNTIME - -fun box(): String { - var methodVar = "OK" - - fun localMethod() : String - { - return lazy { methodVar }::value.get() - } - - return localMethod() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/property/kt6870_privatePropertyReference.kt b/backend.native/tests/external/codegen/box/callableReference/property/kt6870_privatePropertyReference.kt deleted file mode 100644 index 4d5560c98af..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/kt6870_privatePropertyReference.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class Test { - private var iv = 1 - - public fun exec() { - val t = object : Thread() { - override fun run() { - Test::iv.get(this@Test) - Test::iv.set(this@Test, 2) - } - } - t.start() - t.join(1000) - } - - fun result() = if (iv == 2) "OK" else "Fail $iv" -} - -fun box(): String { - val t = Test() - t.exec() - return t.result() -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/listOfStringsMapLength.kt b/backend.native/tests/external/codegen/box/callableReference/property/listOfStringsMapLength.kt deleted file mode 100644 index 1a035732ad3..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/listOfStringsMapLength.kt +++ /dev/null @@ -1,4 +0,0 @@ -// WITH_RUNTIME - -fun box(): String = - if (listOf("abc", "de", "f").map(String::length) == listOf(3, 2, 1)) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/callableReference/property/localClassVar.kt b/backend.native/tests/external/codegen/box/callableReference/property/localClassVar.kt deleted file mode 100644 index fd45085df67..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/localClassVar.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - class Local { - var result = "Fail" - } - - val l = Local() - (Local::result).set(l, "OK") - return (Local::result).get(l) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/overriddenInSubclass.kt b/backend.native/tests/external/codegen/box/callableReference/property/overriddenInSubclass.kt deleted file mode 100644 index d892efcba29..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/overriddenInSubclass.kt +++ /dev/null @@ -1,9 +0,0 @@ -open class Base { - open val foo = "Base" -} - -class Derived : Base() { - override val foo = "OK" -} - -fun box() = (Base::foo).get(Derived()) diff --git a/backend.native/tests/external/codegen/box/callableReference/property/privateSetOuterClass.kt b/backend.native/tests/external/codegen/box/callableReference/property/privateSetOuterClass.kt deleted file mode 100644 index 632b3d49dc5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/privateSetOuterClass.kt +++ /dev/null @@ -1,31 +0,0 @@ -class A { - var value: String = "fail1" - private set - - inner class B { - fun foo(): kotlin.reflect.KMutableProperty0 = this@A::value - } -} - -class C { - var value: String = "fail2" - private set - - fun bar(): kotlin.reflect.KMutableProperty0 { - class D { - fun foo(): kotlin.reflect.KMutableProperty0 = this@C::value - } - - return D().foo() - } -} - -fun box(): String { - val a = A() - a.B().foo().set("O") - - val c = C() - c.bar().set("K") - - return a.value + c.value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/callableReference/property/privateSetterInsideClass.kt b/backend.native/tests/external/codegen/box/callableReference/property/privateSetterInsideClass.kt deleted file mode 100644 index 8674d12a3a8..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/privateSetterInsideClass.kt +++ /dev/null @@ -1,18 +0,0 @@ -import kotlin.reflect.KMutableProperty - -class Bar(name: String) { - var foo: String = name - private set - - fun test() { - val p = Bar::foo - if (p !is KMutableProperty<*>) throw AssertionError("Fail: p is not a KMutableProperty") - p.set(this, "OK") - } -} - -fun box(): String { - val bar = Bar("Fail") - bar.test() - return bar.foo -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/privateSetterOutsideClass.kt b/backend.native/tests/external/codegen/box/callableReference/property/privateSetterOutsideClass.kt deleted file mode 100644 index 3c8b5f8de62..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/privateSetterOutsideClass.kt +++ /dev/null @@ -1,26 +0,0 @@ -// See KT-12337 Reference to property with invisible setter should not be a KMutableProperty - -import kotlin.reflect.KProperty1 -import kotlin.reflect.KMutableProperty - -open class Bar(name: String) { - var foo: String = name - private set -} - -class Baz : Bar("") { - fun ref() = Bar::foo -} - -fun box(): String { - val p1: KProperty1 = Bar::foo - if (p1 is KMutableProperty<*>) return "Fail: p1 is a KMutableProperty" - - val p2 = Baz().ref() - if (p2 is KMutableProperty<*>) return "Fail: p2 is a KMutableProperty" - - val p3 = Bar("")::foo - if (p3 is KMutableProperty<*>) return "Fail: p3 is a KMutableProperty" - - return p1.get(Bar("OK")) -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleExtension.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleExtension.kt deleted file mode 100644 index 28d7199fe8d..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleExtension.kt +++ /dev/null @@ -1,12 +0,0 @@ -val String.id: String - get() = this - -fun box(): String { - val pr = String::id - - if (pr.get("123") != "123") return "Fail value: ${pr.get("123")}" - - if (pr.name != "id") return "Fail name: ${pr.name}" - - return pr.get("OK") -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleMember.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleMember.kt deleted file mode 100644 index 39bf36a0707..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleMember.kt +++ /dev/null @@ -1,9 +0,0 @@ -class A(val x: Int) - -fun box(): String { - val p = A::x - if (p.get(A(42)) != 42) return "Fail 1" - if (p.get(A(-1)) != -1) return "Fail 2" - if (p.name != "x") return "Fail 3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableExtension.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableExtension.kt deleted file mode 100644 index e69cbbe72fc..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableExtension.kt +++ /dev/null @@ -1,18 +0,0 @@ -var storage = 0 - -var Int.foo: Int - get() { - return this + storage - } - set(value) { - storage = this + value - } - -fun box(): String { - val pr = Int::foo - if (pr.get(42) != 42) return "Fail 1: ${pr.get(42)}" - pr.set(200, 39) - if (pr.get(-239) != 0) return "Fail 2: ${pr.get(-239)}" - if (storage != 239) return "Fail 3: $storage" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableMember.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableMember.kt deleted file mode 100644 index f7d815af3fc..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableMember.kt +++ /dev/null @@ -1,16 +0,0 @@ -data class Box(var value: String) - -fun box(): String { - val o = Box("lorem") - val prop = Box::value - - if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}" - prop.set(o, "ipsum") - if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}" - if (o.value != "ipsum") return "Fail 3: ${o.value}" - o.value = "dolor" - if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}" - if ("$o" != "Box(value=dolor)") return "Fail 5: $o" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableTopLevel.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableTopLevel.kt deleted file mode 100644 index 46abcebe5f9..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleMutableTopLevel.kt +++ /dev/null @@ -1,12 +0,0 @@ -data class Box(val value: String) - -var pr = Box("first") - -fun box(): String { - val property = ::pr - if (property.get() != Box("first")) return "Fail value: ${property.get()}" - if (property.name != "pr") return "Fail name: ${property.name}" - property.set(Box("second")) - if (property.get().value != "second") return "Fail value 2: ${property.get()}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/property/simpleTopLevel.kt b/backend.native/tests/external/codegen/box/callableReference/property/simpleTopLevel.kt deleted file mode 100644 index 818327da26f..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/property/simpleTopLevel.kt +++ /dev/null @@ -1,10 +0,0 @@ -data class Box(val value: String) - -val foo = Box("lol") - -fun box(): String { - val property = ::foo - if (property.get() != Box("lol")) return "Fail value: ${property.get()}" - if (property.name != "foo") return "Fail name: ${property.name}" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt deleted file mode 100644 index 7ba39313db5..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt +++ /dev/null @@ -1,19 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT -// FULL_JDK - -import java.io.* -import kotlin.test.* - -class Foo(val value: String) - -fun box(): String { - val oos = ObjectOutputStream(ByteArrayOutputStream()) - try { - oos.writeObject(Foo("abacaba")::value) - return "Fail: Foo is not Serializable and thus writeObject should have thrown an exception" - } - catch (e: NotSerializableException) { - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt b/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt deleted file mode 100644 index 9a5f6260e03..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import java.io.* -import kotlin.test.* - -data class Foo(val value: String) : Serializable - -fun box(): String { - val baos = ByteArrayOutputStream() - val oos = ObjectOutputStream(baos) - oos.writeObject(Foo("abacaba")::value) - oos.close() - - val bais = ByteArrayInputStream(baos.toByteArray()) - val ois = ObjectInputStream(bais) - assertEquals(Foo("abacaba")::value, ois.readObject()) - ois.close() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/serializability/noReflect.kt b/backend.native/tests/external/codegen/box/callableReference/serializability/noReflect.kt deleted file mode 100644 index 92421e2ed66..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/serializability/noReflect.kt +++ /dev/null @@ -1,27 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_RUNTIME - -import java.io.* -import kotlin.test.* - -class Foo(val prop: String) { - fun method() {} -} - -fun box(): String { - val baos = ByteArrayOutputStream() - val oos = ObjectOutputStream(baos) - oos.writeObject(Foo::prop) - oos.writeObject(Foo::method) - oos.writeObject(::Foo) - oos.close() - - val bais = ByteArrayInputStream(baos.toByteArray()) - val ois = ObjectInputStream(bais) - assertEquals(Foo::prop, ois.readObject()) - assertEquals(Foo::method, ois.readObject()) - assertEquals(::Foo, ois.readObject()) - ois.close() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/serializability/reflectedIsNotSerialized.kt b/backend.native/tests/external/codegen/box/callableReference/serializability/reflectedIsNotSerialized.kt deleted file mode 100644 index 9e6f7ce011e..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/serializability/reflectedIsNotSerialized.kt +++ /dev/null @@ -1,25 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import java.io.* -import kotlin.test.* - -fun bar() {} - -fun box(): String { - val baos = ByteArrayOutputStream() - val oos = ObjectOutputStream(baos) - oos.writeObject(::bar) - oos.close() - - val bais = ByteArrayInputStream(baos.toByteArray()) - val ois = ObjectInputStream(bais) - val o = ois.readObject() - ois.close() - - // Test that we don't serialize the reflected view of the reference: it's not needed because it can be restored at runtime - val field = kotlin.jvm.internal.CallableReference::class.java.getDeclaredField("reflected").apply { isAccessible = true } - assertNull(field.get(o)) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/callableReference/serializability/withReflect.kt b/backend.native/tests/external/codegen/box/callableReference/serializability/withReflect.kt deleted file mode 100644 index 0ba69e1e44b..00000000000 --- a/backend.native/tests/external/codegen/box/callableReference/serializability/withReflect.kt +++ /dev/null @@ -1,27 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE -// WITH_REFLECT - -import java.io.* -import kotlin.test.* - -class Foo(val prop: String) { - fun method() {} -} - -fun box(): String { - val baos = ByteArrayOutputStream() - val oos = ObjectOutputStream(baos) - oos.writeObject(Foo::prop) - oos.writeObject(Foo::method) - oos.writeObject(::Foo) - oos.close() - - val bais = ByteArrayInputStream(baos.toByteArray()) - val ois = ObjectInputStream(bais) - assertEquals(Foo::prop, ois.readObject()) - assertEquals(Foo::method, ois.readObject()) - assertEquals(::Foo, ois.readObject()) - ois.close() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/as.kt b/backend.native/tests/external/codegen/box/casts/as.kt deleted file mode 100644 index 6b78d69af24..00000000000 --- a/backend.native/tests/external/codegen/box/casts/as.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun foo(x: Any) = x as Runnable - -fun box(): String { - val r = object : Runnable { - override fun run() {} - } - return if (foo(r) === r) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/asForConstants.kt b/backend.native/tests/external/codegen/box/casts/asForConstants.kt deleted file mode 100644 index 43aa798276f..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asForConstants.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun box(): String { - if (check(1, { it as Int }) == "OK") return "fail 1" - if (check(1, { it as Byte }) != "OK") return "fail 2" - if (check(1, { it as Short }) != "OK") return "fail 3" - if (check(1, { it as Long }) != "OK") return "fail 4" - if (check(1, { it as Char }) != "OK") return "fail 5" - if (check(1, { it as Double }) != "OK") return "fail 6" - if (check(1, { it as Float }) != "OK") return "fail 7" - - if (check(1.0, { it as Int }) != "OK") return "fail 11" - if (check(1.0, { it as Byte }) != "OK") return "fail 12" - if (check(1.0, { it as Short }) != "OK") return "fail 13" - if (check(1.0, { it as Long }) != "OK") return "fail 14" - if (check(1.0, { it as Char }) != "OK") return "fail 15" - if (check(1.0, { it as Double }) == "OK") return "fail 16" - if (check(1.0, { it as Float }) != "OK") return "fail 17" - - if (check(1f, { it as Int }) != "OK") return "fail 21" - if (check(1f, { it as Byte }) != "OK") return "fail 22" - if (check(1f, { it as Short }) != "OK") return "fail 23" - if (check(1f, { it as Long }) != "OK") return "fail 24" - if (check(1f, { it as Char }) != "OK") return "fail 25" - if (check(1f, { it as Double }) != "OK") return "fail 26" - if (check(1f, { it as Float }) == "OK") return "fail 27" - - return "OK" -} - -fun check(param: T, f: (T) -> Unit): String { - try { - f(param) - } - catch (e: ClassCastException) { - return "OK" - } - return "fail" -} - diff --git a/backend.native/tests/external/codegen/box/casts/asSafe.kt b/backend.native/tests/external/codegen/box/casts/asSafe.kt deleted file mode 100644 index 3e86a808c45..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asSafe.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun foo(x: Any) = x as? Runnable - -fun box(): String { - val r = object : Runnable { - override fun run() {} - } - return if (foo(r) === r) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/asSafeFail.kt b/backend.native/tests/external/codegen/box/casts/asSafeFail.kt deleted file mode 100644 index c3500dd5c1a..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asSafeFail.kt +++ /dev/null @@ -1,16 +0,0 @@ -class A -class B - -fun box(): String { - val a = A() - a as? B - a as? B ?: "fail" - - if ((A() as? B) != null) return "fail1" - if ((a as? B) != null) return "fail2" - - val v = a as? B ?: "fail" - if (v != "fail") return "fail4" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/asSafeForConstants.kt b/backend.native/tests/external/codegen/box/casts/asSafeForConstants.kt deleted file mode 100644 index be3fbff1dc4..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asSafeForConstants.kt +++ /dev/null @@ -1,30 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun box(): String { - if ((1 as? Int) == null) return "fail 1" - if ((1 as? Byte) != null) return "fail 2" - if ((1 as? Short) != null) return "fail 3" - if ((1 as? Long) != null) return "fail 4" - if ((1 as? Char) != null) return "fail 5" - if ((1 as? Double) != null) return "fail 6" - if ((1 as? Float) != null) return "fail 7" - - if ((1.0 as? Int) != null) return "fail 11" - if ((1.0 as? Byte) != null) return "fail 12" - if ((1.0 as? Short) != null) return "fail 13" - if ((1.0 as? Long) != null) return "fail 14" - if ((1.0 as? Char) != null) return "fail 15" - if ((1.0 as? Double) == null) return "fail 16" - if ((1.0 as? Float) != null) return "fail 17" - - if ((1f as? Int) != null) return "fail 21" - if ((1f as? Byte) != null) return "fail 22" - if ((1f as? Short) != null) return "fail 23" - if ((1f as? Long) != null) return "fail 24" - if ((1f as? Char) != null) return "fail 25" - if ((1f as? Double) != null) return "fail 26" - if ((1f as? Float) == null) return "fail 27" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/asUnit.kt b/backend.native/tests/external/codegen/box/casts/asUnit.kt deleted file mode 100644 index 8c11703906c..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asUnit.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = if (4 as? Unit != null) "Fail" else "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/asWithGeneric.kt b/backend.native/tests/external/codegen/box/casts/asWithGeneric.kt deleted file mode 100644 index 9760295a6dc..00000000000 --- a/backend.native/tests/external/codegen/box/casts/asWithGeneric.kt +++ /dev/null @@ -1,26 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun test1() = null as T -fun test2(): T { - val a : Any? = null - return a as T -} - -fun test3() = null as T - -fun box(): String { - if (test1() != null) return "fail: test1" - if (test2() != null) return "fail: test2" - var result3 = "fail" - try { - test3() - } - catch(e: TypeCastException) { - result3 = "OK" - } - if (result3 != "OK") return "fail: test3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/castGenericNull.kt b/backend.native/tests/external/codegen/box/casts/castGenericNull.kt deleted file mode 100644 index 42628250375..00000000000 --- a/backend.native/tests/external/codegen/box/casts/castGenericNull.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun castToString(t: T) { - t as String -} - - -fun box(): String { - try { - castToString(null) - } catch (e: Exception) { - return "OK" - } - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/asFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/asFunKBig.kt deleted file mode 100644 index 43df48d37b6..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/asFunKBig.kt +++ /dev/null @@ -1,254 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -import kotlin.test.* - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -inline fun asFailsWithCCE(operation: String, crossinline block: () -> Unit) { - assertFailsWith(ClassCastException::class, "$operation should throw an exception") { - block() - } -} - -inline fun asSucceeds(operation: String, block: () -> Unit) { - block() -} - -interface TestFnBase { - fun testGood(x: Any) - fun testBad(x: Any) -} - -object TestFn0 : TestFnBase { - override fun testGood(x: Any) { x as Function0<*> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function0<*>") { - x as Function0<*> - } -} - -object TestFn1 : TestFnBase { - override fun testGood(x: Any) { x as Function1<*, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function1<*, *>") { - x as Function1<*, *> - } -} - -object TestFn2 : TestFnBase { - override fun testGood(x: Any) { x as Function2<*, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function2<*, *, *>") { - x as Function2<*, *, *> - } -} - -object TestFn3 : TestFnBase { - override fun testGood(x: Any) { x as Function3<*, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function3<*, *, *, *>") { - x as Function3<*, *, *, *> - } -} - -object TestFn4 : TestFnBase { - override fun testGood(x: Any) { x as Function4<*, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function4<*, *, *, *, *>") { - x as Function4<*, *, *, *, *> - } -} - -object TestFn5 : TestFnBase { - override fun testGood(x: Any) { x as Function5<*, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function5<*, *, *, *, *, *>") { - x as Function5<*, *, *, *, *, *> - } -} - -object TestFn6 : TestFnBase { - override fun testGood(x: Any) { x as Function6<*, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function6<*, *, *, *, *, *, *>") { - x as Function6<*, *, *, *, *, *, *> - } -} - -object TestFn7 : TestFnBase { - override fun testGood(x: Any) { x as Function7<*, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function7<*, *, *, *, *, *, *, *>") { - x as Function7<*, *, *, *, *, *, *, *> - } -} - -object TestFn8 : TestFnBase { - override fun testGood(x: Any) { x as Function8<*, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function8<*, *, *, *, *, *, *, *, *>") { - x as Function8<*, *, *, *, *, *, *, *, *> - } -} - -object TestFn9 : TestFnBase { - override fun testGood(x: Any) { x as Function9<*, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function9<*, *, *, *, *, *, *, *, *, *>") { - x as Function9<*, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn10 : TestFnBase { - override fun testGood(x: Any) { x as Function10<*, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function10<*, *, *, *, *, *, *, *, *, *, *>") { - x as Function10<*, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn11 : TestFnBase { - override fun testGood(x: Any) { x as Function11<*, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function11<*, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn12 : TestFnBase { - override fun testGood(x: Any) { x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn13 : TestFnBase { - override fun testGood(x: Any) { x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn14 : TestFnBase { - override fun testGood(x: Any) { x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn15 : TestFnBase { - override fun testGood(x: Any) { x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn16 : TestFnBase { - override fun testGood(x: Any) { x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn17 : TestFnBase { - override fun testGood(x: Any) { x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn18 : TestFnBase { - override fun testGood(x: Any) { x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn19 : TestFnBase { - override fun testGood(x: Any) { x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn20 : TestFnBase { - override fun testGood(x: Any) { x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn21 : TestFnBase { - override fun testGood(x: Any) { x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn22 : TestFnBase { - override fun testGood(x: Any) { x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } - override fun testBad(x: Any) = - asFailsWithCCE("x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/asFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/asFunKSmall.kt deleted file mode 100644 index 790c04b9642..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/asFunKSmall.kt +++ /dev/null @@ -1,47 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun fn0() {} -fun fn1(x: Any) {} - -inline fun asFailsWithCCE(operation: String, block: () -> Unit) { - try { - block() - } - catch (e: java.lang.ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should throw ClassCastException, no exception thrown") -} - -inline fun asSucceeds(operation: String, block: () -> Unit) { - try { - block() - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -class MyFun: Function - -fun box(): String { - val f0 = ::fn0 as Any - val f1 = ::fn1 as Any - - val myFun = MyFun() as Any - - asSucceeds("f0 as Function0<*>") { f0 as Function0<*> } - asFailsWithCCE("f0 as Function1<*, *>") { f0 as Function1<*, *> } - asFailsWithCCE("f1 as Function0<*>") { f1 as Function0<*> } - asSucceeds("f1 as Function1<*, *>") { f1 as Function1<*, *> } - - asFailsWithCCE("myFun as Function0<*>") { myFun as Function0<*> } - asFailsWithCCE("myFun as Function1<*, *>") { myFun as Function1<*, *> } - - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/isFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/isFunKBig.kt deleted file mode 100644 index 1985402f6bc..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/isFunKBig.kt +++ /dev/null @@ -1,181 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -abstract class TestFnBase(val type: String) { - abstract fun testGood(x: Any) - abstract fun testBad(x: Any) - - protected fun assertIs(x: Any, condition: Boolean) { - assert(condition) { "x is $type: failed for $x" } - } - - protected fun assertIsNot(x: Any, condition: Boolean) { - assert(condition) { "x !is $type: failed for $x" } - } -} - -object TestFn0 : TestFnBase("Function0<*>") { - override fun testGood(x: Any) { assertIs(x, x is Function0<*>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function0<*>) } -} - -object TestFn1 : TestFnBase("Function1<*, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function1<*, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function1<*, *>) } -} - -object TestFn2 : TestFnBase("Function2<*, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function2<*, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function2<*, *, *>) } -} - -object TestFn3 : TestFnBase("Function3<*, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function3<*, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function3<*, *, *, *>) } -} - -object TestFn4 : TestFnBase("Function4<*, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function4<*, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function4<*, *, *, *, *>) } -} - -object TestFn5 : TestFnBase("Function5<*, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function5<*, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function5<*, *, *, *, *, *>) } -} - -object TestFn6 : TestFnBase("Function6<*, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function6<*, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function6<*, *, *, *, *, *, *>) } -} - -object TestFn7 : TestFnBase("Function7<*, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function7<*, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function7<*, *, *, *, *, *, *, *>) } -} - -object TestFn8 : TestFnBase("Function8<*, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function8<*, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function8<*, *, *, *, *, *, *, *, *>) } -} - -object TestFn9 : TestFnBase("Function9<*, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function9<*, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function9<*, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn10 : TestFnBase("Function10<*, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function10<*, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function10<*, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn11 : TestFnBase("Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function11<*, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function11<*, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn12 : TestFnBase("Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn13 : TestFnBase("Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn14 : TestFnBase("Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn15 : TestFnBase("Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn16 : TestFnBase("Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn17 : TestFnBase("Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn18 : TestFnBase("Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn19 : TestFnBase("Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn20 : TestFnBase("Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn21 : TestFnBase("Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -object TestFn22 : TestFnBase("Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertIs(x, x is Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } - override fun testBad(x: Any) { assertIsNot(x, x !is Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/isFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/isFunKSmall.kt deleted file mode 100644 index 540798009ff..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/isFunKSmall.kt +++ /dev/null @@ -1,60 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// 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 epg = Any::extProp.getter - val eps = Any::extProp.setter - - val afoo = A::foo - - fun local0() {} - fun local1(x: Any) {} - - 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<*>" } - - 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<*>" } - - assert(ef is Function1<*, *>) { "Failed: ef is Function1<*, *>" } - assert(epg is Function1<*, *>) { "Failed: epg is Function1<*, *>"} - assert(eps is Function2<*, *, *>) { "Failed: eps is Function2<*, *, *>"} - - assert(afoo is Function1<*, *>) { "afoo is Function1<*, *>" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/javaTypeIsFunK.kt b/backend.native/tests/external/codegen/box/casts/functions/javaTypeIsFunK.kt deleted file mode 100644 index ec1c3c21eb6..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/javaTypeIsFunK.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: JFun.java - -class JFun implements kotlin.jvm.functions.Function0 { - public String invoke() { - return "OK"; - } -} - -// FILE: test.kt - -fun box(): String { - val jfun = JFun() - val jf = jfun as Any - if (jf is Function0<*>) return jfun() - else return "Failed: jf is Function0<*>" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKBig.kt deleted file mode 100644 index d853a01bb9d..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKBig.kt +++ /dev/null @@ -1,277 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -import kotlin.test.* - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -inline fun reifiedAsSucceeds(x: Any, operation: String) { - x as T -} - -inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { - assertFailsWith(ClassCastException::class, "$operation should throw an exception") { - x as T - } -} - -interface TestFnBase { - fun testGood(x: Any) - fun testBad(x: Any) -} - -object TestFn0 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function0<*>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function0<*>") -} - -object TestFn1 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function1<*, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function1<*, *>") -} - -object TestFn2 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function2<*, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function2<*, *, *>") -} - -object TestFn3 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function3<*, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function3<*, *, *, *>") -} - -object TestFn4 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function4<*, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function4<*, *, *, *, *>") -} - -object TestFn5 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function5<*, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function5<*, *, *, *, *, *>") -} - -object TestFn6 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function6<*, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function6<*, *, *, *, *, *, *>") -} - -object TestFn7 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function7<*, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function7<*, *, *, *, *, *, *, *>") -} - -object TestFn8 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function8<*, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function8<*, *, *, *, *, *, *, *, *>") -} - -object TestFn9 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function9<*, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function9<*, *, *, *, *, *, *, *, *, *>") -} - -object TestFn10 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function10<*, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function10<*, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn11 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn12 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn13 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn14 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn15 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn16 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn17 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn18 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn19 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn20 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn21 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn22 : TestFnBase { - override fun testGood(x: Any) = - reifiedAsSucceeds>( - x, "x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedAsFailsWithCCE>( - x, "x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKSmall.kt deleted file mode 100644 index 9c0e6f4c256..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedAsFunKSmall.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun fn0() {} -fun fn1(x: Any) {} - -inline fun reifiedAsSucceeds(x: Any, operation: String) { - try { - x as T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { - try { - x as T - } - catch (e: java.lang.ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should fail with CCE, no exception thrown") -} - -fun box(): String { - val f0 = ::fn0 as Any - val f1 = ::fn1 as Any - - reifiedAsSucceeds>(f0, "f0 as Function0<*>") - reifiedAsFailsWithCCE>(f0, "f0 as Function1<*, *>") - reifiedAsFailsWithCCE>(f1, "f1 as Function0<*>") - reifiedAsSucceeds>(f1, "f1 as Function1<*, *>") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKBig.kt deleted file mode 100644 index 40bc0a05f1f..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKBig.kt +++ /dev/null @@ -1,195 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -inline fun assertReifiedIs(x: Any, type: String) { - val answer: Boolean - try { - answer = x is T - } - catch (e: Throwable) { - throw AssertionError("$x is $type: should not throw exceptions, got $e") - } - assert(answer) { "$x is $type: failed" } -} - -inline fun assertReifiedIsNot(x: Any, type: String) { - val answer: Boolean - try { - answer = x !is T - } - catch (e: Throwable) { - throw AssertionError("$x !is $type: should not throw exceptions, got $e") - } - assert(answer) { "$x !is $type: failed" } -} - -abstract class TestFnBase(val type: String) { - abstract fun testGood(x: Any) - abstract fun testBad(x: Any) -} - -object TestFn0 : TestFnBase("Function0<*>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn1 : TestFnBase("Function1<*, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn2 : TestFnBase("Function2<*, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn3 : TestFnBase("Function3<*, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn4 : TestFnBase("Function4<*, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn5 : TestFnBase("Function5<*, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn6 : TestFnBase("Function6<*, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn7 : TestFnBase("Function7<*, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn8 : TestFnBase("Function8<*, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn9 : TestFnBase("Function9<*, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn10 : TestFnBase("Function10<*, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn11 : TestFnBase("Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn12 : TestFnBase("Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn13 : TestFnBase("Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn14 : TestFnBase("Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn15 : TestFnBase("Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn16 : TestFnBase("Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn17 : TestFnBase("Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn18 : TestFnBase("Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn19 : TestFnBase("Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn20 : TestFnBase("Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn21 : TestFnBase("Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -object TestFn22 : TestFnBase("Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - override fun testGood(x: Any) { assertReifiedIs>(x, type) } - override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKSmall.kt deleted file mode 100644 index 71436394ae7..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedIsFunKSmall.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun fn0() {} -fun fn1(x: Any) {} - -inline fun assertReifiedIs(x: Any, type: String) { - val answer: Boolean - try { - answer = x is T - } - catch (e: Throwable) { - throw AssertionError("$x is $type: should not throw exceptions, got $e") - } - assert(answer) { "$x is $type: failed" } -} - -inline fun assertReifiedIsNot(x: Any, type: String) { - val answer: Boolean - try { - answer = x !is T - } - catch (e: Throwable) { - throw AssertionError("$x !is $type: should not throw exceptions, got $e") - } - assert(answer) { "$x !is $type: failed" } -} - -fun box(): String { - val f0 = ::fn0 as Any - val f1 = ::fn1 as Any - - assertReifiedIs>(f0, "Function0<*>") - assertReifiedIs>(f1, "Function1<*, *>") - assertReifiedIsNot>(f1, "Function0<*>") - assertReifiedIsNot>(f0, "Function1<*, *>") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKBig.kt deleted file mode 100644 index a5844221cb4..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKBig.kt +++ /dev/null @@ -1,288 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y == null) { - throw AssertionError("$operation: should return non-null, got null") - } -} - -inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y != null) { - throw AssertionError("$operation: should return null, got $y") - } -} - -interface TestFnBase { - fun testGood(x: Any) - fun testBad(x: Any) -} - -object TestFn0 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function0<*>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function0<*>") -} - -object TestFn1 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function1<*, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function1<*, *>") -} - -object TestFn2 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function2<*, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function2<*, *, *>") -} - -object TestFn3 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function3<*, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function3<*, *, *, *>") -} - -object TestFn4 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function4<*, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function4<*, *, *, *, *>") -} - -object TestFn5 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function5<*, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function5<*, *, *, *, *, *>") -} - -object TestFn6 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function6<*, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function6<*, *, *, *, *, *, *>") -} - -object TestFn7 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function7<*, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function7<*, *, *, *, *, *, *, *>") -} - -object TestFn8 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function8<*, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function8<*, *, *, *, *, *, *, *, *>") -} - -object TestFn9 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function9<*, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function9<*, *, *, *, *, *, *, *, *, *>") -} - -object TestFn10 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn11 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn12 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn13 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn14 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn15 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn16 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn17 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn18 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn19 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn20 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn21 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -object TestFn22 : TestFnBase { - override fun testGood(x: Any) = - reifiedSafeAsReturnsNonNull>( - x, "x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") - override fun testBad(x: Any) = - reifiedSafeAsReturnsNull>( - x, "x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKSmall.kt deleted file mode 100644 index a3d4c0fcb27..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/reifiedSafeAsFunKSmall.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun fn0() {} -fun fn1(x: Any) {} - -inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y == null) { - throw AssertionError("$operation: should return non-null, got null") - } -} - -inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y != null) { - throw AssertionError("$operation: should return null, got $y") - } -} - -fun box(): String { - val f0 = ::fn0 as Any - val f1 = ::fn1 as Any - - reifiedSafeAsReturnsNonNull>(f0, "f0 as Function0<*>") - reifiedSafeAsReturnsNull>(f0, "f0 as Function1<*, *>") - reifiedSafeAsReturnsNull>(f1, "f1 as Function0<*>") - reifiedSafeAsReturnsNonNull>(f1, "f1 as Function1<*, *>") - - reifiedSafeAsReturnsNull>(null, "null as Function0<*>") - reifiedSafeAsReturnsNull>(null, "null as Function1<*, *>") - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKBig.kt b/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKBig.kt deleted file mode 100644 index 4cbc23a639d..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKBig.kt +++ /dev/null @@ -1,331 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME -// This is a big, ugly, semi-auto generated test. -// Use corresponding 'Small' test for debug. - -fun fn0() {} -fun fn1(x0: Any) {} -fun fn2(x0: Any, x1: Any) {} -fun fn3(x0: Any, x1: Any, x2: Any) {} -fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} -fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} -fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} -fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} -fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} -fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} -fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} -fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} -fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} -fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} -fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} -fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} -fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} -fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} -fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} -fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} -fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} -fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} -fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} - -val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, - ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, - ::fn20, ::fn21, ::fn22) - -inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x == null) { "$operation: should return null, got $x" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x != null) { "$operation: should return non-null" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -interface TestFnBase { - abstract fun testGood(x: Any) - abstract fun testBad(x: Any) -} - -object TestFn0 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function0<*>") { - x as? Function0<*> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function0<*>") { - x as? Function0<*> - } -} - -object TestFn1 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function1<*, *>") { - x as? Function1<*, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function1<*, *>") { - x as? Function1<*, *> - } -} - -object TestFn2 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function2<*, *, *>") { - x as? Function2<*, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function2<*, *, *>") { - x as? Function2<*, *, *> - } -} - -object TestFn3 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function3<*, *, *, *>") { - x as? Function3<*, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function3<*, *, *, *>") { - x as? Function3<*, *, *, *> - } -} - -object TestFn4 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function4<*, *, *, *, *>") { - x as? Function4<*, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function4<*, *, *, *, *>") { - x as? Function4<*, *, *, *, *> - } -} - -object TestFn5 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function5<*, *, *, *, *, *>") { - x as? Function5<*, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function5<*, *, *, *, *, *>") { - x as? Function5<*, *, *, *, *, *> - } -} - -object TestFn6 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function6<*, *, *, *, *, *, *>") { - x as? Function6<*, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function6<*, *, *, *, *, *, *>") { - x as? Function6<*, *, *, *, *, *, *> - } -} - -object TestFn7 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function7<*, *, *, *, *, *, *, *>") { - x as? Function7<*, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function7<*, *, *, *, *, *, *, *>") { - x as? Function7<*, *, *, *, *, *, *, *> - } -} - -object TestFn8 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function8<*, *, *, *, *, *, *, *, *>") { - x as? Function8<*, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function8<*, *, *, *, *, *, *, *, *>") { - x as? Function8<*, *, *, *, *, *, *, *, *> - } -} - -object TestFn9 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function9<*, *, *, *, *, *, *, *, *, *>") { - x as? Function9<*, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function9<*, *, *, *, *, *, *, *, *, *>") { - x as? Function9<*, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn10 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") { - x as? Function10<*, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") { - x as? Function10<*, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn11 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn12 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn13 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn14 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn15 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn16 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn17 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn18 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn19 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn20 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn21 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -object TestFn22 : TestFnBase { - override fun testGood(x: Any) = - safeAsReturnsNonNull("x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } - override fun testBad(x: Any) = - safeAsReturnsNull("x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { - x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> - } -} - -val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, - TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, - TestFn20, TestFn21, TestFn22) - -fun box(): String { - for (fnI in 0 .. 22) { - for (testI in 0 .. 22) { - if (fnI == testI) { - tests[testI].testGood(fns[fnI]) - } - else { - tests[testI].testBad(fns[fnI]) - } - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKSmall.kt b/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKSmall.kt deleted file mode 100644 index 0628070f83f..00000000000 --- a/backend.native/tests/external/codegen/box/casts/functions/safeAsFunKSmall.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -// WITH_RUNTIME - -fun fn0() {} -fun fn1(x: Any) {} - -inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x == null) { "$operation: should return null, got $x" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x != null) { "$operation: should return non-null" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -fun box(): String { - val f0 = ::fn0 as Any - val f1 = ::fn1 as Any - - safeAsReturnsNonNull("f0 as? Function0<*>") { f0 as? Function0<*> } - safeAsReturnsNull("f0 as? Function1<*, *>") { f0 as? Function1<*, *> } - safeAsReturnsNull("f1 as? Function0<*>") { f1 as? Function0<*> } - safeAsReturnsNonNull("f1 as? Function1<*, *>") { f1 as? Function1<*, *> } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBounds.kt b/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBounds.kt deleted file mode 100644 index 31183798872..00000000000 --- a/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBounds.kt +++ /dev/null @@ -1,22 +0,0 @@ -interface A { - fun foo(): Any? - fun bar(): String -} - -interface B { - fun foo(): String -} - -fun bar(x: T): String where T : A, T : B { - if (x.foo().length != 2 || x.foo() != "OK") return "fail 1" - if (x.bar() != "ok") return "fail 2" - - return "OK" -} - -class C : A, B { - override fun foo() = "OK" - override fun bar() = "ok" -} - -fun box(): String = bar(C()) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt b/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt deleted file mode 100644 index de3adc56939..00000000000 --- a/backend.native/tests/external/codegen/box/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface FirstTrait -interface SecondTrait - -fun T.doSomething(): String where T : FirstTrait, T : SecondTrait { - return "OK" -} - -class Foo : FirstTrait, SecondTrait { - fun bar(): String { - return doSomething() - } -} - -fun box(): String { - return Foo().bar() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/intersectionTypeSmartcast.kt b/backend.native/tests/external/codegen/box/casts/intersectionTypeSmartcast.kt deleted file mode 100644 index 509ef35fabd..00000000000 --- a/backend.native/tests/external/codegen/box/casts/intersectionTypeSmartcast.kt +++ /dev/null @@ -1,27 +0,0 @@ -interface A { - fun foo(): Any? -} - -interface B { - fun foo(): String -} - -fun bar(x: Any?): String { - if (x is A) { - val k = x.foo() - if (k != "OK") return "fail 1" - } - - if (x is B) { - val k = x.foo() - if (k.length != 2) return "fail 2" - } - - if (x is A && x is B) { - return x.foo() - } - - return "fail 4" -} - -fun box(): String = bar(object : A, B { override fun foo() = "OK" }) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt b/backend.native/tests/external/codegen/box/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt deleted file mode 100644 index 8c58629b05c..00000000000 --- a/backend.native/tests/external/codegen/box/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface Foo -interface Bar - -class Baz : Foo, Bar - -fun S.bip(): String where S : Foo, S: Bar { - return "OK" -} - -fun box(): String { - val baz = Baz() - return baz.bip() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/intersectionTypeWithoutGenericsAsReceiver.kt b/backend.native/tests/external/codegen/box/casts/intersectionTypeWithoutGenericsAsReceiver.kt deleted file mode 100644 index 52c1ef7e498..00000000000 --- a/backend.native/tests/external/codegen/box/casts/intersectionTypeWithoutGenericsAsReceiver.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A -interface B - -class C : A, B - -fun T.foo(): String where T : A, T : B { - return "OK" -} - -fun box(): String { - return C().foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/is.kt b/backend.native/tests/external/codegen/box/casts/is.kt deleted file mode 100644 index 19a3e284e5c..00000000000 --- a/backend.native/tests/external/codegen/box/casts/is.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun foo(x: Any) = x is Runnable - -fun box(): String { - val r = object : Runnable { - override fun run() {} - } - return if (foo(r) && !foo(42)) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/isNullablePrimitive.kt b/backend.native/tests/external/codegen/box/casts/isNullablePrimitive.kt deleted file mode 100644 index 6a820551736..00000000000 --- a/backend.native/tests/external/codegen/box/casts/isNullablePrimitive.kt +++ /dev/null @@ -1,48 +0,0 @@ -fun box(): String { - val n: Any? = null - - val intV: Any? = 23 - val floatV: Any? = 23.4F - val doubleV: Any? = 23.45 - val longV: Any? = 234L - val stringV: Any? = "foo" - val booleanV: Any? = true - val functionV: Any? = { x: Int -> x + 1 } - - if (n !is Int?) return "fail: null !is Int?" - if (n !is Float?) return "fail: null !is Float?" - if (n !is Double?) return "fail: null !is Double?" - if (n !is String?) return "fail: null !is String?" - if (n !is Boolean?) return "fail: null !is Boolean?" - if (n !is Function1<*, *>?) return "fail: null !is Function?" - - if (n is Int) return "fail: null is Int" - if (n is Float) return "fail: null is Float" - if (n is Double) return "fail: null is Double" - if (n is String) return "fail: null is String" - if (n is Boolean) return "fail: null is Boolean" - if (n is Function1<*, *>) return "fail: null is Function" - - if (intV !is Int?) return "fail: 23 !is Int?" - if (intV is String?) return "fail: 23 is String?" - - if (floatV !is Float?) return "fail: 23.4F !is Float?" - if (floatV is String?) return "fail: 23.4F is String?" - - if (doubleV !is Double?) return "fail: 23.45 !is Double?" - if (doubleV is String?) return "fail: 23.45 is String?" - - if (longV !is Long?) return "fail: 234L !is Long?" - if (longV is String?) return "fail: 234L is String?" - - if (stringV !is String?) return "fail: 'foo' !is String?" - if (stringV is Double?) return "fail: 'foo' is Double?" - - if (booleanV !is Boolean?) return "fail: true !is Boolean?" - if (booleanV is Double?) return "fail: true is Double?" - - if (functionV !is Function1<*, *>?) return "fail: !is Function?" - if (functionV is String?) return "fail: is String?" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/lambdaToUnitCast.kt b/backend.native/tests/external/codegen/box/casts/lambdaToUnitCast.kt deleted file mode 100644 index 94ddfb05c00..00000000000 --- a/backend.native/tests/external/codegen/box/casts/lambdaToUnitCast.kt +++ /dev/null @@ -1,6 +0,0 @@ -val foo: () -> Unit = {} - -fun box(): String { - foo() as Unit - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt deleted file mode 100644 index 8f18303c58c..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Box(val value: T) - -fun box() : String { - val b = Box(2 * 3) - val expected: Long? = 6L - return if (b.value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/javaBox.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/javaBox.kt deleted file mode 100644 index 16a7d407e12..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/javaBox.kt +++ /dev/null @@ -1,28 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: Box.java - -public class Box { - private final T value; - - public Box(T value) { - this.value = value; - } - - public static Box create(T defaultValue) { - return new Box(defaultValue); - } - - public T getValue() { - return value; - } -} - -// FILE: test.kt -// See KT-10313: ClassCastException with Generics - -fun box(): String { - val sub = Box(-1) - return if (sub.value == -1L) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt deleted file mode 100644 index 229afac35f9..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Box(val value: T) - -fun box() : String { - val b = Box(x@ (1 + 2)) - val expected: Long? = 3L - return if (b.value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt deleted file mode 100644 index a70372d5ca4..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Box(val value: T) - -fun box() : String { - val b = Box((-1)) - val expected: Long? = -1L - return if (b.value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/superConstructor.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/superConstructor.kt deleted file mode 100644 index f896fd083f6..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/superConstructor.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class Base(val value: T) -class Box(): Base(-1) - -fun box(): String { - val expected: Long? = -1L - return if (Box().value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt deleted file mode 100644 index 6f253b61557..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Box(val value: T) - -fun box() : String { - val b = Box(-1) - val expected: Long? = -1L - return if (b.value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/vararg.kt b/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/vararg.kt deleted file mode 100644 index dab9ff62303..00000000000 --- a/backend.native/tests/external/codegen/box/casts/literalExpressionAsGenericArgument/vararg.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Box(val value: T) - -fun run(vararg z: T): Box { - return Box(z[0]) -} - -fun box(): String { - val b = run(-1, -1, -1) - val expected: Long? = -1L - return if (b.value == expected) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/asWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/asWithMutable.kt deleted file mode 100644 index 18e55258044..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/asWithMutable.kt +++ /dev/null @@ -1,127 +0,0 @@ - -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -inline fun asFailsWithCCE(operation: String, block: () -> Unit) { - try { - block() - } - catch (e: ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should throw ClassCastException, no exception thrown") -} - -inline fun asSucceeds(operation: String, block: () -> Unit) { - try { - block() - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - asFailsWithCCE("itr as MutableIterator") { itr as MutableIterator<*> } - asSucceeds("mitr as MutableIterator") { mitr as MutableIterator<*> } - - val litr = LItr() as Any - val mlitr = MLItr() - - asFailsWithCCE("litr as MutableIterator") { litr as MutableIterator<*> } - asFailsWithCCE("litr as MutableListIterator") { litr as MutableListIterator<*> } - asSucceeds("mlitr as MutableIterator") { mlitr as MutableIterator<*> } - asSucceeds("mlitr as MutableListIterator") { mlitr as MutableListIterator<*> } - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - asFailsWithCCE("it as MutableIterable") { it as MutableIterable<*> } - asSucceeds("mit as MutableIterable") { mit as MutableIterable<*> } - asSucceeds("arrayList as MutableIterable") { arrayList as MutableIterable<*> } - - val coll = C() as Any - val mcoll = MC() - - asFailsWithCCE("coll as MutableIterable") { coll as MutableIterable<*> } - asFailsWithCCE("coll as MutableCollection") { coll as MutableCollection<*> } - asSucceeds("mcoll as MutableIterable") { mcoll as MutableIterable<*> } - asSucceeds("mcoll as MutableCollection") { mcoll as MutableCollection<*> } - asSucceeds("arrayList as MutableCollection") { arrayList as MutableCollection<*> } - - val list = L() as Any - val mlist = ML() - - asFailsWithCCE("list as MutableIterable") { list as MutableIterable<*> } - asFailsWithCCE("list as MutableCollection") { list as MutableCollection<*> } - asFailsWithCCE("list as MutableList") { list as MutableList<*> } - asSucceeds("mlist as MutableIterable") { mlist as MutableIterable<*> } - asSucceeds("mlist as MutableCollection") { mlist as MutableCollection<*> } - asSucceeds("mlist as MutableList") { mlist as MutableList<*> } - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - asFailsWithCCE("set as MutableIterable") { set as MutableIterable<*> } - asFailsWithCCE("set as MutableCollection") { set as MutableCollection<*> } - asFailsWithCCE("set as MutableSet") { set as MutableSet<*> } - asSucceeds("mset as MutableIterable") { mset as MutableIterable<*> } - asSucceeds("mset as MutableCollection") { mset as MutableCollection<*> } - asSucceeds("mset as MutableSet") { mset as MutableSet<*> } - asSucceeds("hashSet as MutableSet") { hashSet as MutableSet<*> } - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - asFailsWithCCE("map as MutableMap") { map as MutableMap<*, *> } - asSucceeds("mmap as MutableMap") { mmap as MutableMap<*, *> } - - val entry = ME() as Any - val mentry = MME() - - asFailsWithCCE("entry as MutableMap.MutableEntry") { entry as MutableMap.MutableEntry<*, *> } - asSucceeds("mentry as MutableMap.MutableEntry") { mentry as MutableMap.MutableEntry<*, *> } - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - asSucceeds("hashMapEntry as MutableMap.MutableEntry") { hashMapEntry as MutableMap.MutableEntry<*, *> } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/isWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/isWithMutable.kt deleted file mode 100644 index 56e8fb846c8..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/isWithMutable.kt +++ /dev/null @@ -1,111 +0,0 @@ -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - assert(itr !is MutableIterator<*>) { "Itr should satisfy '!is MutableIterator'" } - assert(mitr is MutableIterator<*>) { "MItr should satisfy 'is MutableIterator'" } - - val litr = LItr() as Any - val mlitr = MLItr() - - assert(litr !is MutableIterator<*>) { "LItr should satisfy '!is MutableIterator'" } - assert(litr !is MutableListIterator<*>) { "LItr should satisfy '!is MutableListIterator'" } - assert(mlitr is MutableListIterator<*>) { "MLItr should satisfy 'is MutableListIterator'" } - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - assert(it !is MutableIterable<*>) { "It should satisfy '!is MutableIterable'" } - assert(mit is MutableIterable<*>) { "MIt should satisfy 'is MutableIterable'" } - assert(arrayList is MutableIterable<*>) { "ArrayList should satisfy 'is MutableIterable'" } - - val coll = C() as Any - val mcoll = MC() - - assert(coll !is MutableCollection<*>) { "C should satisfy '!is MutableCollection'" } - assert(coll !is MutableIterable<*>) { "C should satisfy '!is MutableIterable'" } - assert(mcoll is MutableCollection<*>) { "MC should satisfy 'is MutableCollection'" } - assert(mcoll is MutableIterable<*>) { "MC should satisfy 'is MutableIterable'" } - assert(arrayList is MutableCollection<*>) { "ArrayList should satisfy 'is MutableCollection'" } - - val list = L() as Any - val mlist = ML() - - assert(list !is MutableList<*>) { "L should satisfy '!is MutableList'" } - assert(list !is MutableCollection<*>) { "L should satisfy '!is MutableCollection'" } - assert(list !is MutableIterable<*>) { "L should satisfy '!is MutableIterable'" } - assert(mlist is MutableList<*>) { "ML should satisfy 'is MutableList'" } - assert(mlist is MutableCollection<*>) { "ML should satisfy 'is MutableCollection'" } - assert(mlist is MutableIterable<*>) { "ML should satisfy 'is MutableIterable'" } - assert(arrayList is MutableList<*>) { "ArrayList should satisfy 'is MutableList'" } - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - assert(set !is MutableSet<*>) { "S should satisfy '!is MutableSet'" } - assert(set !is MutableCollection<*>) { "S should satisfy '!is MutableCollection'" } - assert(set !is MutableIterable<*>) { "S should satisfy '!is MutableIterable'" } - assert(mset is MutableSet<*>) { "MS should satisfy 'is MutableSet'" } - assert(mset is MutableCollection<*>) { "MS should satisfy 'is MutableCollection'" } - assert(mset is MutableIterable<*>) { "MS should satisfy 'is MutableIterable'" } - assert(hashSet is MutableSet<*>) { "HashSet should satisfy 'is MutableSet'" } - assert(hashSet is MutableCollection<*>) { "HashSet should satisfy 'is MutableCollection'" } - assert(hashSet is MutableIterable<*>) { "HashSet should satisfy 'is MutableIterable'" } - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - assert(map !is MutableMap<*, *>) { "M should satisfy '!is MutableMap'" } - assert(mmap is MutableMap<*, *>) { "MM should satisfy 'is MutableMap'"} - assert(hashMap is MutableMap<*, *>) { "HashMap should satisfy 'is MutableMap'" } - - val entry = ME() as Any - val mentry = MME() - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - assert(entry !is MutableMap.MutableEntry<*, *>) { "ME should satisfy '!is MutableMap.MutableEntry'"} - assert(mentry is MutableMap.MutableEntry<*, *>) { "MME should satisfy 'is MutableMap.MutableEntry'"} - assert(hashMapEntry is MutableMap.MutableEntry<*, *>) { "HashMap.Entry should satisfy 'is MutableMap.MutableEntry'"} - - assert((mlist as Any) !is MutableSet<*>) { "ML !is MutableSet" } - assert((mlist as Any) !is MutableIterator<*>) { "ML !is MutableIterator" } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/mutabilityMarkerInterfaces.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/mutabilityMarkerInterfaces.kt deleted file mode 100644 index 5aa856a189a..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/mutabilityMarkerInterfaces.kt +++ /dev/null @@ -1,60 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -abstract class Itr : Iterator -abstract class MItr : MutableIterator -abstract class LItr : ListIterator -abstract class MLItr : MutableListIterator -abstract class It : Iterable -abstract class MIt : MutableIterable -abstract class C : Collection -abstract class MC : MutableCollection -abstract class L : List -abstract class ML : MutableList -abstract class S : Set -abstract class MS : MutableSet -abstract class M : Map -abstract class MM : MutableMap -abstract class ME : Map.Entry -abstract class MME : MutableMap.MutableEntry - -abstract class L2 : L() -abstract class ML2 : ML() - -abstract class Weird : Iterator, MutableList - -fun expectInterfaces(jClass: Class<*>, expectedInterfaceNames: Set) { - val actualInterfaceNames = jClass.getInterfaces().mapTo(linkedSetOf()) { it.name } - - assert(actualInterfaceNames == expectedInterfaceNames) { - "${jClass.name}: interfaces: expected: $expectedInterfaceNames; actual: $actualInterfaceNames" - } -} - -fun box(): String { - expectInterfaces(Itr::class.java, setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MItr::class.java, setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMutableIterator")) - expectInterfaces(LItr::class.java, setOf("java.util.ListIterator", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MLItr::class.java, setOf("java.util.ListIterator", "kotlin.jvm.internal.markers.KMutableListIterator")) - expectInterfaces(It::class.java, setOf("java.lang.Iterable", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MIt::class.java, setOf("java.lang.Iterable", "kotlin.jvm.internal.markers.KMutableIterable")) - expectInterfaces(C::class.java, setOf("java.util.Collection", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MC::class.java, setOf("java.util.Collection", "kotlin.jvm.internal.markers.KMutableCollection")) - expectInterfaces(L::class.java, setOf("java.util.List", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(ML::class.java, setOf("java.util.List", "kotlin.jvm.internal.markers.KMutableList")) - expectInterfaces(S::class.java, setOf("java.util.Set", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MS::class.java, setOf("java.util.Set", "kotlin.jvm.internal.markers.KMutableSet")) - expectInterfaces(M::class.java, setOf("java.util.Map", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MM::class.java, setOf("java.util.Map", "kotlin.jvm.internal.markers.KMutableMap")) - expectInterfaces(ME::class.java, setOf("java.util.Map\$Entry", "kotlin.jvm.internal.markers.KMappedMarker")) - expectInterfaces(MME::class.java, setOf("java.util.Map\$Entry", "kotlin.jvm.internal.markers.KMutableMap\$Entry")) - expectInterfaces(L2::class.java, setOf()) - expectInterfaces(ML2::class.java, setOf()) - expectInterfaces(Weird::class.java, - setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMappedMarker", - "java.util.List", "kotlin.jvm.internal.markers.KMutableList")) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedAsWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedAsWithMutable.kt deleted file mode 100644 index 77d2d3b8683..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedAsWithMutable.kt +++ /dev/null @@ -1,128 +0,0 @@ -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -inline fun reifiedAsSucceeds(x: Any, operation: String) { - try { - x as T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { - try { - x as T - } - catch (e: ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should fail with CCE, no exception thrown") -} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - reifiedAsFailsWithCCE>(itr, "reifiedAs>(itr)") - reifiedAsSucceeds>(mitr, "reifiedAs>(mitr)") - - val litr = LItr() as Any - val mlitr = MLItr() - - reifiedAsFailsWithCCE>(litr, "reifiedAs>(litr)") - reifiedAsFailsWithCCE>(litr, "reifiedAs>(litr)") - reifiedAsSucceeds>(mlitr, "reifiedAs>(mlitr)") - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - reifiedAsFailsWithCCE>(it, "reifiedAs>(it)") - reifiedAsSucceeds>(mit, "reifiedAs>(mit)") - reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") - - val coll = C() as Any - val mcoll = MC() - - reifiedAsFailsWithCCE>(coll, "reifiedAs>(coll)") - reifiedAsFailsWithCCE>(coll, "reifiedAs>(coll)") - reifiedAsSucceeds>(mcoll, "reifiedAs>(mcoll)") - reifiedAsSucceeds>(mcoll, "reifiedAs>(mcoll)") - reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") - - val list = L() as Any - val mlist = ML() - - reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") - reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") - reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") - reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") - reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") - reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") - reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") - reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") - reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") - reifiedAsSucceeds>(mset, "reifiedAs>(mset)") - reifiedAsSucceeds>(mset, "reifiedAs>(mset)") - reifiedAsSucceeds>(mset, "reifiedAs>(mset)") - reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") - reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") - reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - reifiedAsFailsWithCCE>(map, "reifiedAs>(map)") - reifiedAsSucceeds>(mmap, "reifiedAs>(mmap)") - reifiedAsSucceeds>(hashMap, "reifiedAs>(hashMap)") - - val entry = ME() as Any - val mentry = MME() - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - reifiedAsFailsWithCCE>(entry, "reifiedAs>(entry)") - reifiedAsSucceeds>(mentry, "reifiedAs>(mentry)") - reifiedAsSucceeds>(hashMapEntry, "reifiedAs>(hashMapEntry)") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedIsWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedIsWithMutable.kt deleted file mode 100644 index df6e233f20a..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedIsWithMutable.kt +++ /dev/null @@ -1,111 +0,0 @@ -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -inline fun reifiedIs(x: Any): Boolean = x is T -inline fun reifiedIsNot(x: Any): Boolean = x !is T - -fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - assert(reifiedIsNot>(itr)) { "reifiedIsNot>(itr)" } - assert(reifiedIs>(mitr)) { "reifiedIs>(mitr)" } - - val litr = LItr() as Any - val mlitr = MLItr() - - assert(reifiedIsNot>(litr)) { "reifiedIsNot>(litr)" } - assert(reifiedIsNot>(litr)) { "reifiedIsNot>(litr)" } - assert(reifiedIs>(mlitr)) { "reifiedIs>(mlitr)" } - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - assert(reifiedIsNot>(it)) { "reifiedIsNot>(it)" } - assert(reifiedIs>(mit)) { "reifiedIs>(mit)" } - assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } - - val coll = C() as Any - val mcoll = MC() - - assert(reifiedIsNot>(coll)) { "reifiedIsNot>(coll)" } - assert(reifiedIsNot>(coll)) { "reifiedIsNot>(coll)" } - assert(reifiedIs>(mcoll)) { "reifiedIs>(mcoll)" } - assert(reifiedIs>(mcoll)) { "reifiedIs>(mcoll)" } - assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } - - val list = L() as Any - val mlist = ML() - - assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } - assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } - assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } - assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } - assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } - assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } - assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } - assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } - assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } - assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } - assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } - assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } - assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } - assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } - assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - assert(reifiedIsNot>(map)) { "reifiedIsNot>(map)" } - assert(reifiedIs>(mmap)) { "reifiedIs>(mmap)"} - assert(reifiedIs>(hashMap)) { "reifiedIs>(hashMap)" } - - val entry = ME() as Any - val mentry = MME() - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - assert(reifiedIsNot>(entry)) { "reifiedIsNot>(entry)"} - assert(reifiedIs>(mentry)) { "reifiedIs>(mentry)"} - assert(reifiedIs>(hashMapEntry)) { "reifiedIs>(hashMapEntry)"} - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedSafeAsWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedSafeAsWithMutable.kt deleted file mode 100644 index a54ad8b239f..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/reifiedSafeAsWithMutable.kt +++ /dev/null @@ -1,139 +0,0 @@ -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y == null) { - throw AssertionError("$operation: should return non-null, got null") - } -} - -inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y != null) { - throw AssertionError("$operation: should return null, got $y") - } -} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - reifiedSafeAsReturnsNull>(itr, "reifiedSafeAs>(itr)") - reifiedSafeAsReturnsNonNull>(mitr, "reifiedSafeAs>(mitr)") - - val litr = LItr() as Any - val mlitr = MLItr() - - reifiedSafeAsReturnsNull>(litr, "reifiedSafeAs>(litr)") - reifiedSafeAsReturnsNull>(litr, "reifiedSafeAs>(litr)") - reifiedSafeAsReturnsNonNull>(mlitr, "reifiedSafeAs>(mlitr)") - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - reifiedSafeAsReturnsNull>(it, "reifiedSafeAs>(it)") - reifiedSafeAsReturnsNonNull>(mit, "reifiedSafeAs>(mit)") - reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") - - val coll = C() as Any - val mcoll = MC() - - reifiedSafeAsReturnsNull>(coll, "reifiedSafeAs>(coll)") - reifiedSafeAsReturnsNull>(coll, "reifiedSafeAs>(coll)") - reifiedSafeAsReturnsNonNull>(mcoll, "reifiedSafeAs>(mcoll)") - reifiedSafeAsReturnsNonNull>(mcoll, "reifiedSafeAs>(mcoll)") - reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") - - val list = L() as Any - val mlist = ML() - - reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") - reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") - reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") - reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") - reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") - reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") - reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") - reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") - reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") - reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") - reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") - reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") - reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") - reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") - reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - reifiedSafeAsReturnsNull>(map, "reifiedSafeAs>(map)") - reifiedSafeAsReturnsNonNull>(mmap, "reifiedSafeAs>(mmap)") - reifiedSafeAsReturnsNonNull>(hashMap, "reifiedSafeAs>(hashMap)") - - val entry = ME() as Any - val mentry = MME() - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - reifiedSafeAsReturnsNull>(entry, "reifiedSafeAs>(entry)") - reifiedSafeAsReturnsNonNull>(mentry, "reifiedSafeAs>(mentry)") - reifiedSafeAsReturnsNonNull>(hashMapEntry, "reifiedSafeAs>(hashMapEntry)") - - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/safeAsWithMutable.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/safeAsWithMutable.kt deleted file mode 100644 index 58113095c09..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/safeAsWithMutable.kt +++ /dev/null @@ -1,140 +0,0 @@ -// WITH_RUNTIME - -class Itr : Iterator by ArrayList().iterator() -class MItr : MutableIterator by ArrayList().iterator() -class LItr : ListIterator by ArrayList().listIterator() -class MLItr : MutableListIterator by ArrayList().listIterator() - -class It : Iterable by ArrayList() -class MIt : MutableIterable by ArrayList() -class C : Collection by ArrayList() -class MC : MutableCollection by ArrayList() -class L : List by ArrayList() -class ML : MutableList by ArrayList() -class S : Set by HashSet() -class MS : MutableSet by HashSet() - -class M : Map by HashMap() -class MM : MutableMap by HashMap() - -class ME : Map.Entry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() -} - -class MME : MutableMap.MutableEntry { - override val key: String get() = throw UnsupportedOperationException() - override val value: String get() = throw UnsupportedOperationException() - override fun setValue(value: String): String = throw UnsupportedOperationException() -} - -fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} - - -inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x == null) { "$operation: should return null, got $x" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x != null) { "$operation: should return non-null" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -fun box(): String { - val itr = Itr() as Any - val mitr = MItr() - - safeAsReturnsNull("itr as? MutableIterator") { itr as? MutableIterator<*> } - safeAsReturnsNonNull("mitr as? MutableIterator") { mitr as? MutableIterator<*> } - - val litr = LItr() as Any - val mlitr = MLItr() - - safeAsReturnsNull("litr as? MutableIterator") { litr as? MutableIterator<*> } - safeAsReturnsNull("litr as? MutableListIterator") { litr as? MutableListIterator<*> } - safeAsReturnsNonNull("mlitr as? MutableIterator") { mlitr as? MutableIterator<*> } - safeAsReturnsNonNull("mlitr as? MutableListIterator") { mlitr as? MutableListIterator<*> } - - val it = It() as Any - val mit = MIt() - val arrayList = ArrayList() - - safeAsReturnsNull("it as? MutableIterable") { it as? MutableIterable<*> } - safeAsReturnsNonNull("mit as? MutableIterable") { mit as? MutableIterable<*> } - safeAsReturnsNonNull("arrayList as? MutableIterable") { arrayList as? MutableIterable<*> } - - val coll = C() as Any - val mcoll = MC() - - safeAsReturnsNull("coll as? MutableIterable") { coll as? MutableIterable<*> } - safeAsReturnsNull("coll as? MutableCollection") { coll as? MutableCollection<*> } - safeAsReturnsNonNull("mcoll as? MutableIterable") { mcoll as? MutableIterable<*> } - safeAsReturnsNonNull("mcoll as? MutableCollection") { mcoll as? MutableCollection<*> } - safeAsReturnsNonNull("arrayList as? MutableCollection") { arrayList as? MutableCollection<*> } - - val list = L() as Any - val mlist = ML() - - safeAsReturnsNull("list as? MutableIterable") { list as? MutableIterable<*> } - safeAsReturnsNull("list as? MutableCollection") { list as? MutableCollection<*> } - safeAsReturnsNull("list as? MutableList") { list as? MutableList<*> } - safeAsReturnsNonNull("mlist as? MutableIterable") { mlist as? MutableIterable<*> } - safeAsReturnsNonNull("mlist as? MutableCollection") { mlist as? MutableCollection<*> } - safeAsReturnsNonNull("mlist as? MutableList") { mlist as? MutableList<*> } - - val set = S() as Any - val mset = MS() - val hashSet = HashSet() - - safeAsReturnsNull("set as? MutableIterable") { set as? MutableIterable<*> } - safeAsReturnsNull("set as? MutableCollection") { set as? MutableCollection<*> } - safeAsReturnsNull("set as? MutableSet") { set as? MutableSet<*> } - safeAsReturnsNonNull("mset as? MutableIterable") { mset as? MutableIterable<*> } - safeAsReturnsNonNull("mset as? MutableCollection") { mset as? MutableCollection<*> } - safeAsReturnsNonNull("mset as? MutableSet") { mset as? MutableSet<*> } - safeAsReturnsNonNull("hashSet as? MutableSet") { hashSet as? MutableSet<*> } - - val map = M() as Any - val mmap = MM() - val hashMap = HashMap() - - safeAsReturnsNull("map as? MutableMap") { map as? MutableMap<*, *> } - safeAsReturnsNonNull("mmap as? MutableMap") { mmap as? MutableMap<*, *> } - safeAsReturnsNonNull("hashMap as? MutableMap") { hashMap as? MutableMap<*, *> } - - val entry = ME() as Any - val mentry = MME() - - safeAsReturnsNull("entry as? MutableMap.MutableEntry") { entry as? MutableMap.MutableEntry<*, *> } - safeAsReturnsNonNull("mentry as? MutableMap.MutableEntry") { mentry as? MutableMap.MutableEntry<*, *> } - - hashMap[""] = "" - val hashMapEntry = hashMap.entries.first() - - safeAsReturnsNonNull("hashMapEntry as? MutableMap.MutableEntry") { hashMapEntry as? MutableMap.MutableEntry<*, *> } - - safeAsReturnsNull("null as? MutableIterator") { null as? MutableIterator<*> } - safeAsReturnsNull("null as? MutableListIterator") { null as? MutableListIterator<*> } - safeAsReturnsNull("null as? MutableIterable") { null as? MutableIterable<*> } - safeAsReturnsNull("null as? MutableCollection") { null as? MutableCollection<*> } - safeAsReturnsNull("null as? MutableList") { null as? MutableList<*> } - safeAsReturnsNull("null as? MutableSet") { null as? MutableSet<*> } - safeAsReturnsNull("null as? MutableMap") { null as? MutableMap<*, *> } - safeAsReturnsNull("null as? MutableMap.MutableEntry") { null as? MutableMap.MutableEntry<*, *> } - - safeAsReturnsNull("mlist as? MutableSet") { mlist as? MutableSet<*> } - safeAsReturnsNull("mlist as? MutableIterator") { mlist as? MutableIterator<*> } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/mutableCollections/weirdMutableCasts.kt b/backend.native/tests/external/codegen/box/casts/mutableCollections/weirdMutableCasts.kt deleted file mode 100644 index 137035866b1..00000000000 --- a/backend.native/tests/external/codegen/box/casts/mutableCollections/weirdMutableCasts.kt +++ /dev/null @@ -1,143 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun unsupported(): Nothing = throw UnsupportedOperationException() - -class Weird : Iterator, MutableIterable, MutableMap.MutableEntry { - override fun next(): String = unsupported() - override fun hasNext(): Boolean = unsupported() - override val key: String get() = unsupported() - override val value: String get() = unsupported() - override fun setValue(value: String): String = unsupported() - override fun iterator(): MutableIterator = unsupported() -} - -inline fun asFailsWithCCE(operation: String, cast: () -> Unit) { - try { - cast() - } - catch (e: java.lang.ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should throw ClassCastException, no exception thrown") -} - -inline fun asSucceeds(operation: String, cast: () -> Unit) { - try { - cast() - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x == null) { "$operation: should return null, got $x" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { - try { - val x = cast() - assert(x != null) { "$operation: should return non-null" } - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun reifiedIs(x: Any): Boolean = x is T - -inline fun reifiedIsNot(x: Any): Boolean = x !is T - -inline fun reifiedAsSucceeds(x: Any, operation: String) { - try { - x as T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } -} - -inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { - try { - x as T - } - catch (e: java.lang.ClassCastException) { - return - } - catch (e: Throwable) { - throw AssertionError("$operation: should throw ClassCastException, got $e") - } - throw AssertionError("$operation: should fail with CCE, no exception thrown") -} - -inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y == null) { - throw AssertionError("$operation: should return non-null, got null") - } -} - -inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { - val y = try { - x as? T - } - catch (e: Throwable) { - throw AssertionError("$operation: should not throw exceptions, got $e") - } - if (y != null) { - throw AssertionError("$operation: should return null, got $y") - } -} - -fun box(): String { - val w: Any = Weird() - - assert(w is Iterator<*>) { "w is Iterator<*>" } - assert(w !is MutableIterator<*>) { "w !is MutableIterator<*>" } - assert(w is MutableIterable<*>) { "w is MutableIterable<*>" } - assert(w is MutableMap.MutableEntry<*, *>) { "w is MutableMap.MutableEntry<*, *>" } - - asSucceeds("w as Iterator<*>") { w as Iterator<*> } - asFailsWithCCE("w as MutableIterator<*>") { w as MutableIterator<*> } - asSucceeds("w as MutableIterable<*>") { w as MutableIterable<*> } - asSucceeds("w as MutableMap.MutableEntry<*, *>") { w as MutableMap.MutableEntry<*, *> } - - safeAsReturnsNonNull("w as Iterator<*>") { w as? Iterator<*> } - safeAsReturnsNull("w as? MutableIterator<*>") { w as? MutableIterator<*> } - safeAsReturnsNonNull("w as? MutableIterable<*>") { w as? MutableIterable<*> } - safeAsReturnsNonNull("w as? MutableMap.MutableEntry<*, *>") { w as? MutableMap.MutableEntry<*, *> } - - assert(reifiedIs>(w)) { "reifiedIs>(w)" } - assert(reifiedIsNot>(w)) { "reifiedIsNot>(w)" } - assert(reifiedIs>(w)) { "reifiedIs>(w)" } - assert(reifiedIs>(w)) { "reifiedIs>(w)" } - - reifiedAsSucceeds>(w, "reified w as Iterator<*>") - reifiedAsFailsWithCCE>(w, "reified w as MutableIterator<*>") - reifiedAsSucceeds>(w, "reified w as MutableIterable<*>") - reifiedAsSucceeds>(w, "reified w as MutableMap.MutableEntry<*, *>") - - reifiedSafeAsReturnsNonNull>(w, "reified w as? Iterator<*>") - reifiedSafeAsReturnsNull>(w, "reified w as? MutableIterator<*>") - reifiedSafeAsReturnsNonNull>(w, "reified w as? MutableIterable<*>") - reifiedSafeAsReturnsNonNull>(w, "reified w as? MutableMap.MutableEntry<*, *>") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/notIs.kt b/backend.native/tests/external/codegen/box/casts/notIs.kt deleted file mode 100644 index 5e784474bb9..00000000000 --- a/backend.native/tests/external/codegen/box/casts/notIs.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun foo(x: Any) = x !is Runnable - -fun box(): String { - val r = object : Runnable { - override fun run() {} - } - return if (!foo(r) && foo(42)) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/casts/unitAsAny.kt b/backend.native/tests/external/codegen/box/casts/unitAsAny.kt deleted file mode 100644 index 74326356cba..00000000000 --- a/backend.native/tests/external/codegen/box/casts/unitAsAny.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun println(s: String) { -} - -fun box(): String { - val x = println(":Hi!") as Any - if (x != Unit) return "Fail: $x" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/unitAsInt.kt b/backend.native/tests/external/codegen/box/casts/unitAsInt.kt deleted file mode 100644 index 5e0ab81ea20..00000000000 --- a/backend.native/tests/external/codegen/box/casts/unitAsInt.kt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun foo() {} - -fun box(): String { - try { - foo() as Int? - } - catch (e: ClassCastException) { - return "OK" - } - catch (e: Throwable) { - return "Fail: ClassCastException should have been thrown, but was instead ${e.javaClass.getName()}: ${e.message}" - } - - return "Fail: no exception was thrown" -} diff --git a/backend.native/tests/external/codegen/box/casts/unitAsSafeAny.kt b/backend.native/tests/external/codegen/box/casts/unitAsSafeAny.kt deleted file mode 100644 index 81d5a495425..00000000000 --- a/backend.native/tests/external/codegen/box/casts/unitAsSafeAny.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun println(s: String) { -} - -fun box(): String { - val x = println(":Hi!") as? Any - if (x != Unit) return "Fail: $x" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/casts/unitNullableCast.kt b/backend.native/tests/external/codegen/box/casts/unitNullableCast.kt deleted file mode 100644 index c0f644e88a5..00000000000 --- a/backend.native/tests/external/codegen/box/casts/unitNullableCast.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo() {} - -fun bar(): Int? = foo() as? Int - -fun box(): String { - return if (bar() == null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/checkcastOptimization/kt19128.kt b/backend.native/tests/external/codegen/box/checkcastOptimization/kt19128.kt deleted file mode 100644 index 07117907188..00000000000 --- a/backend.native/tests/external/codegen/box/checkcastOptimization/kt19128.kt +++ /dev/null @@ -1,26 +0,0 @@ -class A - -class B - -class C - -fun foo(parameters: Any?): Any? { - var payload: Any? = null - - if (parameters != null) { - if (parameters is A || parameters is B) { - payload = parameters - } else { - payload = "O" - } - } - - if (payload is String) { - payload += "K" - } - - return payload -} - -fun box(): String = - "${foo(C())}" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/checkcastOptimization/kt19246.kt b/backend.native/tests/external/codegen/box/checkcastOptimization/kt19246.kt deleted file mode 100644 index 7fce122da6a..00000000000 --- a/backend.native/tests/external/codegen/box/checkcastOptimization/kt19246.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -enum class ResultType constructor(val reason: String) { - SOMETHING("123"), - OK("OK"), - UNKNOWN("FAIL"); - - companion object { - fun getByVal(reason: String): ResultType { - return ResultType.values().firstOrDefault({ it.reason == reason }, UNKNOWN) - } - } -} - -inline fun Array.firstOrDefault(predicate: (T) -> Boolean, default: T): T { - return firstOrNull(predicate) ?: default -} - -fun box(): String = ResultType.getByVal("OK").reason diff --git a/backend.native/tests/external/codegen/box/classLiteral/bound/javaIntrinsicWithSideEffect.kt b/backend.native/tests/external/codegen/box/classLiteral/bound/javaIntrinsicWithSideEffect.kt deleted file mode 100644 index 52190d0f390..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/bound/javaIntrinsicWithSideEffect.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -fun box(): String { - var x = 42 - val k = (x++)::class.java - if (k != Int::class.java) return "Fail 1: $k" - if (x != 43) return "Fail 2: $x (side effect should have taken place)" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/bound/primitives.kt b/backend.native/tests/external/codegen/box/classLiteral/bound/primitives.kt deleted file mode 100644 index c2fd3c472e9..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/bound/primitives.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(true::class, Boolean::class) - assertEquals(42.toByte()::class, Byte::class) - assertEquals('z'::class, Char::class) - assertEquals(3.14::class, Double::class) - assertEquals(2.72f::class, Float::class) - assertEquals(42::class, Int::class) - assertEquals(42L::class, Long::class) - assertEquals(42.toShort()::class, Short::class) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/bound/sideEffect.kt b/backend.native/tests/external/codegen/box/classLiteral/bound/sideEffect.kt deleted file mode 100644 index a1fee693ce7..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/bound/sideEffect.kt +++ /dev/null @@ -1,17 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - var x = 42 - - val k1 = (x++)::class - if (k1 != Int::class) return "Fail 1: $k1" - 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" - if (x != 86) return "Fail 4: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/bound/simple.kt b/backend.native/tests/external/codegen/box/classLiteral/bound/simple.kt deleted file mode 100644 index 6c7092c7bbb..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/bound/simple.kt +++ /dev/null @@ -1,6 +0,0 @@ - -fun box(): String { - val x: CharSequence = "" - val klass = x::class - return if (klass == String::class) "OK" else "Fail: $klass" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/bound/smartCast.kt b/backend.native/tests/external/codegen/box/classLiteral/bound/smartCast.kt deleted file mode 100644 index 7b66b1e1786..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/bound/smartCast.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-16291 Smart cast doesn't work when getting class of instance - -class Foo(val s: String) { - override fun equals(other: Any?): Boolean { - return other != null && other::class == this::class && s == (other as Foo).s - } -} - -fun box(): String { - return if (Foo("a") == Foo("a")) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/java.kt b/backend.native/tests/external/codegen/box/classLiteral/java/java.kt deleted file mode 100644 index 64f95e8ad6d..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/java.kt +++ /dev/null @@ -1,63 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass - -fun checkPrimitive(clazz: Class<*>, expected: String) { - assert (clazz!!.canonicalName == expected) { - "clazz name: ${clazz.canonicalName}" - } -} - -fun checkPrimitive(kClass: KClass<*>, expected: String) { - checkPrimitive(kClass.java, expected) -} - -fun checkObject(clazz: Class<*>, expected: String) { - assert (clazz.canonicalName == "$expected") { - "clazz should be object, but found: ${clazz!!.canonicalName}" - } -} - -fun checkObject(kClass: KClass<*>, expected: String) { - checkObject(kClass.java, expected) -} - -fun box(): String { - checkPrimitive(Boolean::class.java, "boolean") - checkPrimitive(Boolean::class, "boolean") - - checkPrimitive(Char::class.java, "char") - checkPrimitive(Char::class, "char") - - checkPrimitive(Byte::class.java, "byte") - checkPrimitive(Byte::class, "byte") - - checkPrimitive(Short::class.java, "short") - checkPrimitive(Short::class, "short") - - checkPrimitive(Int::class.java, "int") - checkPrimitive(Int::class, "int") - - checkPrimitive(Float::class.java, "float") - checkPrimitive(Float::class, "float") - - checkPrimitive(Long::class.java, "long") - checkPrimitive(Long::class, "long") - - checkPrimitive(Double::class.java, "double") - checkPrimitive(Double::class, "double") - - checkObject(String::class.java, "java.lang.String") - checkObject(String::class, "java.lang.String") - - checkObject(Nothing::class.java, "java.lang.Void") - checkObject(Nothing::class, "java.lang.Void") - - checkObject(java.lang.Void::class.java, "java.lang.Void") - checkObject(java.lang.Void::class, "java.lang.Void") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectType.kt b/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectType.kt deleted file mode 100644 index b64ff4634f6..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectType.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass - -fun check(clazz: Class<*>?, expected: String) { - assert (clazz!!.canonicalName == expected) { - "clazz name: ${clazz.canonicalName}" - } -} - -fun check(kClass: KClass<*>, expected: String) { - check(kClass.javaObjectType, expected) -} - -fun box(): String { - check(Boolean::class.javaObjectType, "java.lang.Boolean") - check(Boolean::class, "java.lang.Boolean") - - check(Char::class.javaObjectType, "java.lang.Character") - check(Char::class, "java.lang.Character") - - check(Byte::class.javaObjectType, "java.lang.Byte") - check(Byte::class, "java.lang.Byte") - - check(Short::class.javaObjectType, "java.lang.Short") - check(Short::class, "java.lang.Short") - - check(Int::class.javaObjectType, "java.lang.Integer") - check(Int::class, "java.lang.Integer") - - check(Float::class.javaObjectType, "java.lang.Float") - check(Float::class, "java.lang.Float") - - check(Long::class.javaObjectType, "java.lang.Long") - check(Long::class, "java.lang.Long") - - check(Double::class.javaObjectType, "java.lang.Double") - check(Double::class, "java.lang.Double") - - check(String::class.javaObjectType, "java.lang.String") - check(String::class, "java.lang.String") - - check(Nothing::class.javaObjectType, "java.lang.Void") - check(Nothing::class, "java.lang.Void") - - check(Void::class.javaObjectType, "java.lang.Void") - check(Void::class, "java.lang.Void") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectTypeReified.kt b/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectTypeReified.kt deleted file mode 100644 index 02fc734f52a..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/javaObjectTypeReified.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun check(expected: String) { - val clazz = T::class.javaObjectType!! - assert (clazz.canonicalName == "java.lang.$expected") { - "clazz name: ${clazz.canonicalName}" - } -} - -fun box(): String { - check("Boolean") - check("Character") - check("Byte") - check("Short") - check("Integer") - check("Float") - check("Long") - check("Double") - - check("String") - check("Void") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveType.kt b/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveType.kt deleted file mode 100644 index c413aee39c2..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveType.kt +++ /dev/null @@ -1,63 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass - -fun check(clazz: Class<*>?, expected: String) { - assert (clazz!!.canonicalName == expected) { - "clazz name: ${clazz.canonicalName}" - } -} - -fun check(kClass: KClass<*>, expected: String) { - check(kClass.javaPrimitiveType, expected) -} - -fun checkNull(clazz: Class<*>?) { - assert (clazz == null) { - "clazz should be null: ${clazz!!.canonicalName}" - } -} - -fun checkNull(kClass: KClass<*>) { - checkNull(kClass.javaPrimitiveType) -} - -fun box(): String { - check(Boolean::class.javaPrimitiveType, "boolean") - check(Boolean::class, "boolean") - - check(Char::class.javaPrimitiveType, "char") - check(Char::class, "char") - - check(Byte::class.javaPrimitiveType, "byte") - check(Byte::class, "byte") - - check(Short::class.javaPrimitiveType, "short") - check(Short::class, "short") - - check(Int::class.javaPrimitiveType, "int") - check(Int::class, "int") - - check(Float::class.javaPrimitiveType, "float") - check(Float::class, "float") - - check(Long::class.javaPrimitiveType, "long") - check(Long::class, "long") - - check(Double::class.javaPrimitiveType, "double") - check(Double::class, "double") - - checkNull(String::class.javaPrimitiveType) - checkNull(String::class) - - checkNull(Nothing::class.javaPrimitiveType) - checkNull(Nothing::class) - - checkNull(Void::class.javaPrimitiveType) - checkNull(Void::class) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt b/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt deleted file mode 100644 index c9b71561637..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun check(expected: String) { - val clazz = T::class.javaPrimitiveType!! - assert (clazz.canonicalName == expected) { - "clazz name: ${clazz.canonicalName}" - } -} - -inline fun checkNull() { - val clazz = T::class.javaPrimitiveType - assert (clazz == null) { - "clazz should be null: ${clazz!!.canonicalName}" - } -} - -fun box(): String { - check("boolean") - check("char") - check("byte") - check("short") - check("int") - check("float") - check("long") - check("double") - - checkNull() - checkNull() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/javaReified.kt b/backend.native/tests/external/codegen/box/classLiteral/java/javaReified.kt deleted file mode 100644 index e6e4821d9aa..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/javaReified.kt +++ /dev/null @@ -1,27 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -inline fun check(expected: String) { - val clazz = T::class.java!! - assert (clazz.canonicalName == "java.lang.$expected") { - "clazz name: ${clazz.canonicalName}" - } -} - -fun box(): String { - check("Boolean") - check("Character") - check("Byte") - check("Short") - check("Integer") - check("Float") - check("Long") - check("Double") - - check("String") - check("Void") - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/kt11943.kt b/backend.native/tests/external/codegen/box/classLiteral/java/kt11943.kt deleted file mode 100644 index 31b37df66c9..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/kt11943.kt +++ /dev/null @@ -1,19 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.reflect.KClass - -val > T.myjava1: Class<*> - get() = java - -val > T.myjava2: Class - get() = java - -class O -class K - -fun box(): String = - O::class.myjava1.getSimpleName() + K::class.myjava2.getSimpleName() - diff --git a/backend.native/tests/external/codegen/box/classLiteral/java/objectSuperConstructorCall.kt b/backend.native/tests/external/codegen/box/classLiteral/java/objectSuperConstructorCall.kt deleted file mode 100644 index cfbf4d7f08b..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/java/objectSuperConstructorCall.kt +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals - -abstract class S(val klass: Class) { - val result = klass.simpleName -} - -object OK : S(OK::class.java) - -class C { - companion object Companion : S(Companion::class.java) -} - -fun box(): String { - assertEquals("Companion", C.Companion.result) - return OK.result -} diff --git a/backend.native/tests/external/codegen/box/classLiteral/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/box/classLiteral/primitiveKClassEquality.kt deleted file mode 100644 index 53d9f7d980b..00000000000 --- a/backend.native/tests/external/codegen/box/classLiteral/primitiveKClassEquality.kt +++ /dev/null @@ -1,18 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -import kotlin.test.assertEquals -import kotlin.test.assertFalse - -fun box(): String { - val x = Int::class.javaPrimitiveType!!.kotlin - val y = Int::class.javaObjectType.kotlin - - assertEquals(x, y) - assertEquals(x.hashCode(), y.hashCode()) - assertFalse(x === y) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/boxPrimitiveTypeInClinitOfClassObject.kt b/backend.native/tests/external/codegen/box/classes/boxPrimitiveTypeInClinitOfClassObject.kt deleted file mode 100644 index 497167d4be6..00000000000 --- a/backend.native/tests/external/codegen/box/classes/boxPrimitiveTypeInClinitOfClassObject.kt +++ /dev/null @@ -1,31 +0,0 @@ -class A { - companion object { - var xi = 0 - var xin : Int? = 0 - var xinn : Int? = null - - var xl = 0.toLong() - var xln : Long? = 0.toLong() - var xlnn : Long? = null - - var xb = 0.toByte() - var xbn : Byte? = 0.toByte() - var xbnn : Byte? = null - - var xf = 0.toFloat() - var xfn : Float? = 0.toFloat() - var xfnn : Float? = null - - var xd = 0.toDouble() - var xdn : Double? = 0.toDouble() - var xdnn : Double? = null - - var xs = 0.toShort() - var xsn : Short? = 0.toShort() - var xsnn : Short? = null - } -} - -fun box() : String { - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/classCompanionInitializationWithJava.kt b/backend.native/tests/external/codegen/box/classes/classCompanionInitializationWithJava.kt deleted file mode 100644 index 814f87dbdb5..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classCompanionInitializationWithJava.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: CompanionInitialization.java - -public class CompanionInitialization { - - public static Object getCompanion() { - return ConcreteWithStatic.Companion; - } - -} - -// FILE: CompanionInitialization.kt - -interface IStatic - -open class Static(x: IStatic) { - fun doSth() { - } -} - -class ConcreteWithStatic : IStatic { - companion object : Static(ConcreteWithStatic()) -} - -fun box(): String { - ConcreteWithStatic.doSth() - - val companion: Any? = CompanionInitialization.getCompanion() - if (companion == null) return "fail 1" - if (companion != ConcreteWithStatic) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/classNamedAsOldPackageFacade.kt b/backend.native/tests/external/codegen/box/classes/classNamedAsOldPackageFacade.kt deleted file mode 100644 index 24c2efdc564..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classNamedAsOldPackageFacade.kt +++ /dev/null @@ -1,7 +0,0 @@ -package test - -class TestPackage { - val OK = "OK" -} - -fun box(): String = TestPackage().OK \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/classObject.kt b/backend.native/tests/external/codegen/box/classes/classObject.kt deleted file mode 100644 index c8da87c8a7f..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObject.kt +++ /dev/null @@ -1,11 +0,0 @@ -class C() { - companion object { - fun create() = C() - } -} - -fun box(): String { - val c = C.create() - return if (c is C) "OK" else "fail" -} - diff --git a/backend.native/tests/external/codegen/box/classes/classObjectAsExtensionReceiver.kt b/backend.native/tests/external/codegen/box/classes/classObjectAsExtensionReceiver.kt deleted file mode 100644 index 886dbdf8364..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectAsExtensionReceiver.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun Any.foo() = 1 - -class A { - companion object -} - -fun box() = if (A.foo() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/classes/classObjectAsStaticInitializer.kt b/backend.native/tests/external/codegen/box/classes/classObjectAsStaticInitializer.kt deleted file mode 100644 index b6172d6b2d0..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectAsStaticInitializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -var global = 0; - -class C { - companion object { - init { - global = 1; - } - } -} - -fun box(): String { - if (global != 0) { - return "fail1: global = $global" - } - - val c = C() - if (global == 1) return "OK" else return "fail2: global = $global" -} - diff --git a/backend.native/tests/external/codegen/box/classes/classObjectField.kt b/backend.native/tests/external/codegen/box/classes/classObjectField.kt deleted file mode 100644 index f23073c6e89..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectField.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A() { - companion object { - val value = 10 - } -} - -fun box() = if (A.value == 10) "OK" else "Fail ${A.value}" diff --git a/backend.native/tests/external/codegen/box/classes/classObjectInTrait.kt b/backend.native/tests/external/codegen/box/classes/classObjectInTrait.kt deleted file mode 100644 index e34f5622a3e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectInTrait.kt +++ /dev/null @@ -1,12 +0,0 @@ -// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final - -interface C { - companion object { - public val FOO: String = "OK" - } -} - -fun box(): String { - return C.FOO -} - diff --git a/backend.native/tests/external/codegen/box/classes/classObjectNotOfEnum.kt b/backend.native/tests/external/codegen/box/classes/classObjectNotOfEnum.kt deleted file mode 100644 index e2a775320cd..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectNotOfEnum.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - companion object { - fun values() = "O" - fun valueOf() = "K" - } -} - -fun box() = A.values() + A.valueOf() diff --git a/backend.native/tests/external/codegen/box/classes/classObjectToString.kt b/backend.native/tests/external/codegen/box/classes/classObjectToString.kt deleted file mode 100644 index 901b77a1bad..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectToString.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS, NATIVE -class SomeClass { companion object } - -fun box() = - if ((SomeClass.toString() as java.lang.String).matches("SomeClass\\\$Companion@[0-9a-fA-F]+")) - "OK" - else - "Fail: $SomeClass" diff --git a/backend.native/tests/external/codegen/box/classes/classObjectWithPrivateGenericMember.kt b/backend.native/tests/external/codegen/box/classes/classObjectWithPrivateGenericMember.kt deleted file mode 100644 index bb7b150238f..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectWithPrivateGenericMember.kt +++ /dev/null @@ -1,15 +0,0 @@ -class C() { - companion object { - private fun create() = C() - } - - class ZZZ { - val c = C.create() - } -} - -fun box(): String { - C.ZZZ().c - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/classes/classObjectsWithParentClasses.kt b/backend.native/tests/external/codegen/box/classes/classObjectsWithParentClasses.kt deleted file mode 100644 index 668619e3032..00000000000 --- a/backend.native/tests/external/codegen/box/classes/classObjectsWithParentClasses.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class Test { - companion object { - fun testStatic(ic: InnerClass): NotInnerClass = NotInnerClass(ic.value) - } - - fun test(): InnerClass = InnerClass(150) - - inner open class InnerClass(val value: Int) - open class NotInnerClass(val value: Int) -} - -fun box() = if (Test.testStatic(Test().test()).value == 150) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/comanionObjectFieldVsClassField.kt b/backend.native/tests/external/codegen/box/classes/comanionObjectFieldVsClassField.kt deleted file mode 100644 index 12667820fd5..00000000000 --- a/backend.native/tests/external/codegen/box/classes/comanionObjectFieldVsClassField.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -class Host { - val ok = "OK" - - fun foo() = run { bar(ok) } - - companion object { - val ok = 0 - - fun bar(s: String) = s.substring(ok) - } -} - -fun box() = Host().foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/defaultObjectSameNamesAsInOuter.kt b/backend.native/tests/external/codegen/box/classes/defaultObjectSameNamesAsInOuter.kt deleted file mode 100644 index 8332b83ef41..00000000000 --- a/backend.native/tests/external/codegen/box/classes/defaultObjectSameNamesAsInOuter.kt +++ /dev/null @@ -1,18 +0,0 @@ -class A { - private val p: Int - get() = 4 - - companion object B { - val p: Int - get() = 6 - } - - fun a() = p + B.p -} - - -fun box(): String { - if (A().a() != 10) return "Fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/delegation2.kt b/backend.native/tests/external/codegen/box/classes/delegation2.kt deleted file mode 100644 index 81b8b0fb47e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegation2.kt +++ /dev/null @@ -1,24 +0,0 @@ -interface Trait1 { - fun foo() : String -} - -interface Trait2 { - fun bar() : String -} - -class T1 : Trait1{ - override fun foo() = "aaa" -} - -class T2 : Trait2{ - override fun bar() = "bbb" -} - -class C(a:Trait1, b:Trait2) : Trait1 by a, Trait2 by b - -fun box() : String { - val c = C(T1(),T2()) - if(c.foo() != "aaa") return "fail" - if(c.bar() != "bbb") return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/delegation3.kt b/backend.native/tests/external/codegen/box/classes/delegation3.kt deleted file mode 100644 index fd4f07800a2..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegation3.kt +++ /dev/null @@ -1,35 +0,0 @@ -interface One { - public open fun foo() : Int - public open fun faz() : Int = 10 -} -interface Two { - public open fun foo() : Int - public open fun quux() : Int = 100 -} - -class OneImpl : One { - public override fun foo() = 1 -} -class TwoImpl : Two { - public override fun foo() = 2 -} - -class Test2(a : One, b : Two) : Two by b, One by a { - public override fun foo() = 0 -} - -fun box() : String { - var t2 = Test2(OneImpl(), TwoImpl()) - if (t2.foo() != 0) - return "Fail #1" - if (t2.faz() != 10) - return "Fail #2" - if (t2.quux() != 100) - return "Fail #3" - if (t2 !is One) - return "Fail #4" - if (t2 !is Two) - return "Fail #5" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/delegation4.kt b/backend.native/tests/external/codegen/box/classes/delegation4.kt deleted file mode 100644 index 7a9c9449e58..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegation4.kt +++ /dev/null @@ -1,28 +0,0 @@ -interface First { - public open fun foo() : Int -} - -interface Second : First { - public open fun bar() : Int -} - -class Impl : Second { - public override fun foo() = 1 - public override fun bar() = 2 -} - -class Test(s : Second) : Second by s {} - -fun box() : String { - var t = Test(Impl()) - if (t.foo() != 1) - return "Fail #1" - if (t.bar() != 2) - return "Fail #2" - if (t !is First) - return "Fail #3" - if (t !is Second) - return "Fail #4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/delegationGenericArg.kt b/backend.native/tests/external/codegen/box/classes/delegationGenericArg.kt deleted file mode 100644 index f298e834f79..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegationGenericArg.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A { - fun foo(t: T): String -} - -class Derived(a: A) : A by a - -fun box(): String { - val o = object : A { - override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t" - } - return Derived(o).foo(42) -} diff --git a/backend.native/tests/external/codegen/box/classes/delegationGenericArgUpperBound.kt b/backend.native/tests/external/codegen/box/classes/delegationGenericArgUpperBound.kt deleted file mode 100644 index 72e541b7f3b..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegationGenericArgUpperBound.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A { - fun foo(t: T): String -} - -class Derived(a: A) : A by a - -fun box(): String { - val o = object : A { - override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t" - } - return Derived(o).foo(42) -} diff --git a/backend.native/tests/external/codegen/box/classes/delegationGenericLongArg.kt b/backend.native/tests/external/codegen/box/classes/delegationGenericLongArg.kt deleted file mode 100644 index 8bd117f9fa1..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegationGenericLongArg.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A { - fun foo(t: T, u: U): String -} - -class Derived(a: A) : A by a - -fun box(): String { - val o = object : A { - override fun foo(t: Long, u: Int) = if (t == u.toLong()) "OK" else "Fail $t $u" - } - return Derived(o).foo(42, 42) -} diff --git a/backend.native/tests/external/codegen/box/classes/delegationJava.kt b/backend.native/tests/external/codegen/box/classes/delegationJava.kt deleted file mode 100644 index f4ad18d3b22..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegationJava.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS, NATIVE - -class TestJava(r : Runnable) : Runnable by r {} -class TestRunnable() : Runnable { - public override fun run() = System.out.println("foobar") -} - -fun box() : String { - var del = TestJava(TestRunnable()) - del.run() - if (del !is Runnable) - return "Fail #1" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/delegationMethodsWithArgs.kt b/backend.native/tests/external/codegen/box/classes/delegationMethodsWithArgs.kt deleted file mode 100644 index a8c0e37230c..00000000000 --- a/backend.native/tests/external/codegen/box/classes/delegationMethodsWithArgs.kt +++ /dev/null @@ -1,34 +0,0 @@ -package test - -interface TextField { - fun getText(): String -} - -interface InputTextField : TextField { - fun setText(text: String) -} - -interface MooableTextField : InputTextField { - fun moo(a: Int, b: Int, c: Int): Int -} - -class SimpleTextField : MooableTextField { - private var text2 = "" - override fun getText() = text2 - override fun setText(text: String) { - this.text2 = text - } - override fun moo(a: Int, b: Int, c: Int) = a + b + c -} - -class TextFieldWrapper(textField: MooableTextField) : MooableTextField by textField - -fun box() : String { - val textField = TextFieldWrapper(SimpleTextField()) - textField.setText("hello world!") - - if (!textField.getText().equals("hello world!")) return "FAIL #!1" - if (textField.moo(1,2,3) != 6) return "FAIL #2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/exceptionConstructor.kt b/backend.native/tests/external/codegen/box/classes/exceptionConstructor.kt deleted file mode 100644 index 30da7cb5b09..00000000000 --- a/backend.native/tests/external/codegen/box/classes/exceptionConstructor.kt +++ /dev/null @@ -1,7 +0,0 @@ -class GameError(msg: String): Exception(msg) { -} - -fun box(): String { - val e = GameError("foo") - return if (e.message == "foo") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/extensionOnNamedClassObject.kt b/backend.native/tests/external/codegen/box/classes/extensionOnNamedClassObject.kt deleted file mode 100644 index dd3efea880b..00000000000 --- a/backend.native/tests/external/codegen/box/classes/extensionOnNamedClassObject.kt +++ /dev/null @@ -1,12 +0,0 @@ -class C() { - companion object Foo -} - -fun C.Foo.create() = 3 - -fun box(): String { - val c1 = C.Foo.create() - val c2 = C.create() - return if (c1 == 3 && c2 == 3) "OK" else "fail" -} - diff --git a/backend.native/tests/external/codegen/box/classes/funDelegation.kt b/backend.native/tests/external/codegen/box/classes/funDelegation.kt deleted file mode 100644 index 2a75f698109..00000000000 --- a/backend.native/tests/external/codegen/box/classes/funDelegation.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Base() { - fun n(n : Int) : Int = n + 1 -} - -interface Abstract {} - -class Derived1() : Base(), Abstract {} -class Derived2() : Abstract, Base() {} - -fun test(s : Base) : Boolean = s.n(238) == 239 - -fun box() : String { - if (!test(Base())) return "Fail #1" - if (!test(Derived1())) return "Fail #2" - if (!test(Derived2())) return "Fail #3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/implementComparableInSubclass.kt b/backend.native/tests/external/codegen/box/classes/implementComparableInSubclass.kt deleted file mode 100644 index 4d7504f26ac..00000000000 --- a/backend.native/tests/external/codegen/box/classes/implementComparableInSubclass.kt +++ /dev/null @@ -1,22 +0,0 @@ -// See KT-12865 - -package foo - -abstract class Base { - val x = 23 -} - -class Derived : Base(), Comparable { - val y = 42 - override fun compareTo(other: Derived): Int { - throw UnsupportedOperationException("not implemented") - } -} - -fun box(): String { - val b = Derived() - if (b.x != 23) return "fail1: ${b.x}" - if (b.y != 42) return "fail2: ${b.y}" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inheritSetAndHashSet.kt b/backend.native/tests/external/codegen/box/classes/inheritSetAndHashSet.kt deleted file mode 100644 index b5799632fdf..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inheritSetAndHashSet.kt +++ /dev/null @@ -1,11 +0,0 @@ -// IGNORE_BACKEND: NATIVE - -interface A : Set - -class B : A, HashSet() - -fun box(): String { - val b = B() - b.add("OK") - return b.iterator().next() -} diff --git a/backend.native/tests/external/codegen/box/classes/inheritance.kt b/backend.native/tests/external/codegen/box/classes/inheritance.kt deleted file mode 100644 index 78d6d58fa3b..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inheritance.kt +++ /dev/null @@ -1,41 +0,0 @@ -// Changed when traits were introduced. May not make sense any more - -open class X(val x : Int) {} -interface Y { - abstract val y : Int -} - -class YImpl(override val y : Int) : Y {} - -class Point(x : Int, yy : Int) : X(x) , Y { - override val y : Int = yy -} - -interface Abstract {} - -class P1(x : Int, yy : Y) : Abstract, X(x), Y by yy {} -class P2(x : Int, yy : Y) : X(x), Abstract, Y by yy {} -class P3(x : Int, yy : Y) : X(x), Y by yy, Abstract {} -class P4(x : Int, yy : Y) : Y by yy, Abstract, X(x) {} - -fun box() : String { - if (X(239).x != 239) return "FAIL #1" - if (YImpl(239).y != 239) return "FAIL #2" - - val p = Point(240, -1) - if (p.x + p.y != 239) return "FAIL #3" - - val y = YImpl(-1) - val p1 = P1(240, y) - if (p1.x + p1.y != 239) return "FAIL #4" - val p2 = P2(240, y) - if (p2.x + p2.y != 239) return "FAIL #5" - - val p3 = P3(240, y) - if (p3.x + p3.y != 239) return "FAIL #6" - - val p4 = P4(240, y) - if (p4.x + p4.y != 239) return "FAIL #7" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/inheritedInnerClass.kt b/backend.native/tests/external/codegen/box/classes/inheritedInnerClass.kt deleted file mode 100644 index 82bd91e93cd..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inheritedInnerClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Outer() { - open inner class InnerBase() { - } - - inner class InnerDerived(): InnerBase() { - } - - public val foo: InnerBase? = InnerDerived() -} - -fun box() : String { - val o = Outer() - return if (o.foo === null) "fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/inheritedMethod.kt b/backend.native/tests/external/codegen/box/classes/inheritedMethod.kt deleted file mode 100644 index fb9c3bfe080..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inheritedMethod.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class Foo { - fun xyzzy(): String = "xyzzy" -} - -class Bar(): Foo() { - fun test(): String = xyzzy() -} - -fun box() : String { - val bar = Bar() - val f = bar.test() - return if (f == "xyzzy") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/initializerBlock.kt b/backend.native/tests/external/codegen/box/classes/initializerBlock.kt deleted file mode 100644 index ccaac7f0473..00000000000 --- a/backend.native/tests/external/codegen/box/classes/initializerBlock.kt +++ /dev/null @@ -1,13 +0,0 @@ -class C() { - public var f: Int - - init { - f = 610 - } -} - -fun box(): String { - val c = C() - if (c.f != 610) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/initializerBlockDImpl.kt b/backend.native/tests/external/codegen/box/classes/initializerBlockDImpl.kt deleted file mode 100644 index 087f4ab0c54..00000000000 --- a/backend.native/tests/external/codegen/box/classes/initializerBlockDImpl.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME -class World() { - public val items: ArrayList = ArrayList() - - inner class Item() { - init { - items.add(this) - } - } - - val foo = Item() -} - -fun box() : String { - val w = World() - if (w.items.size != 1) return "fail" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerived.kt b/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerived.kt deleted file mode 100644 index 2f928428baf..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerived.kt +++ /dev/null @@ -1,40 +0,0 @@ -open class A(val value: String) { - inner class B(val s: String) { - val result = value + "_" + s - } -} - -class C : A("fromC") { - fun classReceiver() = B("OK") - fun superReceiver() = super.B("OK") - - fun newAReceiver() = A("fromA").B("OK") - fun aReceiver(): B { - val a = A("fromA") - return a.B("OK") - } - - fun A.extReceiver() = this.B("OK") - fun extReceiver() = A("fromA").extReceiver() -} - -fun box(): String { - val receiver = C() - var result = receiver.classReceiver().result - if (result != "fromC_OK") return "fail 1: $result" - - result = receiver.superReceiver().result - if (result != "fromC_OK") return "fail 2: $result" - - - result = receiver.aReceiver().result - if (result != "fromA_OK") return "fail 3: $result" - - result = receiver.newAReceiver().result - if (result != "fromA_OK") return "fail 3: $result" - - result = receiver.extReceiver().result - if (result != "fromA_OK") return "fail 3: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerivedLabeled.kt b/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerivedLabeled.kt deleted file mode 100644 index 34db2545d47..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/instantiateInDerivedLabeled.kt +++ /dev/null @@ -1,42 +0,0 @@ -open class A(val value: String) { - inner class B(val s: String) { - val result = value + "_" + s - } -} - -class C : A("fromC") { - - inner class X: A("fromX") { - fun classReceiver() = B("OK") - fun superReceiver() = super.B("OK") - fun superXReceiver() = super@X.B("OK") - fun superXCastReceiver() = (this@X as A).B("OK") - - fun superCReceiver() = super@C.B("OK") - fun superCCastReceiver() = (this@C as A).B("OK") - } -} - -fun box(): String { - val receiver = C().X() - var result = receiver.classReceiver().result - if (result != "fromX_OK") return "fail 1: $result" - - result = receiver.superReceiver().result - if (result != "fromX_OK") return "fail 2: $result" - - result = receiver.superXReceiver().result - if (result != "fromX_OK") return "fail 3: $result" - - result = receiver.superXCastReceiver().result - if (result != "fromX_OK") return "fail 4: $result" - - - result = receiver.superCReceiver().result - if (result != "fromC_OK") return "fail 3: $result" - - result = receiver.superCCastReceiver().result - if (result != "fromC_OK") return "fail 4: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inner/instantiateInSameClass.kt b/backend.native/tests/external/codegen/box/classes/inner/instantiateInSameClass.kt deleted file mode 100644 index bc6200c60c5..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/instantiateInSameClass.kt +++ /dev/null @@ -1,34 +0,0 @@ -class C(val value: String = "C") { - - inner class B(val s: String) { - val result = value + "_" + s - } - - fun classReceiver() = B("OK") - - fun newCReceiver() = C("newC").B("OK") - fun cReceiver(): B { - val c = C("newC") - return c.B("OK") - } - - fun C.extReceiver1() = this.B("OK") - fun extReceiver() = C("newC").extReceiver1() -} - -fun box(): String { - val receiver = C() - var result = receiver.classReceiver().result - if (result != "C_OK") return "fail 1: $result" - - result = receiver.cReceiver().result - if (result != "newC_OK") return "fail 3: $result" - - result = receiver.newCReceiver().result - if (result != "newC_OK") return "fail 3: $result" - - result = receiver.extReceiver().result - if (result != "newC_OK") return "fail 3: $result" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inner/kt6708.kt b/backend.native/tests/external/codegen/box/classes/inner/kt6708.kt deleted file mode 100644 index db242e7c0bb..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/kt6708.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class A() { - open inner class InnerA -} - -class B : A() { - inner class InnerB : A.InnerA() -} - -fun box(): String { - B().InnerB() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inner/properOuter.kt b/backend.native/tests/external/codegen/box/classes/inner/properOuter.kt deleted file mode 100644 index 41d1e4406db..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/properOuter.kt +++ /dev/null @@ -1,16 +0,0 @@ - -open class A(val s: String) { - open inner class B(val s: String) { - fun testB() = s + this@A.s - } - - open inner class C(): A("C") { - fun testC() = - B("B_").testB() - } -} - -fun box(): String { - val res = A("A").C().testC() - return if (res == "B_C") "OK" else res; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/inner/properSuperLinking.kt b/backend.native/tests/external/codegen/box/classes/inner/properSuperLinking.kt deleted file mode 100644 index 230ad1d9ee4..00000000000 --- a/backend.native/tests/external/codegen/box/classes/inner/properSuperLinking.kt +++ /dev/null @@ -1,16 +0,0 @@ - -open class A(val s: String) { - - val z = s - - fun test() = s - - open inner class B(s: String): A(s) { - fun testB() = z + test() - } -} - -fun box(): String { - val res = A("Fail").B("OK").testB() - return if (res == "OKOK") "OK" else res; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/innerClass.kt b/backend.native/tests/external/codegen/box/classes/innerClass.kt deleted file mode 100644 index 8f43233aa95..00000000000 --- a/backend.native/tests/external/codegen/box/classes/innerClass.kt +++ /dev/null @@ -1,19 +0,0 @@ -class Outer(val foo: StringBuilder) { - inner class Inner() { - fun len() : Int { - return foo.length - } - } - - fun test() : Inner { - return Inner() - } -} - -fun box() : String { - val sb = StringBuilder("xyzzy") - val o = Outer(sb) - val i = o.test() - val l = i.len() - return if (l != 5) "fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/interfaceCompanionInitializationWithJava.kt b/backend.native/tests/external/codegen/box/classes/interfaceCompanionInitializationWithJava.kt deleted file mode 100644 index 0db5f2d4372..00000000000 --- a/backend.native/tests/external/codegen/box/classes/interfaceCompanionInitializationWithJava.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: CompanionInitialization.java - -public class CompanionInitialization { - - public static Object getCompanion() { - return IStatic.Companion; - } - -} - -// FILE: CompanionInitialization.kt - -open class Static(): IStatic { - val p = IStatic::class.java.getDeclaredField("const").get(null) -} - -interface IStatic { - fun doSth() { - } - - companion object : Static() { - const val const = 1; - } -} - -fun box(): String { - IStatic.doSth() - - val companion: Any? = CompanionInitialization.getCompanion() - if (companion == null) return "fail 1" - if (companion != IStatic) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1018.kt b/backend.native/tests/external/codegen/box/classes/kt1018.kt deleted file mode 100644 index 6e192f5e0be..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1018.kt +++ /dev/null @@ -1,12 +0,0 @@ -public class StockMarketTableModel() { - - public fun getColumnCount() : Int { - return COLUMN_TITLES?.size!! - } - - companion object { - private val COLUMN_TITLES : Array = arrayOfNulls(10) - } -} - -fun box() : String = if(StockMarketTableModel().getColumnCount()==10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/classes/kt1120.kt b/backend.native/tests/external/codegen/box/classes/kt1120.kt deleted file mode 100644 index 69a428951cd..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1120.kt +++ /dev/null @@ -1,19 +0,0 @@ -// Won't ever work with JS backend. -// 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() - val workerThread: Thread = Thread(object : Runnable { - override fun run() { - val a = any - val b = RefreshQueue.any - if (a != b) throw AssertionError() - } - }) -} - -fun box() : String { - RefreshQueue.workerThread.run() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1134.kt b/backend.native/tests/external/codegen/box/classes/kt1134.kt deleted file mode 100644 index cbe62018fd4..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1134.kt +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: Enable when JS backend supports Java class library -// IGNORE_BACKEND: JS, NATIVE -public class SomeClass() : java.lang.Object() { -} - -public fun box():String { - System.out?.println(SomeClass().getClass()) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1157.kt b/backend.native/tests/external/codegen/box/classes/kt1157.kt deleted file mode 100644 index 126889d5110..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1157.kt +++ /dev/null @@ -1,21 +0,0 @@ -public object SomeClass { - private val work = object : Runnable { - override fun run() { - foo() - } - } - - private fun foo(): Unit { - } - - public fun run(): Unit = work.run() -} - -interface Runnable { - fun run(): Unit -} - -fun box(): String { - SomeClass.run() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1247.kt b/backend.native/tests/external/codegen/box/classes/kt1247.kt deleted file mode 100644 index 4ba62b57487..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1247.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun f(a : Int?, b : Int.(Int)->Int) = a?.b(1) - -fun box(): String { - val x = f(1) { this+it+2 } - return if (x == 4) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1345.kt b/backend.native/tests/external/codegen/box/classes/kt1345.kt deleted file mode 100644 index 3933f9c552e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1345.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface Creator { - fun create() : T -} - -class Actor(val code: String = "OK") - -interface Factory : Creator - -class MyFactory() : Factory { - override fun create(): Actor = Actor() -} - -fun box() : String = MyFactory().create().code diff --git a/backend.native/tests/external/codegen/box/classes/kt1439.kt b/backend.native/tests/external/codegen/box/classes/kt1439.kt deleted file mode 100644 index f5cd98d49c4..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1439.kt +++ /dev/null @@ -1,17 +0,0 @@ -class MyClass(var fnc : () -> String) { - - fun test(): String { - return fnc() - } - -} - -fun printtest() : String { - return "OK" -} - -fun box(): String { - var c = MyClass({ printtest() }) - - return c.test() -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1535.kt b/backend.native/tests/external/codegen/box/classes/kt1535.kt deleted file mode 100644 index f1efa2d6b2c..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1535.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: Enable when JS backend supports Java class library, since FunctionX are required for interoperation -// IGNORE_BACKEND: JS -class Works() : Function0 { - public override fun invoke():Any { - return "Works" as Any - } -} -class Broken() : Function0 { - public override fun invoke():String { - return "Broken" - } -} - -fun box(): String { - val works1: ()->Any = Works(); - works1() - - val broken1: ()->String = Broken(); - broken1() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1538.kt b/backend.native/tests/external/codegen/box/classes/kt1538.kt deleted file mode 100644 index e412b9885e3..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1538.kt +++ /dev/null @@ -1,21 +0,0 @@ -data class Pair(val first: First, val second: Second) - -fun parseCatalogs(hashMap: Any?) { - val r = toHasMap(hashMap) - if (!r.first) { - return - } - val nodes = r.second -} - -fun toHasMap(value: Any?): Pair?> { - if(value is HashMap<*, *>) { - return Pair(true, value as HashMap) - } - return Pair(false, null as HashMap?) -} - -fun box() : String { - parseCatalogs(null) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1578.kt b/backend.native/tests/external/codegen/box/classes/kt1578.kt deleted file mode 100644 index e485684b4da..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1578.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box() : String { - var i = 0 - { - i++ - }() - i++ //the problem is here -// i = i + 1 //this way it works - return if (i == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1611.kt b/backend.native/tests/external/codegen/box/classes/kt1611.kt deleted file mode 100644 index b04a15ef70e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1611.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - return Foo().doBar("OK") -} - -class Foo() { - val bar : (str : String) -> String = { it } - - fun doBar(str : String): String { - return bar(str); - } -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1721.kt b/backend.native/tests/external/codegen/box/classes/kt1721.kt deleted file mode 100644 index c38869f87b8..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1721.kt +++ /dev/null @@ -1,6 +0,0 @@ -class T(val f : () -> Any?) { - fun call() : Any? = f() -} -fun box(): String { - return T({ "OK" }).call() as String -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1726.kt b/backend.native/tests/external/codegen/box/classes/kt1726.kt deleted file mode 100644 index c718ea84028..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1726.kt +++ /dev/null @@ -1,15 +0,0 @@ -class Foo( - var state : Int, - val f : (Int) -> Int){ - - fun next() : Int { - val nextState = f(state) - state = nextState - return state - } -} - -fun box(): String { - val f = Foo(23, {x -> 2 * x}) - return if (f.next() == 46) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1759.kt b/backend.native/tests/external/codegen/box/classes/kt1759.kt deleted file mode 100644 index b34b725c39b..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1759.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Greeter(var name : String) { - fun greet() { - name = name.plus("") - } -} - -fun box() : String { - Greeter("OK").greet() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1891.kt b/backend.native/tests/external/codegen/box/classes/kt1891.kt deleted file mode 100644 index e9183589db3..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1891.kt +++ /dev/null @@ -1,14 +0,0 @@ -class MyList() { - var value: T? = null - - operator fun get(index: Int): T = value!! - - operator fun set(index: Int, value: T) { this.value = value } -} - -fun box(): String { - val list = MyList() - list[17] = 1 - list[17] = list[18]++ - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1918.kt b/backend.native/tests/external/codegen/box/classes/kt1918.kt deleted file mode 100644 index 1da1471e2d3..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1918.kt +++ /dev/null @@ -1,20 +0,0 @@ -class Bar { -} - -interface Foo { - fun xyzzy(x: Any?): String -} - -fun buildFoo(bar: Bar.() -> Unit): Foo { - return object : Foo { - override fun xyzzy(x: Any?): String { - (x as? Bar)?.bar() - return "OK" - } - } -} - -fun box(): String { - val foo = buildFoo({}) - return foo.xyzzy(Bar()) -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1976.kt b/backend.native/tests/external/codegen/box/classes/kt1976.kt deleted file mode 100644 index 7e02add4ef3..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1976.kt +++ /dev/null @@ -1,8 +0,0 @@ -class A { - public val f : ()->String = {"OK"} -} - -fun box(): String { - val a = A() - return a.f() // does not work: (in runtime) ClassCastException: A cannot be cast to kotlin.Function0 -} diff --git a/backend.native/tests/external/codegen/box/classes/kt1980.kt b/backend.native/tests/external/codegen/box/classes/kt1980.kt deleted file mode 100644 index 74414304f25..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt1980.kt +++ /dev/null @@ -1,27 +0,0 @@ -public inline fun Int.times(body : () -> Unit) { - var count = this; - while (count > 0) { - body() - count-- - } -} - -fun calc() : Int { - val a = ArrayList<()->Int>() - 2.times { - var j = 1 - a.add({ j }) - ++j - } - var sum = 0 - for (f in a) { - val g = f as () -> Int - sum += g() - } - return sum -} - -fun box() : String { - val x = calc() - return if (x == 4) "OK" else x.toString() -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2224.kt b/backend.native/tests/external/codegen/box/classes/kt2224.kt deleted file mode 100644 index fe6d9bcbe48..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2224.kt +++ /dev/null @@ -1,44 +0,0 @@ -interface A { - fun foo(): Int -} - -class B1 : A { - override fun foo() = 10 -} - -class B2(val z: Int) : A { - override fun foo() = z -} - - - -fun f1(b: B1): Int { - val o = object : A by b { } - return o.foo() -} - -fun f2(b: B2): Int { - val o = object : A by B2(b.z) { } - return o.foo() -} - -fun f3(b: B2, mult: Int): Int { - val o = object : A by B2(mult * b.z) { } - return o.foo() -} - -fun f4(b: B1, x: Int, y: Int, z: Int): Int { - val o = object : A by b { - fun bar() = x + y + z - } - return o.foo() -} - - -fun box(): String { - if (f1(B1()) != 10) return "fail #1" - if (f2(B2(239)) != 239) return "fail #2" - if (f3(B2(239), 2) != 239*2) return "fail #3" - if (f4(B1(), 1, 2, 3) != 10) return "fail #4" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2288.kt b/backend.native/tests/external/codegen/box/classes/kt2288.kt deleted file mode 100644 index 773d737f06a..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2288.kt +++ /dev/null @@ -1,10 +0,0 @@ -// TODO: Enable when JS backend supports Java class library -// IGNORE_BACKEND: JS, NATIVE -public open class Test(): java.util.RandomAccess, Cloneable, java.io.Serializable -{ - public override fun clone(): Test = Test() // Override 'clone()' with more precise type 'Test' - - public override fun toString() = "OK" -} - -fun box() = Test().clone().toString() diff --git a/backend.native/tests/external/codegen/box/classes/kt2384.kt b/backend.native/tests/external/codegen/box/classes/kt2384.kt deleted file mode 100644 index d990d4cbc00..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2384.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - companion object { - val b = 0 - val c = b - - init { - val d = b - } - } -} - -fun box(): String { - A() - return if (A.c == A.b) "OK" else "Fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2390.kt b/backend.native/tests/external/codegen/box/classes/kt2390.kt deleted file mode 100644 index 9d664ee825d..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2390.kt +++ /dev/null @@ -1,35 +0,0 @@ - -class JsonObject() { -} - -class JsonArray() { -} - -public interface Formatter { - public fun format(source: IN?): OUT -} - -public interface MultiFormatter { - public fun format(source: Collection): OUT -} - -public class Project() { -} - -public interface JsonFormatter: Formatter, MultiFormatter { - public override fun format(source: Collection): JsonArray { - return JsonArray(); - } -} - -public class ProjectJsonFormatter(): JsonFormatter { - public override fun format(source: Project?): JsonObject { - return JsonObject() - } -} - - -fun box(): String { - val formatter = ProjectJsonFormatter() - return if (formatter.format(Project()) != null) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2391.kt b/backend.native/tests/external/codegen/box/classes/kt2391.kt deleted file mode 100644 index 2176c01b98e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2391.kt +++ /dev/null @@ -1,19 +0,0 @@ -public interface LoggerAware { - public val logger: StringBuilder -} - -public abstract class HttpServer(): LoggerAware { - public fun start() { - logger.append("OK") - } -} - -public class MyHttpServer(): HttpServer() { - public override val logger = StringBuilder() -} - -fun box(): String { - val server = MyHttpServer() - server.start() - return server.logger.toString()!! -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2395.kt b/backend.native/tests/external/codegen/box/classes/kt2395.kt deleted file mode 100644 index ccd1b1c5356..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2395.kt +++ /dev/null @@ -1,13 +0,0 @@ -// TARGET_BACKEND: JVM - -import java.util.AbstractList - -class MyList(): AbstractList() { - public fun getModificationCount(): Int = modCount - public override fun get(index: Int): String = "" - public override val size: Int get() = 0 -} - -fun box(): String { - return if (MyList().getModificationCount() == 0) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2417.kt b/backend.native/tests/external/codegen/box/classes/kt2417.kt deleted file mode 100644 index fe584cce56a..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2417.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun box() : String{ - val set = HashSet() - set.add("foo") - val t1 = "foo" in set // returns true, valid - if(!t1) return "fail1" - val t2 = "foo" !in set // returns true, invalid - if(t2) return "fail2" - val t3 = "bar" in set // returns false, valid - if(t3) return "fail3" - val t4 = "bar" !in set // return false, invalid - if(!t4) return "fail4" - val t5 = when("foo") { - in set -> true - else -> false - } - if(!t5) return "fail5" - val t6 = when("foo") { - !in set -> true - else -> false - } - if(t6) return "fail6" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2477.kt b/backend.native/tests/external/codegen/box/classes/kt2477.kt deleted file mode 100644 index 8f45431717c..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2477.kt +++ /dev/null @@ -1,23 +0,0 @@ -package test - -interface A { - public val c: String - get() = "OK" -} - -interface B { - private val c: String - get() = "FAIL" -} - -open class C { - private val c: String = "FAIL" -} - -open class D: C(), A, B { - val b = c -} - -fun box() : String { - return D().c -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2480.kt b/backend.native/tests/external/codegen/box/classes/kt2480.kt deleted file mode 100644 index cbeec9ce597..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2480.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box() = Class().printSome() - -public abstract class AbstractClass { - public fun printSome() : T = some - - public abstract val some: T -} - -public class Class: AbstractClass() { - public override val some: String - get() = "OK" - -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2482.kt b/backend.native/tests/external/codegen/box/classes/kt2482.kt deleted file mode 100644 index 6a614198741..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2482.kt +++ /dev/null @@ -1,9 +0,0 @@ -public fun box() : String { - if ( 0 == 0 ) { // Does not crash if either this... - if ( 0 == 0 ) { // ...or this is changed to if ( true ) - // Does not crash if the following is uncommented. - //println("foo") - } - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2485.kt b/backend.native/tests/external/codegen/box/classes/kt2485.kt deleted file mode 100644 index 5ef24c24577..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2485.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun f1(a : Any?) {} -fun f2(a : Boolean?) {} -fun f3(a : Any) {} -fun f4(a : Boolean) {} - -fun box() : String { - f1(1 == 1) - f2(1 == 1) - f3(1 == 1) - f4(1 == 1) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt249.kt b/backend.native/tests/external/codegen/box/classes/kt249.kt deleted file mode 100644 index afd8fa0a0a7..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt249.kt +++ /dev/null @@ -1,13 +0,0 @@ -package x - -class Outer() { - companion object { - class Inner() { - } - } -} - -fun box (): String { - val inner = Outer.Companion.Inner() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2532.kt b/backend.native/tests/external/codegen/box/classes/kt2532.kt deleted file mode 100644 index 24d12e9f884..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2532.kt +++ /dev/null @@ -1,15 +0,0 @@ -package foo - -interface B { - val c: Int - get() = 2 -} - -class A(val b: B) : B by b { - override val c: Int = 3 -} - -fun box(): String { - val c = A(object: B {}).c - return if (c == 3) "OK" else "fail: $c" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2566.kt b/backend.native/tests/external/codegen/box/classes/kt2566.kt deleted file mode 100644 index 6a134feb84f..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2566.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class A { - open fun foo() = "OK" -} - -open class B : A() { - override fun foo() = super.foo() -} - -interface I - -class C : I, B() { - override fun foo() = super.foo() -} - -fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/box/classes/kt2566_2.kt b/backend.native/tests/external/codegen/box/classes/kt2566_2.kt deleted file mode 100644 index b119af85615..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2566_2.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class A { - open val foo: String = "OK" -} - -open class B : A() { - inner class E { - val foo: String = super@B.foo - } -} - -class C : B() { - inner class D { - val foo: String = super@C.foo - } -} - -fun box() = C().foo diff --git a/backend.native/tests/external/codegen/box/classes/kt2607.kt b/backend.native/tests/external/codegen/box/classes/kt2607.kt deleted file mode 100644 index 10688476918..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2607.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box() : String { - val o = object { - - inner class C { - fun foo() = "OK" - } - } - return o.C().foo() -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2626.kt b/backend.native/tests/external/codegen/box/classes/kt2626.kt deleted file mode 100644 index 34ba1d2ad8d..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2626.kt +++ /dev/null @@ -1,10 +0,0 @@ -package example2 - -fun box() = Context.OsType.OK.toString() - -object Context -{ - public enum class OsType { - WIN2000, WINDOWS, MACOSX, LINUX, OTHER, OK; - } -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2711.kt b/backend.native/tests/external/codegen/box/classes/kt2711.kt deleted file mode 100644 index 409537ae567..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2711.kt +++ /dev/null @@ -1,15 +0,0 @@ -class IntRange { - operator fun contains(a: Int) = (1..2).contains(a) -} - -class C() { - operator fun rangeTo(i: Int) = IntRange() -} - - -fun box(): String { - if (2 in C()..2) { - 2 == 2 - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt2784.kt b/backend.native/tests/external/codegen/box/classes/kt2784.kt deleted file mode 100644 index fc7c5dfccbe..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt2784.kt +++ /dev/null @@ -1,10 +0,0 @@ -open class Factory(p: Int) - -class A { - companion object : Factory(1) -} - -fun box() : String { - A - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/kt285.kt b/backend.native/tests/external/codegen/box/classes/kt285.kt deleted file mode 100644 index 945b250f7dc..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt285.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface Trait { - fun foo() = "O" - fun bar(): String -} - -class SimpleClass : Trait { - override fun bar() = "K" -} - -// Delegating 'toString' doesn't work, see KT-9519 -class ComplexClass : Trait by SimpleClass() { - fun qux() = foo() + bar() -} - -fun box() = ComplexClass().qux() diff --git a/backend.native/tests/external/codegen/box/classes/kt3001.kt b/backend.native/tests/external/codegen/box/classes/kt3001.kt deleted file mode 100644 index 0524528ca1e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt3001.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface A { - val result: String -} - -class Base(override val result: String) : A - -open class Derived : A by Base("OK") - -class Z : Derived() - -fun box() = Z().result diff --git a/backend.native/tests/external/codegen/box/classes/kt3114.kt b/backend.native/tests/external/codegen/box/classes/kt3114.kt deleted file mode 100644 index 32d42899074..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt3114.kt +++ /dev/null @@ -1,13 +0,0 @@ -class KeySpan(val left: String) { - - public fun matches(value : String) : Boolean { - - return left > value && left > value - } - -} - -fun box() : String { - KeySpan("1").matches("3") - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/kt3414.kt b/backend.native/tests/external/codegen/box/classes/kt3414.kt deleted file mode 100644 index 6b4a083eda9..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt3414.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface A { - fun foo(): Int -} - -interface B { - fun foo(): Int -} - -class Z(val a: A) : A by a, B - -fun box(): String { - val s = Z(object : A { - override fun foo(): Int { - return 1; - } - }); - return if (s.foo() == 1) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/kt343.kt b/backend.native/tests/external/codegen/box/classes/kt343.kt deleted file mode 100644 index adae992ae21..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt343.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun launch(f : () -> Unit) { - f() -} - -fun box(): String { - val list = ArrayList() - val foo : () -> Unit = { - list.add(2) //first exception - } - foo() - - launch({ - list.add(3) - }) - - val bar = { - val x = 1 //second exception - } - bar() - - return if (list.size == 2 && list.get(0) == 2 && list.get(1) == 3) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt3546.kt b/backend.native/tests/external/codegen/box/classes/kt3546.kt deleted file mode 100644 index b4d36c1f3e6..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt3546.kt +++ /dev/null @@ -1,25 +0,0 @@ -interface A { - fun test(): String -} - -interface B { - fun test(): String -} - -interface C: A, B - -class Z(val param: String): C { - - override fun test(): String { - return param - } -} - -public class MyClass(val value : C) : C by value { - -} - -fun box(): String { - val s = MyClass(Z("OK")) - return s.test() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/kt454.kt b/backend.native/tests/external/codegen/box/classes/kt454.kt deleted file mode 100644 index be3994d660c..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt454.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - var s1 = (l1@ "s") - val s2 = (l2@ if (l3@ true) s1 else null) - return if (s2 == "s") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt471.kt b/backend.native/tests/external/codegen/box/classes/kt471.kt deleted file mode 100644 index 4de658a6626..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt471.kt +++ /dev/null @@ -1,109 +0,0 @@ -class MyNumber(val i: Int) { - operator fun inc(): MyNumber = MyNumber(i+1) -} - -class MNR(var ref: MyNumber) {} - -fun test1() : Boolean { - var m = MyNumber(42) - - m++ - if (m.i != 43) return false - return true -} - -fun test2() : Boolean { - var m = MyNumber(44) - - var m2 = m++ - if (m2.i != 44) return false - if (m.i != 45) return false - return true -} - -fun test3() : Boolean { - var mnr = MNR(MyNumber(42)) - mnr.ref++ - if (mnr.ref.i != 43) return false - return true -} - -fun test4() : Boolean { - var mnr = MNR(MyNumber(42)) - val m3 = mnr.ref++ - if (m3.i != 42) return false - return true -} - -fun test5() : Boolean { - var mnr = Array(2,{MyNumber(42)}) - mnr[0]++ - if (mnr[0].i != 43) return false - return true -} - -fun test6() : Boolean { - var mnr = Array(2,{it -> MyNumber(42-it)}) - mnr[1] = mnr[0]++ - if (mnr[0].i != 43) return false - if (mnr[1].i != 42) return false - return true -} - -class MyArrayList() { - private var value17: T? = null - private var value39: T? = null - operator fun get(index: Int): T { - if (index == 17) return value17!! - if (index == 39) return value39!! - throw Exception() - } - operator fun set(index: Int, value: T): T? { - if (index == 17) value17 = value - else if (index == 39) value39 = value - else throw Exception() - return null - } -} - -fun test7() : Boolean { - var mnr = MyArrayList() - mnr[17] = MyNumber(42) - mnr[17]++ - if (mnr[17].i != 43) return false - return true -} - -fun test8() : Boolean { - var mnr = MyArrayList() - mnr[17] = MyNumber(42) - mnr[39] = mnr[17]++ - if (mnr[17].i != 43) return false - if (mnr[39].i != 42) return false - return true -} - - -fun box() : String { - var m = MyNumber(42) - - if (!test1()) return "fail test 1" - if (!test2()) return "fail test 2" - if (!test3()) return "fail test 3" - if (!test4()) return "fail test 4" - - if (!test5()) return "fail test 5" - if (!test6()) return "fail test 6" - if (!test7()) return "fail test 7" - if (!test8()) return "fail test 8" - - - ++m - if (m.i != 43) return "fail 0" - - var m1 = ++m - if (m1.i != 44) return "fail 3" - if (m.i != 44) return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt48.kt b/backend.native/tests/external/codegen/box/classes/kt48.kt deleted file mode 100644 index 007c5958af0..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt48.kt +++ /dev/null @@ -1,29 +0,0 @@ -class A() { - var xi = 0 - var xin : Int? = 0 - var xinn : Int? = null - - var xl = 0.toLong() - var xln : Long? = 0.toLong() - var xlnn : Long? = null - - var xb = 0.toByte() - var xbn : Byte? = 0.toByte() - var xbnn : Byte? = null - - var xf = 0.toFloat() - var xfn : Float? = 0.toFloat() - var xfnn : Float? = null - - var xd = 0.toDouble() - var xdn : Double? = 0.toDouble() - var xdnn : Double? = null - - var xs = 0.toShort() - var xsn : Short? = 0.toShort() - var xsnn : Short? = null -} - -fun box() : String { - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt496.kt b/backend.native/tests/external/codegen/box/classes/kt496.kt deleted file mode 100644 index e4c31c86a27..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt496.kt +++ /dev/null @@ -1,83 +0,0 @@ -fun test1() : Boolean { - try { - return true - } finally { - if(true) // otherwise we wisely have unreachable code - return false - } -} - -var x = true -fun test2() : Boolean { - try { - } finally { - x = false; - } - return x -} - -fun test3() : Int { - var y = 0 - try { - ++y - } finally { - ++y - } - return y -} - -var z = 0 -fun test4() : Int { - z = 0 - return try { - try { - z++ - } - finally { - z++ - } - } finally { - ++z - } -} - -fun test5() : Int { - var x = 0 - while(true) { - try { - if(x < 10) - x++ - else - break - } - finally { - x++ - } - } - return x -} - -fun test6() : Int { - var x = 0 - while(x < 10) { - try { - x++ - continue - } - finally { - x++ - } - } - return x -} - -fun box() : String { - if(test1()) return "test1 failed" - if(test2()) return "test2 failed" - if(test3() != 2) return "test3 failed" - if(test4() != 0) return "test4 failed" - if(test5() != 11) return "test5 failed" - if(test6() != 10) return "test6 failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt500.kt b/backend.native/tests/external/codegen/box/classes/kt500.kt deleted file mode 100644 index b9c66165f9e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt500.kt +++ /dev/null @@ -1,29 +0,0 @@ -var GUEST_USER_ID = 3 -val USER_ID = - try { - getUserIdFromEnvironment() - } - catch (e : UnsupportedOperationException) { - ++GUEST_USER_ID - } - -val USER_ID_2 = - try { - getUserIdFromEnvironment() - } - catch (e : UnsupportedOperationException) { - GUEST_USER_ID - } - finally { - GUEST_USER_ID++ - } - -fun getUserIdFromEnvironment() : Int = throw UnsupportedOperationException() - -fun box() : String { - if(USER_ID != 4) return "test0 failed" - if(USER_ID_2 != 4) return "test2 failed" - if(GUEST_USER_ID != 5) return "test3 failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt501.kt b/backend.native/tests/external/codegen/box/classes/kt501.kt deleted file mode 100644 index 6705704587e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt501.kt +++ /dev/null @@ -1,22 +0,0 @@ -class Reluctant() { - init { - throw Exception("I'm not coming out") - } -} - -fun test1() : String { - try { - val b = Reluctant() - return "Surprise!" - } - catch (ex : Exception) { - return "I told you so" - } -} - - -fun box() : String { - if(test1() != "I told you so") return "test1 failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt504.kt b/backend.native/tests/external/codegen/box/classes/kt504.kt deleted file mode 100644 index 2f55f67acdd..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt504.kt +++ /dev/null @@ -1,17 +0,0 @@ -package mult_constructors_3_bug - -public open class Identifier() { - private var myNullable : Boolean = true - companion object { - open public fun init(isNullable : Boolean) : Identifier { - val id = Identifier() - id.myNullable = isNullable - return id - } - } -} - -fun box() : String { - Identifier.init(true) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt508.kt b/backend.native/tests/external/codegen/box/classes/kt508.kt deleted file mode 100644 index 54557146984..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt508.kt +++ /dev/null @@ -1,12 +0,0 @@ -operator fun MutableMap.set(key : K, value : V) = put(key, value) - -fun box() : String { - - val commands : MutableMap = HashMap() - - commands["c1"] = "239" - if(commands["c1"] != "239") return "fail" - - commands["c1"] += "932" - return if(commands["c1"] == "239932") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt5347.kt b/backend.native/tests/external/codegen/box/classes/kt5347.kt deleted file mode 100644 index cca6a97b08e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt5347.kt +++ /dev/null @@ -1,44 +0,0 @@ -fun test1(str: String): String { - data class A(val x: Int) { - fun foo() = str - } - return A(0).copy().foo() -} - -class TestClass(val x: String) { - fun foo(): String { - data class A(val x: Int) { - fun foo() = this@TestClass.x - } - return A(0).copy().foo() - } -} - -fun test2(str: String): String = TestClass(str).foo() - -fun test3(str: String): String { - var xx = "" - data class A(val x: Int) { - fun foo(): String { xx = str; return xx } - } - return A(0).copy().foo() -} - -fun test4(str: String): String { - var xx = "" - fun bar(s: String): String { xx = s; return xx } - data class A(val x: Int) { - fun foo(): String = bar(str) - } - return A(0).copy().foo() -} - -fun box(): String { - return when { - test1("test1") != "test1" -> "Failed #1 (parameter capture)" - test2("test2") != "test2" -> "Failed #2 ('this' capture)" - test3("test3") != "test3" -> "Failed #3 ('var' capture)" - test4("test4") != "test4" -> "Failed #4 (local function capture)" - else -> "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/kt6136.kt b/backend.native/tests/external/codegen/box/classes/kt6136.kt deleted file mode 100644 index 14a14e1c4e0..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt6136.kt +++ /dev/null @@ -1,26 +0,0 @@ -interface Id { - val id: T -} - -data class Actor ( - override val id: Int, - val firstName: String, - val lastName: String -) : Id - -fun box(): String { - val a1 = Actor(1, "Jeff", "Bridges") - - val a1c = a1.copy() - if (a1c.id != a1.id) return "Failed: a1.copy().id==${a1c.id}" - - val a2 = Actor(2, "Jeff", "Bridges") - if (a2 == a1) return "Failed: a2==a1" - - // Assume that our hashCode is good enough for this test :) - if (a2.hashCode() == a1.hashCode()) return "Failed: a2.hashCode()==a1.hashCode()" - - a1.toString() - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt633.kt b/backend.native/tests/external/codegen/box/classes/kt633.kt deleted file mode 100644 index 04e0a26ec12..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt633.kt +++ /dev/null @@ -1,23 +0,0 @@ -class mInt(val i : Int) { - override fun toString() : String = "mint: $i" - operator fun plus(i : Int) = mInt(this.i + i) - operator fun inc() = mInt(i + 1) -} - -class MyArray() { - val a = Array(10, {mInt(0)}) - operator fun get(i : mInt) : mInt = a[i.i] - operator fun set(i : mInt, v : mInt) { - a[i.i] = v - } -} - -fun box() : String { - val a = MyArray() - var i = mInt(0) - a[i++] - a[i++] = mInt(1) - for (i in 0..9) - a[mInt(i)] - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt6816.kt b/backend.native/tests/external/codegen/box/classes/kt6816.kt deleted file mode 100644 index ed081c608fb..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt6816.kt +++ /dev/null @@ -1,25 +0,0 @@ -public class CalculatorConstants( - val id: Long = 0, - val detour: Double = 0.0, - val taxi: Double = 0.0, - val loop: Double = 0.0, - val planeCondition: Double = 0.0, - val co2PerKerosene: Double = 0.0, - val freight: Double = 0.0, - val rfi: Double = 0.0, - val rfiAltitude: Double = 0.0, - val averageContribution: Double = 0.0, - val singleContribution: Double = 0.0, - val returnContribution: Double = 0.0, - val defraFactor: Double = 0.0, - val airCondMult: Double = 0.0, - val autoTransMult: Double = 0.0, - val hybridDefault: String? = null, - val travelClassOne: Double = 0.0, - val status: String = "OK" -) - -fun box(): String { - val c = CalculatorConstants() - return c.status -} diff --git a/backend.native/tests/external/codegen/box/classes/kt707.kt b/backend.native/tests/external/codegen/box/classes/kt707.kt deleted file mode 100644 index a1cb2833e5d..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt707.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS, NATIVE -class List(val head: T, val tail: List? = null) - -fun List.mapHead(f: (T)-> T): List = List(f(head), null) - -fun box() : String { - val a: Int = List(1).mapHead{it * 2}.head - System.out?.println(a) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt723.kt b/backend.native/tests/external/codegen/box/classes/kt723.kt deleted file mode 100644 index 6d020a0bc99..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt723.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Int?.inc() : Int { if (this != null) return this.inc() else throw NullPointerException() } - -public fun box() : String { - var i : Int? = 10 - val j = i++ - - return if(j==10 && 11 == i) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt725.kt b/backend.native/tests/external/codegen/box/classes/kt725.kt deleted file mode 100644 index 3aea020f890..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt725.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Int?.inc() = this!!.inc() - -public fun box() : String { - var i : Int? = 10 - val j = i++ - - return if(j==10 && 11 == i) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt8011.kt b/backend.native/tests/external/codegen/box/classes/kt8011.kt deleted file mode 100644 index e4ab453aa33..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt8011.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -fun testFun1(str: String): String { - val local = str - - class Local { - fun foo() = str - } - - val list = listOf(0).map { Local() } - return list[0].foo() -} - -fun box(): String { - return when { - testFun1("test1") != "test1" -> "Fail #1" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/classes/kt8011a.kt b/backend.native/tests/external/codegen/box/classes/kt8011a.kt deleted file mode 100644 index 9a8fa24c6d9..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt8011a.kt +++ /dev/null @@ -1,52 +0,0 @@ -fun testFun1(str: String): String { - val capture = str - - class A { - val x = capture - } - - return A().x -} - - -fun testFun2(str: String): String { - class A { - val x = str - } - fun bar() = A() - return bar().x -} - - -class TestClass(val str: String) { - var xx: String? = null - - init { - class A { - val x = str - } - - xx = A().x - } -} - -fun testFun3(str: String): String = TestClass(str).xx!! - - -fun String.testFun4(): String { - class A { - val x = this@testFun4 - } - return A().x -} - - -fun box(): String { - return when { - testFun1("test1") != "test1" -> "Fail #1 (local class with capture)" - testFun2("test2") != "test2" -> "Fail #2 (local class with capture ctor in another context)" - testFun3("test3") != "test3" -> "Fail #3 (local class with capture ctor in init{ ... })" - "test4".testFun4() != "test4" -> "Fail #4 (local class with extension receiver)" - else -> "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/classes/kt903.kt b/backend.native/tests/external/codegen/box/classes/kt903.kt deleted file mode 100644 index b4a75ee8128..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt903.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM - -operator fun Int.plus(a: Int?) = this + a!! - -public open class PerfectNumberFinder() { - open public fun isPerfect(number : Int) : Boolean { - var factors : MutableList = ArrayList() - factors?.add(1) - factors?.add(number) - for (i in 2..(Math.sqrt((number).toDouble()) - 1).toInt()) - if (((number % i) == 0)) { - factors?.add(i) - if (((number / i) != i)) - factors?.add((number / i)) - - } - - var sum : Int = 0 - for (i : Int? in factors) - sum += i - return ((sum - number) == number) - } -} - -fun box () = if (PerfectNumberFinder().isPerfect(28)) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/classes/kt940.kt b/backend.native/tests/external/codegen/box/classes/kt940.kt deleted file mode 100644 index f9e99b3716a..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt940.kt +++ /dev/null @@ -1,17 +0,0 @@ -// WITH_RUNTIME - -fun box() : String { - val w = object : Comparator { - - override fun compare(o1 : String?, o2 : String?) : Int { - val l1 : Int = o1?.length ?: 0 - val l2 = o2?.length ?: 0 - return l1 - l2 - } - - override fun equals(obj: Any?): Boolean = obj === this - } - - w.compare("aaa", "bbb") - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/kt9642.kt b/backend.native/tests/external/codegen/box/classes/kt9642.kt deleted file mode 100644 index e26512eda4e..00000000000 --- a/backend.native/tests/external/codegen/box/classes/kt9642.kt +++ /dev/null @@ -1,18 +0,0 @@ -class Outer { - class Nested { - fun fn(): String { - s = "OK" - return s - } - } - - @kotlin.native.ThreadLocal - companion object { - public var s = "fail" - private set - } -} - -fun box(): String { - return Outer.Nested().fn() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/namedClassObject.kt b/backend.native/tests/external/codegen/box/classes/namedClassObject.kt deleted file mode 100644 index 2ff7587752d..00000000000 --- a/backend.native/tests/external/codegen/box/classes/namedClassObject.kt +++ /dev/null @@ -1,12 +0,0 @@ -class C() { - companion object Foo { - fun create() = 3 - } -} - -fun box(): String { - val c1 = C.Foo.create() - val c2 = C.create() - return if (c1 == 3 && c2 == 3) "OK" else "fail" -} - diff --git a/backend.native/tests/external/codegen/box/classes/outerThis.kt b/backend.native/tests/external/codegen/box/classes/outerThis.kt deleted file mode 100644 index 346e44ecbbf..00000000000 --- a/backend.native/tests/external/codegen/box/classes/outerThis.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Outer() { - inner class Inner() { - val outer: Outer get() = this@Outer - } - - public val x : Inner = Inner() -} - -fun box() : String { - val o = Outer() - return if (o === o.x.outer) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/overloadBinaryOperator.kt b/backend.native/tests/external/codegen/box/classes/overloadBinaryOperator.kt deleted file mode 100644 index 2333984acfa..00000000000 --- a/backend.native/tests/external/codegen/box/classes/overloadBinaryOperator.kt +++ /dev/null @@ -1,23 +0,0 @@ -class ArrayWrapper() { - val contents = ArrayList() - - fun add(item: T) { - contents.add(item) - } - - operator fun plus(b: ArrayWrapper): ArrayWrapper { - val result = ArrayWrapper() - result.contents.addAll(contents) - result.contents.addAll(b.contents) - return result - } -} - -fun box(): String { - val v1 = ArrayWrapper() - val v2 = ArrayWrapper() - v1.add("foo") - v2.add("bar") - val v3 = v1 + v2 - return if (v3.contents.size == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/overloadPlusAssign.kt b/backend.native/tests/external/codegen/box/classes/overloadPlusAssign.kt deleted file mode 100644 index 04fa8c842ca..00000000000 --- a/backend.native/tests/external/codegen/box/classes/overloadPlusAssign.kt +++ /dev/null @@ -1,24 +0,0 @@ -class ArrayWrapper() { - val contents = ArrayList() - - fun add(item: T) { - contents.add(item) - } - - operator fun plusAssign(rhs: ArrayWrapper) { - contents.addAll(rhs.contents) - } - - operator fun get(index: Int): T { - return contents.get(index)!! - } -} - -fun box(): String { - var v1 = ArrayWrapper() - val v2 = ArrayWrapper() - v1.add("foo") - v2.add("bar") - v1 += v2 - return if (v1.contents.size == 2) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/overloadPlusAssignReturn.kt b/backend.native/tests/external/codegen/box/classes/overloadPlusAssignReturn.kt deleted file mode 100644 index 005c69ce4f9..00000000000 --- a/backend.native/tests/external/codegen/box/classes/overloadPlusAssignReturn.kt +++ /dev/null @@ -1,28 +0,0 @@ -class ArrayWrapper() { - val contents = ArrayList() - - fun add(item: T) { - contents.add(item) - } - - operator fun plus(rhs: ArrayWrapper): ArrayWrapper { - val result = ArrayWrapper() - result.contents.addAll(contents) - result.contents.addAll(rhs.contents) - return result - } - - operator fun get(index: Int): T { - return contents.get(index)!! - } -} - -fun box(): String { - var v1 = ArrayWrapper() - val v2 = ArrayWrapper() - v1.add("foo") - val v3 = v1 - v2.add("bar") - v1 += v2 - return if (v1.contents.size == 2 && v3.contents.size == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/overloadPlusToPlusAssign.kt b/backend.native/tests/external/codegen/box/classes/overloadPlusToPlusAssign.kt deleted file mode 100644 index 005c69ce4f9..00000000000 --- a/backend.native/tests/external/codegen/box/classes/overloadPlusToPlusAssign.kt +++ /dev/null @@ -1,28 +0,0 @@ -class ArrayWrapper() { - val contents = ArrayList() - - fun add(item: T) { - contents.add(item) - } - - operator fun plus(rhs: ArrayWrapper): ArrayWrapper { - val result = ArrayWrapper() - result.contents.addAll(contents) - result.contents.addAll(rhs.contents) - return result - } - - operator fun get(index: Int): T { - return contents.get(index)!! - } -} - -fun box(): String { - var v1 = ArrayWrapper() - val v2 = ArrayWrapper() - v1.add("foo") - val v3 = v1 - v2.add("bar") - v1 += v2 - return if (v1.contents.size == 2 && v3.contents.size == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/overloadUnaryOperator.kt b/backend.native/tests/external/codegen/box/classes/overloadUnaryOperator.kt deleted file mode 100644 index 5813e80f4c2..00000000000 --- a/backend.native/tests/external/codegen/box/classes/overloadUnaryOperator.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_RUNTIME -class ArrayWrapper() { - val contents = ArrayList() - - fun add(item: T) { - contents.add(item) - } - - operator fun unaryMinus(): ArrayWrapper { - val result = ArrayWrapper() - result.contents.addAll(contents) - result.contents.reverse() - return result - } - - operator fun get(index: Int): T { - return contents.get(index)!! - } -} - -fun box(): String { - val v1 = ArrayWrapper() - v1.add("foo") - v1.add("bar") - val v2 = -v1 - return if (v2[0] == "bar" && v2[1] == "foo") "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/privateOuterFunctions.kt b/backend.native/tests/external/codegen/box/classes/privateOuterFunctions.kt deleted file mode 100644 index ceeb4ff69ce..00000000000 --- a/backend.native/tests/external/codegen/box/classes/privateOuterFunctions.kt +++ /dev/null @@ -1,35 +0,0 @@ -class C { - private fun String.ext() : String = "" - private fun f() {} - - public fun foo() : String { - { - "".ext() - f() - }.invoke() - - object : Runnable { - public override fun run() { - "".ext() - f() - } - }.run() - - Inner().innerFun() - - return "OK" - } - - private inner class Inner() { - fun innerFun() { - "".ext() - f() - } - } -} - -interface Runnable { - fun run(): Unit -} - -fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/box/classes/privateOuterProperty.kt b/backend.native/tests/external/codegen/box/classes/privateOuterProperty.kt deleted file mode 100644 index 0f0bc3e452f..00000000000 --- a/backend.native/tests/external/codegen/box/classes/privateOuterProperty.kt +++ /dev/null @@ -1,31 +0,0 @@ -class C{ - private var v : Int = 0 - - public fun foo() : Int { - { - v = v + 1 - }.invoke() - - object : Runnable { - public override fun run() { - v = v + 1 - } - }.run() - - Inner().innerFun() - - return v - } - - private inner class Inner() { - fun innerFun() { - v = v + 1 - } - } -} - -interface Runnable { - fun run(): Unit -} - -fun box() = if (C().foo() == 3) "OK" else "NOT OK" diff --git a/backend.native/tests/external/codegen/box/classes/privateToThis.kt b/backend.native/tests/external/codegen/box/classes/privateToThis.kt deleted file mode 100644 index 8905986a1f4..00000000000 --- a/backend.native/tests/external/codegen/box/classes/privateToThis.kt +++ /dev/null @@ -1,11 +0,0 @@ -class A(init_o: I, private val init_k: I) { - private val o: I = init_o - private fun k(): I = init_k - - fun getOk() = o.toString() + k().toString() -} - -fun box(): String { - val a = A("O", "K") - return a.getOk() -} diff --git a/backend.native/tests/external/codegen/box/classes/propertyDelegation.kt b/backend.native/tests/external/codegen/box/classes/propertyDelegation.kt deleted file mode 100644 index 59720282936..00000000000 --- a/backend.native/tests/external/codegen/box/classes/propertyDelegation.kt +++ /dev/null @@ -1,33 +0,0 @@ -open class Base() { - val plain = 239 - public val read : Int - get() = 239 - - public var readwrite : Int = 0 - get() = field + 1 - set(n : Int) { - field = n - } -} - -interface Abstract {} - -class Derived1() : Base(), Abstract {} -class Derived2() : Abstract, Base() {} - -fun code(s : Base) : Int { - if (s.plain != 239) return 1 - if (s.read != 239) return 2 - s.readwrite = 238 - if (s.readwrite != 239) return 3 - return 0 -} - -fun test(s : Base) : Boolean = code(s) == 0 - -fun box() : String { - if (!test(Base())) return "Fail #1" - if (!test(Derived1())) return "Fail #2" - if (!test(Derived2())) return "Fail #3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/propertyInInitializer.kt b/backend.native/tests/external/codegen/box/classes/propertyInInitializer.kt deleted file mode 100644 index bd8aa833063..00000000000 --- a/backend.native/tests/external/codegen/box/classes/propertyInInitializer.kt +++ /dev/null @@ -1,16 +0,0 @@ -class Outer() { - val s = "xyzzy" - - open inner class InnerBase(public val name: String) { - } - - inner class InnerDerived(): InnerBase(s) { - } - - val x = InnerDerived() -} - -fun box() : String { - val o = Outer() - return if (o.x.name != "xyzzy") "fail" else "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/quotedClassName.kt b/backend.native/tests/external/codegen/box/classes/quotedClassName.kt deleted file mode 100644 index 0031c7032b0..00000000000 --- a/backend.native/tests/external/codegen/box/classes/quotedClassName.kt +++ /dev/null @@ -1,9 +0,0 @@ -// IGNORE_BACKEND: JS - -class `A!u00A0`() { - val ok = "OK" -} - -fun box(): String { - return `A!u00A0`().ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/rightHandOverride.kt b/backend.native/tests/external/codegen/box/classes/rightHandOverride.kt deleted file mode 100644 index 2c5af2c9927..00000000000 --- a/backend.native/tests/external/codegen/box/classes/rightHandOverride.kt +++ /dev/null @@ -1,20 +0,0 @@ -// Changed when traits were introduced. May not make sense any more - -interface Left {} -open class Right() { - open fun f() = 42 -} - -class D() : Left, Right() { - override fun f() = 239 -} - -fun box() : String { - val r : Right = Right() - val d : D = D() - - if (r.f() != 42) return "Fail #1" - if (d.f() != 239) return "Fail #2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/sealedInSameFile.kt b/backend.native/tests/external/codegen/box/classes/sealedInSameFile.kt deleted file mode 100644 index 673afef28ef..00000000000 --- a/backend.native/tests/external/codegen/box/classes/sealedInSameFile.kt +++ /dev/null @@ -1,38 +0,0 @@ -class B : A() - -sealed class A() { - constructor(i: Int): this() - - class C: A() -} - -object T : Y() - -class D : A(4) - -class E : A { - constructor(i: Int): super(i) - constructor(): super() -} - -object S : Z() - -sealed class Y : X() - -sealed class Z : Y() - -sealed class X : A() - -class Q : Y() - -fun box() : String { - B() - A.C() - D() - E() - E(4) - T - S - Q() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/selfcreate.kt b/backend.native/tests/external/codegen/box/classes/selfcreate.kt deleted file mode 100644 index 95d67471511..00000000000 --- a/backend.native/tests/external/codegen/box/classes/selfcreate.kt +++ /dev/null @@ -1,14 +0,0 @@ -class B () {} - -open class A(val b : B) { - fun a(): A = object: A(b) {} -} - -fun box() : String { - val b = B() - val a = A(b).a() - - if (a.b !== b) return "failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/classes/simpleBox.kt b/backend.native/tests/external/codegen/box/classes/simpleBox.kt deleted file mode 100644 index be95d012d51..00000000000 --- a/backend.native/tests/external/codegen/box/classes/simpleBox.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Box(t: T) { - var value = t -} - -fun box(): String { - val box: Box = Box(1) - return if (box.value == 1) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/classes/superConstructorCallWithComplexArg.kt b/backend.native/tests/external/codegen/box/classes/superConstructorCallWithComplexArg.kt deleted file mode 100644 index 1d2c6d4646a..00000000000 --- a/backend.native/tests/external/codegen/box/classes/superConstructorCallWithComplexArg.kt +++ /dev/null @@ -1,19 +0,0 @@ -var log = "" - -open class Base(val s: String) - -class A(i: Int) : Base("O" + if (i == 23) { - log += "logged" - "K" -} -else { - "fail" -}) - -fun box(): String { - val result = A(23).s - if (result != "OK") return "fail: $result" - if (log != "logged") return "fail log: $log" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/classes/typedDelegation.kt b/backend.native/tests/external/codegen/box/classes/typedDelegation.kt deleted file mode 100644 index e0b1241a6aa..00000000000 --- a/backend.native/tests/external/codegen/box/classes/typedDelegation.kt +++ /dev/null @@ -1,31 +0,0 @@ -interface A { - var zzzValue : T - fun zzz() : T -} - -class Base : A { - override var zzzValue : T? = null - - override fun zzz() : T? = zzzValue -} - -class X : A by Base() - -fun box() : String { - (Base() as A).zzz() - - if (X().zzz() != null) { - return "Fail" - } - - val x = X() - x.zzzValue = "aa" - if (x.zzzValue != "aa") { - return "Fail 2"; - } - if (x.zzz() != "aa") { - return "Fail 3"; - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/captureExtensionReceiver.kt b/backend.native/tests/external/codegen/box/closures/captureExtensionReceiver.kt deleted file mode 100644 index bd78f48b9ef..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureExtensionReceiver.kt +++ /dev/null @@ -1,40 +0,0 @@ -interface B { - val bar: T -} - -fun String.foo() = object : B { - override val bar: String = length.toString() -} - -class C { - - fun String.extension() = this.length - - fun String.fooInClass() = object : B { - override val bar: String = extension().toString() - } - - fun String.fooInClassNoReceiver() = object : B { - override val bar: String = "123".extension().toString() - } - - fun fooInClass(s: String) = s.fooInClass().bar - - fun fooInClassNoReceiver(s: String) = s.fooInClassNoReceiver().bar -} - -fun box(): String { - var result = "Hello, world!".foo().bar - if (result != "13") return "fail 1: $result" - - result = C().fooInClass("Hello, world!") - - if (result != "13") return "fail 2: $result" - - result = C().fooInClassNoReceiver("Hello, world!") - - if (result != "3") return "fail 3: $result" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/captureFunctionInProperty.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/captureFunctionInProperty.kt deleted file mode 100644 index e2c507f3b28..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/captureFunctionInProperty.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface T { - fun result(): String -} - -class A(val x: String) { - fun getx() = x - - fun foo() = object : T { - val bar = getx() - - override fun result() = bar - } -} - -fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inFunction.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inFunction.kt deleted file mode 100644 index 7b4828fa7b5..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inFunction.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface T { - fun result(): String -} - -class A(val x: String) { - fun foo() = object : T { - fun bar() = x - - override fun result() = bar() - } -} - -fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inProperty.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inProperty.kt deleted file mode 100644 index 8f1846f7cfb..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inProperty.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface T { - fun result(): String -} - -class A(val x: String) { - fun foo() = object : T { - val bar = x - - override fun result() = bar - } -} - -fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyDeepObjectChain.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyDeepObjectChain.kt deleted file mode 100644 index 0bb07f581b9..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyDeepObjectChain.kt +++ /dev/null @@ -1,18 +0,0 @@ -interface T { - fun result(): String -} - -class A(val x: String) { - fun foo() = object : T { - fun bar() = object : T { - fun baz() = object : T { - val y = x - override fun result() = y - } - override fun result() = baz().result() - } - override fun result() = bar().result() - } -} - -fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperClass.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperClass.kt deleted file mode 100644 index 2f7ff86a10c..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperClass.kt +++ /dev/null @@ -1,15 +0,0 @@ -interface T { - fun result(): String -} - -open class B(val x: String) - -class A : B("OK") { - fun foo() = object : T { - val bar = x - - override fun result() = bar - } -} - -fun box() = A().foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt deleted file mode 100644 index 3d600017d08..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface T { - fun result(): String -} - -abstract class A(val x: Z) - -open class B : A("OK") - -class C : B() { - fun foo() = object : T { - val bar = x - - override fun result() = bar - } -} - -fun box() = C().foo().result() diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4176.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4176.kt deleted file mode 100644 index 129b3ad92c8..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4176.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Z(val s: Int) { - open fun a() {} -} - -class B(val x: Int) { - fun foo() { - class X : Z(x) { - - } - X() - } -} - -fun box(): String { - B(1).foo() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4656.kt b/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4656.kt deleted file mode 100644 index c3b93ff7efd..00000000000 --- a/backend.native/tests/external/codegen/box/closures/captureOuterProperty/kt4656.kt +++ /dev/null @@ -1,16 +0,0 @@ -//KT-4656 Wrong capturing a function literal variable - -fun box(): String { - var foo = { 1 } - var bar = 1 - - val t = { "${foo()} $bar" } - fun b() = "${foo()} $bar" - - foo = { 2 } - bar = 2 - - if (t() != "2 2") return "fail1" - if (b() != "2 2") return "fail2" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedLocalGenericFun.kt b/backend.native/tests/external/codegen/box/closures/capturedLocalGenericFun.kt deleted file mode 100644 index ebe26220013..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedLocalGenericFun.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box() : String { - - fun local(s : T) : T { - return s; - } - - fun test(s : Int) : Int { - return local(s) - } - - if (test(10) != 10) return "fail1" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInCrossinline.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInCrossinline.kt deleted file mode 100644 index 0568c83dde4..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInCrossinline.kt +++ /dev/null @@ -1,9 +0,0 @@ -inline fun runCrossInline(crossinline f: () -> Unit) { - f() -} - -fun box(): String { - var x = "" - runCrossInline { x = "OK" } - return x -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyAssign.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyAssign.kt deleted file mode 100644 index 5faf6875838..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyAssign.kt +++ /dev/null @@ -1,7 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var x = "" - run { x = "OK" } - return x -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyCAO.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyCAO.kt deleted file mode 100644 index 0f62af3ed4d..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyCAO.kt +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var x = "" - run { - x += "O" - x += "K" - } - return x -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIncrDecr.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIncrDecr.kt deleted file mode 100644 index c8d5c31083e..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIncrDecr.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var x = 0 - run { x++ } - run { ++x } - return if (x == 2) "OK" else "Fail: $x" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIndexedCAO.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIndexedCAO.kt deleted file mode 100644 index 44e0531c7b7..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIndexedCAO.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME - -class Host(var value: String) { - operator fun get(i: Int, j: Int, k: Int) = value - - operator fun set(i: Int, j: Int, k: Int, newValue: String) { - value = newValue - } -} - -fun box(): String { - var x = Host("") - run { - x[0, 0, 0] += "O" - x[0, 0, 0] += "K" - } - return x.value -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedVarsOfSize2.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedVarsOfSize2.kt deleted file mode 100644 index 10f31cbc43a..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/capturedVarsOfSize2.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var xl = 0L // Long, size 2 - var xi = 0 // Int, size 1 - var xd = 0.0 // Double, size 2 - - run { - xl++ - xd += 1.0 - xi++ - } - - run { - run { - xl++ - xd += 1.0 - xi++ - } - } - - if (xi != 2) return "fail: xi=$xi" - if (xl != 2L) return "fail: xl=$xl" - if (xd != 2.0) return "fail: xd=$xd" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17200.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17200.kt deleted file mode 100644 index 0d223fc9f97..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17200.kt +++ /dev/null @@ -1,26 +0,0 @@ -inline fun inlineCall(action: () -> Unit) { - action() -} - -fun test() { - var width = 1 - inlineCall { - width += width - } -} - -fun test2() { - var width = 1L - val newValue = 1; - val newValue2 = "123"; - val newValue3 = 2.0; - inlineCall { - width += width - } -} - -fun box(): String { - test() - test2() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17588.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17588.kt deleted file mode 100644 index 44a84014aa5..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/kt17588.kt +++ /dev/null @@ -1,30 +0,0 @@ -//WITH_RUNTIME -class Test { - - data class Style( - val color: Int? = null, - val underlined: Boolean? = null, - val separator: String = "" - ) - - init { - var flag: Boolean? = null - - val receiver: String = "123" - try { - receiver.let { a2 -> - flag = false - } - } finally { - receiver.hashCode() - } - val style = Style(null, flag, "123") - } -} - - -fun box(): String { - Test() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt deleted file mode 100644 index 09ed429ede5..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - run { - run { - var x = 0 - run { ++x } - if (x == 0) return "fail" - } - - run { - var x = 0 - run { x++ } - if (x == 0) return "fail" - } - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt deleted file mode 100644 index cfe5bee1565..00000000000 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt +++ /dev/null @@ -1,42 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - val value = builder { - var r = "" - - for (x in listOf("O", "$", "K")) { - if (x == "$") continue - run { - r += suspendWithResult(x) - } - } - run { - r += "." - } - result = r - } - - if (value != "OK.") return "fail: suspend in for body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFun.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFun.kt deleted file mode 100644 index 106b0a763b3..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFun.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - fun rec(n : Int) { - fun x(m : Int) { - if (n > 0) rec(n - 1) - } - - x(0) - } - - rec(5) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt deleted file mode 100644 index 38c08c8a19d..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - fun rec(n : Int) { - fun x(m : Int, k : Int) { - if (n > 0) rec(n - 1 + k) - } - - x(0, 0) - } - - rec(5) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt deleted file mode 100644 index 94562f8c7f1..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt +++ /dev/null @@ -1,35 +0,0 @@ -package d - -fun box(): String { - ListTag().test(listOf("a", "b")) - return "OK" -} - -fun ListTag.test(list: List) { - for (item in list) { - item() { - a { - text = item - } - } - } -} - -open class HtmlTag -open class ListTag : HtmlTag() {} -class LI : ListTag() {} - -public fun ListTag.item(body: LI.() -> Unit): Unit {} -fun HtmlTag.a(contents: A.() -> Unit) {} - -abstract class A : HtmlTag() { - public abstract var text: String -} - -fun listOf(vararg strings: String): List { - val list = ArrayList() - for (s in strings) { - list.add(s) - } - return list -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevels.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevels.kt deleted file mode 100644 index e0fc6457f26..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevels.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun box(): String { - fun foo(x: Int) { - fun bar(y: Int) { - fun baz(z: Int) { - foo(x - 1) - } - - baz(y) - } - - if (x > 0) bar(x) - } - - foo(1) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt deleted file mode 100644 index a5fadc55936..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun box(): String { - fun foo(x: Int, s: String): String { - fun bar(y: Int) { - fun baz(z: Int, k: Int) { - foo(x - 1 + k, "Fail") - } - - baz(y, 0) - } - - if (x > 0) bar(x) - return s - } - - return foo(1, "OK") -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt b/backend.native/tests/external/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt deleted file mode 100644 index ec2ea57118e..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt +++ /dev/null @@ -1,15 +0,0 @@ -//KT-3276 - -fun box(): String { - fun rec(n : Int) { - val x = { m : Int -> - if (n > 0) rec(n - 1) - } - - x(0) - } - - rec(5) - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureInsideConstrucor.kt b/backend.native/tests/external/codegen/box/closures/closureInsideConstrucor.kt deleted file mode 100644 index 38192dd47b0..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureInsideConstrucor.kt +++ /dev/null @@ -1,14 +0,0 @@ -//adopted snippet from kdoc -open class KModel { - val sourcesInfo: String - init { - fun relativePath(psiFile: String): String { - return psiFile; - } - sourcesInfo = relativePath("OK") - } -} - -fun box():String { - return KModel().sourcesInfo; -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/closureOnTopLevel1.kt b/backend.native/tests/external/codegen/box/closures/closureOnTopLevel1.kt deleted file mode 100644 index b0dd8df8d31..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureOnTopLevel1.kt +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -package test - -val p = { "OK" }() - -val getter: String - get() = { "OK" }() - -fun f() = { "OK" }() - -val obj = object : Function0 { - override fun invoke() = "OK" -} - -fun box(): String { - if (p != "OK") return "FAIL" - if (getter != "OK") return "FAIL" - if (f() != "OK") return "FAIL" - if (obj() != "OK") return "FAIL" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureOnTopLevel2.kt b/backend.native/tests/external/codegen/box/closures/closureOnTopLevel2.kt deleted file mode 100644 index 2f161ffc47c..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureOnTopLevel2.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -val p = { "OK" }() - -val getter: String - get() = { "OK" }() - -fun f() = { "OK" }() - -val obj = object : Function0 { - override fun invoke() = "OK" -} - -fun box(): String { - if (p != "OK") return "FAIL" - if (getter != "OK") return "FAIL" - if (f() != "OK") return "FAIL" - if (obj() != "OK") return "FAIL" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/closureWithParameter.kt b/backend.native/tests/external/codegen/box/closures/closureWithParameter.kt deleted file mode 100644 index 6e5d15af401..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureWithParameter.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box() : String { - return apply( "OK", {arg: String -> arg } ) -} - -fun apply(arg : String, f : (p:String) -> String) : String { - return f(arg) -} diff --git a/backend.native/tests/external/codegen/box/closures/closureWithParameterAndBoxing.kt b/backend.native/tests/external/codegen/box/closures/closureWithParameterAndBoxing.kt deleted file mode 100644 index a1a13fb62a6..00000000000 --- a/backend.native/tests/external/codegen/box/closures/closureWithParameterAndBoxing.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box() : String { - return if (apply( 5, {arg: Int -> arg + 13 } ) == 18) "OK" else "fail" -} - -fun apply(arg : Int, f : (p:Int) -> Int) : Int { - return f(arg) -} diff --git a/backend.native/tests/external/codegen/box/closures/doubleEnclosedLocalVariable.kt b/backend.native/tests/external/codegen/box/closures/doubleEnclosedLocalVariable.kt deleted file mode 100644 index 96ac7f2ef19..00000000000 --- a/backend.native/tests/external/codegen/box/closures/doubleEnclosedLocalVariable.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box() : String { - val cl = 39 - return if (sum(200, { val ff = {cl}; ff() }) == 239) "OK" else "FAIL" -} - -fun sum(arg:Int, f : () -> Int) : Int { - return arg + f() -} diff --git a/backend.native/tests/external/codegen/box/closures/enclosingLocalVariable.kt b/backend.native/tests/external/codegen/box/closures/enclosingLocalVariable.kt deleted file mode 100644 index 01e1a103ff2..00000000000 --- a/backend.native/tests/external/codegen/box/closures/enclosingLocalVariable.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box() : String { - val cl = 39 - return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL" -} - -fun sum(arg:Int, f : () -> Int) : Int { - return arg + f() -} diff --git a/backend.native/tests/external/codegen/box/closures/enclosingThis.kt b/backend.native/tests/external/codegen/box/closures/enclosingThis.kt deleted file mode 100644 index 787a4d89e4a..00000000000 --- a/backend.native/tests/external/codegen/box/closures/enclosingThis.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Point(val x:Int, val y:Int) { - fun mul() : (scalar:Int)->Point { - return { scalar:Int -> Point(x * scalar, y * scalar) } - } -} - -val m = Point(2, 3).mul() - -fun box() : String { - val answer = m(5) - return if (answer.x == 10 && answer.y == 15) "OK" else "FAIL" -} diff --git a/backend.native/tests/external/codegen/box/closures/extensionClosure.kt b/backend.native/tests/external/codegen/box/closures/extensionClosure.kt deleted file mode 100644 index d4c73c7bcfe..00000000000 --- a/backend.native/tests/external/codegen/box/closures/extensionClosure.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Point(val x : Int, val y : Int) - -fun box() : String { - val answer = apply(Point(3, 5), { scalar : Int -> - Point(x * scalar, y * scalar) - }) - - return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL" -} - -fun apply(arg:Point, f : Point.(scalar : Int) -> Point) : Point { - return arg.f(2) -} diff --git a/backend.native/tests/external/codegen/box/closures/kt10044.kt b/backend.native/tests/external/codegen/box/closures/kt10044.kt deleted file mode 100644 index 277f356c76c..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt10044.kt +++ /dev/null @@ -1,41 +0,0 @@ -open class JClass() { - fun test(): String { - return "OK" - } -} - -class Example : JClass { - constructor() : super() - - private var obj: JClass? = null - - var result: String? = null - - init { - { - result = obj?.test() - }() - } -} - -class Example2 : JClass { - constructor() : super() - - private var obj: JClass? = this - - var result: String? = null - - init { - { - result = obj?.test() - }() - } -} - - -fun box(): String { - val result = Example().result - if (result != null) "fail 1: $result" - - return Example2().result!! -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt11634.kt b/backend.native/tests/external/codegen/box/closures/kt11634.kt deleted file mode 100644 index 7bd1880718f..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt11634.kt +++ /dev/null @@ -1,27 +0,0 @@ -interface A { - fun foo(): String -} - -class AImpl(val z: String) : A { - override fun foo(): String = z -} - -open class AFabric { - open fun createA(): A = AImpl("OK") -} - -class AWrapperFabric : AFabric() { - - override fun createA(): A { - return AImpl("fail") - } - - fun createMyA(): A { - return object : A by super.createA() { - } - } -} - -fun box(): String { - return AWrapperFabric().createMyA().foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt11634_2.kt b/backend.native/tests/external/codegen/box/closures/kt11634_2.kt deleted file mode 100644 index 1eb0e9ff096..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt11634_2.kt +++ /dev/null @@ -1,27 +0,0 @@ -interface A { - fun foo(): String -} - -class AImpl(val z: String) : A { - override fun foo(): String = z -} - -open class AFabric { - open fun createA(z: String): A = AImpl(z) -} - -class AWrapperFabric : AFabric() { - - override fun createA(z: String): A { - return AImpl("fail: $z") - } - - fun createMyA(): A { - val z = "OK" - return object : A by super.createA(z) {} - } -} - -fun box(): String { - return AWrapperFabric().createMyA().foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt11634_3.kt b/backend.native/tests/external/codegen/box/closures/kt11634_3.kt deleted file mode 100644 index 1fdaa65c236..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt11634_3.kt +++ /dev/null @@ -1,27 +0,0 @@ -interface A { - fun foo(): String -} - -class AImpl(val z: String) : A { - override fun foo(): String = z -} - -open class AFabric { - open fun createA(z: String): A = AImpl(z) -} - -class AWrapperFabric : AFabric() { - - override fun createA(z: String): A { - return AImpl("fail: $z") - } - - fun createMyA(): A { - val z = "OK" - return object : A by super@AWrapperFabric.createA(z) {} - } -} - -fun box(): String { - return AWrapperFabric().createMyA().foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt11634_4.kt b/backend.native/tests/external/codegen/box/closures/kt11634_4.kt deleted file mode 100644 index 08722aa81de..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt11634_4.kt +++ /dev/null @@ -1,28 +0,0 @@ -interface A { - fun foo(): String -} - -open class Base (val p: String) { - open val a = object : A { - override fun foo(): String { - return p - } - } -} - -open class Derived1 (p: String): Base(p) { - override open val a = object : A { - override fun foo(): String { - return "fail" - } - } - - inner class Derived2(p: String) : Base(p) { - val x = object : A by super@Derived1.a {} - } - -} - -fun box(): String { - return Derived1("OK").Derived2("fail").x.foo() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt2151.kt b/backend.native/tests/external/codegen/box/closures/kt2151.kt deleted file mode 100644 index 5b0da23f6ea..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt2151.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo(): String { - return if (true) { - var x = "OK" - fun foo() { x += "fail" } - x - } else "fail" -} - -fun box(): String { - return foo() -} diff --git a/backend.native/tests/external/codegen/box/closures/kt3152.kt b/backend.native/tests/external/codegen/box/closures/kt3152.kt deleted file mode 100644 index 59bf3eaaeeb..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt3152.kt +++ /dev/null @@ -1,14 +0,0 @@ -public class Test { - val content = 1 - inner class A { - val v = object { - fun f() = content - } - } -} - -fun box(): String { - Test().A() - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt3523.kt b/backend.native/tests/external/codegen/box/closures/kt3523.kt deleted file mode 100644 index bbc225f8fd8..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt3523.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class Base { - fun doSomething() { - - } -} - -class X(val action: () -> Unit) { } - -class Foo : Base() { - inner class Bar() { - val x = X({ doSomething() }) - } -} - -fun box() : String { - Foo().Bar() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/kt3738.kt b/backend.native/tests/external/codegen/box/closures/kt3738.kt deleted file mode 100644 index a05dbde0ae1..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt3738.kt +++ /dev/null @@ -1,19 +0,0 @@ -class A { - fun foo() {} - fun bar(f: A.() -> Unit = {}) {} -} - -class B { - class D { - init { - A().bar { - this.foo() - } - } - } -} - -fun box(): String { - B.D() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/kt3905.kt b/backend.native/tests/external/codegen/box/closures/kt3905.kt deleted file mode 100644 index fafd87700d3..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt3905.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box() : String { - fun foo(t:() -> T) : T = t() - - return foo {"OK"} -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt4106.kt b/backend.native/tests/external/codegen/box/closures/kt4106.kt deleted file mode 100644 index f190819f8d5..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt4106.kt +++ /dev/null @@ -1,15 +0,0 @@ -class Foo(private val s: String) { - inner class Inner { - private val x = { - this@Foo.s - }() - } - - val f = Inner() - -} - -fun box(): String { - Foo("!") - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt4137.kt b/backend.native/tests/external/codegen/box/closures/kt4137.kt deleted file mode 100644 index ea401a6fe80..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt4137.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class A(val s: Int) { - -} - -infix fun Int.foo(s: Int): Int { - return this + s -} - -open class B : A({ 1 foo 2} ()) - -fun box(): String { - return if (B().s == 3) "OK" else "Fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/kt5589.kt b/backend.native/tests/external/codegen/box/closures/kt5589.kt deleted file mode 100644 index 3b3a27d91ca..00000000000 --- a/backend.native/tests/external/codegen/box/closures/kt5589.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - val x = "OK" - fun bar(y: String = x): String = y - return bar() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localClassFunClosure.kt b/backend.native/tests/external/codegen/box/closures/localClassFunClosure.kt deleted file mode 100644 index ba0ae9734a0..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localClassFunClosure.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val o = "O" - fun ok() = o + "K" - class OK { - val ok = ok() - } - return OK().ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localClassLambdaClosure.kt b/backend.native/tests/external/codegen/box/closures/localClassLambdaClosure.kt deleted file mode 100644 index 61fcbb61243..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localClassLambdaClosure.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val o = "O" - val ok_L = {o + "K"} - class OK { - val ok = ok_L() - } - return OK().ok -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localFunctionInFunction.kt b/backend.native/tests/external/codegen/box/closures/localFunctionInFunction.kt deleted file mode 100644 index 4639ab437dd..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localFunctionInFunction.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box(): String { - - fun local():Int { - return 10; - } - - class A { - fun test(): Int { - return local() - } - } - - return if (A().test() == 10) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localFunctionInInitializer.kt b/backend.native/tests/external/codegen/box/closures/localFunctionInInitializer.kt deleted file mode 100644 index 6035aac60ad..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localFunctionInInitializer.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - - fun local():Int { - return 10; - } - - class A { - val test = local() - } - - return if (A().test == 10) "OK" else "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localGenericFun.kt b/backend.native/tests/external/codegen/box/closures/localGenericFun.kt deleted file mode 100644 index fe55a5834b5..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localGenericFun.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box() : String { - - fun local(s : T) : T { - return s; - } - - if (local(10) != 10) return "fail1" - - if (local("11") != "11") return "fail2" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localReturn.kt b/backend.native/tests/external/codegen/box/closures/localReturn.kt deleted file mode 100644 index cf6e749f41f..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localReturn.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun box(): String { - val a = 1 - val explicitlyReturned = run1 f@{ - if (a > 0) - return@f "OK" - else "Fail 1" - } - if (explicitlyReturned != "OK") return explicitlyReturned - - val implicitlyReturned = run1 f@{ - if (a < 0) - return@f "Fail 2" - else "OK" - } - if (implicitlyReturned != "OK") return implicitlyReturned - return "OK" -} - -fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/localReturnWithAutolabel.kt b/backend.native/tests/external/codegen/box/closures/localReturnWithAutolabel.kt deleted file mode 100644 index 577f2100352..00000000000 --- a/backend.native/tests/external/codegen/box/closures/localReturnWithAutolabel.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun box(): String { - val a = 1 - val explicitlyReturned = run1 { - if (a > 0) - return@run1 "OK" - else "Fail 1" - } - if (explicitlyReturned != "OK") return explicitlyReturned - - val implicitlyReturned = run1 { - if (a < 0) - return@run1 "Fail 2" - else "OK" - } - if (implicitlyReturned != "OK") return implicitlyReturned - return "OK" -} - -fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/closures/noRefToOuter.kt b/backend.native/tests/external/codegen/box/closures/noRefToOuter.kt deleted file mode 100644 index 366bfc3f5cc..00000000000 --- a/backend.native/tests/external/codegen/box/closures/noRefToOuter.kt +++ /dev/null @@ -1,22 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME - -class A { - fun f(): () -> String { - val s = "OK" - return { -> s } - } -} - -fun box(): String { - val lambdaClass = A().f().javaClass - val fields = lambdaClass.getDeclaredFields().toList() - if (fields.size != 1) return "Fail: lambda should only capture 's': $fields" - - val fieldName = fields[0].getName() - if (fieldName != "\$s") return "Fail: captured variable should be named '\$s': $fields" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/recursiveClosure.kt b/backend.native/tests/external/codegen/box/closures/recursiveClosure.kt deleted file mode 100644 index 25c8a6a86ce..00000000000 --- a/backend.native/tests/external/codegen/box/closures/recursiveClosure.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo(s: String): String { - fun bar(count: Int): String = - if (count == 0) s else bar(count - 1) - return bar(10) -} - -fun box(): String = foo("OK") diff --git a/backend.native/tests/external/codegen/box/closures/refsAreSerializable.kt b/backend.native/tests/external/codegen/box/closures/refsAreSerializable.kt deleted file mode 100644 index 1b6f28b5d6b..00000000000 --- a/backend.native/tests/external/codegen/box/closures/refsAreSerializable.kt +++ /dev/null @@ -1,34 +0,0 @@ -// IGNORE_BACKEND: JS, NATIVE - -import java.io.* - -fun box(): String { - var o = "" - var b = 1.toByte() - var d = 1.0 - var f = 1.0f - var i = 1 - var j = 1L - var s = 1.toShort() - var c = '1' - var z = true - - val lambda = fun(): String { - o = "OK" - b++; d++; f++; i++; j++; s++; c++ - z = false - return "$o $b $d $f $i $j $s $c $z" - } - - val baos = ByteArrayOutputStream() - val oos = ObjectOutputStream(baos) - oos.writeObject(lambda) - oos.close() - - val bais = ByteArrayInputStream(baos.toByteArray()) - val ois = ObjectInputStream(bais) - val result = (ois.readObject() as () -> String)() - ois.close() - - return if (result == "OK 2 2.0 2.0 2 2 2 2 false") "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/closures/simplestClosure.kt b/backend.native/tests/external/codegen/box/closures/simplestClosure.kt deleted file mode 100644 index 7a9f3b439cf..00000000000 --- a/backend.native/tests/external/codegen/box/closures/simplestClosure.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box() : String { - return invoker( {"OK"} ) -} - -fun invoker(gen : () -> String) : String { - return gen() -} diff --git a/backend.native/tests/external/codegen/box/closures/simplestClosureAndBoxing.kt b/backend.native/tests/external/codegen/box/closures/simplestClosureAndBoxing.kt deleted file mode 100644 index 50f22fbeb8d..00000000000 --- a/backend.native/tests/external/codegen/box/closures/simplestClosureAndBoxing.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box() : String { - return if (int_invoker( { 7 } ) == 7) "OK" else "fail" -} - -fun int_invoker(gen : () -> Int) : Int { - return gen() -} diff --git a/backend.native/tests/external/codegen/box/closures/subclosuresWithinInitializers.kt b/backend.native/tests/external/codegen/box/closures/subclosuresWithinInitializers.kt deleted file mode 100644 index 3f76b76193e..00000000000 --- a/backend.native/tests/external/codegen/box/closures/subclosuresWithinInitializers.kt +++ /dev/null @@ -1,24 +0,0 @@ -fun run(block: () -> R) = block() -inline fun inlineRun(block: () -> R) = block() - -class Outer(val outerProp: String) { - fun foo(arg: String): String { - class Local { - val work1 = run { outerProp + arg } - val work2 = inlineRun { outerProp + arg } - val obj = object : Any() { - override fun toString() = outerProp + arg - } - - override fun toString() = "${work1}#${work2}#${obj.toString()}" - } - - return Local().toString() - } -} - -fun box(): String { - val res = Outer("O").foo("K") - if (res != "OK#OK#OK") return "fail: $res" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/closures/underscoreParameters.kt b/backend.native/tests/external/codegen/box/closures/underscoreParameters.kt deleted file mode 100644 index 02b96fd24f0..00000000000 --- a/backend.native/tests/external/codegen/box/closures/underscoreParameters.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K") - -fun box() = foo { x, _, y -> x + y } diff --git a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt b/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt deleted file mode 100644 index ccab06759ae..00000000000 --- a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt +++ /dev/null @@ -1,45 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_REFLECT - -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -import java.util.Arrays -import kotlin.reflect.KClass -import kotlin.reflect.KFunction0 - -inline fun test(kFunction: KFunction0, test: T.() -> Unit) { - val annotation = kFunction.annotations.single() as T - annotation.test() -} - -fun check(b: Boolean, message: String) { - if (!b) throw RuntimeException(message) -} - -annotation class Foo(val a: FloatArray = [], val b: Array = [], val c: Array> = []) - -@Foo(a = [1f, 2f, 1 / 0f]) -fun test1() {} - -@Foo(b = ["Hello", ", ", "Kot" + "lin"]) -fun test2() {} - -@Foo(c = [Int::class, Array::class, Foo::class]) -fun test3() {} - -fun box(): String { - test(::test1) { - check(a.contentEquals(floatArrayOf(1f, 2f, Float.POSITIVE_INFINITY)), "Fail 1: ${a.joinToString()}") - } - - test(::test2) { - check(b.contentEquals(arrayOf("Hello", ", ", "Kotlin")), "Fail 2: ${b.joinToString()}") - } - - test(::test3) { - check(c.contentEquals(arrayOf(Int::class, Array::class, Foo::class)), "Fail 3: ${c.joinToString()}") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt b/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt deleted file mode 100644 index 48d382901d4..00000000000 --- a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt +++ /dev/null @@ -1,38 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_REFLECT - -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -import java.util.Arrays -import kotlin.reflect.KFunction0 - -inline fun test(kFunction: KFunction0, test: T.() -> Unit) { - val annotation = kFunction.annotations.single() as T - annotation.test() -} - -fun check(b: Boolean, message: String) { - if (!b) throw RuntimeException(message) -} - -annotation class Foo(val a: IntArray = [], val b: Array = []) - -const val ONE_INT = 1 -const val ONE_FLOAT = 1f -const val HELLO = "hello" -const val C_CHAR = 'c' - -@Foo( - a = [ONE_INT, ONE_INT + ONE_FLOAT.toInt(), ONE_INT + 10, (ONE_INT % 1.0).toInt()], - b = [HELLO, HELLO + C_CHAR, HELLO + ", Kotlin", C_CHAR.toString() + C_CHAR]) -fun test1() {} - -fun box(): String { - test(::test1) { - check(a.contentEquals(intArrayOf(1, 2, 11, 0)), "Fail 1: ${a.joinToString()}") - check(b.contentEquals(arrayOf("hello", "helloc", "hello, Kotlin", "cc")), "Fail 2: ${b.joinToString()}") - } - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt b/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt deleted file mode 100644 index fb8982083db..00000000000 --- a/backend.native/tests/external/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt +++ /dev/null @@ -1,40 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_REFLECT - -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -import java.util.Arrays -import kotlin.reflect.KClass -import kotlin.reflect.KFunction0 - -inline fun test(kFunction: KFunction0, test: T.() -> Unit) { - val annotation = kFunction.annotations.single() as T - annotation.test() -} - -fun check(b: Boolean, message: String) { - if (!b) throw RuntimeException(message) -} - -annotation class Foo(vararg val a: String = ["a", "b"]) - -annotation class Bar(vararg val a: KClass<*> = [Int::class]) - -@Foo(*["/"]) -fun test1() {} - -@Bar(*[Long::class, String::class]) -fun test2() {} - -fun box(): String { - test(::test1) { - check(a.contentEquals(arrayOf("/")), "Fail 1: ${a.joinToString()}") - } - - test(::test2) { - check(a.contentEquals(arrayOf(Long::class, String::class)), "Fail 2: ${a.joinToString()}") - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt b/backend.native/tests/external/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt deleted file mode 100644 index 644243153a2..00000000000 --- a/backend.native/tests/external/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt +++ /dev/null @@ -1,40 +0,0 @@ -// LANGUAGE_VERSION: 1.2 -// WITH_REFLECT - -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: NATIVE - -import java.util.Arrays -import kotlin.reflect.KClass -import kotlin.reflect.KFunction0 - -inline fun test(kFunction: KFunction0, test: T.() -> String): String { - val annotation = kFunction.annotations.single() as T - return annotation.test() -} - -fun check(b: Boolean, message: String) { - if (!b) throw RuntimeException(message) -} - -annotation class Foo( - val a: IntArray = [], - val b: IntArray = [1, 2, 3], - val c: Array = ["/"], - val d: Array> = [Int::class, Array::class], - val e: DoubleArray = [1.0] -) - -@Foo -fun withAnn() {} - -fun box(): String { - return test(::withAnn) { - check(a.contentEquals(intArrayOf()), "Fail 1: ${a.joinToString()}") - check(b.contentEquals(intArrayOf(1, 2, 3)), "Fail 2: ${b.joinToString()}") - check(c.contentEquals(arrayOf("/")), "Fail 3: ${c.joinToString()}") - check(d.contentEquals(arrayOf(Int::class, Array::class)), "Fail 4: ${d.joinToString()}") - check(e.contentEquals(doubleArrayOf(1.0)), "Fail 5: ${e.joinToString()}") - "OK" - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/collections/charSequence.kt b/backend.native/tests/external/codegen/box/collections/charSequence.kt deleted file mode 100644 index 2e7a8611009..00000000000 --- a/backend.native/tests/external/codegen/box/collections/charSequence.kt +++ /dev/null @@ -1,70 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - public static class B extends A { - public int getLength() { return 456; } - public char get(int index) { - if (index == 1) return 'a'; - return super.get(index); - } - } - - public static String foo() { - B b = new B(); - CharSequence cs = (CharSequence) b; - - if (cs.length() != 456) return "fail 01"; - if (b.length() != 456) return "fail 02"; - if (b.getLength() != 456) return "fail 03"; - - if (cs.charAt(0) != 'z') return "fail 1"; - if (b.get(0) != 'z') return "fail 2"; - - if (cs.charAt(1) != 'a') return "fail 3"; - if (b.get(1) != 'a') return "fail 4"; - - return "OK"; - } -} - -// FILE: test.kt - -open class A : CharSequence { - override val length: Int = 123 - - override fun get(index: Int) = 'z'; - - override fun subSequence(start: Int, end: Int): CharSequence { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val b = J.B() - val a = A() - - if (b[0] != 'z') return "fail 6" - if (a[0] != 'z') return "fail 7" - if (b[1] != 'a') return "fail 8" - if (a[0] != 'z') return "fail 9" - - if (b.get(0) != 'z') return "fail 10" - if (a.get(0) != 'z') return "fail 11" - if (b.get(1) != 'a') return "fail 12" - if (a.get(1) != 'z') return "fail 13" - - var cs: CharSequence = a - if (a.length != 123) return "fail 14" - if (cs.length != 123) return "fail 15" - - cs = b - if (b.length != 456) return "fail 16" - if (b.length != 456) return "fail 17" - - return J.foo(); -} diff --git a/backend.native/tests/external/codegen/box/collections/implementCollectionThroughKotlin.kt b/backend.native/tests/external/codegen/box/collections/implementCollectionThroughKotlin.kt deleted file mode 100644 index 036eb71f713..00000000000 --- a/backend.native/tests/external/codegen/box/collections/implementCollectionThroughKotlin.kt +++ /dev/null @@ -1,97 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -public class J extends MyList { - @Override - public int getSize() { - return 55; - } - - @Override - public int lastIndexOf(String s) { - return 0; - } - - @Override - public int indexOf(String s) { - return 0; - } - - @Override - public boolean contains(String s) { - return true; - } - - @Override - public boolean isEmpty() { - return false; - } - - @NotNull - @Override - public Iterator iterator() { - return null; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public String get(int index) { - return null; - } - - @Override - public List subList(int i, int i1) { - return super.subList(i, i1); - } - - @Override - public ListIterator listIterator(int i) { - return super.listIterator(i); - } - - @Override - public ListIterator listIterator() { - return super.listIterator(); - } -} - -// FILE: test.kt - -abstract class MyList : List - -class ListImpl : J() { - override val size: Int get() = super.size + 1 -} - -fun box(): String { - val impl = ListImpl() - if (impl.size != 56) return "fail 1" - if (!impl.contains("abc")) return "fail 2" - - val l: List = impl - - if (l.size != 56) return "fail 3" - if (!l.contains("abc")) return "fail 4" - - val anyList: List = impl as List - - if (anyList.size != 56) return "fail 5" - if (!anyList.contains("abc")) return "fail 6" - - if (anyList.contains(1)) return "fail 7" - if (anyList.contains(null)) return "fail 8" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/inSetWithSmartCast.kt b/backend.native/tests/external/codegen/box/collections/inSetWithSmartCast.kt deleted file mode 100644 index ee4987608d6..00000000000 --- a/backend.native/tests/external/codegen/box/collections/inSetWithSmartCast.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_RUNTIME - -fun contains(set: Set, x: Int): Boolean = when { - set.size == 0 -> false - else -> x in set as Set -} - -fun box(): String { - val set = setOf(1) - if (contains(set, 1)) { - return "OK" - } - - return "Fail" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequence.kt b/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequence.kt deleted file mode 100644 index ebabbd76ec2..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequence.kt +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - abstract static public class AImpl { - public char charAt(int index) { - return 'A'; - } - - public final int length() { return 56; } - } - - public static class A extends AImpl implements CharSequence { - public CharSequence subSequence(int start, int end) { - return null; - } - } -} - -// FILE: test.kt - -class X : J.A() - -fun box(): String { - val x = X() - if (x.length != 56) return "fail 1" - if (x[0] != 'A') return "fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequenceKotlin.kt b/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequenceKotlin.kt deleted file mode 100644 index 83900da8bf0..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantImplCharSequenceKotlin.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: J.java - -public class J { - public static class A extends AImpl implements CharSequence { - public CharSequence subSequence(int start, int end) { - return null; - } - } -} - -// FILE: test.kt - -abstract class AImpl { - fun charAt(index: Int): Char { - return 'A' - } - - fun length(): Int { - return 56 - } -} - -class X : J.A() - -fun box(): String { - val x = X() - if (x.length != 56) return "fail 1" - if (x[0] != 'A') return "fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableList.kt b/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableList.kt deleted file mode 100644 index 353ad6ab61d..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableList.kt +++ /dev/null @@ -1,115 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; -public class J { - abstract static public class AImpl { - public final int size() { - return 56; - } - - public boolean isEmpty() { - return false; - } - - public final boolean contains(Object o) { - return true; - } - - public Iterator iterator() { - return null; - } - - public Object[] toArray() { - return new Object[0]; - } - - public T[] toArray(T[] a) { - return null; - } - - public boolean add(String s) { - return false; - } - - public boolean remove(Object o) { - return false; - } - - public boolean containsAll(Collection c) { - return false; - } - - public boolean addAll(Collection c) { - return false; - } - - public boolean addAll(int index, Collection c) { - return false; - } - - public boolean removeAll(Collection c) { - return false; - } - - public boolean retainAll(Collection c) { - return false; - } - - public void clear() { - - } - - public String get(int index) { - return null; - } - - public String set(int index, String element) { - return null; - } - - public void add(int index, String element) { - - } - - public String remove(int index) { - return null; - } - - public int indexOf(Object o) { - return 0; - } - - public int lastIndexOf(Object o) { - return 0; - } - - public ListIterator listIterator() { - return null; - } - - public ListIterator listIterator(int index) { - return null; - } - - public List subList(int fromIndex, int toIndex) { - return null; - } - } - - public static class A extends AImpl implements List { - } -} - -// FILE: test.kt - -class X : J.A() - -fun box(): String { - val x = X() - if (x.size != 56) return "fail 1" - if (!x.contains("")) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListKotlin.kt b/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListKotlin.kt deleted file mode 100644 index d99b4ea8ec1..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListKotlin.kt +++ /dev/null @@ -1,105 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: A.java - -public class A extends AImpl implements java.util.List { - public T[] toArray(T[] a) {return null;} - public Object[] toArray() {return null;} -} - -// FILE: test.kt - -public abstract class AImpl { - fun add(element: String): Boolean { - throw UnsupportedOperationException() - } - - fun remove(element: Any?): Boolean { - throw UnsupportedOperationException() - } - - @JvmSuppressWildcards(suppress = false) - fun addAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - fun addAll(index: Int, elements: Collection<@JvmWildcard String>): Boolean { - throw UnsupportedOperationException() - } - - fun removeAll(elements: Collection<*>): Boolean { - throw UnsupportedOperationException() - } - - fun retainAll(elements: Collection<*>): Boolean { - throw UnsupportedOperationException() - } - - fun clear() { - throw UnsupportedOperationException() - } - - fun set(index: Int, element: String): String { - throw UnsupportedOperationException() - } - - fun add(index: Int, element: String) { - throw UnsupportedOperationException() - } - - fun remove(index: Int): String { - throw UnsupportedOperationException() - } - - fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - fun size(): Int = 56 - - fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - fun contains(element: Any?) = true - - fun containsAll(elements: Collection<*>): Boolean { - throw UnsupportedOperationException() - } - - fun get(index: Int): String { - throw UnsupportedOperationException() - } - - fun indexOf(element: Any?): Int { - throw UnsupportedOperationException() - } - - fun lastIndexOf(element: Any?): Int { - throw UnsupportedOperationException() - } - - fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - - -class X : A() - -fun box(): String { - val x = X() - if (x.size != 56) return "fail 1" - if (!x.contains("")) return "fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListSubstitution.kt b/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListSubstitution.kt deleted file mode 100644 index 6e60e2782f2..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantImplMutableListSubstitution.kt +++ /dev/null @@ -1,115 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; -public class J { - abstract static public class AImpl { - public int size() { - return 56; - } - - public boolean isEmpty() { - return false; - } - - public final boolean contains(Object o) { - return true; - } - - public Iterator iterator() { - return null; - } - - public Object[] toArray() { - return new Object[0]; - } - - public T[] toArray(T[] a) { - return null; - } - - public boolean add(E s) { - return false; - } - - public boolean remove(Object o) { - return false; - } - - public boolean containsAll(Collection c) { - return false; - } - - public boolean addAll(Collection c) { - return false; - } - - public boolean addAll(int index, Collection c) { - return false; - } - - public boolean removeAll(Collection c) { - return false; - } - - public boolean retainAll(Collection c) { - return false; - } - - public void clear() { - - } - - public E get(int index) { - return null; - } - - public E set(int index, E element) { - return null; - } - - public void add(int index, E element) { - - } - - public E remove(int index) { - return null; - } - - public int indexOf(Object o) { - return 0; - } - - public int lastIndexOf(Object o) { - return 0; - } - - public ListIterator listIterator() { - return null; - } - - public ListIterator listIterator(int index) { - return null; - } - - public List subList(int fromIndex, int toIndex) { - return null; - } - } - - public static class A extends AImpl implements List { - } -} - -// FILE: test.kt - -class X : J.A() - -fun box(): String { - val x = X() - if (x.size != 56) return "fail 1" - if (!x.contains(null)) return "fail 2" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantRemoveAtOverrideInJava.kt b/backend.native/tests/external/codegen/box/collections/irrelevantRemoveAtOverrideInJava.kt deleted file mode 100644 index 41af923e660..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantRemoveAtOverrideInJava.kt +++ /dev/null @@ -1,112 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J implements Container { - final public String removeAt(int index) { return "abc"; } -} - -// FILE: test.kt - -interface Container { - fun removeAt(x: Int): String -} - -class A : J(), MutableList { - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun contains(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun get(index: Int): String { - throw UnsupportedOperationException() - } - - override fun indexOf(element: String): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(element: String): Int { - throw UnsupportedOperationException() - } - - override fun add(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(element: String): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: String): String { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: String) { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val a = A() - if (a.removeAt(0) != "abc") return "fail 1" - - val l: MutableList = a - if (l.removeAt(0) != "abc") return "fail 2" - - val anyList: MutableList = a as MutableList - if (anyList.removeAt(0) != "abc") return "fail 3" - - val container: Container = a - if (container.removeAt(0) != "abc") return "fail 4" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/irrelevantSizeOverrideInJava.kt b/backend.native/tests/external/codegen/box/collections/irrelevantSizeOverrideInJava.kt deleted file mode 100644 index b3d1023d3c7..00000000000 --- a/backend.native/tests/external/codegen/box/collections/irrelevantSizeOverrideInJava.kt +++ /dev/null @@ -1,46 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J implements Sized { - final public int getSize() { return 123; } -} - -// FILE: test.kt - -interface Sized { - val size: Int -} - -class A : J(), Collection { - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(element: T): Boolean { - throw UnsupportedOperationException() - } - - override fun iterator(): Iterator { - throw UnsupportedOperationException() - } - - override fun containsAll(elements: Collection): Boolean { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val a = A() - if (a.size != 123) return "fail 1" - - val c: Collection = a - if (c.size != 123) return "fail 2" - - val sized: Sized = a - if (sized.size != 123) return "fail 3" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/mutableList.kt b/backend.native/tests/external/codegen/box/collections/mutableList.kt deleted file mode 100644 index 8941b444032..00000000000 --- a/backend.native/tests/external/codegen/box/collections/mutableList.kt +++ /dev/null @@ -1,101 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} - -// FILE: test.kt - -open class KList : MutableList { - override fun add(e: E): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(o: E): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: E): E { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: E) { - throw UnsupportedOperationException() - } - - override fun removeAt(index: Int): E { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } - - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(o: E) = true - override fun containsAll(c: Collection) = true - - override fun get(index: Int): E { - throw UnsupportedOperationException() - } - - override fun indexOf(o: E): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(o: E): Int { - throw UnsupportedOperationException() - } -} - -fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/box/collections/noStubsInJavaSuperClass.kt b/backend.native/tests/external/codegen/box/collections/noStubsInJavaSuperClass.kt deleted file mode 100644 index c884c5cdeb3..00000000000 --- a/backend.native/tests/external/codegen/box/collections/noStubsInJavaSuperClass.kt +++ /dev/null @@ -1,69 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// FILE: B.java -public abstract class B extends A implements L { - public String callIndexAdd(int x) { - add(0, null); - return null; - } -} - -// FILE: main.kt -open class A : Collection { - override val size: Int - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. - - override fun contains(element: T): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun containsAll(elements: Collection): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun isEmpty(): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun iterator(): Iterator { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } -} - -interface L : List - -// 'add(Int; Object)' method must be present in C though it has supeclass that is subclass of List -class C : B() { - override fun get(index: Int): F { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun indexOf(element: F): Int { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun lastIndexOf(element: F): Int { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun listIterator(): ListIterator { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun listIterator(index: Int): ListIterator { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun subList(fromIndex: Int, toIndex: Int): List { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } -} - -fun box() = try { - C().callIndexAdd(1) - throw RuntimeException("fail 1") -} catch (e: UnsupportedOperationException) { - if (e.message != "Operation is not supported for read-only collection") throw RuntimeException("fail 2") - "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/platformValueContains.kt b/backend.native/tests/external/codegen/box/collections/platformValueContains.kt deleted file mode 100644 index 14d2cece53c..00000000000 --- a/backend.native/tests/external/codegen/box/collections/platformValueContains.kt +++ /dev/null @@ -1,54 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - public static String nullValue() { - return null; - } -} - -// FILE: test.kt - -class MySet : Set { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(o: String): Boolean { - throw UnsupportedOperationException() - } - - override fun iterator(): Iterator { - throw UnsupportedOperationException() - } - - override fun containsAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } -} - -fun box(): String { - val mySet = MySet() - - // no UnsupportedOperationException thrown - mySet.contains(J.nullValue()) - J.nullValue() in mySet - - val set: Set = mySet - set.contains(J.nullValue()) - J.nullValue() in set - - val anySet: Set = mySet as Set - anySet.contains(J.nullValue()) - anySet.contains(null) - J.nullValue() in anySet - null in anySet - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/collections/readOnlyList.kt b/backend.native/tests/external/codegen/box/collections/readOnlyList.kt deleted file mode 100644 index 041ec52be0b..00000000000 --- a/backend.native/tests/external/codegen/box/collections/readOnlyList.kt +++ /dev/null @@ -1,60 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} - -// FILE: test.kt - -open class KList : List { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - override fun contains(o: E) = true - override fun containsAll(c: Collection) = true - - override fun iterator(): Iterator { - throw UnsupportedOperationException() - } - - override fun get(index: Int): E { - throw UnsupportedOperationException() - } - - override fun indexOf(element: E): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(element: E): Int { - throw UnsupportedOperationException() - } - - override fun listIterator(): ListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): ListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): List { - throw UnsupportedOperationException() - } -} - -fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/box/collections/readOnlyMap.kt b/backend.native/tests/external/codegen/box/collections/readOnlyMap.kt deleted file mode 100644 index 89fd8d60c90..00000000000 --- a/backend.native/tests/external/codegen/box/collections/readOnlyMap.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - private static class MyMap extends KMap {} - - public static String foo() { - Map collection = new MyMap(); - if (!collection.containsKey("ABCDE")) return "fail 1"; - if (!collection.containsValue(1)) return "fail 2"; - return "OK"; - } -} - -// FILE: test.kt - -open class KMap : Map { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun containsKey(key: K) = true - override fun containsValue(value: V) = true - - override fun get(key: K): V? { - throw UnsupportedOperationException() - } - - override val keys: Set - get() = throw UnsupportedOperationException() - override val values: Collection - get() = throw UnsupportedOperationException() - override val entries: Set> - get() = throw UnsupportedOperationException() -} - -fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/box/collections/removeAtInt.kt b/backend.native/tests/external/codegen/box/collections/removeAtInt.kt deleted file mode 100644 index 8cb05571d02..00000000000 --- a/backend.native/tests/external/codegen/box/collections/removeAtInt.kt +++ /dev/null @@ -1,106 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - private static class MyList extends A {} - - public static String foo() { - MyList myList = new MyList(); - List list = (List) myList; - - if (!list.remove((Integer) 1)) return "fail 1"; - if (list.remove((int) 1) != 123) return "fail 2"; - - if (!myList.remove((Integer) 1)) return "fail 3"; - if (myList.remove((int) 1) != 123) return "fail 4"; - - if (myList.removeAt(1) != 123) return "fail 5"; - return "OK"; - } -} - -// FILE: test.kt - -open class A : MutableList { - override val size: Int - get() = throw UnsupportedOperationException() - override fun isEmpty(): Boolean = throw UnsupportedOperationException() - - override fun contains(o: Int): Boolean { - throw UnsupportedOperationException() - } - - override fun containsAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun get(index: Int): Int { - throw UnsupportedOperationException() - } - - override fun indexOf(o: Int): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(o: Int): Int { - throw UnsupportedOperationException() - } - - override fun add(e: Int): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(o: Int) = true - - override fun removeAt(index: Int): Int = 123 - - override fun addAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: Int): Int { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: Int) { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } -} - -fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/box/collections/strList.kt b/backend.native/tests/external/codegen/box/collections/strList.kt deleted file mode 100644 index b6d42fdbaff..00000000000 --- a/backend.native/tests/external/codegen/box/collections/strList.kt +++ /dev/null @@ -1,101 +0,0 @@ -// TARGET_BACKEND: JVM - -// FILE: J.java - -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} - -// FILE: test.kt - -abstract class KList : MutableList { - override val size: Int - get() = throw UnsupportedOperationException() - - override fun isEmpty(): Boolean { - throw UnsupportedOperationException() - } - - override fun contains(o: String) = true - override fun containsAll(c: Collection) = true - - override fun get(index: Int): String { - throw UnsupportedOperationException() - } - - override fun indexOf(o: String): Int { - throw UnsupportedOperationException() - } - - override fun lastIndexOf(o: String): Int { - throw UnsupportedOperationException() - } - - override fun iterator(): MutableIterator { - throw UnsupportedOperationException() - } - - override fun add(e: String): Boolean { - throw UnsupportedOperationException() - } - - override fun remove(o: String): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun addAll(index: Int, c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun removeAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun retainAll(c: Collection): Boolean { - throw UnsupportedOperationException() - } - - override fun clear() { - throw UnsupportedOperationException() - } - - override fun set(index: Int, element: String): String { - throw UnsupportedOperationException() - } - - override fun add(index: Int, element: String) { - throw UnsupportedOperationException() - } - - override fun removeAt(index: Int): String { - throw UnsupportedOperationException() - } - - override fun listIterator(): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun listIterator(index: Int): MutableListIterator { - throw UnsupportedOperationException() - } - - override fun subList(fromIndex: Int, toIndex: Int): MutableList { - throw UnsupportedOperationException() - } - -} -fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/box/collections/toArrayInJavaClass.kt b/backend.native/tests/external/codegen/box/collections/toArrayInJavaClass.kt deleted file mode 100644 index ac984435cda..00000000000 --- a/backend.native/tests/external/codegen/box/collections/toArrayInJavaClass.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -// WITH_RUNTIME -// FILE: B.java -public class B extends A { - @Override - public T[] toArray(T[] a) { - return a; - } -} - -// FILE: main.kt -open class A : Collection { - override val size: Int - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. - - override fun contains(element: T): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun containsAll(elements: Collection): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun isEmpty(): Boolean { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun iterator(): Iterator { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } -} - -fun box() = B().toArray(arrayOf("OK"))[0] diff --git a/backend.native/tests/external/codegen/box/compatibility/dataClassEqualsHashCodeToString.kt b/backend.native/tests/external/codegen/box/compatibility/dataClassEqualsHashCodeToString.kt deleted file mode 100644 index c0fd15fad4d..00000000000 --- a/backend.native/tests/external/codegen/box/compatibility/dataClassEqualsHashCodeToString.kt +++ /dev/null @@ -1,13 +0,0 @@ -// LANGUAGE_VERSION: 1.0 - -data class Foo(val s: String) - -fun box(): String { - val f1 = Foo("OK") - val f2 = Foo("OK") - if (f1 != f2) return "Fail equals" - if (f1.hashCode() != f2.hashCode()) return "Fail hashCode" - if (f1.toString() != f2.toString() || f1.toString() != "Foo(s=OK)") return "Fail toString: $f1 $f2" - - return f1.s -} diff --git a/backend.native/tests/external/codegen/box/constants/constantsInWhen.kt b/backend.native/tests/external/codegen/box/constants/constantsInWhen.kt deleted file mode 100644 index cbc39e03146..00000000000 --- a/backend.native/tests/external/codegen/box/constants/constantsInWhen.kt +++ /dev/null @@ -1,18 +0,0 @@ -fun test( - b: Boolean, - i: Int -) { - if (b) { - when (i) { - 0 -> foo(1) - else -> null - } - } else null -} - -fun foo(i: Int) = i - -fun box(): String { - test(true, 1) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constants/float.kt b/backend.native/tests/external/codegen/box/constants/float.kt deleted file mode 100644 index 5c60d382df1..00000000000 --- a/backend.native/tests/external/codegen/box/constants/float.kt +++ /dev/null @@ -1,18 +0,0 @@ -fun box(): String { - if (1F != 1.toFloat()) return "fail 1" - if (1.0F != 1.0.toFloat()) return "fail 2" - if (1e1F != 1e1.toFloat()) return "fail 3" - if (1.0e1F != 1.0e1.toFloat()) return "fail 4" - if (1e-1F != 1e-1.toFloat()) return "fail 5" - if (1.0e-1F != 1.0e-1.toFloat()) return "fail 6" - - if (1f != 1.toFloat()) return "fail 7" - if (1.0f != 1.0.toFloat()) return "fail 8" - if (1e1f != 1e1.toFloat()) return "fail 9" - if (1.0e1f != 1.0e1.toFloat()) return "fail 10" - if (1e-1f != 1e-1.toFloat()) return "fail 11" - if (1.0e-1f != 1.0e-1.toFloat()) return "fail 12" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/constants/kt9532.kt b/backend.native/tests/external/codegen/box/constants/kt9532.kt deleted file mode 100644 index bdf0164b927..00000000000 --- a/backend.native/tests/external/codegen/box/constants/kt9532.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: NATIVE - -object A { - const val a: String = "$" - const val b = "1234$a" - const val c = 10000 - - val bNonConst = "1234$a" - val bNullable: String? = "1234$a" -} - -object B { - const val a: String = "$" - const val b = "1234$a" - const val c = 10000 - - val bNonConst = "1234$a" - val bNullable: String? = "1234$a" -} - -fun box(): String { - if (A.a !== B.a) return "Fail 1: A.a !== B.a" - - if (A.b !== B.b) return "Fail 2: A.b !== B.b" - - if (A.c !== B.c) return "Fail 3: A.c !== B.c" - - if (A.bNonConst !== B.bNonConst) return "Fail 4: A.bNonConst !== B.bNonConst" - if (A.bNullable !== B.bNullable) return "Fail 5: A.bNullable !== B.bNullable" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constants/kt9532_lv10.kt b/backend.native/tests/external/codegen/box/constants/kt9532_lv10.kt deleted file mode 100644 index e33ebe3e95b..00000000000 --- a/backend.native/tests/external/codegen/box/constants/kt9532_lv10.kt +++ /dev/null @@ -1,34 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE -// LANGUAGE_VERSION: 1.0 - -object A { - const val a: String = "$" - const val b = "1234$a" - const val c = 10000 - - val bNonConst = "1234$a" - val bNullable: String? = "1234$a" -} - -object B { - const val a: String = "$" - const val b = "1234$a" - const val c = 10000 - - val bNonConst = "1234$a" - val bNullable: String? = "1234$a" -} - -fun box(): String { - if (A.a !== B.a) return "Fail 1: A.a !== B.a" - - if (A.b !== B.b) return "Fail 2: A.b !== B.b" - - if (A.c !== B.c) return "Fail 3: A.c !== B.c" - - if (A.bNonConst === B.bNonConst) return "Fail 4: A.bNonConst === B.bNonConst" - if (A.bNullable === B.bNullable) return "Fail 5: A.bNullable === B.bNullable" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constants/long.kt b/backend.native/tests/external/codegen/box/constants/long.kt deleted file mode 100644 index 7fa2eaf4f50..00000000000 --- a/backend.native/tests/external/codegen/box/constants/long.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - if (1L != 1.toLong()) return "fail 1" - if (0x1L != 0x1.toLong()) return "fail 2" - if (0X1L != 0X1.toLong()) return "fail 3" - if (0b1L != 0b1.toLong()) return "fail 4" - if (0B1L != 0B1.toLong()) return "fail 5" - - return "OK" -} - diff --git a/backend.native/tests/external/codegen/box/constants/privateConst.kt b/backend.native/tests/external/codegen/box/constants/privateConst.kt deleted file mode 100644 index 041cc94e9fd..00000000000 --- a/backend.native/tests/external/codegen/box/constants/privateConst.kt +++ /dev/null @@ -1,7 +0,0 @@ -private const val z = "OK"; - -fun box(): String { - return { - z - }() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/breakInConstructorArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/breakInConstructorArguments.kt deleted file mode 100644 index 13e8ce2d951..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/breakInConstructorArguments.kt +++ /dev/null @@ -1,39 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - var count = 0 - while (true) { - Foo( - logged("i", if (count == 0) 1 else break), - logged("j", 2) - ) - count++ - } - - val result = log.toString() - if (result != "ij") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Int) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/continueInConstructorArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/continueInConstructorArguments.kt deleted file mode 100644 index 52d81e4f22c..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/continueInConstructorArguments.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - var count = 0 - while (true) { - count++ - if (count > 1) break - Foo( - logged("i", if (count == 1) 1 else continue), - logged("j", 2) - ) - } - - val result = log.toString() - if (result != "ij") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Int) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/earlyReturnInConstructorArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/earlyReturnInConstructorArguments.kt deleted file mode 100644 index 3497418bfb0..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/earlyReturnInConstructorArguments.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -inline fun ok(): String { - return foo(1, 1.0, 1.0f, 1L, "O", C(if (bar()) return "zap" else "K")) -} - -fun box(): String { - val ok = ok() - if (ok != "OK") return "Fail: $ok" - - val r = log.toString() - if (r != ";bar;;foo;") return "Fail: '$r'" - - return "OK" -} - -// FILE: C.kt -class C(val str: String) { - init { - log.append(";") - } - - companion object { - init { - log.append(";") - } - } -} - -// FILE: util.kt -fun foo(x: Int, a: Double, b: Float, y: Long, z: String, c: C) = - logged("foo;", z + c.str) - -fun bar() = logged("bar;", false) - -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallEvaluationOrder.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallEvaluationOrder.kt deleted file mode 100644 index 6a07675236f..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallEvaluationOrder.kt +++ /dev/null @@ -1,40 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - Foo( - logged("i", 1.let { it }), - logged("j", - Foo( - logged("k", 2.let { it }), - null - ) - ) - ) - - val result = log.toString() - if (result != "ikj") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Foo?) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt deleted file mode 100644 index 79020cc9986..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=disable -// FILE: test.kt -fun box(): String { - Foo( - logged("i", 1.let { it }), - logged("j", - Foo( - logged("k", 2.let { it }), - null - ) - ) - ) - - val result = log.toString() - if (result != "ikj") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Foo?) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt deleted file mode 100644 index 64c7310ef57..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable -// FILE: test.kt -fun box(): String { - Foo( - logged("i", 1.let { it }), - logged("j", - Foo( - logged("k", 2.let { it }), - null - ) - ) - ) - - val result = log.toString() - if (result != "ikj") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Foo?) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt deleted file mode 100644 index 65ef307f5b8..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=preserve-class-initialization -// FILE: test.kt -fun box(): String { - Foo( - logged("i", 1.let { it }), - logged("j", - Foo( - logged("k", 2.let { it }), - null - ) - ) - ) - - val result = log.toString() - if (result != "ikj") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Foo?) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInInnerClassConstructorCall.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInInnerClassConstructorCall.kt deleted file mode 100644 index 9292242e2b6..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInInnerClassConstructorCall.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - Outer().Inner( - logged("i;", 1.let { it }), - logged("j;", 2.let { it }) - ) - - val result = log.toString() - if (result != "Foo.;i;j;Foo.;Inner.;") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -open class Foo { - init { - log.append("Foo.;") - } - - companion object { - init { - log.append("Foo.;") - } - } -} - -class Outer { - inner class Inner(val x: Int, val y: Int) : Foo() { - init { - log.append("Inner.;") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInLocalClassConstructorCall.kt b/backend.native/tests/external/codegen/box/constructorCall/inlineFunInLocalClassConstructorCall.kt deleted file mode 100644 index 7061885f7aa..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/inlineFunInLocalClassConstructorCall.kt +++ /dev/null @@ -1,41 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - class Local(val i: Int, val j: Int) : Foo() { - init { - log.append("Local.;") - } - } - - Local( - logged("i;", 1.let { it }), - logged("j;", 2.let { it }) - ) - - val result = log.toString() - if (result != "Foo.;i;j;Foo.;Local.;") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -open class Foo { - init { - log.append("Foo.;") - } - - companion object { - init { - log.append("Foo.;") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt deleted file mode 100644 index 151cc983141..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - for (count in 0..3) { - val test = Foo(count, Foo(1, "x", 2), if (count > 0) break else 3) - if (count > 0) return "Fail: count = $count" - if (test.toString() != "Foo(0,Foo(1,x,2),3)") return "Fail: ${test.toString()}" - } - - return "OK" -} - - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(val a: Int, val b: Any, val c: Int) { - init { - log.append("") - } - - override fun toString() = "Foo($a,$b,$c)" - - companion object { - init { - log.append("") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/nonLocalReturnInConstructorArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/nonLocalReturnInConstructorArguments.kt deleted file mode 100644 index a70e2a8a4ec..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/nonLocalReturnInConstructorArguments.kt +++ /dev/null @@ -1,43 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - run L1@{ - var count = 0 - run { - while (true) { - Foo( - logged("i", if (count == 0) 1 else return@L1), - logged("j", 2) - ) - count++ - } - } - } - - val result = log.toString() - if (result != "ij") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Int) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/possiblyPoppedUnitializedValueInArguments.kt b/backend.native/tests/external/codegen/box/constructorCall/possiblyPoppedUnitializedValueInArguments.kt deleted file mode 100644 index d889fb109ff..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/possiblyPoppedUnitializedValueInArguments.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - for (count in 0..3) { - val test = Foo(count, Foo(1, "x", if (count > 0) break else 2), 3) - if (count > 0) return "Fail: count = $count" - if (test.toString() != "Foo(0,Foo(1,x,2),3)") return "Fail: ${test.toString()}" - } - - return "OK" -} - - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(val a: Int, val b: Any, val c: Int) { - init { - log.append("") - } - - override fun toString() = "Foo($a,$b,$c)" - - companion object { - init { - log.append("") - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/constructorCall/regularConstructorCallEvaluationOrder.kt b/backend.native/tests/external/codegen/box/constructorCall/regularConstructorCallEvaluationOrder.kt deleted file mode 100644 index dcba51be98f..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/regularConstructorCallEvaluationOrder.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - Foo(logged("i", 1), logged("j", 2)) - - val result = log.toString() - if (result != "ij") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Int) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/constructorCall/tryCatchInConstructorCallEvaluationOrder.kt b/backend.native/tests/external/codegen/box/constructorCall/tryCatchInConstructorCallEvaluationOrder.kt deleted file mode 100644 index 4e3e586d5c4..00000000000 --- a/backend.native/tests/external/codegen/box/constructorCall/tryCatchInConstructorCallEvaluationOrder.kt +++ /dev/null @@ -1,35 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_RUNTIME -// FILE: test.kt -fun box(): String { - Foo( - logged("i", try { 1 } catch (e: Exception) { 42 }), - logged("j", 2) - ) - - val result = log.toString() - if (result != "ij") return "Fail: '$result'" - - return "OK" -} - -// FILE: util.kt -val log = StringBuilder() - -fun logged(msg: String, value: T): T { - log.append(msg) - return value -} - -// FILE: Foo.kt -class Foo(i: Int, j: Int) { - init { - log.append("") - } - - companion object { - init { - log.append("") - } - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/bottles.kt b/backend.native/tests/external/codegen/box/controlStructures/bottles.kt deleted file mode 100644 index 2d376593843..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/bottles.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var bottles = 99 - while (bottles > 0) { - // System.out.println("bottles of beer on the wall"); - bottles -= 1 - bottles-- - } - return if (bottles == -1) "OK" else "Fail $bottles" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakFromOuter.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakFromOuter.kt deleted file mode 100644 index 7566e7c14a9..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakFromOuter.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - OUTER@while (true) { - var x = "" - try { - do { - x = x + break@OUTER - } while (true) - } finally { - return "OK" - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInDoWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInDoWhile.kt deleted file mode 100644 index cd932454965..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInDoWhile.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - val ok: String? = "OK" - var res = "" - - do { - res += ok ?: break - } while (false) - - return res -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt deleted file mode 100644 index 203452b0a60..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/breakInExpr.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun test(str: String): String { - var s = "" - for (i in 1..3) { - s += if (i<2) str else break - } - return s -} - -fun box(): String = test("OK") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInDoWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInDoWhile.kt deleted file mode 100644 index d46fe01fd97..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInDoWhile.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - var i = 0 - do continue while (i++ < 3) - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt deleted file mode 100644 index 667cd474bd0..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/continueInExpr.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - var s = "OK" - for (i in 1..3) { - s = s + if (i<2) "" else continue - } - return s -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/inlineWithStack.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/inlineWithStack.kt deleted file mode 100644 index 7c5b904df3e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/inlineWithStack.kt +++ /dev/null @@ -1,17 +0,0 @@ -inline fun bar(block: () -> String) : String { - return block() -} - -inline fun bar2() : String { - while (true) break - return bar { return "def" } -} - -fun foobar(x: String, y: String, z: String) = x + y + z - -fun box(): String { - val test = foobar("abc", bar2(), "ghi") - return if (test == "abcdefghi") - "OK" - else "Failed, test=$test" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt deleted file mode 100644 index 96cf2e2eaec..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var x = "OK" - do { - while (true) { - x = x + break - } - } while (false) - return x -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt14581.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt14581.kt deleted file mode 100644 index 0010f1ffdbd..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt14581.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun foo(x: String): String { - var y: String - do { - y = x - } while (y != x.bar(x)) - return y -} - -inline fun String.bar(other: String) = this - -fun box(): String = foo("OK") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713.kt deleted file mode 100644 index 91199580064..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713.kt +++ /dev/null @@ -1,30 +0,0 @@ -class MyQueue { - fun poll(): String? = null -} - -class A { - val delayedQueue = MyQueue() - - fun next() { - while (true) { - delayedQueue.poll() ?: break - } - - while (true) { - unblock(delayedQueue.poll() ?: break) - } - - while (true) { - unblock(delayedQueue.poll() ?: break) - } - } - - fun unblock(p: String) { - - } -} - -fun box() : String { - A().next() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713_2.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713_2.kt deleted file mode 100644 index 17a4079833e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt16713_2.kt +++ /dev/null @@ -1,32 +0,0 @@ -class MyQueue { - fun poll(): String? = null -} - -class A { - val delayedQueue = MyQueue() - - var cond = true - - fun next() { - while (cond) { - delayedQueue.poll() ?: break - } - - while (cond) { - unblock(delayedQueue.poll() ?: break) - } - - while (cond) { - unblock(delayedQueue.poll() ?: break) - } - } - - fun unblock(p: String) { - - } -} - -fun box() : String { - A().next() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt deleted file mode 100644 index 21aa85b6baa..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt +++ /dev/null @@ -1,26 +0,0 @@ -fun returnNullable(): String? = null - -inline fun Array.matchAll(fn: (String) -> Unit) { - for (string in this) { - fn(returnNullable() ?: continue) - } -} - -fun Array.matchAll2(fn: (String) -> Unit) { - matchAll(fn) -} - -inline fun Array.matchAll3(crossinline fn: (String) -> Unit) { - matchAll2 { fn(it) } -} - -fun test(a: Array) { - a.matchAll {} - a.matchAll2 {} - a.matchAll3 {} -} - -fun box(): String { - test(arrayOf("")) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022And.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022And.kt deleted file mode 100644 index 757b5c940be..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022And.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var cycle = true; - while (true) { - if (true && break) { - return "fail" - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022Or.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022Or.kt deleted file mode 100644 index 3b8a943d781..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/kt9022Or.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - var cycle = true; - while (true) { - if (true || break) { - return "OK" - } - } - return "fail" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/pathologicalDoWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/pathologicalDoWhile.kt deleted file mode 100644 index 4e97011ed2c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/pathologicalDoWhile.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - var flag = false - do { - if (flag) break - continue - } while (false) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/popSizes.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/popSizes.kt deleted file mode 100644 index 8c736e5952b..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/popSizes.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun foo(x: Long, y: Int, z: Double, s: String) {} - -fun box(): String { - while (true) { - try { - foo(0, 0, 0.0, "" + continue) - } - finally { - foo(0, 0, 0.0, "" + break) - } - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally1.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally1.kt deleted file mode 100644 index b918861535a..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally1.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - var x = "OK" - while (true) { - try { - x = x + continue - } - finally { - x = x + break - } - } - return x -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt deleted file mode 100644 index 147362a181c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/tryFinally2.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun box(): String { - var r = "" - for (i in 1..1) { - try { - r += "O" - break - } finally { - r += "K" - continue - } - } - return r -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/whileTrueBreak.kt b/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/whileTrueBreak.kt deleted file mode 100644 index 09b73099a16..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakContinueInExpressions/whileTrueBreak.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - while (true) break - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/breakInFinally.kt b/backend.native/tests/external/codegen/box/controlStructures/breakInFinally.kt deleted file mode 100644 index d761ee60360..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/breakInFinally.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - while (true) { - try { - continue; - } - finally { - break; - } - } - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/compareBoxedIntegerToZero.kt b/backend.native/tests/external/codegen/box/controlStructures/compareBoxedIntegerToZero.kt deleted file mode 100644 index 6b2091be148..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/compareBoxedIntegerToZero.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val x: Int? = 0 - if (x != 0) return "Fail $x" - if (0 != x) return "Fail $x" - if (!(x == 0)) return "Fail $x" - if (!(0 == x)) return "Fail $x" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/conditionOfEmptyIf.kt b/backend.native/tests/external/codegen/box/controlStructures/conditionOfEmptyIf.kt deleted file mode 100644 index 153b73525c7..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/conditionOfEmptyIf.kt +++ /dev/null @@ -1,13 +0,0 @@ -var result = "Fail" - -fun setOK(): Boolean { - result = "OK" - return true -} - -fun box(): String { - if (setOK()) { - } else { - } - return result -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/continueInExpr.kt b/backend.native/tests/external/codegen/box/controlStructures/continueInExpr.kt deleted file mode 100644 index 328f8efafec..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/continueInExpr.kt +++ /dev/null @@ -1,16 +0,0 @@ -// WITH_RUNTIME - -fun concatNonNulls(strings: List): String { - var result = "" - for (str in strings) { - result += str?:continue - } - return result -} - -fun box(): String { - val test = concatNonNulls(listOf("abc", null, null, "", null, "def")) - if (test != "abcdef") return "Failed: test=$test" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/continueInFor.kt b/backend.native/tests/external/codegen/box/controlStructures/continueInFor.kt deleted file mode 100644 index 7d5bb6a3dc4..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/continueInFor.kt +++ /dev/null @@ -1,123 +0,0 @@ -fun for_int_range(): Int { - var c = 0 - for (i in 1..10) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_byte_range(): Int { - var c = 0 - val from: Byte = 1 - val to: Byte = 10 - for (i in from..to) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_long_range(): Int { - var c = 0 - val from: Long = 1 - val to: Long = 10 - for (i in from..to) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_int_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_byte_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_long_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_double_list(): Int { - val a = ArrayList() - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_object_list(): Int { - val a = ArrayList() - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_str_array(): Int { - val a = arrayOfNulls(10) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun for_intarray(): Int { - val a = IntArray(10) - var c = 0 - for (i in a) { - if (c >= 5) continue - c++ - } - return c -} - -fun box(): String { - if (for_int_range() != 5) return "fail 1" - if (for_byte_range() != 5) return "fail 2" - if (for_long_range() != 5) return "fail 3" - if (for_intarray() != 5) return "fail 4" - if (for_str_array() != 5) return "fail 5" - if (for_int_list() != 5) return "fail 6" - if (for_byte_list() != 5) return "fail 7" - if (for_long_list() != 5) return "fail 8" - if (for_double_list() != 5) return "fail 9" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/continueInForCondition.kt b/backend.native/tests/external/codegen/box/controlStructures/continueInForCondition.kt deleted file mode 100644 index 3ebace16102..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/continueInForCondition.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME - -fun foo(): List? = listOf("abcde") - -fun box(): String { - for (i in 1..3) { - for (value in foo() ?: continue) { - if (value != "abcde") return "Fail" - } - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/continueInWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/continueInWhile.kt deleted file mode 100644 index 79b4ea623ff..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/continueInWhile.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun foo(i: Int): Int { - var count = i; - var result = 0; - while(count > 0) { - count = count - 1; - if (count <= 2) continue; - result = result + count; - } - return result; -} - -fun box(): String { - if (foo(4) != 3) return "Fail 1" - if (foo(5) != 7) return "Fail 2" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/continueToLabelInFor.kt b/backend.native/tests/external/codegen/box/controlStructures/continueToLabelInFor.kt deleted file mode 100644 index fe644d6e64b..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/continueToLabelInFor.kt +++ /dev/null @@ -1,123 +0,0 @@ -fun for_int_range(): Int { - var c = 0 - loop@ for (i in 1..10) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_byte_range(): Int { - var c = 0 - val from: Byte = 1 - val to: Byte = 10 - loop@ for (i in from..to) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_long_range(): Int { - var c = 0 - val from: Long = 1 - val to: Long = 10 - loop@ for (i in from..to) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_int_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_byte_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_long_list(): Int { - val a = ArrayList() - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_double_list(): Int { - val a = ArrayList() - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_object_list(): Int { - val a = ArrayList() - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_str_array(): Int { - val a = arrayOfNulls(10) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun for_intarray(): Int { - val a = IntArray(10) - var c = 0 - loop@ for (i in a) { - if (c >= 5) continue@loop - c++ - } - return c -} - -fun box(): String { - if (for_int_range() != 5) return "fail 1" - if (for_byte_range() != 5) return "fail 2" - if (for_long_range() != 5) return "fail 3" - if (for_intarray() != 5) return "fail 4" - if (for_str_array() != 5) return "fail 5" - if (for_int_list() != 5) return "fail 6" - if (for_byte_list() != 5) return "fail 7" - if (for_long_list() != 5) return "fail 8" - if (for_double_list() != 5) return "fail 9" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/doWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/doWhile.kt deleted file mode 100644 index f9b776c736c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/doWhile.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box(): String { - var x = 0 - do x++ while (x < 5) - if (x != 5) return "Fail 1 $x" - - var y = 0 - do { y++ } while (y < 5) - if (y != 5) return "Fail 2 $y" - - var z = "" - do { z += z.length } while (z.length < 5) - if (z != "01234") return "Fail 3 $z" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/doWhileFib.kt b/backend.native/tests/external/codegen/box/controlStructures/doWhileFib.kt deleted file mode 100644 index 088f74cb660..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/doWhileFib.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun box(): String { - var fx = 1 - var fy = 1 - - do { - var tmp = fy - fy = fx + fy - fx = tmp - } while (fy < 100) - - return if (fy == 144) "OK" else "Fail $fx $fy" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/doWhileWithContinue.kt b/backend.native/tests/external/codegen/box/controlStructures/doWhileWithContinue.kt deleted file mode 100644 index bb9c73dc6a8..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/doWhileWithContinue.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun box(): String { - var i = 0 - do { - if (i++ > 100) break; - continue; - } while(false) - if (i != 1) return "Fail 1, expected 1, but $i" - - i = 0 - do { - if (i++ > 100) break; - continue; - } while(i<10) - if (i != 10) return "Fail 2, expected 10, but $i" - - i = 0 - do continue while(i++<10) - if (i != 11) return "Fail 3, expected 11, but $i" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/emptyDoWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/emptyDoWhile.kt deleted file mode 100644 index 0f52a36e3b6..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/emptyDoWhile.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - do while (false); - - var x = 0 - do while (x++<5); - if (x != 6) return "Fail: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/emptyFor.kt b/backend.native/tests/external/codegen/box/controlStructures/emptyFor.kt deleted file mode 100644 index 6a09c1b3b43..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/emptyFor.kt +++ /dev/null @@ -1,19 +0,0 @@ -var index = 0 - -interface IterableIterator : Iterator { - operator fun iterator(): Iterator = this -} - -val iterator = object : IterableIterator { - override fun hasNext() = index < 5 - override fun next() = index++ -} - -fun box(): String { - for (x in 1..5); - - for (x in iterator); - if (index != 5) return "Fail: $index" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/emptyWhile.kt b/backend.native/tests/external/codegen/box/controlStructures/emptyWhile.kt deleted file mode 100644 index c52c5124f52..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/emptyWhile.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun box(): String { - while (false); - - var x = 0 - while (x++<5); - if (x != 6) return "Fail: $x" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/factorialTest.kt b/backend.native/tests/external/codegen/box/controlStructures/factorialTest.kt deleted file mode 100644 index fdb108f8bdc..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/factorialTest.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_RUNTIME - -import kotlin.test.assertEquals - -fun facWhile(i: Int): Int { - var count = 1; - var result = 1; - while(count < i) { - count = count + 1; - result = result * count; - } - return result; -} - -fun facBreak(i: Int): Int { - var count = 1; - var result = 1; - while(true) { - count = count + 1; - result = result * count; - if (count == i) break; - } - return result; -} - -fun facDoWhile(i: Int): Int { - var count = 1; - var result = 1; - do { - count = count + 1; - result = result * count; - } while(count != i); - return result; -} - -fun box(): String { - assertEquals(6, facWhile(3)) - assertEquals(6, facBreak(3)) - assertEquals(6, facDoWhile(3)) - assertEquals(120, facWhile(5)) - assertEquals(120, facBreak(5)) - assertEquals(120, facDoWhile(5)) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/finallyOnEmptyReturn.kt b/backend.native/tests/external/codegen/box/controlStructures/finallyOnEmptyReturn.kt deleted file mode 100644 index db1262a9d7a..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/finallyOnEmptyReturn.kt +++ /dev/null @@ -1,14 +0,0 @@ -var result = "Fail" - -fun foo() { - try { - return - } finally { - result = "OK" - } -} - -fun box(): String { - foo() - return result -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forArrayList.kt b/backend.native/tests/external/codegen/box/controlStructures/forArrayList.kt deleted file mode 100644 index cce12773de3..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forArrayList.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_RUNTIME -val alist = arrayListOf(1, 2, 3) // : j.u.ArrayList - -fun box(): String { - var result = 0 - for (i: Int in alist) { - result += i - } - - return if (result == 6) "OK" else "fail: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/forArrayListMultiDecl.kt b/backend.native/tests/external/codegen/box/controlStructures/forArrayListMultiDecl.kt deleted file mode 100644 index 04bd627762e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forArrayListMultiDecl.kt +++ /dev/null @@ -1,12 +0,0 @@ -// WITH_RUNTIME -val alist = arrayListOf(1 to 2, 2 to 3, 3 to 4) - -fun box(): String { - var result = 0 - for ((i: Int, z: Int) in alist) { - - result += i + z - } - - return if (result == 15) "OK" else "fail: $result" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/forInCharSequence.kt b/backend.native/tests/external/codegen/box/controlStructures/forInCharSequence.kt deleted file mode 100644 index f4df7137f60..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forInCharSequence.kt +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var s = "" - for (c in StringBuilder("OK")) { - s += c - } - return s -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/forInCharSequenceMut.kt b/backend.native/tests/external/codegen/box/controlStructures/forInCharSequenceMut.kt deleted file mode 100644 index 6f2b3414c02..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forInCharSequenceMut.kt +++ /dev/null @@ -1,19 +0,0 @@ -// WITH_RUNTIME - -fun box(): String { - var clist = listOf('1', '2', '3', '4') - var res1 = "" - for (ch in clist) { - res1 += ch - clist = listOf() - } - - var s = "1234" - var res2 = "" - for (ch in s) { - res2 += ch - s = "" - } - - return if (res1 == res2) "OK" else "'$res1' != '$res2'" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/forInSmartCastToArray.kt b/backend.native/tests/external/codegen/box/controlStructures/forInSmartCastToArray.kt deleted file mode 100644 index 83a919d7e9f..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forInSmartCastToArray.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun f(x: Any?): Any? { - if (x is Array<*>) { - for (i in x) { - return i - } - } - return "FAIL" -} - -fun box(): String { - val a = arrayOfNulls(1) as Array - a[0] = "OK" - return f(a) as String -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forIntArray.kt b/backend.native/tests/external/codegen/box/controlStructures/forIntArray.kt deleted file mode 100644 index 9fc295b3eda..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forIntArray.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box() : String { - val a = arrayOfNulls(5) - var i = 0 - var sum = 0 - for(el in 0..4) { - a[i] = i++ - } - for (el in (a as Array)) { - sum = sum + el - } - if(sum != 10) return "a failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionAll.kt b/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionAll.kt deleted file mode 100644 index bd701f507a2..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionAll.kt +++ /dev/null @@ -1,26 +0,0 @@ -class It { -} - -class C { -} - -class X { - var hasNext = true - operator fun It.hasNext() = if (hasNext) {hasNext = false; true} else false - operator fun It.next() = 5 - operator fun C.iterator(): It = It() - - fun test() { - for (i in C()) { - foo(i) - } - } - -} - -fun foo(x: Int) {} - -fun box(): String { - X().test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionHasNext.kt b/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionHasNext.kt deleted file mode 100644 index fd0e52ec3f8..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionHasNext.kt +++ /dev/null @@ -1,26 +0,0 @@ -class It { - operator fun next() = 5 -} - -class C { - operator fun iterator(): It = It() -} - -class X { - var hasNext = true - operator fun It.hasNext() = if (hasNext) {hasNext = false; true} else false - - fun test() { - for (i in C()) { - foo(i) - } - } - -} - -fun foo(x: Int) {} - -fun box(): String { - X().test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionNext.kt b/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionNext.kt deleted file mode 100644 index bfc79302ec1..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forLoopMemberExtensionNext.kt +++ /dev/null @@ -1,29 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -class It { - var hasNext = true - operator fun hasNext() = if (hasNext) {hasNext = false; true} else false -} - -class C { - operator fun iterator(): It = It() -} - -class X { - operator fun It.next() = 5 - - fun test() { - for (i in C()) { - foo(i) - } - } - -} - -fun foo(x: Int) {} - -fun box(): String { - X().test() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forNullableIntArray.kt b/backend.native/tests/external/codegen/box/controlStructures/forNullableIntArray.kt deleted file mode 100644 index 10e29bcba89..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forNullableIntArray.kt +++ /dev/null @@ -1,15 +0,0 @@ -fun box() : String { - val b : Array = arrayOfNulls (5) - var i = 0 - var sum = 0 - while(i < 5) { - b[i] = i++ - } - sum = 0 - for (el in b) { - sum = sum + (el ?: 0) - } - if(sum != 10) return "b failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forPrimitiveIntArray.kt b/backend.native/tests/external/codegen/box/controlStructures/forPrimitiveIntArray.kt deleted file mode 100644 index 566894de73a..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forPrimitiveIntArray.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun box() : String { - val a = IntArray (5) - var i = 0 - var sum = 0 - for(el in 0..4) { - a[i] = i++ - } - for (el in a) { - sum = sum + el - } - if(sum != 10) return "a failed" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/forUserType.kt b/backend.native/tests/external/codegen/box/controlStructures/forUserType.kt deleted file mode 100644 index 6dfbdbd00d7..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/forUserType.kt +++ /dev/null @@ -1,117 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box() : String { - var sum : Int = 0 - var i = 0 - - val c6 = MyCollection4() - sum = 0 - for (el in c6) { - sum = sum + el - } - if(sum != 15) return "c6 failed" - - val c5 = MyCollection3() - sum = 0 - for (el in c5) { - sum = sum + (el ?: 0) - } - if(sum != 15) return "c5 failed" - - val c1: Iterable = MyCollection1() - sum = 0 - for (el in c1) { - sum = sum + el!! - } - if(sum != 15) return "c1 failed" - - val c2 = MyCollection1() - sum = 0 - for (el in c2) { - sum = sum + el!! - } - if(sum != 15) return "c2 failed" - - val c3: Iterable = MyCollection2() - sum = 0 - for (el in c3) { - sum = sum + el!! - } - if(sum != 15) return "c3 failed" - - val c4 = MyCollection2() - sum = 0 - for (el in c4) { - sum = sum + el!! - } - if(sum != 15) return "c4 failed" - - val a : Array = arrayOfNulls(5) as Array - for(el in 0..4) { - a[i] = i++ - } - sum = 0 - for (el in a) { - sum = sum + el!! - } - if(sum != 10) return "a failed" - - val b : Array = arrayOfNulls (5) - i = 0 - while(i < 5) { - b[i] = i++ - } - sum = 0 - for (el in b) { - sum = sum + (el ?: 0) - } - System.out?.println(sum) - if(sum != 10) return "b failed" - - return "OK" -} - -class MyCollection1(): Iterable { - override fun iterator(): Iterator = MyIterator() - - class MyIterator(): Iterator { - var k : Int = 5 - - override fun next() : Int = k-- - override fun hasNext() = k > 0 - } -} - -class MyCollection2(): Iterable { - override fun iterator(): Iterator = MyIterator() - - class MyIterator(): Iterator { - var k : Int = 5 - - override fun next() : Int = k-- - override fun hasNext() : Boolean = k > 0 - } -} - -class MyCollection3() { - operator fun iterator() = MyIterator() - - class MyIterator() { - var k : Int = 5 - - operator fun next() : Int? = k-- - operator fun hasNext() : Boolean = k > 0 - } -} - -class MyCollection4() { - operator fun iterator() = MyIterator() - - class MyIterator() { - var k : Int = 5 - - operator fun next() : Int = k-- - operator fun hasNext() = k > 0 - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/inRangeConditionsInWhen.kt b/backend.native/tests/external/codegen/box/controlStructures/inRangeConditionsInWhen.kt deleted file mode 100644 index 09f2faa5557..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/inRangeConditionsInWhen.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Int.contains(i : Int) = true - -fun box(): String { - when (1) { - in 2 -> return "OK" - else -> return "fail" - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt12908.kt b/backend.native/tests/external/codegen/box/controlStructures/kt12908.kt deleted file mode 100644 index e35d92b93dc..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt12908.kt +++ /dev/null @@ -1,20 +0,0 @@ -var field: Int = 0 - -fun next(): Int { - return ++field -} - - -fun box(): String { - val task: String - - do { - if (next() % 2 == 0) { - task = "OK" - break - } - } - while (true) - - return task -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt12908_2.kt b/backend.native/tests/external/codegen/box/controlStructures/kt12908_2.kt deleted file mode 100644 index f4fd0e0555e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt12908_2.kt +++ /dev/null @@ -1,20 +0,0 @@ -var field: Int = 0 - -fun next(): Int { - return ++field -} - - -fun box(): String { - val task: String - - do { - if (next() % 2 == 0) { - task = "OK" - break - } - } - while (!false) - - return task -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt1441.kt b/backend.native/tests/external/codegen/box/controlStructures/kt1441.kt deleted file mode 100644 index 7e5099064b0..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt1441.kt +++ /dev/null @@ -1,16 +0,0 @@ -class Foo { - var rnd = 10 - - public override fun equals(that : Any?) : Boolean = that is Foo && (that.rnd == rnd) -} - -fun box() : String { - val a = Foo() - val b = Foo() - if (a !== a) return "fail 1" - if (b !== b) return "fail 2" - if (b === a) return "fail 3" - if (a === b) return "fail 4" - if( a !=b ) return "fail5" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt14839.kt b/backend.native/tests/external/codegen/box/controlStructures/kt14839.kt deleted file mode 100644 index c76925da31f..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt14839.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - try { - } catch (e: Exception) { - inlineFunctionWithDefaultArguments(e) - } - return "OK" -} - -inline fun inlineFunctionWithDefaultArguments(t: Throwable? = null, bug: Boolean = true) = - Unit \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt15726.kt b/backend.native/tests/external/codegen/box/controlStructures/kt15726.kt deleted file mode 100644 index eb4e336f3e9..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt15726.kt +++ /dev/null @@ -1,26 +0,0 @@ - -fun nyCompiler() { - try { - return - } - catch (e: Exception) {} - finally { - try {} catch (e: Exception) {} - } -} - - -fun nyCompiler2() { - try { - return - } - finally { - try {} catch (e: Exception) {} - } -} - -fun box(): String { - nyCompiler() - nyCompiler2() - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt1688.kt b/backend.native/tests/external/codegen/box/controlStructures/kt1688.kt deleted file mode 100644 index 0bbc232c5f1..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt1688.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - var s = "" - try { - throw RuntimeException() - } catch (e : RuntimeException) { - } finally { - s += "OK" - } - return s -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt1742.kt b/backend.native/tests/external/codegen/box/controlStructures/kt1742.kt deleted file mode 100644 index 6e950e30e41..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt1742.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - val x = 2 - return when(x) { - in (1..3) -> "OK" - else -> "fail" - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt17590.kt b/backend.native/tests/external/codegen/box/controlStructures/kt17590.kt deleted file mode 100644 index 15dba9e8546..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt17590.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun zap(s: String): String? = s - -inline fun tryZap(s: String, fn: (String) -> String): String { - return fn(zap(s) ?: return "null") -} - -fun box() = tryZap("OK") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt17590_long.kt b/backend.native/tests/external/codegen/box/controlStructures/kt17590_long.kt deleted file mode 100644 index 521c7fd61cf..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt17590_long.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(x: Any?, y: Any?) = 0L - -inline fun test(value: Any?): Long { - return foo(null, value ?: return 1L) -} - -fun box(): String { - val t = test(null) - return if (t == 1L) "OK" else "fail: t=$t" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt1899.kt b/backend.native/tests/external/codegen/box/controlStructures/kt1899.kt deleted file mode 100644 index 92a38e1bd89..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt1899.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - if (1 != 0) { - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2147.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2147.kt deleted file mode 100644 index df664fb16ef..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2147.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Foo { - fun isOk() = true -} - -fun box(): String { - val foo: Foo? = Foo() - if (foo?.isOk()!!) return "OK" - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2259.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2259.kt deleted file mode 100644 index f0d79145682..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2259.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo(args: Array) { - try { - } finally { - try { - } catch (e: Throwable) { - } - } -} - -fun box() = "OK" diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2291.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2291.kt deleted file mode 100644 index a1afcfe91b6..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2291.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - 1 in 1.rangeTo(10) - 1..10 - 'h' in 'A'.rangeTo('Z') - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt237.kt b/backend.native/tests/external/codegen/box/controlStructures/kt237.kt deleted file mode 100644 index dbf2075ffe8..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt237.kt +++ /dev/null @@ -1,44 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun main(args: Array?) { - val y: Unit = Unit //do not compile - A() //do not compile - C(Unit) //do not compile - //do not compile - System.out?.println(fff(Unit)) //do not compile - System.out?.println(id(y)) //do not compile - System.out?.println(fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{ e : Int -> }))) //do not compile -} -class A() - -class C(val value: T) { - fun foo(): T = value -} - -fun fff(x: T) : T { return x } - -fun id(value: T): T = value - -fun foreach(array: Array, action: (Int)-> Unit) { - for (el in array) { - action(el) //exception through compilation (see below) - } -} - -fun almostFilter(array: Array, action: (Int)-> Int) { - for (el in array) { - action(el) - } -} - -fun box() : String { - val a = arrayOfNulls(3) as Array - a[0] = 0 - a[1] = 1 - a[2] = 2 - foreach(a, { el : Int -> System.out?.println(el) }) - almostFilter(a, { el : Int -> el }) - main(null) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2416.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2416.kt deleted file mode 100644 index f1442680ff5..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2416.kt +++ /dev/null @@ -1,16 +0,0 @@ -fun box(): String { - 9 in 0..9 - val intRange = 0..9 - 9 in intRange - val charRange = '0'..'9' - '9' in charRange - val byteRange = 0.toByte()..9.toByte() - // seems no stdlib available here, thus no contains as extension - 9 in byteRange - val longRange = 0.toLong()..9.toLong() - 9.toLong() in longRange - val shortRange = 0.toShort()..9.toShort() - 9 in shortRange - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2423.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2423.kt deleted file mode 100644 index c6390b86d3c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2423.kt +++ /dev/null @@ -1,53 +0,0 @@ -// TARGET_BACKEND: JVM - -// WITH_RUNTIME -// FULL_JDK - -import java.util.LinkedList - -fun ok1(): Boolean { - val queue = LinkedList(listOf(1, 2, 3)) - while (!queue.isEmpty()) { - queue.poll() - for (y in 1..3) { - if (queue.contains(y)) { - return true - } - } - } - return false -} - -fun ok2(): Boolean { - val queue = LinkedList(listOf(1, 2, 3)) - val array = arrayOf(1, 2, 3) - while (!queue.isEmpty()) { - queue.poll() - for (y in array) { - if (queue.contains(y)) { - return true - } - } - } - return false -} - -fun ok3(): Boolean { - val queue = LinkedList(listOf(1, 2, 3)) - while (!queue.isEmpty()) { - queue.poll() - var x = 0 - do { - x++ - if (x == 2) return true - } while (x < 2) - } - return false -} - -fun box(): String { - if (!ok1()) return "Fail #1" - if (!ok2()) return "Fail #2" - if (!ok3()) return "Fail #3" - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2577.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2577.kt deleted file mode 100644 index c11ba235411..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2577.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun foo(): Int { - try { - } finally { - try { - return 1 - } catch (e: Throwable) { - return 2 - } - } -} - -fun box() = if (foo() == 1) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt2597.kt b/backend.native/tests/external/codegen/box/controlStructures/kt2597.kt deleted file mode 100644 index af5af144a86..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt2597.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun box(): String { - var i = 0 - { - if (1 == 1) { - i++ - } else { - } - }() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt299.kt b/backend.native/tests/external/codegen/box/controlStructures/kt299.kt deleted file mode 100644 index 9cb4628e7da..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt299.kt +++ /dev/null @@ -1,21 +0,0 @@ -class MyRange1() : ClosedRange { - override val start: Int - get() = 0 - override val endInclusive: Int - get() = 0 - override fun contains(item: Int) = true -} - -class MyRange2() { - operator fun contains(item: Int) = true -} - -fun box(): String { - if (1 in MyRange1()) { - if (1 in MyRange2()) { - return "OK" - } - return "fail 2" - } - return "fail 1" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3087.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3087.kt deleted file mode 100644 index 5858faa4364..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3087.kt +++ /dev/null @@ -1,26 +0,0 @@ -fun putNumberCompareAsUnit() { - if (1 == 1) { - } - else if (1 == 1) { - } -} - -fun putNumberCompareAsVoid() { - if (1 == 1) { - 1 == 1 - } else { - } -} - -fun putInvertAsUnit(b: Boolean) { - if (1 == 1) { - } else if (!b) { - } -} - -fun box(): String { - putNumberCompareAsUnit() - putNumberCompareAsVoid() - putInvertAsUnit(true) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3203_1.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3203_1.kt deleted file mode 100644 index a1b72471df1..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3203_1.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun testIf() { - val condition = true - val result = if (condition) { - val hello: String? = "hello" - if (hello == null) { - false - } - else { - true - } - } - else true - if (!result) throw AssertionError("result is false") -} - -fun box(): String { - testIf() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3203_2.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3203_2.kt deleted file mode 100644 index bde4cc3fe77..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3203_2.kt +++ /dev/null @@ -1,20 +0,0 @@ -fun check1() { - val result = if (true) { - if (true) 1 else 2 - } - else 3 - if (result != 1) throw AssertionError("result: $result") -} - -fun check2() { - val result = if (true) - if (true) 1 else 2 - else 3 - if (result != 1) throw AssertionError("result: $result") -} - -fun box(): String { - check1() - check2() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3273.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3273.kt deleted file mode 100644 index 187dc50ecf8..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3273.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun printlnMock(a: Any) {} - -public fun testCoalesce() { - val value: String = when { - true -> { - if (true) { - "foo" - } else { - "bar" - } - } - else -> "Hello world" - } - - printlnMock(value.length) -} - -fun box(): String { - testCoalesce() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3280.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3280.kt deleted file mode 100644 index 2a2b87a8f1c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3280.kt +++ /dev/null @@ -1,24 +0,0 @@ -fun foo() { - var x = 0 - do { - x++ - var y = x + 5 - } while (y < 10) - if (x != 5) throw AssertionError("$x") -} - -fun bar() { - var b = false - do { - var x = "X" - var y = "Y" - b = true - } while (x + y != "XY") - if (!b) throw AssertionError() -} - -fun box(): String { - foo() - bar() - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt3574.kt b/backend.native/tests/external/codegen/box/controlStructures/kt3574.kt deleted file mode 100644 index 3b2fb00695b..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt3574.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun nil() = null - -fun list() = java.util.Arrays.asList("1") - -fun box(): String { - for (x in nil()?:list()) { - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt416.kt b/backend.native/tests/external/codegen/box/controlStructures/kt416.kt deleted file mode 100644 index 85876312256..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt416.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box() : String { - var a = 10 - return if(a?.plus(10) == 20) "OK" else "fail" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt513.kt b/backend.native/tests/external/codegen/box/controlStructures/kt513.kt deleted file mode 100644 index 74092c47aed..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt513.kt +++ /dev/null @@ -1,24 +0,0 @@ -// WITH_RUNTIME - -class A() { - infix fun ArrayList.add3(el: T) = add(el) - - fun test(list: ArrayList) { - for (i in 1..10) { - list add3 i - } - } -} - -infix fun ArrayList.add2(el: T) = add(el) - -fun box() : String{ - var list = ArrayList() - for (i in 1..10) { - list.add(i) - list add2 i - } - A().test(list) - println(list) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt628.kt b/backend.native/tests/external/codegen/box/controlStructures/kt628.kt deleted file mode 100644 index 234e336e5a7..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt628.kt +++ /dev/null @@ -1,48 +0,0 @@ -class A() { - fun action() = "OK" - - infix fun infix(a: String) = "O" + a - - val property = "OK" - - val a : A - get() = A() -} - -fun test1() = A()!!.property -fun test2() = (A() as A?)!!.property -fun test3() = A()!!.action() -fun test4() = (A() as A?)!!.action() -fun test5() = (null as A?)!!.action() -fun test6() = A().a.a!!.action() -fun test7() = 10!!.plus(11) -fun test8() = (10 as Int?)!!.plus(11) -fun test9() = A()!! infix "K" -fun test10() = (A() as A?) !! infix "K" -fun test11() = (A() as A?) !! infix("K") -fun test12() = A()!! infix ("K") - -fun box() : String { - if(test1() != "OK") return "fail" - if(test2() != "OK") return "fail" - if(test3() != "OK") return "fail" - if(test4() != "OK") return "fail" - - try { - test5() - return "fail" - } - catch(e: NullPointerException) { // - } - - if(test6() != "OK") return "fail" - if(test7() != 21) return "fail" - if(test8() != 21) return "fail" - - if(test9() != "OK") return "fail" - if(test10() != "OK") return "fail" - if(test11() != "OK") return "fail" - if(test12() != "OK") return "fail" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt769.kt b/backend.native/tests/external/codegen/box/controlStructures/kt769.kt deleted file mode 100644 index af1d3682358..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt769.kt +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -package w_range - -fun box() : String { - var i = 0 - when (i) { - 1 -> i-- - else -> { i = 2 } - } - System.out?.println(i) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt772.kt b/backend.native/tests/external/codegen/box/controlStructures/kt772.kt deleted file mode 100644 index 6facb9ef23d..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt772.kt +++ /dev/null @@ -1,25 +0,0 @@ -package demo2 - -fun print(o : Any?) {} - -fun test(i : Int) { - var monthString : String? = "" - when (i) { - 1 -> { - print(1) - print(2) - print(3) - print(4) - print(5) - } - else -> { - monthString = "Invalid month" - } - } - print(monthString) -} - -fun box() : String { - for (i in 1..12) test(i) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt773.kt b/backend.native/tests/external/codegen/box/controlStructures/kt773.kt deleted file mode 100644 index 6facb9ef23d..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt773.kt +++ /dev/null @@ -1,25 +0,0 @@ -package demo2 - -fun print(o : Any?) {} - -fun test(i : Int) { - var monthString : String? = "" - when (i) { - 1 -> { - print(1) - print(2) - print(3) - print(4) - print(5) - } - else -> { - monthString = "Invalid month" - } - } - print(monthString) -} - -fun box() : String { - for (i in 1..12) test(i) - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt8148.kt b/backend.native/tests/external/codegen/box/controlStructures/kt8148.kt deleted file mode 100644 index cdb124ff0e2..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt8148.kt +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class A(var value: String) - -fun box(): String { - val a = A("start") - - try { - test(a) - } catch(e: java.lang.RuntimeException) { - - } - - if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" - - return "OK" -} - -fun test(a: A) : String { - try { - try { - a.value += ", try" - return a.value - } finally { - a.value += ", finally1" - } - } finally { - a.value += ", finally2" - throw RuntimeException("fail") - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt8148_break.kt b/backend.native/tests/external/codegen/box/controlStructures/kt8148_break.kt deleted file mode 100644 index 7751bc545b9..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt8148_break.kt +++ /dev/null @@ -1,36 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class A(var value: String) - -fun box(): String { - val a = A("start") - - try { - test(a) - } catch(e: java.lang.RuntimeException) { - - } - - if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" - - return "OK" -} - -fun test(a: A) : String { - while (true) { - try { - try { - a.value += ", try" - break - } - finally { - a.value += ", finally1" - } - } - finally { - a.value += ", finally2" - throw RuntimeException("fail") - } - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt8148_continue.kt b/backend.native/tests/external/codegen/box/controlStructures/kt8148_continue.kt deleted file mode 100644 index 54a5824e704..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt8148_continue.kt +++ /dev/null @@ -1,37 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -class A(var value: String) - -fun box(): String { - val a = A("start") - - try { - test(a) - } catch(e: java.lang.RuntimeException) { - - } - - if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" - - return "OK" -} - -fun test(a: A) : String { - while (a.value == "start") { - try { - try { - a.value += ", try" - continue - } - finally { - a.value += ", finally1" - } - } - finally { - a.value += ", finally2" - throw RuntimeException("fail") - } - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt870.kt b/backend.native/tests/external/codegen/box/controlStructures/kt870.kt deleted file mode 100644 index 9dde0366a40..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt870.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box() = when { - 1 > 2 -> "false" - 1 >= 1 -> "OK" - else -> "else" - } diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt9022Return.kt b/backend.native/tests/external/codegen/box/controlStructures/kt9022Return.kt deleted file mode 100644 index f8ec8a28450..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt9022Return.kt +++ /dev/null @@ -1,26 +0,0 @@ -fun testOr(b: Boolean): Boolean { - return b || return !b; -} - -fun testOr(): Boolean { - return true || return false; -} - - -fun testAnd(b: Boolean): Boolean { - return b && return !b; -} - -fun testAnd(): Boolean { - return true && return false; -} - -fun box(): String { - if (testOr(false) != true) return "fail 1" - if (testOr(true) != true) return "fail 2" - if (testAnd(false) != false) return "fail 3" - if (testAnd(true) != false) return "fail 4" - if (testOr() != true) return "fail 5" - if (testAnd() != false) return "fail 6" - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt9022Throw.kt b/backend.native/tests/external/codegen/box/controlStructures/kt9022Throw.kt deleted file mode 100644 index 9c306782006..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt9022Throw.kt +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE - -fun box(): String { - var cycle = true; - while (true) { - if (true || throw java.lang.RuntimeException()) { - return "OK" - } - } - return "fail" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt910.kt b/backend.native/tests/external/codegen/box/controlStructures/kt910.kt deleted file mode 100644 index a9226bbdba2..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt910.kt +++ /dev/null @@ -1,21 +0,0 @@ -fun foo() : Int = - try { - 2 - } - finally { - "s" - } - -fun bar(set : MutableSet) : Set = - try { - set - } - finally { - set.add(42) - } - -fun box() : String { - if (foo() != 2) return "fail 1" - val s = bar(HashSet()) - return if (s.contains(42)) "OK" else "fail 2" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/kt958.kt b/backend.native/tests/external/codegen/box/controlStructures/kt958.kt deleted file mode 100644 index f32079bfb69..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/kt958.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun test() = 239 - -fun box() = if(test() in 239..240) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/box/controlStructures/longRange.kt b/backend.native/tests/external/codegen/box/controlStructures/longRange.kt deleted file mode 100644 index b1ab17ee093..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/longRange.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String { - val r = 1.toLong()..2 - var s = "" - for (l in r) { - s += l - } - return if (s == "12") "OK" else "fail: $s" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/parameterWithNameForFunctionType.kt b/backend.native/tests/external/codegen/box/controlStructures/parameterWithNameForFunctionType.kt deleted file mode 100644 index 3796119d725..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/parameterWithNameForFunctionType.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun test(a: T, b: T, operation: (x: T) -> T) { - operation(if (3 > 2) a else b) -} - -fun box(): String { - test(1, 1, { it }) - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/quicksort.kt b/backend.native/tests/external/codegen/box/controlStructures/quicksort.kt deleted file mode 100644 index 381a8cf44bb..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/quicksort.kt +++ /dev/null @@ -1,41 +0,0 @@ -fun IntArray.swap(i:Int, j:Int) { - val temp = this[i] - this[i] = this[j] - this[j] = temp -} - -fun IntArray.quicksort() = quicksort(0, size-1) - -fun IntArray.quicksort(L: Int, R:Int) { - val m = this[(L + R) / 2] - var i = L - var j = R - while (i <= j) { - while (this[i] < m) - i++ - while (this[j] > m) - j-- - if (i <= j) { - swap(i++, j--) - } - else { - } - } - if (L < j) - quicksort(L, j) - if (R > i) - quicksort(i, R) -} - -fun box() : String { - val a = IntArray(10) - for(i in 0..4) { - a[2*i] = 2*i - a[2*i+1] = -2*i-1 - } - a.quicksort() - for(i in 0..a.size-2) { - if (a[i] > a[i+1]) return "Fail $i: ${a[i]} > ${a[i+1]}" - } - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/ifElse.kt b/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/ifElse.kt deleted file mode 100644 index 98d5401d12e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/ifElse.kt +++ /dev/null @@ -1,14 +0,0 @@ -var flag = true - -fun exit(): Nothing = null!! - -fun box(): String { - val a: String - if (flag) { - a = "OK" - } - else { - exit() - } - return a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/inlineMethod.kt b/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/inlineMethod.kt deleted file mode 100644 index 5ec5f8feff2..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/inlineMethod.kt +++ /dev/null @@ -1,12 +0,0 @@ -inline fun exit(): Nothing = null!! - -fun box(): String { - val a: String - try { - a = "OK" - } - catch (e: Exception) { - exit() - } - return a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/propertyGetter.kt b/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/propertyGetter.kt deleted file mode 100644 index 1b69f5b1b66..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/propertyGetter.kt +++ /dev/null @@ -1,16 +0,0 @@ -var flag = true - -object Test { - val magic: Nothing get() = null!! -} - -fun box(): String { - val a: String - if (flag) { - a = "OK" - } - else { - Test.magic - } - return a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/tryCatch.kt b/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/tryCatch.kt deleted file mode 100644 index bc23f5cb748..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/tryCatch.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun exit(): Nothing = null!! - -fun box(): String { - val a: String - try { - a = "OK" - } - catch (e: Exception) { - exit() - } - return a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/when.kt b/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/when.kt deleted file mode 100644 index e4953bb6e3c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/returnsNothing/when.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun exit(): Nothing = null!! - -var x = 0 - -fun box(): String { - val a: String - when (x) { - 0 -> a = "OK" - 1 -> a = "???" - 2 -> exit() - else -> exit() - } - return a -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchFinallyChain.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchFinallyChain.kt deleted file mode 100644 index b0ee1f314dc..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchFinallyChain.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun box() : String { - try { - } finally { - try { - try { - } finally { - try { - } finally { - } - } - } catch (e: Exception) { - try { - } catch (f: Exception) { - } finally { - } - } - return "OK" - } -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/catch.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/catch.kt deleted file mode 100644 index cb00faf1fe3..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/catch.kt +++ /dev/null @@ -1,2 +0,0 @@ -fun box(): String = - "O" + try { throw Exception("oops!") } catch (e: Exception) { "K" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/complexChain.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/complexChain.kt deleted file mode 100644 index 36f2e84f29f..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/complexChain.kt +++ /dev/null @@ -1,52 +0,0 @@ -fun cleanup() {} - -inline fun concat(x: String, y: String): String = x + y - -inline fun throws() { - try { - throw Exception() - } - finally { - cleanup() - } -} - -inline fun first(x: String, y: String): String = x - -fun box(): String = - "" + concat( - try { "" } finally { "0" }, - "" + concat( - first( - try { - try { - "O" - } - finally { - "1" - } - } - catch (e: Exception) { - throw e - } - finally { - cleanup() - }, - "2" - ), - first( - try { - throws() - throw Exception() - "3" - } - catch (e: Exception) { - "K" - } - finally { - cleanup() - }, - "4" - ) - ) - ) diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/deadTryCatch.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/deadTryCatch.kt deleted file mode 100644 index 41a91a17e08..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/deadTryCatch.kt +++ /dev/null @@ -1,26 +0,0 @@ -inline fun catchAll(x: String, block: () -> Unit): String { - try { - block() - } catch (e: Throwable) { - } - return x -} - -inline fun tryTwice(block: () -> Unit) { - try { - block() - try { - block() - } catch (e: Exception) { - } - } catch (e: Exception) { - } -} - -fun box(): String { - return catchAll("OK") { - tryTwice { - throw Exception() - } - } -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/differentTypes.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/differentTypes.kt deleted file mode 100644 index 645de5f06e1..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/differentTypes.kt +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - -fun foo(b: Byte, s: String, i: Int, d: Double, li: Long): String = "$b $s $i $d $li" - -fun box(): String { - val test = foo(1, "abc", 1, 1.0, try { 1L } catch (e: Exception) { 10L }) - if (test != "1 abc 1 1.0 1") return "Failed, test==$test" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/expectException.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/expectException.kt deleted file mode 100644 index 63bd4900c12..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/expectException.kt +++ /dev/null @@ -1,35 +0,0 @@ -public inline fun fails(block: () -> Unit): Throwable? { - var thrown: Throwable? = null - try { - block() - } catch (e: Throwable) { - thrown = e - } - if (thrown == null) - throw Exception("Expected an exception to be thrown") - return thrown -} - -public inline fun throwIt(msg: String) { - throw Exception(msg) -} - -fun box(): String { - fails { - throwIt("oops!") - } - - var x = 0 - try { - fails { - x = 1 - } - } - catch (e: Exception) { - x = 2 - } - - if (x != 2) return "Failed: x==$x" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/finally.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/finally.kt deleted file mode 100644 index 2d4b9f825a7..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/finally.kt +++ /dev/null @@ -1,2 +0,0 @@ -fun box(): String = - "O" + try { "K" } finally { "hmmm" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryCatch.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryCatch.kt deleted file mode 100644 index dd3a181348a..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryCatch.kt +++ /dev/null @@ -1,17 +0,0 @@ -inline fun tryOrElse(f1: () -> T, f2: () -> T): T { - try { - return f1() - } - catch (e: Exception) { - return f2() - } -} - -fun testIt() = "abc" + tryOrElse({ "def" }, { "oops" }) + "ghi" - -fun box(): String { - val test = testIt() - if (test != "abcdefghi") return "Failed, test==$test" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryExpr.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryExpr.kt deleted file mode 100644 index 8205200452a..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryExpr.kt +++ /dev/null @@ -1,14 +0,0 @@ -inline fun tryOrElse(f1: () -> T, f2: () -> T): T = - try { f1() } catch (e: Exception) { f2() } - -fun testIt() = - "abc" + - tryOrElse({ try { "def" } catch(e: Exception) { "oops!" } }, { "hmmm..." }) + - "ghi" - -fun box(): String { - val test = testIt() - if (test != "abcdefghi") return "Failed, test==$test" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryFinally.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryFinally.kt deleted file mode 100644 index eb488beb689..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/inlineTryFinally.kt +++ /dev/null @@ -1,22 +0,0 @@ -inline fun tryAndThen(f1: () -> Unit, f2: () -> Unit, f3: () -> T): T { - try { - f1() - } - catch (e: Exception) { - f2() - } - finally { - return f3() - } -} - -fun testIt() = "abc" + - tryAndThen({}, {}, { "def" }) + - "ghi" - -fun box(): String { - val test = testIt() - if (test != "abcdefghi") return "Failed, test==$test" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572.kt deleted file mode 100644 index 368df7ae6f9..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(string: String, fn: (String) -> String) = - fn(try { zap(string) } catch (e: Exception) { "" }) - -fun box(): String = tryZap("OK") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2.kt deleted file mode 100644 index ed417d9b8bc..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(s1: String, s2: String, fn: (String, String) -> String) = - fn( - try { zap(s1) } catch (e: Exception) { "" }, - try { zap(s2) } catch (e: Exception) { "" } - ) - -fun box(): String = tryZap("O", "K") { a, b -> a + b } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2_ext.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2_ext.kt deleted file mode 100644 index 6f5cb1df234..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_2_ext.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(s1: String, s2: String, fn: String.(String) -> String) = - fn( - try { zap(s1) } catch (e: Exception) { "" }, - try { zap(s2) } catch (e: Exception) { "" } - ) - -fun box(): String = tryZap("O", "K") { this + it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_ext.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_ext.kt deleted file mode 100644 index 8e9066f7cc7..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_ext.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(string: String, fn: String.() -> String) = - fn(try { zap(string) } catch (e: Exception) { "" }) - -fun box(): String = tryZap("OK") { this } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_nested.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_nested.kt deleted file mode 100644 index 7d7467b0694..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17572_nested.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(string: String, fn: (String) -> String) = - fn( - try { - try { - zap(string) - } - catch (e: Exception) { "" } - } catch (e: Exception) { "" } - ) - -fun box(): String = tryZap("OK") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573.kt deleted file mode 100644 index de1d0b45cbc..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap(string: String, fn: (String) -> String) = - fn(try { zap(string) } finally {}) - -fun box(): String = tryZap("OK") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573_nested.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573_nested.kt deleted file mode 100644 index e241aec5239..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt17573_nested.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun zap(s: String) = s - -inline fun tryZap1(string: String, fn: (String) -> String) = - fn( - try { zap(string) } finally { - try { zap(string) } finally { } - } - ) - -inline fun tryZap2(string: String, fn: (String) -> String) = - fn( - try { zap(string) } finally { - try { zap(string) } catch (e: Exception) { } - } - ) - -fun box(): String = tryZap1("O") { it } + tryZap2("K") { it } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt8608.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt8608.kt deleted file mode 100644 index 1d0b92b2c09..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt8608.kt +++ /dev/null @@ -1,30 +0,0 @@ -interface Callable { - fun call(b: Boolean) -} - -inline fun run(f: () -> Unit) { f() } - -class A { - fun foo(): String { - run { - val x = object : Callable { - override fun call(b: Boolean) { - if (b) { - x() - } else { - try { - x() - } catch(t: Throwable) { - } - } - } - } - } - return "OK" - } - - private fun x() {} -} - -fun box(): String = - A().foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt9644try.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt9644try.kt deleted file mode 100644 index 63921992a06..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/kt9644try.kt +++ /dev/null @@ -1,21 +0,0 @@ -inline fun doCall(f: () -> Any) = f() - -fun test1() { - val localResult = doCall { - try { "1" } catch (e: Exception) { "2" } - return - } -} - -fun test2(): String { - val localResult = doCall { - try { "1" } catch (e: Exception) { "2" } - return@test2 "OK" - } - return "Hmmm..." -} - -fun box(): String { - test1() - return test2() -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt deleted file mode 100644 index 4d1bf16a733..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt +++ /dev/null @@ -1,20 +0,0 @@ -class Exception1(msg: String): Exception(msg) -class Exception2(msg: String): Exception(msg) -class Exception3(msg: String): Exception(msg) - -fun box(): String = - "O" + try { - throw Exception3("K") - } - catch (e1: Exception1) { - "e1" - } - catch (e2: Exception2) { - "e2" - } - catch (e3: Exception3) { - e3.message - } - catch (e: Exception) { - "e" - } diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt deleted file mode 100644 index c60bde586a1..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt +++ /dev/null @@ -1,25 +0,0 @@ -inline fun test(s: () -> Int): Int = - try { - val i = s() - i + 10 - } - finally { - 0 - } - -fun box() : String { - test { - try { - val p = 1 - return "OK" - } - catch(e: Exception) { - -2 - } - finally { - -3 - } - } - - return "Failed" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner1.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner1.kt deleted file mode 100644 index bbf5ad07064..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner1.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun shouldReturnFalse() : Boolean { - try { - return true - } finally { - if (true) - return false - } -} - -fun box(): String = - if (shouldReturnFalse()) "Failed" else "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner2.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner2.kt deleted file mode 100644 index 7c0c3e81c55..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/splitTryCorner2.kt +++ /dev/null @@ -1,22 +0,0 @@ -fun shouldReturn11() : Int { - var x = 0 - while (true) { - try { - if(x < 10) - x++ - else - break - } - finally { - x++ - } - } - return x -} - -fun box(): String { - val test = shouldReturn11() - if (test != 11) return "Failed, test=$test" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/try.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/try.kt deleted file mode 100644 index 695e324988e..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/try.kt +++ /dev/null @@ -1,2 +0,0 @@ -fun box(): String = - "O" + try { "K" } catch (e: Exception) { "oops!" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAfterTry.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAfterTry.kt deleted file mode 100644 index 7d6dcc3d2a3..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAfterTry.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String = - "" + - try { "O" } catch (e: Exception) { "1" } + - try { throw Exception("oops!") } catch (e: Exception) { "K" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndBreak.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndBreak.kt deleted file mode 100644 index a1f867b1c3d..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndBreak.kt +++ /dev/null @@ -1,19 +0,0 @@ -fun idiv(a: Int, b: Int): Int = - if (b == 0) throw Exception("Division by zero") else a / b - -fun foo(): Int { - var sum = 0 - var i = 2 - while (i > -10) { - sum += try { idiv(100, i) } catch (e: Exception) { break } - i-- - } - return sum -} - -fun box(): String { - val test = foo() - if (test != 150) return "Failed, test=$test" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndContinue.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndContinue.kt deleted file mode 100644 index 120d463b00c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryAndContinue.kt +++ /dev/null @@ -1,17 +0,0 @@ -fun idiv(a: Int, b: Int): Int = - if (b == 0) throw Exception("Division by zero") else a / b - -fun foo(): Int { - var sum = 0 - for (i in -10 .. 10) { - sum += try { idiv(100, i) } catch (e: Exception) { continue } - } - return sum -} - -fun box(): String { - val test = foo() - if (test != 0) return "Failed, test=$test" - - return "OK" -} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt deleted file mode 100644 index 4db8ad73a72..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt +++ /dev/null @@ -1,18 +0,0 @@ -// WITH_RUNTIME -fun box(): String { - val a = arrayListOf() - - while (true) { - if (a.size == 0) { - break - } - } - - for (i in 1..2) { - a.add(try { foo() } catch (e: Throwable) { "OK" }) - } - - return a[0] -} - -fun foo(): String = throw RuntimeException() diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideCatch.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideCatch.kt deleted file mode 100644 index 09f9857b57c..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideCatch.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun box(): String = - "O" + - try { - throw Exception("oops!") - } - catch (e: Exception) { - try { "K" } catch (e: Exception) { "2" } - } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideTry.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideTry.kt deleted file mode 100644 index 3d1ccd9e7ae..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/tryInsideTry.kt +++ /dev/null @@ -1,10 +0,0 @@ -class MyException(message: String): Exception(message) - -fun box(): String = - "O" + - try { - try { throw Exception("oops!") } catch (mye: MyException) { "1" } - } - catch (e: Exception) { - "K" - } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt b/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt deleted file mode 100644 index 015b4137f65..00000000000 --- a/backend.native/tests/external/codegen/box/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt +++ /dev/null @@ -1,17 +0,0 @@ -inline fun catchAll(x: String, block: () -> Unit): String { - try { - block() - } catch (e: Throwable) { - } - return x -} - -inline fun throwIt(msg: String) { - throw Exception(msg) -} - -inline fun bar(x: String): String = - x + catchAll("") { throwIt("oops!") } - -fun box(): String = - bar("OK") diff --git a/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt deleted file mode 100644 index 5fa1cbfede4..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt +++ /dev/null @@ -1,81 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere( - a: String = "abc", - i1: Int = 1, - i2: Int = 1, - i3: Int = 1, - i4: Int = 1, - i5: Int = 1, - i6: Int = 1, - i7: Int = 1, - i8: Int = 1, - i9: Int = 1, - i10: Int = 1, - i11: Int = 1, - i12: Int = 1, - i13: Int = 1, - i14: Int = 1, - i15: Int = 1, - i16: Int = 1, - i17: Int = 1, - i18: Int = 1, - i19: Int = 1, - i20: Int = 1, - i21: Int = 1, - i22: Int = 1, - i23: Int = 1, - i24: Int = 1, - i25: Int = 1, - i26: Int = 1, - i27: Int = 1, - i28: Int = 1, - i29: Int = 1, - i30: Int = 1, - i31: Int = 1 - ): String = suspendCoroutineOrReturn { x -> - x.resume(a + "#" + (i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 + i18 + i19 + i20 + i21 + i22 + i23 + i24 + i25 + i26 + i27 + i28 + i29 + i30 + i31)) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "OK" - - builder { - var a = suspendHere() - if (a != "abc#31") { - result = "fail 1: $a" - throw RuntimeException(result) - } - - a = suspendHere("cde") - if (a != "cde#31") { - result = "fail 2: $a" - throw RuntimeException(result) - } - - a = suspendHere(i2 = 6) - if (a != "abc#36") { - result = "fail 3: $a" - throw RuntimeException(result) - } - - a = suspendHere("xyz", 9) - if (a != "xyz#39") { - result = "fail 4: $a" - throw RuntimeException(result) - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt deleted file mode 100644 index 038df73732d..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -class A { - suspend private fun a(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } - - suspend fun myfun(): String { - var result = "fail" - builder { - result = a() - } - - return result - } -} - -fun box(): String { - var result = "" - - builder { - result = A().myfun() - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt b/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt deleted file mode 100644 index 3207face102..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt +++ /dev/null @@ -1,125 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -interface AsyncGenerator { - suspend fun yield(value: T) -} - -interface AsyncSequence { - operator fun iterator(): AsyncIterator -} - -interface AsyncIterator { - operator suspend fun hasNext(): Boolean - operator suspend fun next(): T -} - -fun asyncGenerate(block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { - override fun iterator(): AsyncIterator { - val iterator = AsyncGeneratorIterator() - iterator.nextStep = block.createCoroutine(receiver = iterator, completion = iterator) - return iterator - } -} - -class AsyncGeneratorIterator: AsyncIterator, AsyncGenerator, Continuation { - var computedNext = false - var nextValue: T? = null - var nextStep: Continuation? = null - - // if (computesNext) computeContinuation is Continuation - // if (!computesNext) computeContinuation is Continuation - var computesNext = false - var computeContinuation: Continuation<*>? = null - - override val context = EmptyCoroutineContext - - suspend fun computeHasNext(): Boolean = suspendCoroutineOrReturn { c -> - computesNext = false - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - suspend fun computeNext(): T = suspendCoroutineOrReturn { c -> - computesNext = true - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - @Suppress("UNCHECKED_CAST") - fun resumeIterator(exception: Throwable?) { - if (exception != null) { - done() - computeContinuation!!.resumeWithException(exception) - return - } - if (computesNext) { - computedNext = false - (computeContinuation as Continuation).resume(nextValue as T) - } else { - (computeContinuation as Continuation).resume(nextStep != null) - } - } - - override suspend fun hasNext(): Boolean { - if (!computedNext) return computeHasNext() - return nextStep != null - } - - override suspend fun next(): T { - if (!computedNext) return computeNext() - computedNext = false - return nextValue as T - } - - private fun done() { - computedNext = true - nextStep = null - } - - // Completion continuation implementation - override fun resume(value: Unit) { - done() - resumeIterator(null) - } - - override fun resumeWithException(exception: Throwable) { - done() - resumeIterator(exception) - } - - // Generator implementation - override suspend fun yield(value: T): Unit = suspendCoroutineOrReturn { c -> - computedNext = true - nextValue = value - nextStep = c - resumeIterator(null) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - val seq = asyncGenerate { - yield("O") - yield("K") - } - - var res = "" - - builder { - for (i in seq) { - res += i - } - } - - return res -} diff --git a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorNullMerge.kt b/backend.native/tests/external/codegen/box/coroutines/asyncIteratorNullMerge.kt deleted file mode 100644 index 19dd1927514..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorNullMerge.kt +++ /dev/null @@ -1,136 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -interface AsyncGenerator { - suspend fun yield(value: T) -} - -interface AsyncSequence { - operator fun iterator(): AsyncIterator -} - -interface AsyncIterator { - operator suspend fun hasNext(): Boolean - operator suspend fun next(): T -} - -fun asyncGenerate(block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { - override fun iterator(): AsyncIterator { - val iterator = AsyncGeneratorIterator() - iterator.nextStep = block.createCoroutine(receiver = iterator, completion = iterator) - return iterator - } -} - -class AsyncGeneratorIterator: AsyncIterator, AsyncGenerator, Continuation { - var computedNext = false - var nextValue: T? = null - var nextStep: Continuation? = null - - // if (computesNext) computeContinuation is Continuation - // if (!computesNext) computeContinuation is Continuation - var computesNext = false - var computeContinuation: Continuation<*>? = null - - override val context = EmptyCoroutineContext - - suspend fun computeHasNext(): Boolean = suspendCoroutineOrReturn { c -> - computesNext = false - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - suspend fun computeNext(): T = suspendCoroutineOrReturn { c -> - computesNext = true - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - @Suppress("UNCHECKED_CAST") - fun resumeIterator(exception: Throwable?) { - if (exception != null) { - done() - computeContinuation!!.resumeWithException(exception) - return - } - if (computesNext) { - computedNext = false - (computeContinuation as Continuation).resume(nextValue as T) - } else { - (computeContinuation as Continuation).resume(nextStep != null) - } - } - - override suspend fun hasNext(): Boolean { - if (!computedNext) return computeHasNext() - return nextStep != null - } - - override suspend fun next(): T { - if (!computedNext) return computeNext() - computedNext = false - return nextValue as T - } - - private fun done() { - computedNext = true - nextStep = null - } - - // Completion continuation implementation - override fun resume(value: Unit) { - done() - resumeIterator(null) - } - - override fun resumeWithException(exception: Throwable) { - done() - resumeIterator(exception) - } - - // Generator implementation - override suspend fun yield(value: T): Unit = suspendCoroutineOrReturn { c -> - computedNext = true - nextValue = value - nextStep = c - resumeIterator(null) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun cst(a: Any?): String? = a as String? -fun any(a: Any?): Any? = a - -fun box(): String { - val seq = asyncGenerate { - yield("O") - yield("K") - } - - var res = "" - - builder { - // type of `prev` should be j/l/Object everywhere (even in a expected type position) - var prev: Any? = null - for (i in seq) { - res += i - prev = any(res) - // merge of NULL_VALUE and j/l/Object should result in common j/l/Object value - // but it was NULL_VALUE and we do not spill null values, we just put - // ACONST_NULL after suspension point instead - } - - res = cst(prev) ?: "fail 1" - } - - return res -} diff --git a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt b/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt deleted file mode 100644 index 45baabe6c78..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt +++ /dev/null @@ -1,131 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -interface AsyncGenerator { - suspend fun yield(value: T) -} - -interface AsyncSequence { - operator fun iterator(): AsyncIterator -} - -interface AsyncIterator { - operator suspend fun hasNext(): Boolean - operator suspend fun next(): T -} - -fun asyncGenerate(block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { - override fun iterator(): AsyncIterator { - val iterator = AsyncGeneratorIterator() - iterator.nextStep = block.createCoroutine(receiver = iterator, completion = iterator) - return iterator - } -} - -class AsyncGeneratorIterator: AsyncIterator, AsyncGenerator, Continuation { - var computedNext = false - var nextValue: T? = null - var nextStep: Continuation? = null - - // if (computesNext) computeContinuation is Continuation - // if (!computesNext) computeContinuation is Continuation - var computesNext = false - var computeContinuation: Continuation<*>? = null - - override val context = EmptyCoroutineContext - - suspend fun computeHasNext(): Boolean = suspendCoroutineOrReturn { c -> - computesNext = false - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - suspend fun computeNext(): T = suspendCoroutineOrReturn { c -> - computesNext = true - computeContinuation = c - nextStep!!.resume(Unit) - COROUTINE_SUSPENDED - } - - @Suppress("UNCHECKED_CAST") - fun resumeIterator(exception: Throwable?) { - if (exception != null) { - done() - computeContinuation!!.resumeWithException(exception) - return - } - if (computesNext) { - computedNext = false - (computeContinuation as Continuation).resume(nextValue as T) - } else { - (computeContinuation as Continuation).resume(nextStep != null) - } - } - - override suspend fun hasNext(): Boolean { - if (!computedNext) return computeHasNext() - return nextStep != null - } - - override suspend fun next(): T { - if (!computedNext) return computeNext() - computedNext = false - return nextValue as T - } - - private fun done() { - computedNext = true - nextStep = null - } - - // Completion continuation implementation - override fun resume(value: Unit) { - done() - resumeIterator(null) - } - - override fun resumeWithException(exception: Throwable) { - done() - resumeIterator(exception) - } - - // Generator implementation - override suspend fun yield(value: T): Unit = suspendCoroutineOrReturn { c -> - computedNext = true - nextValue = value - nextStep = c - resumeIterator(null) - COROUTINE_SUSPENDED - } -} - -suspend fun AsyncSequence.toList(): List { - val out = arrayListOf() - for (e in this@toList) out += e // fails at this line - return out -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - val seq = asyncGenerate { - yield("O") - yield("K") - } - - var res = listOf() - - builder { - res = seq.toList() - } - - if (res.size > 2) return "fail 1: ${res.size}" - - return res[0] + res[1] -} diff --git a/backend.native/tests/external/codegen/box/coroutines/await.kt b/backend.native/tests/external/codegen/box/coroutines/await.kt deleted file mode 100644 index 307f949209a..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/await.kt +++ /dev/null @@ -1,119 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// FILE: promise.kt -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Promise(private val executor: ((T) -> Unit) -> Unit) { - private var value: Any? = null - private var thenList: MutableList<(T) -> Unit>? = mutableListOf() - - init { - executor { - value = it - for (resolve in thenList!!) { - resolve(it) - } - thenList = null - } - } - - fun then(onFulfilled: (T) -> S): Promise { - return Promise { resolve -> - if (thenList != null) { - thenList!!.add { resolve(onFulfilled(it)) } - } - else { - resolve(onFulfilled(value as T)) - } - } - } -} - -// FILE: queue.kt -import helpers.* -private val queue = mutableListOf<() -> Unit>() - -fun postpone(computation: () -> T): Promise { - return Promise { resolve -> - queue += { - resolve(computation()) - } - } -} - -fun processQueue() { - while (queue.isNotEmpty()) { - queue.removeAt(0)() - } -} - -// FILE: await.kt -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -private var log = "" - -private var inAwait = false - -suspend fun await(value: Promise): S = suspendCoroutine { continuation -> - if (inAwait) { - throw IllegalStateException("Can't call await recursively") - } - inAwait = true - postpone { - value.then { result -> - continuation.resume(result) - } - } - inAwait = false -} - -suspend fun awaitAndLog(value: Promise): S { - log += "before await;" - return await(value.then { result -> - log += "after await: $result;" - result - }) -} - -fun async(c: suspend () -> T): Promise { - return Promise { resolve -> - c.startCoroutine(handleResultContinuation(resolve)) - } -} - -fun asyncOperation(resultSupplier: () -> T) = Promise { resolve -> - log += "before async;" - postpone { - val result = resultSupplier() - log += "after async $result;" - resolve(result) - } -} - -fun getLog() = log - -// FILE: main.kt -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -private fun test() = async { - val o = await(asyncOperation { "O" }) - val k = awaitAndLog(asyncOperation { "K" }) - return@async o + k -} - -fun box(): String { - val resultPromise = test() - var result: String? = null - resultPromise.then { result = it } - processQueue() - - if (result != "OK") return "fail1: $result" - if (getLog() != "before async;after async O;before async;before await;after async K;after await: K;") return "fail2: ${getLog()}" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt b/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt deleted file mode 100644 index 5f5b878833e..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt +++ /dev/null @@ -1,40 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere(): Any = suspendCoroutineOrReturn { x -> } - -fun builder(c: suspend () -> Unit) { - var exception: Throwable? = null - - c.createCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(data: Unit) { - } - - override fun resumeWithException(e: Throwable) { - exception = e - } - }).resumeWithException(RuntimeException("OK")) - - if (exception?.message != "OK") { - throw RuntimeException("Unexpected result: ${exception?.message}") - } -} - -fun box(): String { - var result = "OK" - builder { - suspendHere() - result = "fail 1" - } - - builder { - result = "fail 2" - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt b/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt deleted file mode 100644 index faf89dc6cae..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -suspend fun suspendHere(): Any = suspendCoroutineOrReturn { x ->} - -fun builder(c: suspend () -> Unit) { - try { - c.createCoroutine(EmptyContinuation).resumeWithException(RuntimeException("OK")) - } - catch(e: Exception) { - if (e?.message != "OK") { - throw RuntimeException("Unexpected result: ${e?.message}") - } - return - } - - throw RuntimeException("Exception must be thrown above") -} - -fun box(): String { - var result = "OK" - builder { - suspendHere() - result = "fail 1" - } - - builder { - result = "fail 2" - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt b/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt deleted file mode 100644 index b3d416e8776..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt +++ /dev/null @@ -1,49 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -suspend fun await(t: T): T = suspendCoroutineOrReturn { c -> - c.resume(t) - COROUTINE_SUSPENDED -} - -fun builder(c: suspend () -> Unit): String { - var result = "fail" - c.startCoroutine(handleResultContinuation { - result = "OK" - }) - return result -} - -var TRUE = true -var FALSE = false -fun box(): String { - val r1 = builder { await(Unit) } - if (r1 != "OK") return "fail 1" - - val r2 = builder { - if (await(1) != 1) throw RuntimeException("fail1") - - if (TRUE) return@builder - } - if (r2 != "OK") return "fail 2" - - val r3 = builder { - if (await(1) != 1) throw RuntimeException("fail2") - - if (FALSE) return@builder - } - if (r3 != "OK") return "fail 3" - - val r4 = builder { - if (await(1) != 1) throw RuntimeException("fail3") - - return@builder - } - if (r4 != "OK") return "fail 4" - - return builder { await(1) } -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt deleted file mode 100644 index 272d02615f1..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt +++ /dev/null @@ -1,57 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - val value = builder { - try { - outer@for (x in listOf("A", "B")) { - try { - result += suspendWithResult(x) - for (y in listOf("C", "D")) { - try { - result += suspendWithResult(y) - if (y == "D") { - break@outer - } - } - finally { - result += "!" - } - result += "E" - } - } - finally { - result += "@" - } - result += "ignore" - } - result += "*" - } - finally { - result += "finally" - } - result += "." - } - if (value != "AC!ED!@*finally.") return "fail: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt deleted file mode 100644 index 7898ff7785f..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt +++ /dev/null @@ -1,53 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - var value = builder { - outer@for (x in listOf("O", "K")) { - result += suspendWithResult(x) - for (y in listOf("Q", "W")) { - result += suspendWithResult(y) - if (y == "W") { - break@outer - } - } - } - result += "." - } - if (value != "OQW.") return "fail: break outer loop: $value" - - value = builder { - for (x in listOf("O", "K")) { - result += suspendWithResult(x) - for (y in listOf("Q", "W")) { - if (y == "W") { - break - } - result += suspendWithResult(y) - } - } - result += "." - } - if (value != "OQKQ.") return "fail: break inner loop: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt deleted file mode 100644 index 452919efa28..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - var value = builder { - var x = 1 - do { - result += x - } while (suspendWithResult(x++) < 3) - result += "." - } - if (value != "123.") return "fail: suspend as do..while condition: $value" - - value = builder { - var x = 1 - do { - result += suspendWithResult(x) - result += ";" - } while (x++ < 3) - result += "." - } - if (value != "1;2;3;.") return "fail: suspend in do..while body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt deleted file mode 100644 index 1f2f0fe1544..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt +++ /dev/null @@ -1,34 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - val value = builder { - for (x in listOf("O", "$", "K")) { - if (x == "$") continue - result += suspendWithResult(x) - } - result += "." - } - if (value != "OK.") return "fail: suspend in for body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt deleted file mode 100644 index 4ed50a3a673..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt +++ /dev/null @@ -1,33 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - val value = builder { - for (x in listOf("O", "K")) { - result += suspendWithResult(x) - } - result += "." - } - if (value != "OK.") return "fail: suspend in for body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forWithStep.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forWithStep.kt deleted file mode 100644 index 43279828a11..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forWithStep.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - val value = builder { - for (x: Long in 20L..30L step 5L) { - listOf("#").forEach { - result += it + suspendWithResult(x).toString() - } - } - result += "." - } - if (value != "#20#25#30.") return "fail: suspend in for body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt deleted file mode 100644 index 3cebc02ee03..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt +++ /dev/null @@ -1,78 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - var value = builder { - if (suspendWithResult(true)) { - result = "OK" - } - } - if (value != "OK") return "fail: suspend as if condition: $value" - - value = builder { - for (x in listOf(true, false)) { - if (x) { - result += suspendWithResult("O") - } - else { - result += "K" - } - } - } - if (value != "OK") return "fail: suspend in then branch: $value" - - value = builder { - for (x in listOf(true, false)) { - if (x) { - result += "O" - } - else { - result += suspendWithResult("K") - } - } - } - if (value != "OK") return "fail: suspend in else branch: $value" - - value = builder { - for (x in listOf(true, false)) { - if (x) { - result += suspendWithResult("O") - } - else { - result += suspendWithResult("K") - } - } - } - if (value != "OK") return "fail: suspend in both branches: $value" - - value = builder { - for (x in listOf(true, false)) { - if (x) { - result += suspendWithResult("O") - } - result += ";" - } - } - if (value != "O;;") return "fail: suspend in then branch without else: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt deleted file mode 100644 index 30f5cd8c1d7..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt +++ /dev/null @@ -1,50 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun builder(c: suspend () -> Unit): Unit { - c.startCoroutine(handleResultContinuation { - finished = true - }) -} - -fun box(): String { - builder { - var i = 0 - var j = 0 - outer@while (i < 10) { - while (j < 10) { - if (i + j > 3) break@outer - log += "$i,$j;" - suspendAndContinue() - j++ - } - log += "i++;" - i++ - } - log += "done;" - suspendAndContinue() - } - - while (!finished) { - log += "@;" - postponed() - } - - if (log != "0,0;@;0,1;@;0,2;@;0,3;@;done;@;") return "fail: $log" - - return "OK" -} - -suspend fun suspendAndContinue(): Unit = suspendCoroutineOrReturn { c -> - postponed = { - c.resume(Unit) - } - COROUTINE_SUSPENDED -} - -var postponed: () -> Unit = {} -var finished = false -var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt deleted file mode 100644 index 8d2efbbd2e3..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt +++ /dev/null @@ -1,66 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var result = "" - - suspend fun suspendAndLog(value: T): T = suspendCoroutineOrReturn { c -> - result += "suspend($value);" - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> String): String { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.result += "return($it);" - }) - return controller.result -} - -fun builderUnit(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, handleResultContinuation { - controller.result += "return;" - }) - return controller.result -} - -fun id(value: T) = value - -fun box(): String { - var value = builder { - try { - if (id(23) == 23) { - return@builder suspendAndLog("OK") - } - } - finally { - result += "finally;" - } - result += "afterFinally;" - "shouldNotReach" - } - if (value != "suspend(OK);finally;return(OK);") return "fail1: $value" - - value = builderUnit { - try { - if (id(23) == 23) { - suspendAndLog("OK") - return@builderUnit - } - } - finally { - result += "finally;" - } - result += "afterFinally;" - "shouldNotReach" - } - if (value != "suspend(OK);finally;return;") return "fail2: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt deleted file mode 100644 index ab9a7bbeeb5..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt +++ /dev/null @@ -1,37 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - result += "[" - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - var value = builder { - for (v in listOf("A", "B", "C")) { - when (v) { - "A" -> result += "A;" - "B" -> result += suspendWithResult(v) + "]" - else -> result += suspendWithResult(v) + "]!" - } - } - } - if (value != "A;B]C]!") return "fail: suspend as if condition: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt deleted file mode 100644 index 3b58b756534..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt +++ /dev/null @@ -1,63 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendAndLog(value: T): T = suspendCoroutineOrReturn { c -> - result += "suspend($value);" - c.resume(value) - COROUTINE_SUSPENDED - } - - // Tail calls are not allowed to be Nothing typed. See KT-15051 - suspend fun suspendLogAndThrow(exception: Throwable): Any? = suspendCoroutineOrReturn { c -> - result += "throw(${exception.message});" - c.resumeWithException(exception) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(data: Unit) { - - } - - override fun resumeWithException(exception: Throwable) { - controller.result += "caught(${exception.message});" - } - }) - - return controller.result -} - -fun box(): String { - val value = builder { - try { - try { - suspendAndLog("1") - suspendLogAndThrow(RuntimeException("exception")) - } - catch (e: RuntimeException) { - suspendAndLog("caught") - suspendLogAndThrow(RuntimeException("fromCatch")) - } - } finally { - suspendAndLog("finally") - } - suspendAndLog("ignore") - } - if (value != "suspend(1);throw(exception);suspend(caught);throw(fromCatch);suspend(finally);caught(fromCatch);") { - return "fail: $value" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt deleted file mode 100644 index 0ed5739fa11..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt +++ /dev/null @@ -1,47 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendAndLog(value: T): T = suspendCoroutineOrReturn { c -> - result += "suspend($value);" - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, object : Continuation { - override val context = EmptyCoroutineContext - - override fun resume(data: Unit) {} - - override fun resumeWithException(exception: Throwable) { - controller.result += "ignoreCaught(${exception.message});" - } - }) - return controller.result -} - -fun box(): String { - val value = builder { - try { - suspendAndLog("before") - throw RuntimeException("foo") - } catch (e: RuntimeException) { - result += "caught(${e.message});" - } - suspendAndLog("after") - } - if (value != "suspend(before);caught(foo);suspend(after);") { - return "fail: $value" - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt deleted file mode 100644 index 4debc5952c4..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - - -class Controller { - var result = "" - - suspend fun suspendWithResult(value: T): T = suspendCoroutineOrReturn { c -> - c.resume(value) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - return controller.result -} - -fun box(): String { - var value = builder { - var x = 1 - while (suspendWithResult(x) <= 3) { - result += x++ - } - result += "." - } - if (value != "123.") return "fail: suspend as while condition: $value" - - value = builder { - var x = 1 - while (x <= 3) { - result += suspendWithResult(x++) - result += ";" - } - result += "." - } - if (value != "1;2;3;.") return "fail: suspend in while body: $value" - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt b/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt deleted file mode 100644 index 5b9aeb1adb1..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var result = false - suspend fun suspendHere(): String = suspendCoroutineOrReturn { x -> - x.resume("OK") - COROUTINE_SUSPENDED - } - - fun foo() { - result = true - } -} - -fun builder(c: suspend Controller.() -> Unit) { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation) - if (!controller.result) throw RuntimeException("fail") -} - -fun noinlineRun(block: () -> Unit) { - block() -} - -fun box(): String { - builder { - if (suspendHere() != "OK") { - throw RuntimeException("fail 1") - } - noinlineRun { - foo() - } - - if (suspendHere() != "OK") { - throw RuntimeException("fail 2") - } - } - - return "OK" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/coroutineToString.kt b/backend.native/tests/external/codegen/box/coroutines/coroutineToString.kt deleted file mode 100644 index fd02bebdc86..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/coroutineToString.kt +++ /dev/null @@ -1,33 +0,0 @@ -// TARGET_BACKEND: JVM -// WITH_REFLECT -// WITH_COROUTINES - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class A { - suspend fun foo() {} - - suspend fun bar(): T { - foo() - return suspendCoroutineOrReturn { x -> - x.resume(x.toString() as T) - COROUTINE_SUSPENDED - } - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - result = A().bar() - } - - return if (result == "(kotlin.coroutines.experimental.Continuation) -> kotlin.Any?") "OK" else "Fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt b/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt deleted file mode 100644 index daed63fe077..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -fun builder(c: suspend () -> Unit) { - val x = c.createCoroutine(EmptyContinuation) - - x.resume(Unit) - x.resume(Unit) -} - -fun box(): String { - var result = "" - - try { - builder { - result = "OK" - } - } catch (e: IllegalStateException) { - return result - } - - return "fail: $result" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt b/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt deleted file mode 100644 index 1834496d4ad..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt +++ /dev/null @@ -1,93 +0,0 @@ -// WITH_RUNTIME -// IGNORE_BACKEND: JS -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED - -fun runCustomLambdaAsCoroutine(e: Throwable? = null, x: (Continuation) -> Any?): String { - var result = "fail" - var wasIntercepted = false - val c = (x as suspend () -> String).createCoroutine(object: Continuation { - override fun resumeWithException(exception: Throwable) { - throw exception - } - - override val context: CoroutineContext - get() = object: ContinuationInterceptor { - override fun fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R { - throw IllegalStateException() - } - - override fun get(key: CoroutineContext.Key): E? { - if (key == ContinuationInterceptor.Key) { - return this as E - } - return null - } - - override fun interceptContinuation(continuation: Continuation) = object : Continuation { - override val context: CoroutineContext - get() = continuation.context - - override fun resume(value: T) { - wasIntercepted = true - continuation.resume(value) - } - - override fun resumeWithException(exception: Throwable) { - wasIntercepted = true - continuation.resumeWithException(exception) - } - } - - override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext { - throw IllegalStateException() - } - - override fun plus(context: CoroutineContext): CoroutineContext { - throw IllegalStateException() - } - - override val key: CoroutineContext.Key<*> - get() = ContinuationInterceptor.Key - } - - override fun resume(value: String) { - result = value - } - }) - - if (e != null) - c.resumeWithException(e) - else - c.resume(Unit) - - if (!wasIntercepted) return "was not intercepted" - - return result -} - -fun box(): String { - val x = runCustomLambdaAsCoroutine { - it.resume("OK") - COROUTINE_SUSPENDED - } - - if (x != "OK") return "fail 1: $x" - - val y = runCustomLambdaAsCoroutine { - "OK" - } - - if (y != "OK") return "fail 2: $x" - - - try { - runCustomLambdaAsCoroutine(RuntimeException("OK")) { - throw RuntimeException("fail 3") - } - } catch(e: Exception) { - return e.message!! - } - - return "fail 3" -} diff --git a/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt deleted file mode 100644 index 1337341d73b..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt +++ /dev/null @@ -1,48 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - suspend fun suspendHere(a: String = "abc", i: Int = 2): String = suspendCoroutineOrReturn { x -> - x.resume(a + "#" + (i + 1)) - COROUTINE_SUSPENDED - } -} - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "OK" - - builder { - var a = suspendHere() - if (a != "abc#3") { - result = "fail 1: $a" - throw RuntimeException(result) - } - - a = suspendHere("cde") - if (a != "cde#3") { - result = "fail 2: $a" - throw RuntimeException(result) - } - - a = suspendHere(i = 6) - if (a != "abc#7") { - result = "fail 3: $a" - throw RuntimeException(result) - } - - a = suspendHere("xyz", 9) - if (a != "xyz#10") { - result = "fail 4: $a" - throw RuntimeException(result) - } - } - - return result -} diff --git a/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt b/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt deleted file mode 100644 index 4e3eb06ff79..00000000000 --- a/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt +++ /dev/null @@ -1,94 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -class Controller { - var log = "" - var resumeIndex = 0 - - suspend fun suspendWithValue(value: T): T = suspendCoroutineOrReturn { continuation -> - log += "suspend($value);" - continuation.resume(value) - COROUTINE_SUSPENDED - } - - suspend fun suspendWithException(value: String): Unit = suspendCoroutineOrReturn { continuation -> - log += "error($value);" - continuation.resumeWithException(RuntimeException(value)) - COROUTINE_SUSPENDED - } -} - -abstract class ContinuationDispatcher : AbstractCoroutineContextElement(ContinuationInterceptor), ContinuationInterceptor { - abstract fun dispatchResume(value: T, continuation: Continuation): Boolean - abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean - override fun interceptContinuation(continuation: Continuation): Continuation = DispatchedContinuation(this, continuation) -} - -private class DispatchedContinuation( - val dispatcher: ContinuationDispatcher, - val continuation: Continuation -): Continuation { - override val context: CoroutineContext = continuation.context - - override fun resume(value: T) { - if (!dispatcher.dispatchResume(value, continuation)) - continuation.resume(value) - } - - override fun resumeWithException(exception: Throwable) { - if (!dispatcher.dispatchResumeWithException(exception, continuation)) - continuation.resumeWithException(exception) - } -} - -fun test(c: suspend Controller.() -> Unit): String { - val controller = Controller() - c.startCoroutine(controller, EmptyContinuation(object: ContinuationDispatcher() { - private fun dispatchResume(block: () -> Unit) { - val id = controller.resumeIndex++ - controller.log += "before $id;" - block() - controller.log += "after $id;" - } - - override fun