Remove LocalClassProtoTestGenerated, replace with kotlinp tests

This test uses a hacky mode of the compiler which is not worth it to
support further (especially in K2), `USE_SINGLE_MODULE`, where
everything is compiled in one module. The purpose of the test is just to
check that metadata for local/anonymous classes is written correctly.
So we can replace it with the tests on kotlinp, which uses
kotlinx-metadata-jvm and dumps all loaded metadata to text.

This replacement is not perfect, in particular because it won't check
that the reflection machinery is able to load this metadata, and because
it won't check that annotations are loaded correctly from the bytecode.
But IMHO it's good enough, there are box tests on reflection on local
classes (e.g. `reflection/annotations/localClassLiteral.kt`), so this
way is better than having to support the weird compiler mode for just
one test.
This commit is contained in:
Alexander Udalov
2022-08-26 13:30:56 +02:00
parent 7bf6d64cfb
commit abaffeddab
24 changed files with 178 additions and 263 deletions
@@ -1,25 +0,0 @@
// CLASS_NAME_SUFFIX: A$foo$Local
import kotlin.reflect.KClass
class A {
annotation class Ann(val info: String)
annotation class Bnn(val klass: KClass<*>)
fun foo() {
@Ann("class")
class Local {
@Ann("fun")
fun foo(): Local = this
@field:Ann("val")
@Bnn(Local::class)
val x = foo()
@Ann("inner")
@Bnn(Array<Array<out Local>>::class)
inner class Inner
}
}
}
@@ -1,9 +0,0 @@
@A.Ann(info = "class") local final class `A$foo$Local`
public constructor `A$foo$Local`()
@A.Bnn(klass = A$foo$Local::class) @field:A.Ann(info = "val") public final val x: `A$foo$Local`
@A.Ann(info = "fun") public final fun foo(): `A$foo$Local`
@A.Ann(info = "inner") @A.Bnn(klass = kotlin.Array<kotlin.Array<A$foo$Local>>::class) local final inner class Inner {
public constructor Inner()
}
@@ -1,5 +0,0 @@
// CLASS_NAME_SUFFIX: $main$1
fun main() = object : Runnable {
override fun run() { }
}
@@ -1,3 +0,0 @@
local final class `AnonymousObjectKt$main$1` : java.lang.Runnable
public open override /*1*/ fun run(): kotlin.Unit
-24
View File
@@ -1,24 +0,0 @@
package test
// CLASS_NAME_SUFFIX: Deepest
fun main() {
class Local {
inner class Inner {
val prop = object {
fun foo() {
fun bar() {
class DeepLocal {
inner class Deepest {
fun local(): Local = Local()
fun inner(): Inner = Inner()
fun deep(): DeepLocal = DeepLocal()
fun deepest(): Deepest? = Deepest()
}
}
}
}
}
}
}
}
@@ -1,7 +0,0 @@
local final inner class Deepest
public constructor Deepest()
public final fun deep(): test.`DeepInnerChainKt$main$Local$Inner$prop$1$foo$1$DeepLocal`
public final fun deepest(): test.`DeepInnerChainKt$main$Local$Inner$prop$1$foo$1$DeepLocal`.Deepest?
public final fun inner(): test.`DeepInnerChainKt$main$Local`.Inner
public final fun local(): test.`DeepInnerChainKt$main$Local`
-10
View File
@@ -1,10 +0,0 @@
// CLASS_NAME_SUFFIX: main$Local$Inner
fun main() {
class Local {
inner class Inner {
fun local(l: Local) {}
fun inner(i: Inner) {}
}
}
}
@@ -1,5 +0,0 @@
local final inner class Inner
public constructor Inner()
public final fun inner(/*0*/ i: `InnerOfLocalKt$main$Local`.Inner): kotlin.Unit
public final fun local(/*0*/ l: `InnerOfLocalKt$main$Local`): kotlin.Unit
@@ -1,13 +0,0 @@
// CLASS_NAME_SUFFIX: $main$Local
fun main() {
open class Local {
fun param(l: Local) {}
val returnType: Local = this
fun Local.receiver() = this
fun <T : Local, U : T> generic(t: T): U = null!!
}
}
@@ -1,7 +0,0 @@
local open class `LocalClassInSignatureKt$main$Local`
public constructor `LocalClassInSignatureKt$main$Local`()
public final val returnType: `LocalClassInSignatureKt$main$Local`
public final fun </*0*/ T : `LocalClassInSignatureKt$main$Local`, /*1*/ U : T> generic(/*0*/ t: T): U
public final fun param(/*0*/ l: `LocalClassInSignatureKt$main$Local`): kotlin.Unit
public final fun `LocalClassInSignatureKt$main$Local`.receiver(): `LocalClassInSignatureKt$main$Local`
@@ -1,7 +0,0 @@
// CLASS_NAME_SUFFIX: A$foo$Local
class A {
fun foo() {
class Local
}
}
@@ -1,3 +0,0 @@
local final class `A$foo$Local`
public constructor `A$foo$Local`()
@@ -1,5 +0,0 @@
// CLASS_NAME_SUFFIX: $main$Local
fun main() {
class Local
}
@@ -1,3 +0,0 @@
local final class `SimpleInTopLevelFunctionKt$main$Local`
public constructor `SimpleInTopLevelFunctionKt$main$Local`()