[Wasm] Support lazy associated object initialisation

Fix #KT-63939
This commit is contained in:
Igor Yakovlev
2024-01-25 19:54:33 +01:00
committed by Space Team
parent 55bbaec3f9
commit be6b9e8a9a
12 changed files with 149 additions and 62 deletions
@@ -21,7 +21,7 @@ fun main(args: Array<String>) {
val k2BoxTestDir = "multiplatform/k2"
val jsTranslatorTestPattern = "^([^_](.+))\\.kt$"
val jsTranslatorReflectionPattern = "^(findAssociatedObject(InSeparatedFile)?)\\.kt$"
val jsTranslatorReflectionPattern = "^(findAssociatedObject(InSeparatedFile)?(Lazyness)?)\\.kt$"
val jsTranslatorEsModulesExcludedDirs = listOf(
// JsExport is not supported for classes
"jsExport", "native", "export",
@@ -514,7 +514,7 @@ public class FirWasmJsTranslatorTestGenerated extends AbstractFirWasmJsTranslato
public class Reflection {
@Test
public void testAllFilesPresentInReflection() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^(findAssociatedObject(InSeparatedFile)?)\\.kt$"), null, TargetBackend.WASM, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^(findAssociatedObject(InSeparatedFile)?(Lazyness)?)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@@ -528,6 +528,12 @@ public class FirWasmJsTranslatorTestGenerated extends AbstractFirWasmJsTranslato
public void testFindAssociatedObjectInSeparatedFile() throws Exception {
runTest("js/js.translator/testData/box/reflection/findAssociatedObjectInSeparatedFile.kt");
}
@Test
@TestMetadata("findAssociatedObjectLazyness.kt")
public void testFindAssociatedObjectLazyness() throws Exception {
runTest("js/js.translator/testData/box/reflection/findAssociatedObjectLazyness.kt");
}
}
@Nested
@@ -514,7 +514,7 @@ public class K1WasmJsTranslatorTestGenerated extends AbstractK1WasmJsTranslatorT
public class Reflection {
@Test
public void testAllFilesPresentInReflection() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^(findAssociatedObject(InSeparatedFile)?)\\.kt$"), null, TargetBackend.WASM, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^(findAssociatedObject(InSeparatedFile)?(Lazyness)?)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@@ -528,6 +528,12 @@ public class K1WasmJsTranslatorTestGenerated extends AbstractK1WasmJsTranslatorT
public void testFindAssociatedObjectInSeparatedFile() throws Exception {
runTest("js/js.translator/testData/box/reflection/findAssociatedObjectInSeparatedFile.kt");
}
@Test
@TestMetadata("findAssociatedObjectLazyness.kt")
public void testFindAssociatedObjectLazyness() throws Exception {
runTest("js/js.translator/testData/box/reflection/findAssociatedObjectLazyness.kt");
}
}
@Nested