diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtected.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtected.kt new file mode 100644 index 00000000000..6250b18d1ce --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/accessorForProtected.kt @@ -0,0 +1,38 @@ +// FILE: 1.kt + +import b.B +import a.BSamePackage + +fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail" + +// FILE: 2.kt + +package a + +open class A { + protected fun protectedFun(): String = "OK" +} + +class BSamePackage: A() { + fun test(): String { + val a = { + protectedFun() + } + return a() + } +} + +// FILE: 3.kt + +package b + +import a.A + +class B: A() { + fun test(): String { + val a = { + protectedFun() + } + return a() + } +} diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtected/1.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtected/1.kt deleted file mode 100644 index e5846cdf592..00000000000 --- a/compiler/testData/codegen/boxMultiFile/accessorForProtected/1.kt +++ /dev/null @@ -1,4 +0,0 @@ -import b.B -import a.BSamePackage - -fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail" diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtected/2.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtected/2.kt deleted file mode 100644 index 859cbbed3a7..00000000000 --- a/compiler/testData/codegen/boxMultiFile/accessorForProtected/2.kt +++ /dev/null @@ -1,14 +0,0 @@ -package a - -open class A { - protected fun protectedFun(): String = "OK" -} - -class BSamePackage: A() { - fun test(): String { - val a = { - protectedFun() - } - return a() - } -} diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtected/3.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtected/3.kt deleted file mode 100644 index 60ab0f257ee..00000000000 --- a/compiler/testData/codegen/boxMultiFile/accessorForProtected/3.kt +++ /dev/null @@ -1,12 +0,0 @@ -package b - -import a.A - -class B: A() { - fun test(): String { - val a = { - protectedFun() - } - return a() - } -} diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/1.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt similarity index 77% rename from compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/1.kt rename to compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt index 3fabc5a4bdd..14960a71ce7 100644 --- a/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/1.kt +++ b/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt @@ -1,3 +1,5 @@ +// FILE: 1.kt + import test.A import kotlin.test.assertEquals @@ -47,3 +49,19 @@ class C : B() { } fun box() = C().box() + +// FILE: 2.kt + +package test + +abstract class A { + public var state = "" + + // These implementations should not be called, because they are overridden in C + + protected open fun method(): String = "A.method" + + protected open var property: String + get() = "A.property" + set(value) { state += "A.property;" } +} diff --git a/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/2.kt b/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/2.kt deleted file mode 100644 index 59cb2e4deb1..00000000000 --- a/compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/2.kt +++ /dev/null @@ -1,13 +0,0 @@ -package test - -abstract class A { - public var state = "" - - // These implementations should not be called, because they are overridden in C - - protected open fun method(): String = "A.method" - - protected open var property: String - get() = "A.property" - set(value) { state += "A.property;" } -} diff --git a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt b/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt new file mode 100644 index 00000000000..07b1bd2799a --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt @@ -0,0 +1,22 @@ +// FILE: box.kt + +package test + +import b.bar + +fun box(): String = bar() + +// FILE: caller.kt + +package b + +import a.foo + +fun bar(): String = foo() + +// FILE: multifileClass.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +fun foo(): String = "OK" diff --git a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/box.kt b/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/box.kt deleted file mode 100644 index fdda71fb581..00000000000 --- a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/box.kt +++ /dev/null @@ -1,5 +0,0 @@ -package test - -import b.bar - -fun box(): String = bar() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/caller.kt b/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/caller.kt deleted file mode 100644 index b8b58154e62..00000000000 --- a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/caller.kt +++ /dev/null @@ -1,5 +0,0 @@ -package b - -import a.foo - -fun bar(): String = foo() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/multifileClass.kt b/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/multifileClass.kt deleted file mode 100644 index 4d1b4f46224..00000000000 --- a/compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/multifileClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun foo(): String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt b/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt new file mode 100644 index 00000000000..8bc0417184e --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt @@ -0,0 +1,21 @@ +// FILE: box.kt + +package test + +import a.foo + +fun box(): String = foo { "OK" } + +// FILE: foo.kt + +@file:[JvmName("A") JvmMultifileClass] +package a + +inline fun foo(body: () -> String): String = zee(body()) + +// FILE: zee.kt + +@file:[JvmName("A") JvmMultifileClass] +package a + +public fun zee(x: String): String = x diff --git a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/box.kt b/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/box.kt deleted file mode 100644 index e12d247c2e1..00000000000 --- a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/box.kt +++ /dev/null @@ -1,5 +0,0 @@ -package test - -import a.foo - -fun box(): String = foo { "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/foo.kt b/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/foo.kt deleted file mode 100644 index 5b08cf7e9ad..00000000000 --- a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/foo.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("A") JvmMultifileClass] -package a - -inline fun foo(body: () -> String): String = zee(body()) \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/zee.kt b/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/zee.kt deleted file mode 100644 index d7bf0ca4b3c..00000000000 --- a/compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/zee.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("A") JvmMultifileClass] -package a - -public fun zee(x: String): String = x \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/internalVisibility.kt b/compiler/testData/codegen/boxMultiFile/internalVisibility.kt new file mode 100644 index 00000000000..e35cdf1320a --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/internalVisibility.kt @@ -0,0 +1,9 @@ +// FILE: 1.kt + +fun box() = a.x + +// FILE: 2.kt + +package a + +val x: String = "OK" diff --git a/compiler/testData/codegen/boxMultiFile/internalVisibility/1.kt b/compiler/testData/codegen/boxMultiFile/internalVisibility/1.kt deleted file mode 100644 index 32347abea7f..00000000000 --- a/compiler/testData/codegen/boxMultiFile/internalVisibility/1.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = a.x \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/internalVisibility/2.kt b/compiler/testData/codegen/boxMultiFile/internalVisibility/2.kt deleted file mode 100644 index d3f108c2306..00000000000 --- a/compiler/testData/codegen/boxMultiFile/internalVisibility/2.kt +++ /dev/null @@ -1,3 +0,0 @@ -package a - -val x: String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt10047/a.kt b/compiler/testData/codegen/boxMultiFile/kt10047.kt similarity index 63% rename from compiler/testData/codegen/boxMultiFile/kt10047/a.kt rename to compiler/testData/codegen/boxMultiFile/kt10047.kt index 65da12b7742..8317ac0f765 100644 --- a/compiler/testData/codegen/boxMultiFile/kt10047/a.kt +++ b/compiler/testData/codegen/boxMultiFile/kt10047.kt @@ -1,3 +1,5 @@ +// FILE: a.kt + package test2 import test.Actor @@ -17,4 +19,18 @@ fun box(): String { if (O2dDialog().test2() != null) return "fail 2" return "OK" -} \ No newline at end of file +} + +// FILE: b.kt + +package test + +open class Actor + +abstract public class O2dScriptAction { + protected var owner: T? = null + private set + + protected fun calc(): T? = null + +} diff --git a/compiler/testData/codegen/boxMultiFile/kt10047/b.kt b/compiler/testData/codegen/boxMultiFile/kt10047/b.kt deleted file mode 100644 index 18a9a2d03a4..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt10047/b.kt +++ /dev/null @@ -1,11 +0,0 @@ -package test - -open class Actor - -abstract public class O2dScriptAction { - protected var owner: T? = null - private set - - protected fun calc(): T? = null - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt1515/1.kt b/compiler/testData/codegen/boxMultiFile/kt1515.kt similarity index 66% rename from compiler/testData/codegen/boxMultiFile/kt1515/1.kt rename to compiler/testData/codegen/boxMultiFile/kt1515.kt index af3f3b52383..7cd77d0374c 100644 --- a/compiler/testData/codegen/boxMultiFile/kt1515/1.kt +++ b/compiler/testData/codegen/boxMultiFile/kt1515.kt @@ -1,3 +1,5 @@ +// FILE: 1.kt + package thispackage import otherpackage.* @@ -15,4 +17,13 @@ fun box(): String { fun localUse(): Boolean { val c = Runnable::class.java return (c.getName()!! == "java.lang.Runnable") -} \ No newline at end of file +} + +// FILE: 2.kt + +package otherpackage + +fun fromOtherPackage(): Boolean { + val c = Runnable::class.java + return (c.getName()!! == "java.lang.Runnable") +} diff --git a/compiler/testData/codegen/boxMultiFile/kt1515/2.kt b/compiler/testData/codegen/boxMultiFile/kt1515/2.kt deleted file mode 100644 index 1366861294e..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt1515/2.kt +++ /dev/null @@ -1,6 +0,0 @@ -package otherpackage - -fun fromOtherPackage(): Boolean { - val c = Runnable::class.java - return (c.getName()!! == "java.lang.Runnable") -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt1528/2.kt b/compiler/testData/codegen/boxMultiFile/kt1528.kt similarity index 53% rename from compiler/testData/codegen/boxMultiFile/kt1528/2.kt rename to compiler/testData/codegen/boxMultiFile/kt1528.kt index cd91be22861..99352a01acb 100644 --- a/compiler/testData/codegen/boxMultiFile/kt1528/2.kt +++ b/compiler/testData/codegen/boxMultiFile/kt1528.kt @@ -1,4 +1,10 @@ +// FILE: 1.kt + +fun box() = foo() + +// FILE: 2.kt + private val a = "OK" fun foo() : String { return "${a}" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxMultiFile/kt1528/1.kt b/compiler/testData/codegen/boxMultiFile/kt1528/1.kt deleted file mode 100644 index 3a79d6bfe14..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt1528/1.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = foo() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt1845/1.kt b/compiler/testData/codegen/boxMultiFile/kt1845.kt similarity index 62% rename from compiler/testData/codegen/boxMultiFile/kt1845/1.kt rename to compiler/testData/codegen/boxMultiFile/kt1845.kt index 9c898d2bf80..1451484226a 100644 --- a/compiler/testData/codegen/boxMultiFile/kt1845/1.kt +++ b/compiler/testData/codegen/boxMultiFile/kt1845.kt @@ -1,6 +1,12 @@ +// FILE: 1.kt + public var v1: String = "V1" fun box(): String { val s = "v1: $v1, v2: $v2" return "OK" } + +// FILE: 2.kt + +public var v2: String = "V2" diff --git a/compiler/testData/codegen/boxMultiFile/kt1845/2.kt b/compiler/testData/codegen/boxMultiFile/kt1845/2.kt deleted file mode 100644 index 471d34bf5ed..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt1845/2.kt +++ /dev/null @@ -1 +0,0 @@ -public var v2: String = "V2" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt2060/2.kt b/compiler/testData/codegen/boxMultiFile/kt2060.kt similarity index 50% rename from compiler/testData/codegen/boxMultiFile/kt2060/2.kt rename to compiler/testData/codegen/boxMultiFile/kt2060.kt index 666cea73389..374e73111fb 100644 --- a/compiler/testData/codegen/boxMultiFile/kt2060/2.kt +++ b/compiler/testData/codegen/boxMultiFile/kt2060.kt @@ -1,3 +1,20 @@ +// FILE: 1.kt + +import testing.ClassWithInternals + +public class HelloServer() : ClassWithInternals() { + public override fun start() { + val test = foo() + someGetter //+ some + } +} + +fun box() : String { + HelloServer().start() + return "OK" +} + +// FILE: 2.kt + package testing; // There is no error if both files are in default package public abstract class ClassWithInternals { diff --git a/compiler/testData/codegen/boxMultiFile/kt2060/1.kt b/compiler/testData/codegen/boxMultiFile/kt2060/1.kt deleted file mode 100644 index 1fb28efa593..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt2060/1.kt +++ /dev/null @@ -1,12 +0,0 @@ -import testing.ClassWithInternals - -public class HelloServer() : ClassWithInternals() { - public override fun start() { - val test = foo() + someGetter //+ some - } -} - -fun box() : String { - HelloServer().start() - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt5445/1.kt b/compiler/testData/codegen/boxMultiFile/kt5445.kt similarity index 71% rename from compiler/testData/codegen/boxMultiFile/kt5445/1.kt rename to compiler/testData/codegen/boxMultiFile/kt5445.kt index 2e6c53cf188..7b342adab2e 100644 --- a/compiler/testData/codegen/boxMultiFile/kt5445/1.kt +++ b/compiler/testData/codegen/boxMultiFile/kt5445.kt @@ -1,3 +1,5 @@ +// FILE: 1.kt + package test2 import test.A @@ -13,4 +15,12 @@ public class B : A() { } return "fail" } -} \ No newline at end of file +} + +// FILE: 2.kt + +package test + +open class A { + @JvmField protected val s = 2; +} diff --git a/compiler/testData/codegen/boxMultiFile/kt5445/2.kt b/compiler/testData/codegen/boxMultiFile/kt5445/2.kt deleted file mode 100644 index e0d6465bd51..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt5445/2.kt +++ /dev/null @@ -1,5 +0,0 @@ -package test - -open class A { - @JvmField protected val s = 2; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt5445_2/1.kt b/compiler/testData/codegen/boxMultiFile/kt5445_2.kt similarity index 59% rename from compiler/testData/codegen/boxMultiFile/kt5445_2/1.kt rename to compiler/testData/codegen/boxMultiFile/kt5445_2.kt index 5d5aee157c1..62def12b07f 100644 --- a/compiler/testData/codegen/boxMultiFile/kt5445_2/1.kt +++ b/compiler/testData/codegen/boxMultiFile/kt5445_2.kt @@ -1,3 +1,5 @@ +// FILE: 1.kt + package test2 import test.A @@ -11,3 +13,11 @@ class C : A() { public fun box(): String { return C().a() } + +// FILE: 2.kt + +package test + +open class A { + @JvmField protected val s = "OK"; +} diff --git a/compiler/testData/codegen/boxMultiFile/kt5445_2/2.kt b/compiler/testData/codegen/boxMultiFile/kt5445_2/2.kt deleted file mode 100644 index fd1aa049951..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt5445_2/2.kt +++ /dev/null @@ -1,5 +0,0 @@ -package test - -open class A { - @JvmField protected val s = "OK"; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt9717.kt b/compiler/testData/codegen/boxMultiFile/kt9717.kt new file mode 100644 index 00000000000..f2438b5a591 --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/kt9717.kt @@ -0,0 +1,12 @@ +// FILE: box.kt + +object Test { + val test: String = OK +} + +fun box(): String = Test.test + +// FILE: Vars.kt + +public var OK: String = "OK" + private set diff --git a/compiler/testData/codegen/boxMultiFile/kt9717/Vars.kt b/compiler/testData/codegen/boxMultiFile/kt9717/Vars.kt deleted file mode 100644 index 76e2c8e1b78..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt9717/Vars.kt +++ /dev/null @@ -1,2 +0,0 @@ -public var OK: String = "OK" - private set \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt9717/box.kt b/compiler/testData/codegen/boxMultiFile/kt9717/box.kt deleted file mode 100644 index a71af04152b..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt9717/box.kt +++ /dev/null @@ -1,5 +0,0 @@ -object Test { - val test: String = OK -} - -fun box(): String = Test.test \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/b.kt b/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages.kt similarity index 57% rename from compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/b.kt rename to compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages.kt index 12f8e3aad0f..d201d7c2a39 100644 --- a/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/b.kt +++ b/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages.kt @@ -1,3 +1,16 @@ +// FILE: a.kt + +package a + +import b.* + +fun box(): String { + BB().ok() + return BB().OK +} + +// FILE: b.kt + package b public open class B { @@ -7,4 +20,4 @@ public open class B { public class BB : B() { public fun ok(): String = OK -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/a.kt b/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/a.kt deleted file mode 100644 index b281370407e..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/a.kt +++ /dev/null @@ -1,8 +0,0 @@ -package a - -import b.* - -fun box(): String { - BB().ok() - return BB().OK -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/kt9958/a.kt b/compiler/testData/codegen/boxMultiFile/kt9958.kt similarity index 50% rename from compiler/testData/codegen/boxMultiFile/kt9958/a.kt rename to compiler/testData/codegen/boxMultiFile/kt9958.kt index 916e2477330..d138dc19fe4 100644 --- a/compiler/testData/codegen/boxMultiFile/kt9958/a.kt +++ b/compiler/testData/codegen/boxMultiFile/kt9958.kt @@ -1,3 +1,5 @@ +// FILE: a.kt + package a import b.* @@ -13,4 +15,16 @@ class B { fun box(): String { B() return result -} \ No newline at end of file +} + +// FILE: b.kt + +package b + +var result = "fail" + +abstract class A { + protected fun foo() { + result = "OK" + } +} diff --git a/compiler/testData/codegen/boxMultiFile/kt9958/b.kt b/compiler/testData/codegen/boxMultiFile/kt9958/b.kt deleted file mode 100644 index 36d890bfe7b..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt9958/b.kt +++ /dev/null @@ -1,9 +0,0 @@ -package b - -var result = "fail" - -abstract class A { - protected fun foo() { - result = "OK" - } -} diff --git a/compiler/testData/codegen/boxMultiFile/kt9958Interface/a.kt b/compiler/testData/codegen/boxMultiFile/kt9958Interface.kt similarity index 55% rename from compiler/testData/codegen/boxMultiFile/kt9958Interface/a.kt rename to compiler/testData/codegen/boxMultiFile/kt9958Interface.kt index ed6935687cf..639bf6b35bb 100644 --- a/compiler/testData/codegen/boxMultiFile/kt9958Interface/a.kt +++ b/compiler/testData/codegen/boxMultiFile/kt9958Interface.kt @@ -1,3 +1,5 @@ +// FILE: a.kt + package a import b.* @@ -15,4 +17,16 @@ class C : B fun box(): String { C().test() return result -} \ No newline at end of file +} + +// FILE: b.kt + +package b + +var result = "fail" + +abstract class A { + protected fun foo() { + result = "OK" + } +} diff --git a/compiler/testData/codegen/boxMultiFile/kt9958Interface/b.kt b/compiler/testData/codegen/boxMultiFile/kt9958Interface/b.kt deleted file mode 100644 index 36d890bfe7b..00000000000 --- a/compiler/testData/codegen/boxMultiFile/kt9958Interface/b.kt +++ /dev/null @@ -1,9 +0,0 @@ -package b - -var result = "fail" - -abstract class A { - protected fun foo() { - result = "OK" - } -} diff --git a/compiler/testData/codegen/boxMultiFile/mainInFiles/1.kt b/compiler/testData/codegen/boxMultiFile/mainInFiles.kt similarity index 70% rename from compiler/testData/codegen/boxMultiFile/mainInFiles/1.kt rename to compiler/testData/codegen/boxMultiFile/mainInFiles.kt index f8b6659280a..c488f31116f 100644 --- a/compiler/testData/codegen/boxMultiFile/mainInFiles/1.kt +++ b/compiler/testData/codegen/boxMultiFile/mainInFiles.kt @@ -1,3 +1,5 @@ +// FILE: 1.kt + package test class A {} @@ -19,3 +21,20 @@ fun box(): String { return args[0] } + + +// FILE: a.kt + +package pkg + +fun main(args: Array) { + args[0] += "O" +} + +// FILE: b.kt + +package pkg + +fun main(args: Array) { + args[0] += "K" +} diff --git a/compiler/testData/codegen/boxMultiFile/mainInFiles/a.kt b/compiler/testData/codegen/boxMultiFile/mainInFiles/a.kt deleted file mode 100644 index a22ae536ac8..00000000000 --- a/compiler/testData/codegen/boxMultiFile/mainInFiles/a.kt +++ /dev/null @@ -1,5 +0,0 @@ -package pkg - -fun main(args: Array) { - args[0] += "O" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/mainInFiles/b.kt b/compiler/testData/codegen/boxMultiFile/mainInFiles/b.kt deleted file mode 100644 index 1d15647a4b5..00000000000 --- a/compiler/testData/codegen/boxMultiFile/mainInFiles/b.kt +++ /dev/null @@ -1,5 +0,0 @@ -package pkg - -fun main(args: Array) { - args[0] += "K" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization.kt b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization.kt new file mode 100644 index 00000000000..9030317f1a5 --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization.kt @@ -0,0 +1,26 @@ +// FILE: box.kt + +import a.* + +fun box(): String = OK + +// FILE: part1.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val O: String = "O" + +// FILE: part2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val K: String = "K" + +// FILE: part3.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK: String = O + K diff --git a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/box.kt b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/box.kt deleted file mode 100644 index cc7fc172275..00000000000 --- a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/box.kt +++ /dev/null @@ -1,3 +0,0 @@ -import a.* - -fun box(): String = OK \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part1.kt b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part1.kt deleted file mode 100644 index 34fdf81546b..00000000000 --- a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part1.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val O: String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part2.kt b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part2.kt deleted file mode 100644 index aa95ebb6637..00000000000 --- a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part2.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val K: String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part3.kt b/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part3.kt deleted file mode 100644 index f39e13de085..00000000000 --- a/compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/part3.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK: String = O + K \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport.kt b/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport.kt new file mode 100644 index 00000000000..7d185e9ee00 --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport.kt @@ -0,0 +1,24 @@ +// FILE: box.kt + +package a + +import pack.* + +class X : SomeClass() + +fun box(): String { + X() + return "OK" +} + +// FILE: file1.kt + +package kotlin.jvm + +private class SomeClass + +// FILE: file2.kt + +package pack + +public open class SomeClass diff --git a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/box.kt b/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/box.kt deleted file mode 100644 index ff1527f24a2..00000000000 --- a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/box.kt +++ /dev/null @@ -1,10 +0,0 @@ -package a - -import pack.* - -class X : SomeClass() - -fun box(): String { - X() - return "OK" -} diff --git a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file1.kt b/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file1.kt deleted file mode 100644 index ba7bfa5c7c5..00000000000 --- a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file1.kt +++ /dev/null @@ -1,3 +0,0 @@ -package kotlin.jvm - -private class SomeClass diff --git a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file2.kt b/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file2.kt deleted file mode 100644 index 65624445def..00000000000 --- a/compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/file2.kt +++ /dev/null @@ -1,3 +0,0 @@ -package pack - -public open class SomeClass diff --git a/compiler/testData/codegen/boxMultiFile/protectedFromLambda/B.kt b/compiler/testData/codegen/boxMultiFile/protectedFromLambda.kt similarity index 61% rename from compiler/testData/codegen/boxMultiFile/protectedFromLambda/B.kt rename to compiler/testData/codegen/boxMultiFile/protectedFromLambda.kt index 30751992ab4..2aec1ad2a0b 100644 --- a/compiler/testData/codegen/boxMultiFile/protectedFromLambda/B.kt +++ b/compiler/testData/codegen/boxMultiFile/protectedFromLambda.kt @@ -1,4 +1,15 @@ -// B.kt +// FILE: A.kt + +package first + +open class A { + protected open fun test(): String = "FAIL (A)" +} + +fun box() = second.C().value() + +// FILE: B.kt + // See also KT-8344: INVOKESPECIAL instead of INVOKEVIRTUAL in accessor package second @@ -14,4 +25,3 @@ public abstract class B(): A() { class C: B() { override fun test() = "OK" } - diff --git a/compiler/testData/codegen/boxMultiFile/protectedFromLambda/A.kt b/compiler/testData/codegen/boxMultiFile/protectedFromLambda/A.kt deleted file mode 100644 index 70f4b057db4..00000000000 --- a/compiler/testData/codegen/boxMultiFile/protectedFromLambda/A.kt +++ /dev/null @@ -1,8 +0,0 @@ -// A.kt -package first - -open class A { - protected open fun test(): String = "FAIL (A)" -} - -fun box() = second.C().value() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles.kt b/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles.kt new file mode 100644 index 00000000000..74bca491a4c --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles.kt @@ -0,0 +1,22 @@ +// FILE: 1/wrapped.kt + +fun getWrapped1(): Runnable { + val f = { } + return Runnable(f) +} + +// FILE: 2/wrapped2.kt + +fun getWrapped2(): Runnable { + val f = { } + return Runnable(f) +} + +// FILE: box.kt + +fun box(): String { + val class1 = getWrapped1().javaClass + val class2 = getWrapped2().javaClass + + return if (class1 != class2) "OK" else "Same class: $class1" +} diff --git a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/1/wrapped.kt b/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/1/wrapped.kt deleted file mode 100644 index 733fce7706e..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/1/wrapped.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun getWrapped1(): Runnable { - val f = { } - return Runnable(f) -} diff --git a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/2/wrapped2.kt b/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/2/wrapped2.kt deleted file mode 100644 index 4abed42b27f..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/2/wrapped2.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun getWrapped2(): Runnable { - val f = { } - return Runnable(f) -} diff --git a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/box.kt b/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/box.kt deleted file mode 100644 index b7342e79fba..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/box.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val class1 = getWrapped1().javaClass - val class2 = getWrapped2().javaClass - - return if (class1 != class2) "OK" else "Same class: $class1" -} diff --git a/compiler/testData/codegen/boxMultiFile/sameFileName.kt b/compiler/testData/codegen/boxMultiFile/sameFileName.kt new file mode 100644 index 00000000000..0f029e220ce --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/sameFileName.kt @@ -0,0 +1,7 @@ +// FILE: 1/box.kt + +fun box() = box1() + "K" + +// FILE: 2/box2.kt + +fun box1() = "O" diff --git a/compiler/testData/codegen/boxMultiFile/sameFileName/1/box.kt b/compiler/testData/codegen/boxMultiFile/sameFileName/1/box.kt deleted file mode 100644 index cf4b866e5a5..00000000000 --- a/compiler/testData/codegen/boxMultiFile/sameFileName/1/box.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = box1() + "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/sameFileName/2/box2.kt b/compiler/testData/codegen/boxMultiFile/sameFileName/2/box2.kt deleted file mode 100644 index 010c49d3b80..00000000000 --- a/compiler/testData/codegen/boxMultiFile/sameFileName/2/box2.kt +++ /dev/null @@ -1 +0,0 @@ -fun box1() = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades.kt b/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades.kt new file mode 100644 index 00000000000..f149e681988 --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades.kt @@ -0,0 +1,21 @@ +// FILE: 1/part.kt + +@file:JvmName("Foo") +@file:JvmMultifileClass +package test + +fun foo(): String = "O" + +// FILE: 2/part.kt + +@file:JvmName("Bar") +@file:JvmMultifileClass +package test + +fun bar(): String = "K" + +// FILE: box.kt + +package test + +fun box(): String = foo() + bar() diff --git a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/1/part.kt b/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/1/part.kt deleted file mode 100644 index bbf345a063f..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/1/part.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Foo") -@file:JvmMultifileClass -package test - -fun foo(): String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/2/part.kt b/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/2/part.kt deleted file mode 100644 index a80959a5736..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/2/part.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Bar") -@file:JvmMultifileClass -package test - -fun bar(): String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/box.kt b/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/box.kt deleted file mode 100644 index aaae71300c2..00000000000 --- a/compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/box.kt +++ /dev/null @@ -1,3 +0,0 @@ -package test - -fun box(): String = foo() + bar() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/simple.kt b/compiler/testData/codegen/boxMultiFile/simple.kt new file mode 100644 index 00000000000..e039250e9ef --- /dev/null +++ b/compiler/testData/codegen/boxMultiFile/simple.kt @@ -0,0 +1,7 @@ +// FILE: 1.kt + +fun box() = ok() + +// FILE: 2.kt + +fun ok(res: String = "OK") = res diff --git a/compiler/testData/codegen/boxMultiFile/simple/1.kt b/compiler/testData/codegen/boxMultiFile/simple/1.kt deleted file mode 100644 index a334e87b623..00000000000 --- a/compiler/testData/codegen/boxMultiFile/simple/1.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = ok() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultiFile/simple/2.kt b/compiler/testData/codegen/boxMultiFile/simple/2.kt deleted file mode 100644 index d8b5fb5b66a..00000000000 --- a/compiler/testData/codegen/boxMultiFile/simple/2.kt +++ /dev/null @@ -1 +0,0 @@ -fun ok(res: String = "OK") = res \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt b/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt deleted file mode 100644 index 214494e4f16..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt +++ /dev/null @@ -1,3 +0,0 @@ -import a.foo - -fun box(): String = foo() \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.2.kt b/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.2.kt deleted file mode 100644 index 4d1b4f46224..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.2.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -fun foo(): String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt b/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt new file mode 100644 index 00000000000..7234667d720 --- /dev/null +++ b/compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt @@ -0,0 +1,12 @@ +// FILE: 1.kt + +import a.foo + +fun box(): String = foo() + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +fun foo(): String = "OK" diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt b/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt deleted file mode 100644 index 5209a8c94e9..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt +++ /dev/null @@ -1,3 +0,0 @@ -import a.OK - -fun box(): String = OK \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.2.kt b/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.2.kt deleted file mode 100644 index 4d04d8f62b4..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.2.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -const val OK: String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt b/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt new file mode 100644 index 00000000000..d151190244e --- /dev/null +++ b/compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt @@ -0,0 +1,12 @@ +// FILE: 1.kt + +import a.OK + +fun box(): String = OK + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +const val OK: String = "OK" diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt b/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt deleted file mode 100644 index 5209a8c94e9..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt +++ /dev/null @@ -1,3 +0,0 @@ -import a.OK - -fun box(): String = OK \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.2.kt b/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.2.kt deleted file mode 100644 index e495105ce66..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.2.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -val OK: String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt b/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt new file mode 100644 index 00000000000..2498383d462 --- /dev/null +++ b/compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt @@ -0,0 +1,12 @@ +// FILE: 1.kt + +import a.OK + +fun box(): String = OK + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK: String = "OK" diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt b/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt deleted file mode 100644 index 89984371091..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt +++ /dev/null @@ -1,6 +0,0 @@ -import a.OK - -fun box(): String { - OK = "OK" - return OK -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.2.kt b/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.2.kt deleted file mode 100644 index a5eadef7399..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.2.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -var OK: String = "Hmmm?" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt b/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt new file mode 100644 index 00000000000..54106c76e72 --- /dev/null +++ b/compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt @@ -0,0 +1,15 @@ +// FILE: 1.kt + +import a.OK + +fun box(): String { + OK = "OK" + return OK +} + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +var OK: String = "Hmmm?" diff --git a/compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.2.kt b/compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.2.kt deleted file mode 100644 index d3e44105b0c..00000000000 --- a/compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.2.kt +++ /dev/null @@ -1,7 +0,0 @@ -@file:[JvmName("MultifileClass") JvmMultifileClass] -package a - -annotation class A - -@A -const val OK: String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt b/compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt similarity index 59% rename from compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt rename to compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt index 91ed9e2a3db..adaa0963a20 100644 --- a/compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt +++ b/compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt @@ -1,9 +1,11 @@ +// FILE: 1.kt + import a.OK fun box(): String { val okRef = ::OK - // TODO + // TODO: see KT-10892 // val annotations = okRef.annotations // val numAnnotations = annotations.size // if (numAnnotations != 1) { @@ -11,4 +13,14 @@ fun box(): String { // } return okRef.get() -} \ No newline at end of file +} + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +annotation class A + +@A +const val OK: String = "OK" diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 03263629a13..e424d74764e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -60,7 +60,7 @@ import static org.jetbrains.kotlin.codegen.CodegenTestUtil.*; import static org.jetbrains.kotlin.test.KotlinTestUtils.compilerConfigurationForTests; import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar; -public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava { +public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava { private static final String DEFAULT_TEST_FILE_NAME = "a_test"; protected KotlinCoreEnvironment myEnvironment; @@ -326,6 +326,21 @@ public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava { + public final String name; + public final String content; + + public TestFile(@NotNull String name, @NotNull String content) { + this.name = name; + this.content = content; + } + + @Override + public int compareTo(@NotNull TestFile o) { + return name.compareTo(o.name); + } + } + @Override protected Void createTestModule(@NotNull String name) { // TODO: support multi-module codegen tests @@ -333,12 +348,12 @@ public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava directives) { - return new File(fileName); + protected TestFile createTestFile(Void module, String fileName, String text, Map directives) { + return new TestFile(fileName, text); } @Override - protected void doMultiFileTest(File file, Map modules, List files) throws Exception { + protected void doMultiFileTest(File file, Map modules, List files) throws Exception { throw new UnsupportedOperationException("Multi-file test cases are not supported in this test"); } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestFiles.java b/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestFiles.java index b0129ea0e7c..011dbb65340 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestFiles.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CodegenTestFiles.java @@ -81,24 +81,29 @@ public class CodegenTestFiles { return psiFiles; } + @NotNull + public static CodegenTestFiles create(@NotNull List ktFiles) { + assert !ktFiles.isEmpty() : "List should have at least one file"; + return new CodegenTestFiles(ktFiles, Collections.>emptyList(), Collections.emptyList()); + } + public static CodegenTestFiles create(Project project, String[] names) { return create(project, names, KotlinTestUtils.getTestDataPathBase()); } public static CodegenTestFiles create(Project project, String[] names, String testDataPath) { - ArrayList files = new ArrayList(); + List files = new ArrayList(names.length); for (String name : names) { try { String content = KotlinTestUtils.doLoadFile(testDataPath + "/codegen/", name); - int i = name.lastIndexOf('/'); - //name = name.substring(i+1); KtFile file = KotlinTestUtils.createFile(name, content, project); files.add(file); - } catch (IOException e) { + } + catch (IOException e) { throw new RuntimeException(e); } } - return new CodegenTestFiles(files, Collections.>emptyList(), Collections.emptyList()); + return create(files); } @NotNull diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxCodegenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxCodegenTest.java index f60965eef0e..d3dd5d25e51 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxCodegenTest.java @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider; import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt; import org.jetbrains.kotlin.codegen.CodegenTestCase; +import org.jetbrains.kotlin.codegen.CodegenTestFiles; import org.jetbrains.kotlin.codegen.GeneratedClassLoader; import org.jetbrains.kotlin.codegen.GenerationUtils; import org.jetbrains.kotlin.config.CompilerConfiguration; @@ -50,10 +51,14 @@ import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava; public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { @Override - protected void doMultiFileTest(File file, Map modules, List files) throws Exception { - assert files.size() == 1 : "Multi-file test cases are not supported yet in this test"; - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - blackBoxFileByFullPath(file.getPath()); + protected void doMultiFileTest(File file, Map modules, List files) throws Exception { + if (files.size() == 1) { + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); + blackBoxFileByFullPath(file.getPath()); + } + else { + doTestMultiFile(files); + } } public void doTestAgainstJava(@NotNull String filename) { @@ -81,25 +86,17 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { blackBoxFileByFullPath(filename); } - public void doTestMultiFile(@NotNull String folderName) { - final List files = new ArrayList(2); - FileUtil.processFilesRecursively(new File(folderName), new Processor() { - @Override - public boolean process(File file) { - if (file.getName().endsWith(".kt")) { - files.add(relativePath(file)); - } - return true; - } - }); - - doTestMultiFile(files); - } - - protected void doTestMultiFile(@NotNull List files) { + private void doTestMultiFile(@NotNull List files) { createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL); Collections.sort(files); - loadFiles(ArrayUtil.toStringArray(files)); + + List ktFiles = new ArrayList(files.size()); + for (TestFile file : files) { + ktFiles.add(KotlinTestUtils.createFile(file.name, file.content, myEnvironment.getProject())); + } + + myFiles = CodegenTestFiles.create(ktFiles); + blackBox(); } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxInlineCodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxInlineCodegenTest.kt index 574c5ffa102..689513b0803 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxInlineCodegenTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/AbstractBlackBoxInlineCodegenTest.kt @@ -20,15 +20,18 @@ import org.jetbrains.kotlin.codegen.InlineTestUtil import org.jetbrains.kotlin.codegen.filterClassFiles import org.jetbrains.kotlin.codegen.getClassFiles import org.jetbrains.kotlin.jvm.compiler.AbstractSMAPBaseTest +import org.jetbrains.kotlin.test.ConfigurationKind import java.io.File abstract class AbstractBlackBoxInlineCodegenTest : AbstractBlackBoxCodegenTest(), AbstractSMAPBaseTest { - fun doTestMultiFileWithInlineCheck(firstFileName: String) { val fileName = relativePath(File(firstFileName)) val inputFiles = listOf(fileName, fileName.substringBeforeLast("1.kt") + "2.kt") - doTestMultiFile(inputFiles) + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL) + loadFiles(*inputFiles.toTypedArray()) + blackBox() + try { InlineTestUtil.checkNoCallsToInline(initializedClassLoader.allGeneratedFiles.filterClassFiles(), myFiles.psiFiles) checkSMAP(myFiles.psiFiles, generateClassesInFile().getClassFiles()) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxMultiFileCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxMultiFileCodegenTestGenerated.java index 14d91c3edf0..e1e51f357ce 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxMultiFileCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxMultiFileCodegenTestGenerated.java @@ -27,155 +27,215 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/boxMultiFile") -@TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class BlackBoxMultiFileCodegenTestGenerated extends AbstractBlackBoxCodegenTest { - @TestMetadata("accessorForProtected") - public void testAccessorForProtected() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtected/"); - doTestMultiFile(fileName); + @TestMetadata("compiler/testData/codegen/boxMultiFile") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class BoxMultiFile extends AbstractBlackBoxCodegenTest { + @TestMetadata("accessorForProtected.kt") + public void testAccessorForProtected() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtected.kt"); + doTest(fileName); + } + + @TestMetadata("accessorForProtectedInvokeVirtual.kt") + public void testAccessorForProtectedInvokeVirtual() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt"); + doTest(fileName); + } + + public void testAllFilesPresentInBoxMultiFile() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultiFile"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("callMultifileClassMemberFromOtherPackage.kt") + public void testCallMultifileClassMemberFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt"); + doTest(fileName); + } + + @TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt") + public void testInlineMultifileClassMemberFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt"); + doTest(fileName); + } + + @TestMetadata("internalVisibility.kt") + public void testInternalVisibility() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/internalVisibility.kt"); + doTest(fileName); + } + + @TestMetadata("kt10047.kt") + public void testKt10047() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt10047.kt"); + doTest(fileName); + } + + @TestMetadata("kt1515.kt") + public void testKt1515() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1515.kt"); + doTest(fileName); + } + + @TestMetadata("kt1528.kt") + public void testKt1528() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1528.kt"); + doTest(fileName); + } + + @TestMetadata("kt1845.kt") + public void testKt1845() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1845.kt"); + doTest(fileName); + } + + @TestMetadata("kt2060.kt") + public void testKt2060() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt2060.kt"); + doTest(fileName); + } + + @TestMetadata("kt5445.kt") + public void testKt5445() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445.kt"); + doTest(fileName); + } + + @TestMetadata("kt5445_2.kt") + public void testKt5445_2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445_2.kt"); + doTest(fileName); + } + + @TestMetadata("kt9717.kt") + public void testKt9717() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717.kt"); + doTest(fileName); + } + + @TestMetadata("kt9717DifferentPackages.kt") + public void testKt9717DifferentPackages() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages.kt"); + doTest(fileName); + } + + @TestMetadata("kt9958.kt") + public void testKt9958() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958.kt"); + doTest(fileName); + } + + @TestMetadata("kt9958Interface.kt") + public void testKt9958Interface() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958Interface.kt"); + doTest(fileName); + } + + @TestMetadata("mainInFiles.kt") + public void testMainInFiles() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/mainInFiles.kt"); + doTest(fileName); + } + + @TestMetadata("multifileClassPartsInitialization.kt") + public void testMultifileClassPartsInitialization() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization.kt"); + doTest(fileName); + } + + @TestMetadata("packageLocalClassNotImportedWithDefaultImport.kt") + public void testPackageLocalClassNotImportedWithDefaultImport() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport.kt"); + doTest(fileName); + } + + @TestMetadata("protectedFromLambda.kt") + public void testProtectedFromLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/protectedFromLambda.kt"); + doTest(fileName); + } + + @TestMetadata("samWrappersDifferentFiles.kt") + public void testSamWrappersDifferentFiles() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles.kt"); + doTest(fileName); + } + + @TestMetadata("sameFileName.kt") + public void testSameFileName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/sameFileName.kt"); + doTest(fileName); + } + + @TestMetadata("samePartNameDifferentFacades.kt") + public void testSamePartNameDifferentFacades() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades.kt"); + doTest(fileName); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/simple.kt"); + doTest(fileName); + } } - @TestMetadata("accessorForProtectedInvokeVirtual") - public void testAccessorForProtectedInvokeVirtual() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/"); - doTestMultiFile(fileName); - } + @TestMetadata("compiler/testData/codegen/boxMultifileClasses") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class BoxMultifileClasses extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInBoxMultifileClasses() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.kt$"), true); + } - public void testAllFilesPresentInBoxMultiFile() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultiFile"), Pattern.compile("^([^\\.]+)$"), false); - } + @TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Calls extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.kt$"), true); + } - @TestMetadata("callMultifileClassMemberFromOtherPackage") - public void testCallMultifileClassMemberFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/"); - doTestMultiFile(fileName); - } + @TestMetadata("callFromOtherPackage.kt") + public void testCallFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt"); + doTest(fileName); + } - @TestMetadata("inlineMultifileClassMemberFromOtherPackage") - public void testInlineMultifileClassMemberFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/"); - doTestMultiFile(fileName); - } + @TestMetadata("constFromOtherPackage.kt") + public void testConstFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt"); + doTest(fileName); + } - @TestMetadata("internalVisibility") - public void testInternalVisibility() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/internalVisibility/"); - doTestMultiFile(fileName); - } + @TestMetadata("valFromOtherPackage.kt") + public void testValFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt"); + doTest(fileName); + } - @TestMetadata("kt10047") - public void testKt10047() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt10047/"); - doTestMultiFile(fileName); - } + @TestMetadata("varFromOtherPackage.kt") + public void testVarFromOtherPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt"); + doTest(fileName); + } + } - @TestMetadata("kt1515") - public void testKt1515() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1515/"); - doTestMultiFile(fileName); - } + @TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Reflection extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInReflection() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.kt$"), true); + } - @TestMetadata("kt1528") - public void testKt1528() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1528/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt1845") - public void testKt1845() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1845/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt2060") - public void testKt2060() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt2060/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt5445") - public void testKt5445() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt5445_2") - public void testKt5445_2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445_2/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt9717") - public void testKt9717() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt9717DifferentPackages") - public void testKt9717DifferentPackages() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt9958") - public void testKt9958() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958/"); - doTestMultiFile(fileName); - } - - @TestMetadata("kt9958Interface") - public void testKt9958Interface() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958Interface/"); - doTestMultiFile(fileName); - } - - @TestMetadata("mainInFiles") - public void testMainInFiles() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/mainInFiles/"); - doTestMultiFile(fileName); - } - - @TestMetadata("multifileClassPartsInitialization") - public void testMultifileClassPartsInitialization() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/"); - doTestMultiFile(fileName); - } - - @TestMetadata("packageLocalClassNotImportedWithDefaultImport") - public void testPackageLocalClassNotImportedWithDefaultImport() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/"); - doTestMultiFile(fileName); - } - - @TestMetadata("protectedFromLambda") - public void testProtectedFromLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/protectedFromLambda/"); - doTestMultiFile(fileName); - } - - @TestMetadata("samWrappersDifferentFiles") - public void testSamWrappersDifferentFiles() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/"); - doTestMultiFile(fileName); - } - - @TestMetadata("sameFileName") - public void testSameFileName() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/sameFileName/"); - doTestMultiFile(fileName); - } - - @TestMetadata("samePartNameDifferentFacades") - public void testSamePartNameDifferentFacades() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/"); - doTestMultiFile(fileName); - } - - @TestMetadata("simple") - public void testSimple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/simple/"); - doTestMultiFile(fileName); + @TestMetadata("constPropertyReferenceFromMultifileClass.kt") + public void testConstPropertyReferenceFromMultifileClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt"); + doTest(fileName); + } + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractBlackBoxMultifileClassCodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractBlackBoxMultifileClassCodegenTest.kt deleted file mode 100644 index 6c632ee4768..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractBlackBoxMultifileClassCodegenTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.jvm.compiler - -import org.jetbrains.kotlin.codegen.generated.AbstractBlackBoxCodegenTest -import java.io.File - - -abstract class AbstractBlackBoxMultifileClassCodegenTest: AbstractBlackBoxCodegenTest() { - fun doTestMultifileClassAgainstSources(firstFileName: String) { - val fileName = relativePath(File(firstFileName)) - val inputFiles = listOf(fileName, fileName.substringBeforeLast("1.kt") + "2.kt") - - doTestMultiFile(inputFiles) - } -} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/BlackBoxMultifileClassKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/BlackBoxMultifileClassKotlinTestGenerated.java deleted file mode 100644 index afd626061cb..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/BlackBoxMultifileClassKotlinTestGenerated.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.jvm.compiler; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/boxMultifileClasses") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class BlackBoxMultifileClassKotlinTestGenerated extends AbstractBlackBoxMultifileClassCodegenTest { - public void testAllFilesPresentInBoxMultifileClasses() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true); - } - - @TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Calls extends AbstractBlackBoxMultifileClassCodegenTest { - public void testAllFilesPresentInCalls() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.1.kt$"), true); - } - - @TestMetadata("callFromOtherPackage.1.kt") - public void testCallFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt"); - doTestMultifileClassAgainstSources(fileName); - } - - @TestMetadata("constFromOtherPackage.1.kt") - public void testConstFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt"); - doTestMultifileClassAgainstSources(fileName); - } - - @TestMetadata("valFromOtherPackage.1.kt") - public void testValFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt"); - doTestMultifileClassAgainstSources(fileName); - } - - @TestMetadata("varFromOtherPackage.1.kt") - public void testVarFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt"); - doTestMultifileClassAgainstSources(fileName); - } - } - - @TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Reflection extends AbstractBlackBoxMultifileClassCodegenTest { - public void testAllFilesPresentInReflection() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.1.kt$"), true); - } - - @TestMetadata("constFromMultifileClass.1.kt") - public void testConstFromMultifileClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt"); - doTestMultifileClassAgainstSources(fileName); - } - } -} diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstMultifileKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstMultifileKotlinTestGenerated.java index d6a81dc3d29..91f9b6f65ad 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstMultifileKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstMultifileKotlinTestGenerated.java @@ -35,51 +35,4 @@ public class CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCo KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true); } - @TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Calls extends AbstractCompileKotlinAgainstMultifileKotlinTest { - public void testAllFilesPresentInCalls() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.1.kt$"), true); - } - - @TestMetadata("callFromOtherPackage.1.kt") - public void testCallFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt"); - doBoxTest(fileName); - } - - @TestMetadata("constFromOtherPackage.1.kt") - public void testConstFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt"); - doBoxTest(fileName); - } - - @TestMetadata("valFromOtherPackage.1.kt") - public void testValFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt"); - doBoxTest(fileName); - } - - @TestMetadata("varFromOtherPackage.1.kt") - public void testVarFromOtherPackage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt"); - doBoxTest(fileName); - } - } - - @TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Reflection extends AbstractCompileKotlinAgainstMultifileKotlinTest { - public void testAllFilesPresentInReflection() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.1.kt$"), true); - } - - @TestMetadata("constFromMultifileClass.1.kt") - public void testConstFromMultifileClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt"); - doBoxTest(fileName); - } - } } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 429bb3d4d9f..1d6402d73ac 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -203,16 +203,13 @@ fun main(args: Array) { model("codegen/boxInline", extension = "1.kt", testMethod = "doBoxTestWithInlineCheck") } - testClass(AbstractBlackBoxMultifileClassCodegenTest::class.java, "BlackBoxMultifileClassKotlinTestGenerated") { - model("codegen/boxMultifileClasses", extension = "1.kt", testMethod = "doTestMultifileClassAgainstSources") - } - testClass(AbstractCompileKotlinAgainstMultifileKotlinTest::class.java, "CompileKotlinAgainstMultifileKotlinTestGenerated") { model("codegen/boxMultifileClasses", extension = "1.kt", testMethod = "doBoxTest") } testClass("BlackBoxMultiFileCodegenTestGenerated") { - model("codegen/boxMultiFile", extension = null, recursive = false, testMethod = "doTestMultiFile") + model("codegen/boxMultiFile") + model("codegen/boxMultifileClasses") } testClass("BlackBoxAgainstJavaCodegenTestGenerated") {