Support plugin intrinsics for serializer() function in K2.

- Add IrPluginContext to JvmBackendContext, so plugin intrinsics can
reference external functions properly.

- Do not use module.findClassAcrossModuleDependencies as Descriptor API does not work for FIR.

- Add asm listing tests in serialization plugin for K2

- Remove Delegated.kt asm listing test as we have similar test in boxIr group.

#KT-56553 Fixed
This commit is contained in:
Leonid Startsev
2023-02-09 15:43:48 +01:00
committed by Space Team
parent 121c920099
commit 80ad6a4cd7
20 changed files with 2416 additions and 359 deletions
@@ -31,12 +31,6 @@ public class SerializationAsmLikeInstructionsListingTestGenerated extends Abstra
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
}
@Test
@TestMetadata("Delegated.kt")
public void testDelegated() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
}
@Test
@TestMetadata("Intrinsics.kt")
public void testIntrinsics() throws Exception {
@@ -0,0 +1,51 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.serialization.runners;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlinx.serialization.TestGeneratorKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("plugins/kotlinx-serialization/testData/codegen")
@TestDataPath("$PROJECT_ROOT")
public class SerializationFir2IrAsmLikeInstructionsListingTestGenerated extends AbstractSerializationFir2IrAsmLikeInstructionsListingTest {
@Test
public void testAllFilesPresentInCodegen() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
}
@Test
@TestMetadata("Intrinsics.kt")
public void testIntrinsics() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/Intrinsics.kt");
}
@Test
@TestMetadata("IntrinsicsAdvanced.kt")
public void testIntrinsicsAdvanced() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/IntrinsicsAdvanced.kt");
}
@Test
@TestMetadata("Sealed.kt")
public void testSealed() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/Sealed.kt");
}
}
@@ -31,12 +31,6 @@ public class SerializationIrAsmLikeInstructionsListingTestGenerated extends Abst
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
}
@Test
@TestMetadata("Delegated.kt")
public void testDelegated() throws Exception {
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
}
@Test
@TestMetadata("Intrinsics.kt")
public void testIntrinsics() throws Exception {