[FIR2IR] Set facade class for backing field properly #KT-42384 Fixed

This commit is contained in:
Mikhail Glukhikh
2020-10-01 16:25:42 +03:00
parent ad7ad98738
commit 76cdf97b6d
7 changed files with 115 additions and 1 deletions
@@ -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)
@@ -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)