[FIR/AA decompiler] Add tests for sealed interfaces

^KT-62895
This commit is contained in:
Marco Pennekamp
2024-01-04 16:37:42 +01:00
committed by Space Team
parent 7c8aff963f
commit 5797b4877c
19 changed files with 158 additions and 0 deletions
@@ -240,6 +240,12 @@ public class DecompiledKnmStubConsistencyFe10TestGenerated extends AbstractDecom
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -240,6 +240,12 @@ public class DecompiledKnmStubConsistencyK2TestGenerated extends AbstractDecompi
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -0,0 +1,7 @@
// FIR_IDENTICAL
package test
sealed interface SealedInterface {
class Nested : SealedInterface
object Top : SealedInterface
}
@@ -0,0 +1,30 @@
PsiJetFileStubImpl[package=test]
PACKAGE_DIRECTIVE
REFERENCE_EXPRESSION[referencedName=test]
IMPORT_LIST
CLASS[classId=test/SealedInterface, fqName=test.SealedInterface, isEnumEntry=false, isInterface=true, isLocal=false, isTopLevel=true, name=SealedInterface, superNames=[]]
MODIFIER_LIST[public]
CLASS_BODY
CLASS[classId=test/SealedInterface.Nested, fqName=test.SealedInterface.Nested, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Nested, superNames=[SealedInterface]]
MODIFIER_LIST[public final]
PRIMARY_CONSTRUCTOR[fqName=null, hasBody=false, isDelegatedCallToThis=false, isExtension=false, isTopLevel=false, name=Nested]
MODIFIER_LIST[public]
VALUE_PARAMETER_LIST
SUPER_TYPE_LIST
SUPER_TYPE_ENTRY
TYPE_REFERENCE
USER_TYPE
USER_TYPE
REFERENCE_EXPRESSION[referencedName=test]
REFERENCE_EXPRESSION[referencedName=SealedInterface]
CLASS_BODY
OBJECT_DECLARATION[classId=test/SealedInterface.Top, fqName=test.SealedInterface.Top, isCompanion=false, isLocal=false, isObjectLiteral=false, isTopLevel=false, name=Top, superNames=[SealedInterface]]
MODIFIER_LIST[public]
SUPER_TYPE_LIST
SUPER_TYPE_ENTRY
TYPE_REFERENCE
USER_TYPE
USER_TYPE
REFERENCE_EXPRESSION[referencedName=test]
REFERENCE_EXPRESSION[referencedName=SealedInterface]
CLASS_BODY
@@ -240,6 +240,12 @@ public class ClsStubBuilderK2CompilerTestGenerated extends AbstractClsStubBuilde
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -240,6 +240,12 @@ public class ClsStubBuilderTestGenerated extends AbstractClsStubBuilderTest {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -240,6 +240,12 @@ public class ByDecompiledPsiStubBuilderK2CompilerTestGenerated extends AbstractB
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -240,6 +240,12 @@ public class ByDecompiledPsiStubBuilderTestGenerated extends AbstractByDecompile
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
}
@Test
@TestMetadata("SealedInterface")
public void testSealedInterface() throws Exception {
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SealedInterface/");
}
@Test
@TestMetadata("SecondaryConstructors")
public void testSecondaryConstructors() throws Exception {
@@ -776,6 +776,12 @@ public class FirLoadK1CompiledJvmKotlinTestGenerated extends AbstractFirLoadK1Co
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@Test
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@Test
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
@@ -776,6 +776,12 @@ public class FirLoadK2CompiledJvmKotlinTestGenerated extends AbstractFirLoadK2Co
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@Test
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@Test
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
@@ -0,0 +1,17 @@
public final class Inheritor2 : R|test/SealedInterface| {
public constructor(): R|test/Inheritor2|
}
public final class Inheritor3 : R|test/SealedInterface| {
public constructor(): R|test/Inheritor3|
}
public sealed interface SealedInterface : R|kotlin/Any| {
public final class Inheritor1 : R|test/SealedInterface| {
public constructor(): R|test/SealedInterface.Inheritor1|
}
}
@@ -0,0 +1,9 @@
package test
class Inheritor3 : SealedInterface
sealed interface SealedInterface {
class Inheritor1 : SealedInterface
}
class Inheritor2 : SealedInterface
@@ -0,0 +1,16 @@
package test
public final class Inheritor2 : test.SealedInterface {
/*primary*/ public constructor Inheritor2()
}
public final class Inheritor3 : test.SealedInterface {
/*primary*/ public constructor Inheritor3()
}
public sealed interface SealedInterface {
public final class Inheritor1 : test.SealedInterface {
/*primary*/ public constructor Inheritor1()
}
}
@@ -2388,6 +2388,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
@@ -695,6 +695,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
@@ -2389,6 +2389,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
@@ -2388,6 +2388,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
@@ -697,6 +697,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
@@ -722,6 +722,12 @@ public class FirLoadK2CompiledJsKotlinTestGenerated extends AbstractFirLoadK2Com
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedClass.kt");
}
@Test
@TestMetadata("SealedInterface.kt")
public void testSealedInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/SealedInterface.kt");
}
@Test
@TestMetadata("SingleAbstractMethod.kt")
public void testSingleAbstractMethod() throws Exception {