diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 050fee1b5b3..5ebc1d7d4a1 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -298,11 +298,6 @@ Task dynamicTest(String name, Closure configureClosure) { } } -linkTest("localDelegatedPropertyLink") { - source = "lower/local_delegated_property_link/main.kt" - lib = "lower/local_delegated_property_link/lib.kt" -} - // This test checks object layout can't be done in // KonanLocalTest paradigm //tasks.register("constructor", UnitKonanTest) { @@ -554,105 +549,11 @@ standaloneTest("leakMemoryWithWorkerTermination") { source = "runtime/workers/leak_memory_with_worker_termination.kt" } -linkTest("enum_linkTest") { - useGoldenData = true - source = "codegen/enum/linkTest_main.kt" - lib = "codegen/enum/linkTest_lib.kt" -} - -linkTest("enum_openMethodNoOverrides") { - useGoldenData = true - source = "codegen/enum/openMethodNoOverrides_main.kt" - lib = "codegen/enum/openMethodNoOverrides_lib.kt" -} - -linkTest("mangling") { - useGoldenData = true - source = "mangling/mangling.kt" - lib = "mangling/manglinglib.kt" -} - -linkTest("innerClass_linkTest") { - source = "codegen/innerClass/linkTest_main.kt" - lib = "codegen/innerClass/linkTest_lib.kt" -} - -linkTest("innerClass_inheritance_linkTest") { - useGoldenData = true - source = "codegen/innerClass/inheritance_linkTest_main.kt" - lib = "codegen/innerClass/inheritance_linkTest_lib.kt" -} - -linkTest("innerClass_inheritance2_linkTest") { - useGoldenData = true - source = "codegen/innerClass/inheritance2_linkTest_main.kt" - lib = "codegen/innerClass/inheritance2_linkTest_lib.kt" -} - -linkTest("innerClass_inheritance3_linkTest") { - useGoldenData = true - source = "codegen/innerClass/inheritance3_linkTest_main.kt" - lib = "codegen/innerClass/inheritance3_linkTest_lib.kt" -} - standaloneTest("initializers_testInfrastructure") { source = "codegen/initializers/testInfrastructure.kt" flags = ["-tr"] } -linkTest("initializers_linkTest1") { - useGoldenData = true - source = "codegen/initializers/linkTest1_main.kt" - lib = "codegen/initializers/linkTest1_lib.kt" -} - -linkTest("initializers_linkTest2") { - useGoldenData = true - source = "codegen/initializers/linkTest2_main.kt" - lib = "codegen/initializers/linkTest2_lib.kt" -} - -linkTest("initializers_sharedVarInInitBlock") { - source = "codegen/initializers/sharedVarInInitBlock_main.kt" - lib = "codegen/initializers/sharedVarInInitBlock_lib.kt" -} - -linkTest("bridges_linkTest") { - useGoldenData = true - source = "codegen/bridges/linkTest_main.kt" - lib = "codegen/bridges/linkTest_lib.kt" -} - -linkTest("bridges_linkTest2") { - useGoldenData = true - source = "codegen/bridges/linkTest2_main.kt" - lib = "codegen/bridges/linkTest2_lib.kt" -} - -linkTest("classDelegation_linkTest") { - useGoldenData = true - source = "codegen/classDelegation/linkTest_main.kt" - lib = "codegen/classDelegation/linkTest_lib.kt" -} - -linkTest("delegatedProperty_delegatedOverride") { - useGoldenData = true - source = "codegen/delegatedProperty/delegatedOverride_main.kt" - lib = "codegen/delegatedProperty/delegatedOverride_lib.kt" -} - -linkTest("delegatedProperty_correctFieldsOrder") { - useGoldenData = true - source = "codegen/delegatedProperty/correctFieldsOrder_main.kt" - lib = "codegen/delegatedProperty/correctFieldsOrder_lib.kt" -} - -linkTest("propertyCallableReference_linkTest") { - useGoldenData = true - source = "codegen/propertyCallableReference/linkTest_main.kt" - lib = "codegen/propertyCallableReference/linkTest_lib.kt" -} - tasks.register("sanity_assertions_enabled_for_local_tests", KonanLocalTest) { source = "sanity/assertions_enabled_for_local_tests.kt" } @@ -694,21 +595,6 @@ tasks.register("empty_string", KonanLocalTest) { source = "datagen/literals/empty_string.kt" } -// Disabled until we extract the classes that should be -// always present from stdlib into a separate binary. -// -//linkTest("link") { -// useGoldenData = true -// source = "link/src/bar.kt" -// lib = "link/lib" -//}( - -linkTest("link_omit_unused") { - useGoldenData = true - source = "link/omit/main.kt" - lib = "link/omit/library.kt" -} - standaloneTest("link_default_libs") { useGoldenData = true source = "link/default/default.kt" @@ -722,12 +608,6 @@ linkTest("no_purge_for_dependencies") { UtilsKt.dependsOnPlatformLibs(it) } -linkTest("lib@name") { - useGoldenData = true - source = "link/klib_name/prog.kt" - lib = "link/klib_name/lib.kt" -} - tasks.register("throw0", KonanLocalTest) { useGoldenData = true source = "runtime/basic/throw0.kt" @@ -1051,53 +931,11 @@ KotlinNativeTestKt.createTest(project, "kt39548", KonanStandaloneTest) { task -> } } -linkTest("deserialized_members") { - source = "serialization/deserialized_members/main.kt" - lib = "serialization/deserialized_members/library.kt" - useGoldenData = true -} - -linkTest("serialized_catch") { - source = "serialization/serialized_catch/main.kt" - lib = "serialization/serialized_catch/library.kt" - useGoldenData = true -} - -linkTest("serialized_doWhile") { - source = "serialization/serialized_doWhile/main.kt" - lib = "serialization/serialized_doWhile/library.kt" - useGoldenData = true -} - -linkTest("serialized_vararg") { - source = "serialization/serialized_vararg/main.kt" - lib = "serialization/serialized_vararg/library.kt" - useGoldenData = true -} - -linkTest("serialized_default_args") { - source = "serialization/serialized_default_args/main.kt" - lib = "serialization/serialized_default_args/library.kt" - useGoldenData = true -} - standaloneTest("serialized_no_typemap") { source = "serialization/regression/no_type_map.kt" useGoldenData = true } -linkTest("serialized_enum_ordinal") { - source = "serialization/enum_ordinal/main.kt" - lib = "serialization/enum_ordinal/library.kt" - useGoldenData = true -} - -linkTest("serialized_char_constant") { - source = "serialization/serialized_char_constant/main.kt" - lib = "serialization/serialized_char_constant/library.kt" - useGoldenData = true -} - standaloneTest("testing_annotations") { source = "testing/annotations.kt" flags = ['-tr'] @@ -1301,36 +1139,6 @@ tasks.register("driver_opt", KonanDriverTest) { flags = ["-opt"] } -// Enable when deserialization for default arguments is fixed. -linkTest("inline_defaultArgs_linkTest") { - useGoldenData = true - source = "codegen/inline/defaultArgs_linkTest_main.kt" - lib = "codegen/inline/defaultArgs_linkTest_lib.kt" -} - -linkTest("inline_sharedVar_linkTest") { - useGoldenData = true - source = "codegen/inline/sharedVar_linkTest_main.kt" - lib = "codegen/inline/sharedVar_linkTest_lib.kt" -} - -linkTest("inline_lateinitProperty_linkTest") { - useGoldenData = true - source = "codegen/inline/lateinitProperty_linkTest_main.kt" - lib = "codegen/inline/lateinitProperty_linkTest_lib.kt" -} - -linkTest("inline_inlineCtor_linkTest") { - source = "codegen/inline/inlineCtor_linkTest_main.kt" - lib = "codegen/inline/inlineCtor_linkTest_lib.kt" -} - -linkTest("inline_innerInlineFunCapturesOuter_linkTest") { - useGoldenData = true - source = "codegen/inline/innerInlineFunCapturesOuter_linkTest_main.kt" - lib = "codegen/inline/innerInlineFunCapturesOuter_linkTest_lib.kt" -} - def generateWithSpaceDefFile() { def buildDirectory = project.layout.buildDirectory.get().asFile def mapOption = "--Map \"$buildDirectory/cutom map.map\"" @@ -2703,18 +2511,6 @@ standaloneTest("split_compilation_pipeline") { useGoldenData = true } -linkTest("private_fake_overrides_0") { - source = "link/private_fake_overrides/inherit_main.kt" - lib = "link/private_fake_overrides/inherit_lib.kt" - useGoldenData = true -} - -linkTest("private_fake_overrides_1") { - source = "link/private_fake_overrides/override_main.kt" - lib = "link/private_fake_overrides/override_lib.kt" - useGoldenData = true -} - Task frameworkTest(String name, Closure configurator) { return KotlinNativeTestKt.createTest(project, name, FrameworkTest) { task -> configurator.delegate = task diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_lib.kt b/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_lib.kt deleted file mode 100644 index 2dd54bf5e42..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_lib.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -sealed class Tag { - abstract fun value(): Any -} - -sealed class TagBoolean : Tag() { - abstract override fun value(): Boolean - - object True : TagBoolean() { - override fun value() = true - } - - object False : TagBoolean() { - override fun value() = false - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.kt b/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.kt deleted file mode 100644 index 86e5845fc8b..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main(args: Array) { - val test: TagBoolean = TagBoolean.True - println(test.value()) -} diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.out b/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.out deleted file mode 100644 index 27ba77ddaf6..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest2_main.out +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/bridges/linkTest_lib.kt deleted file mode 100644 index 52eeb61a0d2..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_lib.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -interface A { - fun foo(): T -} - -open class C: A { - override fun foo(): Int = 42 -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.kt deleted file mode 100644 index f2ff083fc16..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* - -class B: C() - -fun main(args: Array) { - val b = B() - println(b.foo()) - val c: C = b - println(c.foo()) - val a: A = b - println(a.foo()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.out b/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.out deleted file mode 100644 index bda709ecfb4..00000000000 --- a/kotlin-native/backend.native/tests/codegen/bridges/linkTest_main.out +++ /dev/null @@ -1,3 +0,0 @@ -42 -42 -42 diff --git a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_lib.kt deleted file mode 100644 index a9d001fab69..00000000000 --- a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_lib.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package zzz - -interface I { - fun foo(): Int -} - -open class A : I { - override fun foo() = 42 -} - -open class B : I by A() { - val x = 117 - val y = "zzz" -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.kt deleted file mode 100644 index 0005ae4752b..00000000000 --- a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import zzz.* - -class C : B() { - val a = "qxx" - val b = 123 -} - -fun main(args: Array) { - val c = C() - println(c.a) - println(c.b) - println(c.foo()) - println(c.x) - println(c.y) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.out b/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.out deleted file mode 100644 index e90ecd27d28..00000000000 --- a/kotlin-native/backend.native/tests/codegen/classDelegation/linkTest_main.out +++ /dev/null @@ -1,5 +0,0 @@ -qxx -123 -42 -117 -zzz diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_lib.kt b/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_lib.kt deleted file mode 100644 index 8ddf4cb6c47..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_lib.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package zzz - -open class B { - val z by lazy { "qzz" } - val x = 117 - val zzz = "zzz" -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.kt b/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.kt deleted file mode 100644 index c9c4fec3aec..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import zzz.* - -class C : B() { - val a = "qxx" -} - -fun main(args: Array) { - val c = C() - println(c.a) - println(c.x) - println(c.zzz) - println(c.z) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.out b/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.out deleted file mode 100644 index ccb68181a4e..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.out +++ /dev/null @@ -1,4 +0,0 @@ -qxx -117 -zzz -qzz diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt b/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt deleted file mode 100644 index 910bafcbd61..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_lib.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -import kotlin.reflect.KProperty - -open class A { - open val x = 42 -} - -class Delegate { - val f = 117 - operator fun getValue(receiver: Any?, p: KProperty<*>): Int { - println(p.name) - return f - } -} - -open class B: A() { - override val x: Int by Delegate() - - fun bar() { - println(super.x) - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt b/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt deleted file mode 100644 index a138d22f57d..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* - -open class C: B() { - override val x: Int = 156 - - fun foo() { - println(x) - - println(super.x) - bar() - } -} - -fun main(args: Array) { - val c = C() - c.foo() -} diff --git a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.out b/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.out deleted file mode 100644 index 6a95e9efa88..00000000000 --- a/kotlin-native/backend.native/tests/codegen/delegatedProperty/delegatedOverride_main.out +++ /dev/null @@ -1,4 +0,0 @@ -156 -x -117 -42 diff --git a/kotlin-native/backend.native/tests/codegen/enum/linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/enum/linkTest_lib.kt deleted file mode 100644 index d80af8e23ae..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/linkTest_lib.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -enum class A(val x: Int) { - Z1(42), - Z2(117), - Z3(-1) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.kt deleted file mode 100644 index 7484bbcb7d4..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* - -fun main(args: Array) { - println(A.Z1.x) - println(A.valueOf("Z2").x) - println(A.values()[2].x) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.out b/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.out deleted file mode 100644 index 6a476d9c6b4..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/linkTest_main.out +++ /dev/null @@ -1,3 +0,0 @@ -42 -117 --1 diff --git a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_lib.kt b/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_lib.kt deleted file mode 100644 index 12b046c8841..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_lib.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -enum class Foo { - Z; - - open fun bar() = 42 -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.kt b/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.kt deleted file mode 100644 index 7ebd4010253..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.kt +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main() = println(Foo.Z.bar()) \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.out b/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.out deleted file mode 100644 index d81cc0710eb..00000000000 --- a/kotlin-native/backend.native/tests/codegen/enum/openMethodNoOverrides_main.out +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_lib.kt b/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_lib.kt deleted file mode 100644 index 145c8e0d9b3..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_lib.kt +++ /dev/null @@ -1,3 +0,0 @@ -val a = 10 -val b = a * 6 -val c = a * b * 2 \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.kt b/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.kt deleted file mode 100644 index 2fdafb7c6e2..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.kt +++ /dev/null @@ -1 +0,0 @@ -fun main() = println(c) \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.out b/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.out deleted file mode 100644 index 59a3ec59b53..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest1_main.out +++ /dev/null @@ -1 +0,0 @@ -1200 diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_lib.kt b/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_lib.kt deleted file mode 100644 index 9aafbdbf060..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_lib.kt +++ /dev/null @@ -1,3 +0,0 @@ -val a = mutableListOf() -val b = 1.also { a += 2 } -val c = a.single() \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.kt b/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.kt deleted file mode 100644 index 2fdafb7c6e2..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.kt +++ /dev/null @@ -1 +0,0 @@ -fun main() = println(c) \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.out b/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.out deleted file mode 100644 index 0cfbf08886f..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/linkTest2_main.out +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_lib.kt b/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_lib.kt deleted file mode 100644 index 641e7def76b..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_lib.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - val x: Int - - init { - var y = 10 - - fun foo() { y = 42 } - - foo() - - x = y - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_main.kt b/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_main.kt deleted file mode 100644 index 8a1b4f274f2..00000000000 --- a/kotlin-native/backend.native/tests/codegen/initializers/sharedVarInInitBlock_main.kt +++ /dev/null @@ -1,3 +0,0 @@ -import kotlin.test.* - -fun main() = assertEquals(42, (A().x)) \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt deleted file mode 100644 index c8053f8c38a..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -inline fun foo(x: Int, y: Int = 117) = x + y \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt deleted file mode 100644 index f8ed29ab609..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* - -fun main(args: Array) { - println(foo(5)) - println(foo(5, 42)) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.out deleted file mode 100644 index 7cd6da5fb23..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/defaultArgs_linkTest_main.out +++ /dev/null @@ -1,2 +0,0 @@ -122 -47 diff --git a/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_lib.kt deleted file mode 100644 index 5c6a2059f97..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_lib.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -fun foo(n: Int, block: (Int) -> Int): Int { - val arr = IntArray(n) { block(it) } - var sum = 0 - for (x in arr) sum += x - return sum -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_main.kt deleted file mode 100644 index 6281b09a7d5..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/inlineCtor_linkTest_main.kt +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* -import kotlin.test.* - -fun main() { - assertEquals(42, foo(7) { it * 2 }) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_lib.kt deleted file mode 100644 index ffe1e575a38..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_lib.kt +++ /dev/null @@ -1,7 +0,0 @@ -package a - -class E(val x: String) { - inner class Inner { - inline fun foo(y: String) = x + y - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.kt deleted file mode 100644 index 1528b8a28dc..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.kt +++ /dev/null @@ -1,5 +0,0 @@ -import a.* - -fun main() { - println(E("O").Inner().foo("K")) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/innerInlineFunCapturesOuter_linkTest_main.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_lib.kt deleted file mode 100644 index abfed1ee210..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_lib.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) } - -inline fun foo(values: IntArray, crossinline block: (Int, Int, Int) -> Int): Int { - val o = object { - lateinit var s: String - var x: Int = 42 - } - values.forEachNoInline { - o.x = block(o.x, o.s.length, it) - } - return o.x -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.kt deleted file mode 100644 index cb8fab5e905..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") - -import a.* - -fun main() { - try { - val res = foo(intArrayOf(1, 2, 3)) { x, y, z -> x + y - z } - println(res) - } catch (t: UninitializedPropertyAccessException) { - println("OK") - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/lateinitProperty_linkTest_main.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.kt deleted file mode 100644 index f5d4b0788a1..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.* - -fun main() { - println(fold(0, intArrayOf(1, 2, 3)) { x, y -> x + y }) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.out deleted file mode 100644 index 1e8b3149621..00000000000 --- a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_main.out +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_lib.kt deleted file mode 100644 index ac36c27f53b..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_lib.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -open class Outer(val x: Int) { - open inner class Inner1 - inner class Middle(x: Int) : Outer(x) { - inner class Inner2 : Inner1() { - fun foo() = this@Outer.x + this@Middle.x - } - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.kt deleted file mode 100644 index 1b8b308b1df..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main() { - val o = Outer(42).Middle(117).Inner2() - println(o.foo()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.out deleted file mode 100644 index 3f7d1915f71..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance2_linkTest_main.out +++ /dev/null @@ -1 +0,0 @@ -159 diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_lib.kt deleted file mode 100644 index da3f0f4a75f..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_lib.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -open class Outer { - open inner class Inner1 - inner class Middle { - inner class Inner2 : Inner1() { - fun getOuter() = this@Outer - fun getMiddle() = this@Middle - } - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.kt deleted file mode 100644 index c747f110088..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main() { - val o = Outer().Middle().Inner2() - println(o.getOuter() != Outer()) - println(o.getMiddle() != Outer().Middle()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.out deleted file mode 100644 index bb101b641b9..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance3_linkTest_main.out +++ /dev/null @@ -1,2 +0,0 @@ -true -true diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_lib.kt deleted file mode 100644 index 0c60c133801..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_lib.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -open class Foo(val z: Int) { - open inner class FooInner { - fun foo() = z - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.kt deleted file mode 100644 index 40e50d3d05e..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -class Bar : Foo(42) { - inner class BarInner(val x: Int) : FooInner() -} - -fun main() { - val o = Bar().BarInner(117) - println(o.x) - println(o.foo()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.out b/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.out deleted file mode 100644 index 01c576313a0..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/inheritance_linkTest_main.out +++ /dev/null @@ -1,2 +0,0 @@ -117 -42 diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_lib.kt deleted file mode 100644 index c497f75a54e..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_lib.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -open class A { - open inner class Inner { - val x = 42 - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_main.kt deleted file mode 100644 index 4cfb90ff336..00000000000 --- a/kotlin-native/backend.native/tests/codegen/innerClass/linkTest_main.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -open class B : A() { - open inner class Inner : A.Inner() -} - -fun main(args: Array) { - B().Inner() -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt b/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt deleted file mode 100644 index d85930a4974..00000000000 --- a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package a - -class A(val x: Int) \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt b/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt deleted file mode 100644 index 0d122653f82..00000000000 --- a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import a.A - -fun main(args: Array) { - val p1 = A::x - println(p1.get(A(42))) - val a = A(117) - val p2 = a::x - println(p2.get()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.out b/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.out deleted file mode 100644 index 6f7eb39b03d..00000000000 --- a/kotlin-native/backend.native/tests/codegen/propertyCallableReference/linkTest_main.out +++ /dev/null @@ -1,2 +0,0 @@ -42 -117 diff --git a/kotlin-native/backend.native/tests/link/klib_name/lib.kt b/kotlin-native/backend.native/tests/link/klib_name/lib.kt deleted file mode 100644 index a266651b0c0..00000000000 --- a/kotlin-native/backend.native/tests/link/klib_name/lib.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun foo() { - println("linked library") -} diff --git a/kotlin-native/backend.native/tests/link/klib_name/prog.kt b/kotlin-native/backend.native/tests/link/klib_name/prog.kt deleted file mode 100644 index 07f5d6d4727..00000000000 --- a/kotlin-native/backend.native/tests/link/klib_name/prog.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -fun main(args: Array) { - foo() -} diff --git a/kotlin-native/backend.native/tests/link/klib_name/prog.out b/kotlin-native/backend.native/tests/link/klib_name/prog.out deleted file mode 100644 index 8db1afa0f58..00000000000 --- a/kotlin-native/backend.native/tests/link/klib_name/prog.out +++ /dev/null @@ -1 +0,0 @@ -linked library diff --git a/kotlin-native/backend.native/tests/link/lib/foo.kt b/kotlin-native/backend.native/tests/link/lib/foo.kt deleted file mode 100644 index 5ceaa7740fa..00000000000 --- a/kotlin-native/backend.native/tests/link/lib/foo.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package qwerty - -fun foo(a: Int): Int { - return a -} - - diff --git a/kotlin-native/backend.native/tests/link/lib/foo2.kt b/kotlin-native/backend.native/tests/link/lib/foo2.kt deleted file mode 100644 index af5db52e965..00000000000 --- a/kotlin-native/backend.native/tests/link/lib/foo2.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package qwerty - -fun foo2(a: Int): Int { - return a -} - - diff --git a/kotlin-native/backend.native/tests/link/omit/library.kt b/kotlin-native/backend.native/tests/link/omit/library.kt deleted file mode 100644 index 4286010b189..00000000000 --- a/kotlin-native/backend.native/tests/link/omit/library.kt +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package foo -fun foo() {} diff --git a/kotlin-native/backend.native/tests/link/omit/main.kt b/kotlin-native/backend.native/tests/link/omit/main.kt deleted file mode 100644 index 41886e3b9cf..00000000000 --- a/kotlin-native/backend.native/tests/link/omit/main.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main(args: Array) { - println("Hello") -} diff --git a/kotlin-native/backend.native/tests/link/omit/main.out b/kotlin-native/backend.native/tests/link/omit/main.out deleted file mode 100644 index e965047ad7c..00000000000 --- a/kotlin-native/backend.native/tests/link/omit/main.out +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_lib.kt b/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_lib.kt deleted file mode 100644 index 79d005ea442..00000000000 --- a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_lib.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -// Private classes -private open class A { - public fun foo1() = println("PASS") - internal fun foo2() = println("PASS") - protected fun foo3() = println("PASS") -} - -private class B:A() { - fun foo4() = foo3() -} - -// Private interfaces -private interface C { - fun foo() = println("PASS") -} - -private class D: C - -fun runner() { - B().foo1() - B().foo2() - B().foo4() - - D().foo() - - // Objects - object : A(){ - fun foo4() = foo3() - }.apply { - foo1() - foo2() - foo4() - } - - // Function local classes - abstract class E { - public open fun foo1() = println("PASS") - internal open fun foo2() = println("PASS") - protected open fun foo3() = println("PASS") - } - class F : E() { - fun foo4() = foo3() - } - F().foo1() - F().foo2() - F().foo4() -} - diff --git a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.kt b/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.kt deleted file mode 100644 index 46b1d2d0bd2..00000000000 --- a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main() { - runner() -} - diff --git a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.out b/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.out deleted file mode 100644 index 40f949f4c16..00000000000 --- a/kotlin-native/backend.native/tests/link/private_fake_overrides/inherit_main.out +++ /dev/null @@ -1,10 +0,0 @@ -PASS -PASS -PASS -PASS -PASS -PASS -PASS -PASS -PASS -PASS diff --git a/kotlin-native/backend.native/tests/link/purge1/lib.kt b/kotlin-native/backend.native/tests/link/purge1/lib.kt index 11326bb8bfe..2d2811083fe 100644 --- a/kotlin-native/backend.native/tests/link/purge1/lib.kt +++ b/kotlin-native/backend.native/tests/link/purge1/lib.kt @@ -1,6 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) diff --git a/kotlin-native/backend.native/tests/link/purge1/prog.kt b/kotlin-native/backend.native/tests/link/purge1/prog.kt index 8a0446a79af..6780fec41bc 100644 --- a/kotlin-native/backend.native/tests/link/purge1/prog.kt +++ b/kotlin-native/backend.native/tests/link/purge1/prog.kt @@ -1,6 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ diff --git a/kotlin-native/backend.native/tests/link/src/bar.kt b/kotlin-native/backend.native/tests/link/src/bar.kt deleted file mode 100644 index a728d09ba7d..00000000000 --- a/kotlin-native/backend.native/tests/link/src/bar.kt +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import qwerty.* - -fun main(args: Array) { - val size = foo(foo2(args.size)) - println(size.toString()) -} diff --git a/kotlin-native/backend.native/tests/link/src/bar.out b/kotlin-native/backend.native/tests/link/src/bar.out deleted file mode 100644 index 573541ac970..00000000000 --- a/kotlin-native/backend.native/tests/link/src/bar.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/kotlin-native/backend.native/tests/lower/local_delegated_property_link/lib.kt b/kotlin-native/backend.native/tests/lower/local_delegated_property_link/lib.kt deleted file mode 100644 index bea7249286e..00000000000 --- a/kotlin-native/backend.native/tests/lower/local_delegated_property_link/lib.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo(): String{ - val bar: String by lazy { - "OK" - } - - return bar -} - diff --git a/kotlin-native/backend.native/tests/lower/local_delegated_property_link/main.kt b/kotlin-native/backend.native/tests/lower/local_delegated_property_link/main.kt deleted file mode 100644 index 8666e8da168..00000000000 --- a/kotlin-native/backend.native/tests/lower/local_delegated_property_link/main.kt +++ /dev/null @@ -1,5 +0,0 @@ -import kotlin.test.* - -fun main() { - assertEquals("OK", foo()) -} diff --git a/kotlin-native/backend.native/tests/mangling/mangling.kt b/kotlin-native/backend.native/tests/mangling/mangling.kt deleted file mode 100644 index 19f2bd19a4f..00000000000 --- a/kotlin-native/backend.native/tests/mangling/mangling.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun test_direct() { - val mutListInt = mutableListOf(1, 2, 3, 4) - val mutListNum = mutableListOf(9, 10, 11, 12) - val mutListAny = mutableListOf(5, 6, 7, 8) - - mangle1(mutListInt) - mangle1(mutListNum) - mangle1(mutListAny) -} - -fun test_param() { - val mutListInt = mutableListOf(1, 2, 3, 4) - val mutListNum = mutableListOf(9, 10, 11, 12) - val mutListAny = mutableListOf(5, 6, 7, 8) - - mangle2(mutListInt) - mangle2(mutListNum) - mangle2(mutListAny) -} - -fun test_multiple_constructors() { - val any = mapOf() - val comparable = "some string" - val number = 17 - - mangle3(any) - mangle3(comparable) - mangle3(number) -} - -fun main(args: Array) { - test_direct() - test_param() - test_multiple_constructors() -} - diff --git a/kotlin-native/backend.native/tests/mangling/mangling.out b/kotlin-native/backend.native/tests/mangling/mangling.out deleted file mode 100644 index a0f68dcf468..00000000000 --- a/kotlin-native/backend.native/tests/mangling/mangling.out +++ /dev/null @@ -1,9 +0,0 @@ -Int direct [1, 2, 3, 4] -out Number direct [9, 10, 11, 12] -star direct [5, 6, 7, 8] -Int param [1, 2, 3, 4] -out Number param [9, 10, 11, 12] -star param [5, 6, 7, 8] -no constructors {} -single constructor some string -two constructors 17 diff --git a/kotlin-native/backend.native/tests/mangling/manglinglib.kt b/kotlin-native/backend.native/tests/mangling/manglinglib.kt deleted file mode 100644 index a431f5a0cef..00000000000 --- a/kotlin-native/backend.native/tests/mangling/manglinglib.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -public fun mangle1(l: List) { - println("Int direct $l") -} - -public fun mangle1(l: List) { - println("out Number direct $l") -} - -public fun mangle1(l: List<*>) { - println("star direct $l") -} - -public fun mangle2(l: T) where T: List -{ - println("Int param $l") -} - -public fun mangle2(l: T) where T: List -{ - println("out Number param $l") -} - -public fun mangle2(l: T) where T: List<*> -{ - println("star param $l") -} - -public fun mangle3(l: T) -{ - println("no constructors $l") -} - -public fun mangle3(l: T) - where - T: Comparable -{ - println("single constructor $l") -} - -public fun mangle3(l: T) - where - T: Comparable, - T: Number -{ - println("two constructors $l") -} - diff --git a/kotlin-native/backend.native/tests/serialization/deserialized_members/library.kt b/kotlin-native/backend.native/tests/serialization/deserialized_members/library.kt deleted file mode 100644 index 1cd454e1ae0..00000000000 --- a/kotlin-native/backend.native/tests/serialization/deserialized_members/library.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package foo.bar - -class R { - inline fun bar(t: T) { - println("just a single class: $t") - } -} - -class C { - inline fun foo() { - println("first level") - } - - class D { - inline fun foo() { - println("second level") - } - - class E { - inline fun foo() { - println("third levelxz") - } - } - } -} - -class C2 { - inline fun foo() { - println("inner first level") - } - - inner class D2 { - inline fun foo() { - println("inner second level") - } - - inner class E2 { - inline fun foo() { - println("inner third level") - } - } - } -} - -class C3 { - inline fun foo(x: X) { - println("types first level: $x") - } - - class D3 { - inline fun foo(x: X) { - println("types second level $x") - } - - class E3 { - inline fun foo(x: X) { - println("types third level $x") - } - } - } -} - -class C4 { - inline fun foo(x: X) { - println("inner types first level: $x") - } - - inner class D4 { - inline fun foo(x: X, y: Y) { - println("inner types second level $x, $y") - } - - inner class E4 { - inline fun foo(x: X, y: Y, z: Z) { - println("inner types third level $x, $y, $z") - } - } - } -} - diff --git a/kotlin-native/backend.native/tests/serialization/deserialized_members/main.kt b/kotlin-native/backend.native/tests/serialization/deserialized_members/main.kt deleted file mode 100644 index b9817955960..00000000000 --- a/kotlin-native/backend.native/tests/serialization/deserialized_members/main.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import foo.bar.* - -fun main(args: Array) { - val c = C() - val d = C.D() - val e = C.D.E() - c.foo() - d.foo() - e.foo() - - val c2 = C2() - val d2 = C2().D2() - val e2 = C2().D2().E2() - c2.foo() - d2.foo() - e2.foo() - - val c3 = C3() - val d3 = C3.D3() - val e3 = C3.D3.E3() - c3.foo(13) - d3.foo("cha-cha-cha") - e3.foo(1.0f) - - // This part doesn't work with file local inline functions. - // So disabled for now. - // val c4 = C4() - // val d4 = C4().D4() - // val e4 = C4().D4().E4() - // c4.foo(13) - // d4.foo("cawabunga", 17) - // e4.foo(19, "raqa-taqa", 23) - -} diff --git a/kotlin-native/backend.native/tests/serialization/deserialized_members/main.out b/kotlin-native/backend.native/tests/serialization/deserialized_members/main.out deleted file mode 100644 index d026cd77063..00000000000 --- a/kotlin-native/backend.native/tests/serialization/deserialized_members/main.out +++ /dev/null @@ -1,9 +0,0 @@ -first level -second level -third levelxz -inner first level -inner second level -inner third level -types first level: 13 -types second level cha-cha-cha -types third level 1.0 diff --git a/kotlin-native/backend.native/tests/serialization/enum_ordinal/library.kt b/kotlin-native/backend.native/tests/serialization/enum_ordinal/library.kt deleted file mode 100644 index e4a53af9306..00000000000 --- a/kotlin-native/backend.native/tests/serialization/enum_ordinal/library.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -enum class Color { - RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW -} - -fun determineColor(code: Int): Color = when (code) { - 0 -> Color.BLUE - 1 -> Color.MAGENTA - else -> Color.CYAN -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.kt b/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.kt deleted file mode 100644 index 7801b043164..00000000000 --- a/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main(args: Array) { - println(Color.RED.ordinal) - println(Color.GREEN.ordinal) - println(Color.BLUE.ordinal) - val color = when (determineColor(args.size)) { - Color.RED -> println("r") - Color.GREEN -> println("g") - Color.BLUE -> println("b") - Color.CYAN -> println("c") - Color.MAGENTA -> println("m") - Color.YELLOW -> println("y") - - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.out b/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.out deleted file mode 100644 index cbeb5c9cc5d..00000000000 --- a/kotlin-native/backend.native/tests/serialization/enum_ordinal/main.out +++ /dev/null @@ -1,4 +0,0 @@ -0 -1 -2 -b diff --git a/kotlin-native/backend.native/tests/serialization/serialized_catch/library.kt b/kotlin-native/backend.native/tests/serialization/serialized_catch/library.kt deleted file mode 100644 index 9ed7fc76f5a..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_catch/library.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -inline fun foo() { - try { - try { - throw Exception("XXX") - } catch (e: Throwable) { - println("Gotcha1: ${e.message}") - throw Exception("YYY") - } - } catch (e: Throwable) { - println("Gotcha2: ${e.message}") - } -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_catch/main.kt b/kotlin-native/backend.native/tests/serialization/serialized_catch/main.kt deleted file mode 100644 index 8a0446a79af..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_catch/main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -fun main(args: Array) { - foo() -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_catch/main.out b/kotlin-native/backend.native/tests/serialization/serialized_catch/main.out deleted file mode 100644 index 8ec4a09f706..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_catch/main.out +++ /dev/null @@ -1,2 +0,0 @@ -Gotcha1: XXX -Gotcha2: YYY diff --git a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/library.kt b/kotlin-native/backend.native/tests/serialization/serialized_char_constant/library.kt deleted file mode 100644 index 31cc0e9bfd4..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/library.kt +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -inline fun foo(x: Char = '\u042b') = x diff --git a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.kt b/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.kt deleted file mode 100644 index 82bd39a9e27..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main(args: Array) { - println(foo()) -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.out b/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.out deleted file mode 100644 index 9fcf5282792..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_char_constant/main.out +++ /dev/null @@ -1 +0,0 @@ -Ы diff --git a/kotlin-native/backend.native/tests/serialization/serialized_default_args/library.kt b/kotlin-native/backend.native/tests/serialization/serialized_default_args/library.kt deleted file mode 100644 index d019ebb1e1e..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_default_args/library.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -inline val Int.prop get() = SomeDataClass(second = this) - -data class SomeDataClass(val first: Int = 17, val second: Int = 19, val third: Int = 23) - diff --git a/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.kt b/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.kt deleted file mode 100644 index 20751feb97f..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun main(args: Array) { - println(666.prop) -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.out b/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.out deleted file mode 100644 index 60010628fe2..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_default_args/main.out +++ /dev/null @@ -1 +0,0 @@ -SomeDataClass(first=17, second=666, third=23) diff --git a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/library.kt b/kotlin-native/backend.native/tests/serialization/serialized_doWhile/library.kt deleted file mode 100644 index eb96619bdbb..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/library.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -inline fun foo() { - do { - var x: Int = 999 - println(x) - } while (x != 999) -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.kt b/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.kt deleted file mode 100644 index 8a0446a79af..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -fun main(args: Array) { - foo() -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.out b/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.out deleted file mode 100644 index a6905f8ba44..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_doWhile/main.out +++ /dev/null @@ -1 +0,0 @@ -999 diff --git a/kotlin-native/backend.native/tests/serialization/serialized_vararg/library.kt b/kotlin-native/backend.native/tests/serialization/serialized_vararg/library.kt deleted file mode 100644 index 46f037d89ec..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_vararg/library.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -fun bar(vararg x: Int) { - x.forEach { - println(it) - } - println("size: ${x.size}") -} - -inline fun foo() = bar(17, 19, 23, *intArrayOf(29, 31)) - diff --git a/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.kt b/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.kt deleted file mode 100644 index 8a0446a79af..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - - -fun main(args: Array) { - foo() -} diff --git a/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.out b/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.out deleted file mode 100644 index b35a8d31583..00000000000 --- a/kotlin-native/backend.native/tests/serialization/serialized_vararg/main.out +++ /dev/null @@ -1,6 +0,0 @@ -17 -19 -23 -29 -31 -size: 5 diff --git a/native/native.tests/testData/codegen/bridges/multipleModules1.kt b/native/native.tests/testData/codegen/bridges/multipleModules1.kt new file mode 100644 index 00000000000..f8bb928774e --- /dev/null +++ b/native/native.tests/testData/codegen/bridges/multipleModules1.kt @@ -0,0 +1,31 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +interface A { + fun foo(): T +} + +open class C: A { + override fun foo(): Int = 42 +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +class B: C() + +fun box(): String { + val b = B() + assertEquals(42, b.foo()) + val c: C = b + assertEquals(42, c.foo()) + val a: A = b + assertEquals(42, a.foo()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/bridges/multipleModules2.kt b/native/native.tests/testData/codegen/bridges/multipleModules2.kt new file mode 100644 index 00000000000..70aca35effe --- /dev/null +++ b/native/native.tests/testData/codegen/bridges/multipleModules2.kt @@ -0,0 +1,23 @@ +// MODULE: lib +// FILE: lib.kt + +sealed class Tag { + abstract fun value(): Any +} + +sealed class TagBoolean : Tag() { + abstract override fun value(): String + + object True : TagBoolean() { + override fun value() = "OK" + } + + object False : TagBoolean() { + override fun value() = "FAIL" + } +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = TagBoolean.True.value() diff --git a/native/native.tests/testData/codegen/classDelegation/multipleModules.kt b/native/native.tests/testData/codegen/classDelegation/multipleModules.kt new file mode 100644 index 00000000000..d35a7bfee56 --- /dev/null +++ b/native/native.tests/testData/codegen/classDelegation/multipleModules.kt @@ -0,0 +1,39 @@ +// MODULE: lib +// FILE: lib.kt + +package zzz + +interface I { + fun foo(): Int +} + +open class A : I { + override fun foo() = 42 +} + +open class B : I by A() { + val x = 117 + val y = "zzz" +} + +// MODULE: main(lib) +// FILE: main.kt + +import zzz.* +import kotlin.test.* + +class C : B() { + val a = "qxx" + val b = 123 +} + +fun box(): String { + val c = C() + assertEquals("qxx", c.a) + assertEquals(123, c.b) + assertEquals(42, c.foo()) + assertEquals(117, c.x) + assertEquals("zzz", c.y) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/delegatedProperty/correctFieldsOrder.kt b/native/native.tests/testData/codegen/delegatedProperty/correctFieldsOrder.kt new file mode 100644 index 00000000000..784de4e54f5 --- /dev/null +++ b/native/native.tests/testData/codegen/delegatedProperty/correctFieldsOrder.kt @@ -0,0 +1,30 @@ +// MODULE: lib +// FILE: lib.kt + +package zzz + +open class B { + val z by lazy { "qzz" } + val x = 117 + val zzz = "zzz" +} + +// MODULE: main(lib) +// FILE: main.kt + +import zzz.* +import kotlin.test.* + +class C : B() { + val a = "qxx" +} + +fun box(): String { + val c = C() + assertEquals("qxx", c.a) + assertEquals(117, c.x) + assertEquals("zzz", c.zzz) + assertEquals("qzz", c.z) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/delegatedProperty/delegatedOverride.kt b/native/native.tests/testData/codegen/delegatedProperty/delegatedOverride.kt new file mode 100644 index 00000000000..1c4a8d3efc8 --- /dev/null +++ b/native/native.tests/testData/codegen/delegatedProperty/delegatedOverride.kt @@ -0,0 +1,60 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +import kotlin.reflect.KProperty + +public val sb = StringBuilder() + +open class A { + open val x = 42 +} + +class Delegate { + val f = 117 + operator fun getValue(receiver: Any?, p: KProperty<*>): Int { + sb.appendLine(p.name) + return f + } +} + +open class B: A() { + override val x: Int by Delegate() + + fun bar() { + sb.appendLine(super.x) + } +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +open class C: B() { + override val x: Int = 156 + + fun foo() { + sb.appendLine(x) + + sb.appendLine(super.x) + bar() + } +} + +fun box(): String { + val c = C() + c.foo() + + assertEquals(""" + 156 + x + 117 + 42 + + """.trimIndent(), sb.toString()) + + return "OK" +} diff --git a/native/native.tests/testData/codegen/enum/multipleModules.kt b/native/native.tests/testData/codegen/enum/multipleModules.kt new file mode 100644 index 00000000000..88f2a921eda --- /dev/null +++ b/native/native.tests/testData/codegen/enum/multipleModules.kt @@ -0,0 +1,23 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +enum class A(val x: Int) { + Z1(42), + Z2(117), + Z3(-1) +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +fun box(): String { + assertEquals(42, A.Z1.x) + assertEquals(117, A.valueOf("Z2").x) + assertEquals(-1, A.values()[2].x) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/enum/openMethodNoOverrides.kt b/native/native.tests/testData/codegen/enum/openMethodNoOverrides.kt new file mode 100644 index 00000000000..456ef0f3f86 --- /dev/null +++ b/native/native.tests/testData/codegen/enum/openMethodNoOverrides.kt @@ -0,0 +1,13 @@ +// MODULE: lib +// FILE: lib.kt + +enum class Foo { + Z; + + open fun bar() = "OK" +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = Foo.Z.bar() \ No newline at end of file diff --git a/native/native.tests/testData/codegen/initializers/multipleModules1.kt b/native/native.tests/testData/codegen/initializers/multipleModules1.kt new file mode 100644 index 00000000000..5afd291bde4 --- /dev/null +++ b/native/native.tests/testData/codegen/initializers/multipleModules1.kt @@ -0,0 +1,16 @@ +// MODULE: lib +// FILE: lib.kt + +val a = 10 +val b = a * 6 +val c = a * b * 2 + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + assertEquals(1200, c) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/initializers/multipleModules2.kt b/native/native.tests/testData/codegen/initializers/multipleModules2.kt new file mode 100644 index 00000000000..a9b658d83db --- /dev/null +++ b/native/native.tests/testData/codegen/initializers/multipleModules2.kt @@ -0,0 +1,11 @@ +// MODULE: lib +// FILE: lib.kt + +val a = mutableListOf() +val b = 1.also { a += "OK" } +val c = a.single() + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = c \ No newline at end of file diff --git a/native/native.tests/testData/codegen/initializers/sharedVarInInitBlock.kt b/native/native.tests/testData/codegen/initializers/sharedVarInInitBlock.kt new file mode 100644 index 00000000000..fdfd6832e5f --- /dev/null +++ b/native/native.tests/testData/codegen/initializers/sharedVarInInitBlock.kt @@ -0,0 +1,21 @@ +// MODULE: lib +// FILE: lib.kt + +class A { + val x: String + + init { + var y = "FAIL" + + fun foo() { y = "OK" } + + foo() + + x = y + } +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = A().x \ No newline at end of file diff --git a/native/native.tests/testData/codegen/inline/defaultArgsMultipleModules.kt b/native/native.tests/testData/codegen/inline/defaultArgsMultipleModules.kt new file mode 100644 index 00000000000..a84b390a2a3 --- /dev/null +++ b/native/native.tests/testData/codegen/inline/defaultArgsMultipleModules.kt @@ -0,0 +1,18 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +inline fun foo(x: Int, y: Int = 117) = x + y + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +fun box(): String { + assertEquals(122, foo(5)) + assertEquals(47, foo(5, 42)) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/inline/inlineCtor.kt b/native/native.tests/testData/codegen/inline/inlineCtor.kt new file mode 100644 index 00000000000..b1434f4773c --- /dev/null +++ b/native/native.tests/testData/codegen/inline/inlineCtor.kt @@ -0,0 +1,22 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +fun foo(n: Int, block: (Int) -> Int): Int { + val arr = IntArray(n) { block(it) } + var sum = 0 + for (x in arr) sum += x + return sum +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +fun box(): String { + assertEquals(42, foo(7) { it * 2 }) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/inline/innerInlineFunCapturesOuter.kt b/native/native.tests/testData/codegen/inline/innerInlineFunCapturesOuter.kt new file mode 100644 index 00000000000..20f85a6c294 --- /dev/null +++ b/native/native.tests/testData/codegen/inline/innerInlineFunCapturesOuter.kt @@ -0,0 +1,19 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +class E(val x: String) { + inner class Inner { + inline fun foo(y: String) = x + y + } +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* + +fun box(): String { + return E("O").Inner().foo("K") +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/inline/lateinitProperty.kt b/native/native.tests/testData/codegen/inline/lateinitProperty.kt new file mode 100644 index 00000000000..02be1822e86 --- /dev/null +++ b/native/native.tests/testData/codegen/inline/lateinitProperty.kt @@ -0,0 +1,35 @@ +// KT-64511: lateinit is not lowered with caches +// DISABLE_NATIVE: cacheMode=STATIC_EVERYWHERE +// DISABLE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE +// MODULE: lib +// FILE: lib.kt + +package a + +fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) } + +inline fun foo(values: IntArray, crossinline block: (Int, Int, Int) -> Int): Int { + val o = object { + lateinit var s: String + var x: Int = 42 + } + values.forEachNoInline { + o.x = block(o.x, o.s.length, it) + } + return o.x +} + +// MODULE: main(lib) +// FILE: main.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + +import a.* +import kotlin.test.* + +fun box(): String { + assertFailsWith { + foo(intArrayOf(1, 2, 3)) { x, y, z -> x + y - z } + } + return "OK" +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_lib.kt b/native/native.tests/testData/codegen/inline/sharedVar.kt similarity index 57% rename from kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_lib.kt rename to native/native.tests/testData/codegen/inline/sharedVar.kt index e27fc6f994d..c847541c39f 100644 --- a/kotlin-native/backend.native/tests/codegen/inline/sharedVar_linkTest_lib.kt +++ b/native/native.tests/testData/codegen/inline/sharedVar.kt @@ -1,7 +1,5 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ +// MODULE: lib +// FILE: lib.kt package a @@ -13,4 +11,15 @@ inline fun fold(initial: Int, values: IntArray, crossinline block: (Int, Int) -> res = block(res, it) } return res +} + +// MODULE: main(lib) +// FILE: main.kt + +import a.* +import kotlin.test.* + +fun box(): String { + assertEquals(6, fold(0, intArrayOf(1, 2, 3)) { x, y -> x + y }) + return "OK" } \ No newline at end of file diff --git a/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules1.kt b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules1.kt new file mode 100644 index 00000000000..020f6b2d033 --- /dev/null +++ b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules1.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: lib.kt + +open class Foo(val z: Int) { + open inner class FooInner { + fun foo() = z + } +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +class Bar : Foo(42) { + inner class BarInner(val x: Int) : FooInner() +} + +fun box(): String { + val o = Bar().BarInner(117) + assertEquals(117, o.x) + assertEquals(42, o.foo()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules2.kt b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules2.kt new file mode 100644 index 00000000000..acea5a94aab --- /dev/null +++ b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules2.kt @@ -0,0 +1,16 @@ +// MODULE: lib +// FILE: lib.kt + +open class Outer(val x: String) { + open inner class Inner1 + inner class Middle(x: String) : Outer(x) { + inner class Inner2 : Inner1() { + fun foo() = this@Outer.x + this@Middle.x + } + } +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = Outer("O").Middle("K").Inner2().foo() \ No newline at end of file diff --git a/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules3.kt b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules3.kt new file mode 100644 index 00000000000..01c42a27ce3 --- /dev/null +++ b/native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules3.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: lib.kt + +open class Outer { + open inner class Inner1 + inner class Middle { + inner class Inner2 : Inner1() { + fun getOuter() = this@Outer + fun getMiddle() = this@Middle + } + } +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + val o = Outer().Middle().Inner2() + assertNotSame(o.getOuter(), Outer()) + assertNotSame(o.getMiddle(), Outer().Middle()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/innerClass/multipleModules.kt b/native/native.tests/testData/codegen/innerClass/multipleModules.kt new file mode 100644 index 00000000000..c5859248cbb --- /dev/null +++ b/native/native.tests/testData/codegen/innerClass/multipleModules.kt @@ -0,0 +1,17 @@ +// MODULE: lib +// FILE: lib.kt + +open class A { + open inner class Inner { + val x = "OK" + } +} + +// MODULE: main(lib) +// FILE: main.kt + +open class B : A() { + open inner class Inner : A.Inner() +} + +fun box() = B().Inner().x \ No newline at end of file diff --git a/native/native.tests/testData/codegen/link/klibName.kt b/native/native.tests/testData/codegen/link/klibName.kt new file mode 100644 index 00000000000..3449ea2dfc5 --- /dev/null +++ b/native/native.tests/testData/codegen/link/klibName.kt @@ -0,0 +1,9 @@ +// MODULE: lib@name +// FILE: lib.kt + +fun foo() = "OK" + +// MODULE: main(lib@name) +// FILE: main.kt + +fun box() = foo() \ No newline at end of file diff --git a/native/native.tests/testData/codegen/link/link.kt b/native/native.tests/testData/codegen/link/link.kt new file mode 100644 index 00000000000..b6501e6d315 --- /dev/null +++ b/native/native.tests/testData/codegen/link/link.kt @@ -0,0 +1,23 @@ +// MODULE: lib +// FILE: lib1.kt + +package qwerty + +fun foo(a: String): String { + return a +} + +// FILE: lib2.kt + +package qwerty + +fun foo2(a: String): String { + return a +} + +// MODULE: main(lib) +// FILE: main.kt + +import qwerty.* + +fun box() = foo(foo2("OK")) \ No newline at end of file diff --git a/native/native.tests/testData/codegen/link/omitUnused.kt b/native/native.tests/testData/codegen/link/omitUnused.kt new file mode 100644 index 00000000000..3825916ce9f --- /dev/null +++ b/native/native.tests/testData/codegen/link/omitUnused.kt @@ -0,0 +1,13 @@ +// MODULE: lib +// FILE: lib.kt + +package foo + +fun foo() {} + +// MODULE: main(lib) +// FILE: main.kt + +// TODO: This test should be checking that there's no foo in the resulting binary. + +fun box(): String = "OK" \ No newline at end of file diff --git a/native/native.tests/testData/codegen/link/privateFakeOverridesInherit.kt b/native/native.tests/testData/codegen/link/privateFakeOverridesInherit.kt new file mode 100644 index 00000000000..225fb5b8feb --- /dev/null +++ b/native/native.tests/testData/codegen/link/privateFakeOverridesInherit.kt @@ -0,0 +1,76 @@ +// MODULE: lib +// FILE: lib.kt + +val sb = StringBuilder() + +// Private classes +private open class A { + public fun foo1() = sb.appendLine("PASS") + internal fun foo2() = sb.appendLine("PASS") + protected fun foo3() = sb.appendLine("PASS") +} + +private class B:A() { + fun foo4() = foo3() +} + +// Private interfaces +private interface C { + fun foo() = sb.appendLine("PASS") +} + +private class D: C + +fun runner() { + B().foo1() + B().foo2() + B().foo4() + + D().foo() + + // Objects + object : A(){ + fun foo4() = foo3() + }.apply { + foo1() + foo2() + foo4() + } + + // Function local classes + abstract class E { + public open fun foo1() = sb.appendLine("PASS") + internal open fun foo2() = sb.appendLine("PASS") + protected open fun foo3() = sb.appendLine("PASS") + } + class F : E() { + fun foo4() = foo3() + } + F().foo1() + F().foo2() + F().foo4() +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + runner() + assertEquals(""" + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + + """.trimIndent(), sb.toString()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/link/privateFakeOverridesOverride.kt b/native/native.tests/testData/codegen/link/privateFakeOverridesOverride.kt new file mode 100644 index 00000000000..aa49ad95f8c --- /dev/null +++ b/native/native.tests/testData/codegen/link/privateFakeOverridesOverride.kt @@ -0,0 +1,128 @@ +// MODULE: lib +// FILE: lib.kt + +val sb = StringBuilder() + +// Private classes +private open class A { + public open fun foo1() = sb.appendLine("FAIL") + internal open fun foo2() = sb.appendLine("FAIL") + protected open fun foo3() = sb.appendLine("FAIL") + private fun foo4() = sb.appendLine("FAIL") +} + +private class B:A() { + override public fun foo1() = sb.appendLine("PASS") + override internal fun foo2() = sb.appendLine("PASS") + override protected fun foo3() = sb.appendLine("PASS") + private fun foo4() = sb.appendLine("PASS") + fun foo5() = foo3() + fun foo6() = foo4() +} + +private abstract class G { + public abstract fun foo1() + internal abstract fun foo2() + protected abstract fun foo3() + private fun foo4() = sb.appendLine("FAIL") +} + +private class H:A() { + override public fun foo1() = sb.appendLine("PASS") + override internal fun foo2() = sb.appendLine("PASS") + override protected fun foo3() = sb.appendLine("PASS") + private fun foo4() = sb.appendLine("PASS") + fun foo5() = foo3() + fun foo6() = foo4() +} + + +// Private interfaces +private interface C { + fun foo() = sb.appendLine("FAIL") +} + +private class D: C { + override fun foo() = sb.appendLine("PASS") +} + +fun runner() { + B().foo1() + B().foo2() + B().foo5() + B().foo6() + + H().foo1() + H().foo2() + H().foo5() + H().foo6() + + D().foo() + + // Objects + object : A(){ + override public fun foo1() = sb.appendLine("PASS") + override internal fun foo2() = sb.appendLine("PASS") + override protected fun foo3() = sb.appendLine("PASS") + private fun foo4() = sb.appendLine("PASS") + fun foo5() = foo3() + fun foo6() = foo4() + }.apply { + foo1() + foo2() + foo5() + foo6() + } + + // Function local classes + open class E { + public open fun foo1() = sb.appendLine("FAIL") + internal open fun foo2() = sb.appendLine("FAIL") + protected open fun foo3() = sb.appendLine("FAIL") + private fun foo4() = sb.appendLine("FAIL") + } + class F : E() { + public override fun foo1() = sb.appendLine("PASS") + internal override fun foo2() = sb.appendLine("PASS") + protected override fun foo3() = sb.appendLine("PASS") + private fun foo4() = sb.appendLine("PASS") + fun foo5() = foo3() + fun foo6() = foo4() + } + F().foo1() + F().foo2() + F().foo5() + F().foo6() +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + runner() + + assertEquals(""" + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + PASS + + """.trimIndent(), sb.toString()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/lower/localDelegatedProperty.kt b/native/native.tests/testData/codegen/lower/localDelegatedProperty.kt new file mode 100644 index 00000000000..d9a0e67afe2 --- /dev/null +++ b/native/native.tests/testData/codegen/lower/localDelegatedProperty.kt @@ -0,0 +1,17 @@ +// MODULE: lib +// FILE: lib.kt + +fun foo(): String { + val bar: String by lazy { + "OK" + } + + return bar +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box() = foo() diff --git a/native/native.tests/testData/codegen/mangling/direct.kt b/native/native.tests/testData/codegen/mangling/direct.kt new file mode 100644 index 00000000000..22c77a68c46 --- /dev/null +++ b/native/native.tests/testData/codegen/mangling/direct.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: lib.kt + +public fun mangle(l: List) = "Int direct $l" + +public fun mangle(l: List) = "out Number direct $l" + +public fun mangle(l: List<*>) = "star direct $l" + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + val mutListInt = mutableListOf(1, 2, 3, 4) + val mutListNum = mutableListOf(9, 10, 11, 12) + val mutListAny = mutableListOf(5, 6, 7, 8) + + assertEquals("Int direct [1, 2, 3, 4]", mangle(mutListInt)) + assertEquals("out Number direct [9, 10, 11, 12]", mangle(mutListNum)) + assertEquals("star direct [5, 6, 7, 8]", mangle(mutListAny)) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/mangling/multipleConstructors.kt b/native/native.tests/testData/codegen/mangling/multipleConstructors.kt new file mode 100644 index 00000000000..a009b73fc24 --- /dev/null +++ b/native/native.tests/testData/codegen/mangling/multipleConstructors.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: lib.kt + +public fun mangle(l: T) = "no constructors $l" + +public fun mangle(l: T) where T: Comparable = "single constructor $l" + +public fun mangle(l: T) where T: Comparable, T: Number = "two constructors $l" + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + val any = mapOf() + val comparable = "some string" + val number = 17 + + assertEquals("no constructors {}", mangle(any)) + assertEquals("single constructor some string", mangle(comparable)) + assertEquals("two constructors 17", mangle(number)) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/mangling/param.kt b/native/native.tests/testData/codegen/mangling/param.kt new file mode 100644 index 00000000000..78c30676b29 --- /dev/null +++ b/native/native.tests/testData/codegen/mangling/param.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: lib.kt + +public fun mangle(l: T) where T: List = "Int param $l" + +public fun mangle(l: T) where T: List = "out Number param $l" + +public fun mangle(l: T) where T: List<*> = "star param $l" + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + val mutListInt = mutableListOf(1, 2, 3, 4) + val mutListNum = mutableListOf(9, 10, 11, 12) + val mutListAny = mutableListOf(5, 6, 7, 8) + + assertEquals("Int param [1, 2, 3, 4]", mangle(mutListInt)) + assertEquals("out Number param [9, 10, 11, 12]", mangle(mutListNum)) + assertEquals("star param [5, 6, 7, 8]", mangle(mutListAny)) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/propertyCallableReference/multipleModules.kt b/native/native.tests/testData/codegen/propertyCallableReference/multipleModules.kt new file mode 100644 index 00000000000..eff179f54eb --- /dev/null +++ b/native/native.tests/testData/codegen/propertyCallableReference/multipleModules.kt @@ -0,0 +1,18 @@ +// MODULE: lib +// FILE: lib.kt + +package a + +class A(val x: String) + +// MODULE: main(lib) +// FILE: main.kt + +import a.* + +fun box(): String { + val p1 = A::x + val a = A("K") + val p2 = a::x + return p1.get(A("O")) + p2.get() +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/deserializedMembers.kt b/native/native.tests/testData/codegen/serialization/deserializedMembers.kt new file mode 100644 index 00000000000..f9b1056fcd6 --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/deserializedMembers.kt @@ -0,0 +1,138 @@ +// MODULE: lib +// FILE: lib.kt + +package foo.bar + +val sb = StringBuilder() + +class R { + inline fun bar(t: T) { + sb.appendLine("just a single class: $t") + } +} + +class C { + inline fun foo() { + sb.appendLine("first level") + } + + class D { + inline fun foo() { + sb.appendLine("second level") + } + + class E { + inline fun foo() { + sb.appendLine("third levelxz") + } + } + } +} + +class C2 { + inline fun foo() { + sb.appendLine("inner first level") + } + + inner class D2 { + inline fun foo() { + sb.appendLine("inner second level") + } + + inner class E2 { + inline fun foo() { + sb.appendLine("inner third level") + } + } + } +} + +class C3 { + inline fun foo(x: X) { + sb.appendLine("types first level: $x") + } + + class D3 { + inline fun foo(x: X) { + sb.appendLine("types second level $x") + } + + class E3 { + inline fun foo(x: X) { + sb.appendLine("types third level $x") + } + } + } +} + +class C4 { + inline fun foo(x: X) { + sb.appendLine("inner types first level: $x") + } + + inner class D4 { + inline fun foo(x: X, y: Y) { + sb.appendLine("inner types second level $x, $y") + } + + inner class E4 { + inline fun foo(x: X, y: Y, z: Z) { + sb.appendLine("inner types third level $x, $y, $z") + } + } + } +} + +// MODULE: main(lib) +// FILE: main.kt + +import foo.bar.* +import kotlin.test.* + +fun box(): String { + val c = C() + val d = C.D() + val e = C.D.E() + c.foo() + d.foo() + e.foo() + + val c2 = C2() + val d2 = C2().D2() + val e2 = C2().D2().E2() + c2.foo() + d2.foo() + e2.foo() + + val c3 = C3() + val d3 = C3.D3() + val e3 = C3.D3.E3() + c3.foo(13) + d3.foo("cha-cha-cha") + e3.foo(1.0f) + + val c4 = C4() + val d4 = C4().D4() + val e4 = C4().D4().E4() + c4.foo(13) + d4.foo("cawabunga", 17) + e4.foo(19, "raqa-taqa", 23) + + assertEquals(""" + first level + second level + third levelxz + inner first level + inner second level + inner third level + types first level: 13 + types second level cha-cha-cha + types third level 1.0 + inner types first level: 13 + inner types second level cawabunga, 17 + inner types third level 19, raqa-taqa, 23 + + """.trimIndent(), sb.toString()) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedCatch.kt b/native/native.tests/testData/codegen/serialization/serializedCatch.kt new file mode 100644 index 00000000000..b7f4e0cc1ab --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedCatch.kt @@ -0,0 +1,20 @@ +// MODULE: lib +// FILE: lib.kt + +inline fun foo(): String { + try { + try { + throw Exception("O") + } catch (e: Throwable) { + throw Exception("${e.message}K") + } + } catch (e: Throwable) { + return e.message!! + } + return "FAIL" +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = foo() \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedCharConstant.kt b/native/native.tests/testData/codegen/serialization/serializedCharConstant.kt new file mode 100644 index 00000000000..5566a0d4ea6 --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedCharConstant.kt @@ -0,0 +1,14 @@ +// MODULE: lib +// FILE: lib.kt + +inline fun foo(x: Char = '\u042b') = x + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + assertEquals('\u042b', foo()) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedDefaultArgs.kt b/native/native.tests/testData/codegen/serialization/serializedDefaultArgs.kt new file mode 100644 index 00000000000..7807bea87b5 --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedDefaultArgs.kt @@ -0,0 +1,16 @@ +// MODULE: lib +// FILE: lib.kt + +inline val Int.prop get() = SomeDataClass(second = this) + +data class SomeDataClass(val first: Int = 17, val second: Int = 19, val third: Int = 23) + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + assertEquals(SomeDataClass(first = 17, second = 666, third = 23), 666.prop) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedDoWhile.kt b/native/native.tests/testData/codegen/serialization/serializedDoWhile.kt new file mode 100644 index 00000000000..83c76906b27 --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedDoWhile.kt @@ -0,0 +1,19 @@ +// MODULE: lib +// FILE: lib.kt + +val sb = StringBuilder() + +inline fun foo() { + do { + var x: Int = 999 + sb.append("OK") + } while (x != 999) +} + +// MODULE: main(lib) +// FILE: main.kt + +fun box(): String { + foo() + return sb.toString() +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedEnumOrdinal.kt b/native/native.tests/testData/codegen/serialization/serializedEnumOrdinal.kt new file mode 100644 index 00000000000..41d1a415c98 --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedEnumOrdinal.kt @@ -0,0 +1,28 @@ +// MODULE: lib +// FILE: lib.kt + +enum class Color { + RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW +} + +fun determineColor(code: Int): Color = when (code) { + 0 -> Color.BLUE + 1 -> Color.MAGENTA + else -> Color.CYAN +} + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + assertEquals(0, Color.RED.ordinal) + assertEquals(1, Color.GREEN.ordinal) + assertEquals(2, Color.BLUE.ordinal) + assertEquals(Color.BLUE, determineColor(0)) + assertEquals(Color.MAGENTA, determineColor(1)) + assertEquals(Color.CYAN, determineColor(2)) + + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/testData/codegen/serialization/serializedVararg.kt b/native/native.tests/testData/codegen/serialization/serializedVararg.kt new file mode 100644 index 00000000000..2eec01b872e --- /dev/null +++ b/native/native.tests/testData/codegen/serialization/serializedVararg.kt @@ -0,0 +1,32 @@ +// MODULE: lib +// FILE: lib.kt + +val sb = StringBuilder() + +fun bar(vararg x: Int) { + x.forEach { + sb.appendLine(it) + } + sb.appendLine("size: ${x.size}") +} + +inline fun foo() = bar(17, 19, 23, *intArrayOf(29, 31)) + +// MODULE: main(lib) +// FILE: main.kt + +import kotlin.test.* + +fun box(): String { + foo() + assertEquals(""" + 17 + 19 + 23 + 29 + 31 + size: 5 + + """.trimIndent(), sb.toString()) + return "OK" +} \ No newline at end of file diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenLocalTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenLocalTestGenerated.java index abd05472175..7fc4f95af40 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenLocalTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenLocalTestGenerated.java @@ -674,6 +674,18 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("multipleModules1.kt") + public void testMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/bridges/multipleModules1.kt"); + } + + @Test + @TestMetadata("multipleModules2.kt") + public void testMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/bridges/multipleModules2.kt"); + } + @Test @TestMetadata("nativePointed.kt") public void testNativePointed() throws Exception { @@ -837,6 +849,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/classDelegation/method.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/classDelegation/multipleModules.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { @@ -1323,6 +1341,18 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/delegatedProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("correctFieldsOrder.kt") + public void testCorrectFieldsOrder() throws Exception { + runTest("native/native.tests/testData/codegen/delegatedProperty/correctFieldsOrder.kt"); + } + + @Test + @TestMetadata("delegatedOverride.kt") + public void testDelegatedOverride() throws Exception { + runTest("native/native.tests/testData/codegen/delegatedProperty/delegatedOverride.kt"); + } + @Test @TestMetadata("lazy.kt") public void testLazy() throws Exception { @@ -1457,12 +1487,24 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/enum/loop.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/enum/multipleModules.kt"); + } + @Test @TestMetadata("nested.kt") public void testNested() throws Exception { runTest("native/native.tests/testData/codegen/enum/nested.kt"); } + @Test + @TestMetadata("openMethodNoOverrides.kt") + public void testOpenMethodNoOverrides() throws Exception { + runTest("native/native.tests/testData/codegen/enum/openMethodNoOverrides.kt"); + } + @Test @TestMetadata("reorderedArguments.kt") public void testReorderedArguments() throws Exception { @@ -1953,6 +1995,18 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/initializers/correctOrder2.kt"); } + @Test + @TestMetadata("multipleModules1.kt") + public void testMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/multipleModules1.kt"); + } + + @Test + @TestMetadata("multipleModules2.kt") + public void testMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/multipleModules2.kt"); + } + @Test @TestMetadata("object.kt") public void testObject() throws Exception { @@ -1971,6 +2025,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/initializers/return2.kt"); } + @Test + @TestMetadata("sharedVarInInitBlock.kt") + public void testSharedVarInInitBlock() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/sharedVarInInitBlock.kt"); + } + @Test @TestMetadata("static_arrays.kt") public void testStatic_arrays() throws Exception { @@ -2233,6 +2293,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/inline/defaultArgs.kt"); } + @Test + @TestMetadata("defaultArgsMultipleModules.kt") + public void testDefaultArgsMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/inline/defaultArgsMultipleModules.kt"); + } + @Test @TestMetadata("genericFunctionReference.kt") public void testGenericFunctionReference() throws Exception { @@ -2407,6 +2473,18 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/inline/inline9.kt"); } + @Test + @TestMetadata("inlineCtor.kt") + public void testInlineCtor() throws Exception { + runTest("native/native.tests/testData/codegen/inline/inlineCtor.kt"); + } + + @Test + @TestMetadata("innerInlineFunCapturesOuter.kt") + public void testInnerInlineFunCapturesOuter() throws Exception { + runTest("native/native.tests/testData/codegen/inline/innerInlineFunCapturesOuter.kt"); + } + @Test @TestMetadata("lambdaAsAny.kt") public void testLambdaAsAny() throws Exception { @@ -2419,6 +2497,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/inline/lambdaInDefaultValue.kt"); } + @Test + @TestMetadata("lateinitProperty.kt") + public void testLateinitProperty() throws Exception { + runTest("native/native.tests/testData/codegen/inline/lateinitProperty.kt"); + } + @Test @TestMetadata("localFunctionInInitializerBlock.kt") public void testLocalFunctionInInitializerBlock() throws Exception { @@ -2461,6 +2545,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/inline/returnLocalClassFromBlock.kt"); } + @Test + @TestMetadata("sharedVar.kt") + public void testSharedVar() throws Exception { + runTest("native/native.tests/testData/codegen/inline/sharedVar.kt"); + } + @Test @TestMetadata("statementAsLastExprInBlock.kt") public void testStatementAsLastExprInBlock() throws Exception { @@ -2559,6 +2649,30 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/innerClass/getOuterVal.kt"); } + @Test + @TestMetadata("inheritanceMultipleModules1.kt") + public void testInheritanceMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules1.kt"); + } + + @Test + @TestMetadata("inheritanceMultipleModules2.kt") + public void testInheritanceMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules2.kt"); + } + + @Test + @TestMetadata("inheritanceMultipleModules3.kt") + public void testInheritanceMultipleModules3() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules3.kt"); + } + + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/multipleModules.kt"); + } + @Test @TestMetadata("noPrimaryConstructor.kt") public void testNoPrimaryConstructor() throws Exception { @@ -2962,6 +3076,49 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/link") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Link { + @Test + public void testAllFilesPresentInLink() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/link"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("klibName.kt") + public void testKlibName() throws Exception { + runTest("native/native.tests/testData/codegen/link/klibName.kt"); + } + + @Test + @TestMetadata("link.kt") + public void testLink() throws Exception { + runTest("native/native.tests/testData/codegen/link/link.kt"); + } + + @Test + @TestMetadata("omitUnused.kt") + public void testOmitUnused() throws Exception { + runTest("native/native.tests/testData/codegen/link/omitUnused.kt"); + } + + @Test + @TestMetadata("privateFakeOverridesInherit.kt") + public void testPrivateFakeOverridesInherit() throws Exception { + runTest("native/native.tests/testData/codegen/link/privateFakeOverridesInherit.kt"); + } + + @Test + @TestMetadata("privateFakeOverridesOverride.kt") + public void testPrivateFakeOverridesOverride() throws Exception { + runTest("native/native.tests/testData/codegen/link/privateFakeOverridesOverride.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/localClass") @TestDataPath("$PROJECT_ROOT") @@ -3054,6 +3211,56 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/lower") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Lower { + @Test + public void testAllFilesPresentInLower() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/lower"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("localDelegatedProperty.kt") + public void testLocalDelegatedProperty() throws Exception { + runTest("native/native.tests/testData/codegen/lower/localDelegatedProperty.kt"); + } + } + + @Nested + @TestMetadata("native/native.tests/testData/codegen/mangling") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Mangling { + @Test + public void testAllFilesPresentInMangling() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/mangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("direct.kt") + public void testDirect() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/direct.kt"); + } + + @Test + @TestMetadata("multipleConstructors.kt") + public void testMultipleConstructors() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/multipleConstructors.kt"); + } + + @Test + @TestMetadata("param.kt") + public void testParam() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/param.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/object") @TestDataPath("$PROJECT_ROOT") @@ -3225,6 +3432,12 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox runTest("native/native.tests/testData/codegen/propertyCallableReference/dynamicReceiver.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/propertyCallableReference/multipleModules.kt"); + } + @Test @TestMetadata("valClass.kt") public void testValClass() throws Exception { @@ -3262,6 +3475,61 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/serialization") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Serialization { + @Test + public void testAllFilesPresentInSerialization() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/serialization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("deserializedMembers.kt") + public void testDeserializedMembers() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/deserializedMembers.kt"); + } + + @Test + @TestMetadata("serializedCatch.kt") + public void testSerializedCatch() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedCatch.kt"); + } + + @Test + @TestMetadata("serializedCharConstant.kt") + public void testSerializedCharConstant() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedCharConstant.kt"); + } + + @Test + @TestMetadata("serializedDefaultArgs.kt") + public void testSerializedDefaultArgs() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedDefaultArgs.kt"); + } + + @Test + @TestMetadata("serializedDoWhile.kt") + public void testSerializedDoWhile() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedDoWhile.kt"); + } + + @Test + @TestMetadata("serializedEnumOrdinal.kt") + public void testSerializedEnumOrdinal() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedEnumOrdinal.kt"); + } + + @Test + @TestMetadata("serializedVararg.kt") + public void testSerializedVararg() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedVararg.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/stringTrim") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenLocalTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenLocalTestGenerated.java index ffd7b161b95..980533b28b5 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenLocalTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenLocalTestGenerated.java @@ -654,6 +654,18 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("multipleModules1.kt") + public void testMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/bridges/multipleModules1.kt"); + } + + @Test + @TestMetadata("multipleModules2.kt") + public void testMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/bridges/multipleModules2.kt"); + } + @Test @TestMetadata("nativePointed.kt") public void testNativePointed() throws Exception { @@ -815,6 +827,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/classDelegation/method.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/classDelegation/multipleModules.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { @@ -1289,6 +1307,18 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/delegatedProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("correctFieldsOrder.kt") + public void testCorrectFieldsOrder() throws Exception { + runTest("native/native.tests/testData/codegen/delegatedProperty/correctFieldsOrder.kt"); + } + + @Test + @TestMetadata("delegatedOverride.kt") + public void testDelegatedOverride() throws Exception { + runTest("native/native.tests/testData/codegen/delegatedProperty/delegatedOverride.kt"); + } + @Test @TestMetadata("lazy.kt") public void testLazy() throws Exception { @@ -1419,12 +1449,24 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/enum/loop.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/enum/multipleModules.kt"); + } + @Test @TestMetadata("nested.kt") public void testNested() throws Exception { runTest("native/native.tests/testData/codegen/enum/nested.kt"); } + @Test + @TestMetadata("openMethodNoOverrides.kt") + public void testOpenMethodNoOverrides() throws Exception { + runTest("native/native.tests/testData/codegen/enum/openMethodNoOverrides.kt"); + } + @Test @TestMetadata("reorderedArguments.kt") public void testReorderedArguments() throws Exception { @@ -1907,6 +1949,18 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/initializers/correctOrder2.kt"); } + @Test + @TestMetadata("multipleModules1.kt") + public void testMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/multipleModules1.kt"); + } + + @Test + @TestMetadata("multipleModules2.kt") + public void testMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/multipleModules2.kt"); + } + @Test @TestMetadata("object.kt") public void testObject() throws Exception { @@ -1925,6 +1979,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/initializers/return2.kt"); } + @Test + @TestMetadata("sharedVarInInitBlock.kt") + public void testSharedVarInInitBlock() throws Exception { + runTest("native/native.tests/testData/codegen/initializers/sharedVarInInitBlock.kt"); + } + @Test @TestMetadata("static_arrays.kt") public void testStatic_arrays() throws Exception { @@ -2179,6 +2239,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/inline/defaultArgs.kt"); } + @Test + @TestMetadata("defaultArgsMultipleModules.kt") + public void testDefaultArgsMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/inline/defaultArgsMultipleModules.kt"); + } + @Test @TestMetadata("genericFunctionReference.kt") public void testGenericFunctionReference() throws Exception { @@ -2353,6 +2419,18 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/inline/inline9.kt"); } + @Test + @TestMetadata("inlineCtor.kt") + public void testInlineCtor() throws Exception { + runTest("native/native.tests/testData/codegen/inline/inlineCtor.kt"); + } + + @Test + @TestMetadata("innerInlineFunCapturesOuter.kt") + public void testInnerInlineFunCapturesOuter() throws Exception { + runTest("native/native.tests/testData/codegen/inline/innerInlineFunCapturesOuter.kt"); + } + @Test @TestMetadata("lambdaAsAny.kt") public void testLambdaAsAny() throws Exception { @@ -2365,6 +2443,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/inline/lambdaInDefaultValue.kt"); } + @Test + @TestMetadata("lateinitProperty.kt") + public void testLateinitProperty() throws Exception { + runTest("native/native.tests/testData/codegen/inline/lateinitProperty.kt"); + } + @Test @TestMetadata("localFunctionInInitializerBlock.kt") public void testLocalFunctionInInitializerBlock() throws Exception { @@ -2407,6 +2491,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/inline/returnLocalClassFromBlock.kt"); } + @Test + @TestMetadata("sharedVar.kt") + public void testSharedVar() throws Exception { + runTest("native/native.tests/testData/codegen/inline/sharedVar.kt"); + } + @Test @TestMetadata("statementAsLastExprInBlock.kt") public void testStatementAsLastExprInBlock() throws Exception { @@ -2501,6 +2591,30 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/innerClass/getOuterVal.kt"); } + @Test + @TestMetadata("inheritanceMultipleModules1.kt") + public void testInheritanceMultipleModules1() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules1.kt"); + } + + @Test + @TestMetadata("inheritanceMultipleModules2.kt") + public void testInheritanceMultipleModules2() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules2.kt"); + } + + @Test + @TestMetadata("inheritanceMultipleModules3.kt") + public void testInheritanceMultipleModules3() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/inheritanceMultipleModules3.kt"); + } + + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/innerClass/multipleModules.kt"); + } + @Test @TestMetadata("noPrimaryConstructor.kt") public void testNoPrimaryConstructor() throws Exception { @@ -2892,6 +3006,47 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/link") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Link { + @Test + public void testAllFilesPresentInLink() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/link"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("klibName.kt") + public void testKlibName() throws Exception { + runTest("native/native.tests/testData/codegen/link/klibName.kt"); + } + + @Test + @TestMetadata("link.kt") + public void testLink() throws Exception { + runTest("native/native.tests/testData/codegen/link/link.kt"); + } + + @Test + @TestMetadata("omitUnused.kt") + public void testOmitUnused() throws Exception { + runTest("native/native.tests/testData/codegen/link/omitUnused.kt"); + } + + @Test + @TestMetadata("privateFakeOverridesInherit.kt") + public void testPrivateFakeOverridesInherit() throws Exception { + runTest("native/native.tests/testData/codegen/link/privateFakeOverridesInherit.kt"); + } + + @Test + @TestMetadata("privateFakeOverridesOverride.kt") + public void testPrivateFakeOverridesOverride() throws Exception { + runTest("native/native.tests/testData/codegen/link/privateFakeOverridesOverride.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/localClass") @TestDataPath("$PROJECT_ROOT") @@ -2980,6 +3135,52 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/lower") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Lower { + @Test + public void testAllFilesPresentInLower() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/lower"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("localDelegatedProperty.kt") + public void testLocalDelegatedProperty() throws Exception { + runTest("native/native.tests/testData/codegen/lower/localDelegatedProperty.kt"); + } + } + + @Nested + @TestMetadata("native/native.tests/testData/codegen/mangling") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Mangling { + @Test + public void testAllFilesPresentInMangling() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/mangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("direct.kt") + public void testDirect() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/direct.kt"); + } + + @Test + @TestMetadata("multipleConstructors.kt") + public void testMultipleConstructors() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/multipleConstructors.kt"); + } + + @Test + @TestMetadata("param.kt") + public void testParam() throws Exception { + runTest("native/native.tests/testData/codegen/mangling/param.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/object") @TestDataPath("$PROJECT_ROOT") @@ -3143,6 +3344,12 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes runTest("native/native.tests/testData/codegen/propertyCallableReference/dynamicReceiver.kt"); } + @Test + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("native/native.tests/testData/codegen/propertyCallableReference/multipleModules.kt"); + } + @Test @TestMetadata("valClass.kt") public void testValClass() throws Exception { @@ -3180,6 +3387,59 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes } } + @Nested + @TestMetadata("native/native.tests/testData/codegen/serialization") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Serialization { + @Test + public void testAllFilesPresentInSerialization() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/serialization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("deserializedMembers.kt") + public void testDeserializedMembers() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/deserializedMembers.kt"); + } + + @Test + @TestMetadata("serializedCatch.kt") + public void testSerializedCatch() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedCatch.kt"); + } + + @Test + @TestMetadata("serializedCharConstant.kt") + public void testSerializedCharConstant() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedCharConstant.kt"); + } + + @Test + @TestMetadata("serializedDefaultArgs.kt") + public void testSerializedDefaultArgs() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedDefaultArgs.kt"); + } + + @Test + @TestMetadata("serializedDoWhile.kt") + public void testSerializedDoWhile() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedDoWhile.kt"); + } + + @Test + @TestMetadata("serializedEnumOrdinal.kt") + public void testSerializedEnumOrdinal() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedEnumOrdinal.kt"); + } + + @Test + @TestMetadata("serializedVararg.kt") + public void testSerializedVararg() throws Exception { + runTest("native/native.tests/testData/codegen/serialization/serializedVararg.kt"); + } + } + @Nested @TestMetadata("native/native.tests/testData/codegen/stringTrim") @TestDataPath("$PROJECT_ROOT")