[FIR2IR] Set facade class for backing field properly #KT-42384 Fixed
This commit is contained in:
@@ -316,7 +316,11 @@ class Fir2IrConverter(
|
||||
val stubGenerator = irProviders.filterIsInstance<DeclarationStubGenerator>().first()
|
||||
for (descriptor in symbolTable.wrappedTopLevelCallableDescriptors()) {
|
||||
val parentClass = stubGenerator.generateOrGetFacadeClass(descriptor as WrappedDeclarationDescriptor<*>)
|
||||
descriptor.owner.parent = parentClass ?: continue
|
||||
val owner = descriptor.owner
|
||||
owner.parent = parentClass ?: continue
|
||||
if (owner is IrProperty) {
|
||||
owner.backingField?.parent = parentClass
|
||||
}
|
||||
}
|
||||
|
||||
evaluateConstants(irModuleFragment)
|
||||
|
||||
+18
@@ -383,6 +383,24 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/fir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Fir extends AbstractFirCompileKotlinAgainstKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFir() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("LibraryProperty.kt")
|
||||
public void testLibraryProperty() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// FILE: A.kt
|
||||
// WITH_RUNTIME
|
||||
|
||||
package first.second
|
||||
|
||||
class FqName(val s: String)
|
||||
|
||||
@JvmField
|
||||
val VOLATILE_ANNOTATION_FQ_NAME = FqName("volatile")
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import first.second.VOLATILE_ANNOTATION_FQ_NAME
|
||||
import first.second.FqName
|
||||
|
||||
fun foo() = hasAnnotation(VOLATILE_ANNOTATION_FQ_NAME)
|
||||
|
||||
fun hasAnnotation(name: FqName): Boolean = true
|
||||
|
||||
fun box() = if (foo()) "OK" else "FAIL"
|
||||
+18
@@ -388,6 +388,24 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/fir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Fir extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFir() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("LibraryProperty.kt")
|
||||
public void testLibraryProperty() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+18
@@ -383,6 +383,24 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/fir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Fir extends AbstractIrCompileKotlinAgainstKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFir() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("LibraryProperty.kt")
|
||||
public void testLibraryProperty() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -383,6 +383,24 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/fir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Fir extends AbstractJvmIrAgainstOldBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFir() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true);
|
||||
}
|
||||
|
||||
@TestMetadata("LibraryProperty.kt")
|
||||
public void testLibraryProperty() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -383,6 +383,24 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/useDeserializedFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/fir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Fir extends AbstractJvmOldAgainstIrBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFir() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("LibraryProperty.kt")
|
||||
public void testLibraryProperty() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstKotlin/jvm8")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user