[FIR] Update plugin testdata
This commit is contained in:
committed by
TeamCityServer
parent
c60ba51f8f
commit
0f076e16ed
+4
-1
@@ -38,6 +38,8 @@ import org.jetbrains.kotlin.name.Name
|
||||
* - testClassName() functions for all classes annotated with @B
|
||||
* - NestedClassName nested classes for all classes annotated with @B
|
||||
* - function `materialize: ClassName` in those nested classes
|
||||
*
|
||||
* If there are no annotated classes then AllOpenGenerated class is not generated
|
||||
*/
|
||||
class AllOpenClassGenerator(session: FirSession) : FirDeclarationGenerationExtension(session) {
|
||||
companion object {
|
||||
@@ -78,6 +80,7 @@ class AllOpenClassGenerator(session: FirSession) : FirDeclarationGenerationExten
|
||||
|
||||
private fun generateAllOpenGeneratedClass(classId: ClassId): FirClassLikeSymbol<*>? {
|
||||
if (classId != GENERATED_CLASS_ID) return null
|
||||
if (matchedClasses.isEmpty()) return null
|
||||
return buildClass(classId).symbol
|
||||
}
|
||||
|
||||
@@ -152,7 +155,7 @@ class AllOpenClassGenerator(session: FirSession) : FirDeclarationGenerationExten
|
||||
}
|
||||
|
||||
override fun getTopLevelClassIds(): Set<ClassId> {
|
||||
return setOf(GENERATED_CLASS_ID)
|
||||
return if (matchedClasses.isEmpty()) emptySet() else setOf(GENERATED_CLASS_ID)
|
||||
}
|
||||
|
||||
override fun hasPackage(packageFqName: FqName): Boolean {
|
||||
|
||||
+3
@@ -26,6 +26,9 @@ import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
/*
|
||||
* Generates `dummyClassName(value: ClassName): String` function for each class annotated with @A
|
||||
*/
|
||||
class AllOpenTopLevelDeclarationsGenerator(session: FirSession) : FirDeclarationGenerationExtension(session) {
|
||||
private val predicateBasedProvider = session.predicateBasedProvider
|
||||
private val matchedClasses by lazy {
|
||||
|
||||
+5
@@ -11,6 +11,11 @@ FILE: classWithGeneratedMembersAndNestedClass.kt
|
||||
|
||||
}
|
||||
|
||||
public final fun materialize(): R|Foo|
|
||||
|
||||
public final class Nested : R|kotlin/Any| {
|
||||
}
|
||||
|
||||
}
|
||||
public final class Bar : R|kotlin/Any| {
|
||||
public constructor(): R|Bar| {
|
||||
|
||||
+17
@@ -1,4 +1,6 @@
|
||||
FILE: generatedClassWithMembersAndNestedClasses.kt
|
||||
package bar
|
||||
|
||||
@R|org/jetbrains/kotlin/fir/plugin/B|() public final class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|bar/Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
@@ -26,3 +28,18 @@ FILE: generatedClassWithMembersAndNestedClasses.kt
|
||||
lval nestedBar: R|foo/AllOpenGenerated.NestedBar| = Q|foo/AllOpenGenerated|.R|foo/AllOpenGenerated.NestedBar|()
|
||||
R|<local>/nestedBar|.R|foo/AllOpenGenerated.NestedBar.materialize|().R|bar/Bar.bar|()
|
||||
}
|
||||
FILE: ### GENERATED DECLARATIONS ###
|
||||
package foo
|
||||
|
||||
public final class AllOpenGenerated : R|kotlin/Any| {
|
||||
public final class NestedFoo : R|kotlin/Any| {
|
||||
public final fun materialize(): R|bar/Foo|
|
||||
|
||||
}
|
||||
|
||||
public final class NestedBar : R|kotlin/Any| {
|
||||
public final fun materialize(): R|bar/Bar|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -1,4 +1,6 @@
|
||||
FILE: topLevelCallables.kt
|
||||
package foo
|
||||
|
||||
@R|org/jetbrains/kotlin/fir/plugin/A|() public final class MySuperClass : R|kotlin/Any| {
|
||||
public constructor(): R|foo/MySuperClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
@@ -12,3 +14,7 @@ FILE: topLevelCallables.kt
|
||||
}
|
||||
public final fun takeString(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
FILE: ### GENERATED DECLARATIONS ###
|
||||
package foo
|
||||
|
||||
public final fun dummyMySuperClass(value: R|foo/MySuperClass|): R|kotlin/String|
|
||||
|
||||
-4
@@ -2,10 +2,6 @@ package foo
|
||||
|
||||
import org.jetbrains.kotlin.fir.plugin.A
|
||||
|
||||
/*
|
||||
* Plugin generates `dummyClassName(value: ClassName): String` function for each class annotated with @A
|
||||
*/
|
||||
|
||||
@A
|
||||
class MySuperClass {
|
||||
fun test() {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
FILE: simple.kt
|
||||
package foo
|
||||
|
||||
public abstract interface MyInterface : R|kotlin/Any| {
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
|
||||
Reference in New Issue
Block a user