Fix access to top level delegated property from another property
#KT-5612 Fixed
This commit is contained in:
@@ -55,6 +55,8 @@ public class PackagePartCodegen extends MemberCodegen<JetFile> {
|
||||
ArrayUtil.EMPTY_STRING_ARRAY
|
||||
);
|
||||
v.visitSource(element.getName(), null);
|
||||
|
||||
generatePropertyMetadataArrayFieldIfNeeded(packagePartType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,11 +77,6 @@ public class PackagePartCodegen extends MemberCodegen<JetFile> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateSyntheticParts() {
|
||||
generatePropertyMetadataArrayFieldIfNeeded(packagePartType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateKotlinAnnotation() {
|
||||
writeKotlinSyntheticClassAnnotation(v, KotlinSyntheticClass.Kind.PACKAGE_PART);
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// KT-5612
|
||||
|
||||
class Delegate {
|
||||
public fun get(thisRef: Any?, prop: PropertyMetadata): String {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
val prop by Delegate()
|
||||
|
||||
val a = prop
|
||||
|
||||
fun box() = a
|
||||
@@ -1887,6 +1887,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/delegatedProperty")
|
||||
public static class DelegatedProperty extends AbstractBlackBoxCodegenTest {
|
||||
@TestMetadata("accessTopLevelDelegatedPropertyInClinit.kt")
|
||||
public void testAccessTopLevelDelegatedPropertyInClinit() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDelegatedProperty() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/delegatedProperty"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user