diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 3f3615c5bbe..e6a796be2d3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -38001,6 +38001,70 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + public class SameFileInSourceAndDependencies { + @Test + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @Test + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @Test + @TestMetadata("jvmFieldMemberPropertyDeclaration.kt") + public void testJvmFieldMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @Test + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @Test + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt index 5d728651c16..f289ae20f93 100644 --- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt +++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.psi2ir.Psi2IrConfiguration import org.jetbrains.kotlin.psi2ir.Psi2IrTranslator import org.jetbrains.kotlin.psi2ir.generators.DeclarationStubGeneratorImpl import org.jetbrains.kotlin.psi2ir.generators.generateTypicalIrProviderList +import org.jetbrains.kotlin.psi2ir.preprocessing.SourceDeclarationsPreprocessor import org.jetbrains.kotlin.resolve.CleanableBindingContext open class JvmIrCodegenFactory( @@ -115,6 +116,8 @@ open class JvmIrCodegenFactory( } } + SourceDeclarationsPreprocessor(psi2irContext).run(files) + for (extension in pluginExtensions) { psi2ir.addPostprocessingStep { module -> val old = stubGenerator.unboundSymbolGeneration diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt index ec81dd3a93c..5627a3e0b32 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt @@ -25,7 +25,6 @@ import org.jetbrains.kotlin.ir.linkage.IrDeserializer import org.jetbrains.kotlin.ir.linkage.IrProvider import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.util.SymbolTable -import org.jetbrains.kotlin.ir.util.TypeTranslator import org.jetbrains.kotlin.ir.util.noUnboundLeft import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext @@ -35,7 +34,9 @@ import org.jetbrains.kotlin.psi2ir.generators.TypeTranslatorImpl import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.utils.SmartList -typealias Psi2IrPostprocessingStep = (IrModuleFragment) -> Unit +fun interface Psi2IrPostprocessingStep { + fun invoke(irModuleFragment: IrModuleFragment) +} class Psi2IrTranslator( val languageVersionSettings: LanguageVersionSettings, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/preprocessing/SourceDeclarationsPreprocessor.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/preprocessing/SourceDeclarationsPreprocessor.kt new file mode 100644 index 00000000000..64a8e59dbb9 --- /dev/null +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/preprocessing/SourceDeclarationsPreprocessor.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2010-2021 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.kotlin.psi2ir.preprocessing + +import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.synthetics.findClassDescriptor +import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext +import org.jetbrains.kotlin.resolve.DescriptorUtils + +class SourceDeclarationsPreprocessor(private val context: GeneratorContext) { + + fun run(ktFiles: Collection) { + for (ktFile in ktFiles.toSet()) { + for (ktDeclaration in ktFile.declarations) { + processDeclaration(ktDeclaration) + } + } + } + + private fun processDeclaration(ktDeclaration: KtDeclaration) { + when (ktDeclaration) { + is KtClassOrObject -> + processClassOrObject(ktDeclaration) + } + } + + private fun processClassOrObject(ktClassOrObject: KtClassOrObject) { + val classDescriptor = ktClassOrObject.findClassDescriptor(context.bindingContext) + if (DescriptorUtils.isEnumEntry(classDescriptor)) return + context.symbolTable.referenceClass(classDescriptor) + ktClassOrObject.body?.let { ktClassBody -> + ktClassBody.declarations.forEach { processDeclaration(it) } + } + } +} diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt new file mode 100644 index 00000000000..32360a11632 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: 2.kt +abstract class A { + private val value = "OK" + fun f() = value +} + +abstract class B : A() + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +abstract class A { + private val value = "OK" + fun f() = value +} + +abstract class B : A() diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt new file mode 100644 index 00000000000..e70cf828984 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt @@ -0,0 +1,17 @@ +// MODULE: lib +// FILE: 2.kt +fun a() = "OK" +fun b() = a() + +// FILE: 3.kt +fun c() = b() + +// MODULE: main(lib) +// FILE: 1.kt +fun d() = c() + +fun box(): String = d() + +// FILE: 2.kt +fun a() = "OK" +fun b() = a() diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt new file mode 100644 index 00000000000..5c874d41038 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt @@ -0,0 +1,27 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// MODULE: lib +// FILE: 2.kt +abstract class A { + @JvmField val value: String = "OK" + fun f() = value +} + +abstract class B : A() + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +abstract class A { + @JvmField val value: String = "OK" + fun f() = value +} + +abstract class B : A() diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt new file mode 100644 index 00000000000..40d218d011c --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt @@ -0,0 +1,33 @@ +// MODULE: lib +// FILE: 2.kt +abstract class A { + protected lateinit var value: String + fun f() = value +} + +abstract class B : A() { + init { + value = "OK" + } +} + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +abstract class A { + protected lateinit var value: String + fun f() = value +} + +abstract class B : A() { + init { + value = "OK" + } +} diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt new file mode 100644 index 00000000000..79ab837eb03 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt @@ -0,0 +1,27 @@ +// MODULE: lib +// FILE: 2.kt +abstract class A { + protected val value = "OK" +} + +abstract class B : A() { + fun f() = value +} + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +abstract class A { + protected val value = "OK" +} + +abstract class B : A() { + fun f() = value +} diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt new file mode 100644 index 00000000000..7ddc9391e35 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt @@ -0,0 +1,25 @@ +// MODULE: lib +// FILE: 2.kt +abstract class A { + protected val value = "O" + fun f(k: String = "K") = value + k +} + +abstract class B : A() + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +abstract class A { + protected val value = "O" + fun f(k: String = "K") = value + k +} + +abstract class B : A() diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt new file mode 100644 index 00000000000..e9ed91496b4 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt @@ -0,0 +1,27 @@ +// MODULE: lib +// FILE: 2.kt +abstract class A { + protected val value = "OK" +} + +abstract class B : A() { + val ok get() = value +} + +// FILE: 3.kt +abstract class C : B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().ok + +// FILE: 2.kt +abstract class A { + protected val value = "OK" +} + +abstract class B : A() { + val ok get() = value +} diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt new file mode 100644 index 00000000000..c2d82d06b41 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt @@ -0,0 +1,30 @@ +// IGNORE_BACKEND: JS_IR +// MODULE: lib +// FILE: 2.kt +class Host { + abstract class B : A() + + abstract class A { + private val value = "OK" + fun f() = value + } +} + +// FILE: 3.kt +abstract class C : Host.B() + +// MODULE: main(lib) +// FILE: 1.kt +class D : C() + +fun box(): String = D().f() + +// FILE: 2.kt +class Host { + abstract class B : A() + + abstract class A { + private val value = "OK" + fun f() = value + } +} diff --git a/compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt new file mode 100644 index 00000000000..1c0f9bb2a59 --- /dev/null +++ b/compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND: JS_IR +// MODULE: lib +// FILE: 2.kt +val a get() = "OK" +val b get() = a + +// FILE: 3.kt +val c get() = b + +// MODULE: main(lib) +// FILE: 1.kt +val d get() = c + +fun box(): String = d + +// FILE: 2.kt +val a get() = "OK" +val b get() = a diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 34de1798b90..d7ac6dc1e02 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -37983,6 +37983,70 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + public class SameFileInSourceAndDependencies { + @Test + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @Test + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @Test + @TestMetadata("jvmFieldMemberPropertyDeclaration.kt") + public void testJvmFieldMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @Test + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @Test + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d557064f746..4754704f82e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -38001,6 +38001,70 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + public class SameFileInSourceAndDependencies { + @Test + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @Test + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @Test + @TestMetadata("jvmFieldMemberPropertyDeclaration.kt") + public void testJvmFieldMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @Test + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @Test + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @Test + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @Test + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index d0f1dec41fb..596662e8e12 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -30318,6 +30318,64 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SameFileInSourceAndDependencies extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @TestMetadata("jvmFieldMemberPropertyDeclaration.kt") + public void testJvmFieldMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/jvmFieldMemberPropertyDeclaration.kt"); + } + + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index bd615a3d73b..4a0d5f97df0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -25623,6 +25623,59 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SameFileInSourceAndDependencies extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index d6e3f056b9b..b73f72f9bc4 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -25044,6 +25044,59 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SameFileInSourceAndDependencies extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index d59274a0061..4682ba560e9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -25004,6 +25004,59 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SameFileInSourceAndDependencies extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 1222b7b9cde..ec57afc6388 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -13586,6 +13586,59 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/sameFileInSourceAndDependencies") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SameFileInSourceAndDependencies extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInSameFileInSourceAndDependencies() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sameFileInSourceAndDependencies"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("classDeclaration.kt") + public void testClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/classDeclaration.kt"); + } + + @TestMetadata("functionDeclaration.kt") + public void testFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/functionDeclaration.kt"); + } + + @TestMetadata("lateinitMemberPropertyDeclaration.kt") + public void testLateinitMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/lateinitMemberPropertyDeclaration.kt"); + } + + @TestMetadata("memberFunctionDeclaration.kt") + public void testMemberFunctionDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionDeclaration.kt"); + } + + @TestMetadata("memberFunctionWithDefaultArgumentsDeclaration.kt") + public void testMemberFunctionWithDefaultArgumentsDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberFunctionWithDefaultArgumentsDeclaration.kt"); + } + + @TestMetadata("memberPropertyDeclaration.kt") + public void testMemberPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/memberPropertyDeclaration.kt"); + } + + @TestMetadata("nestedClassDeclaration.kt") + public void testNestedClassDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/nestedClassDeclaration.kt"); + } + + @TestMetadata("propertyDeclaration.kt") + public void testPropertyDeclaration() throws Exception { + runTest("compiler/testData/codegen/box/sameFileInSourceAndDependencies/propertyDeclaration.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)