KT-45676: fix backing field annotation resolve

This commit is contained in:
Matthew Gharrity
2021-03-24 12:15:02 -04:00
committed by Petukhov Victor
parent 6a586fb731
commit 2cb9d1f287
3 changed files with 17 additions and 0 deletions
@@ -809,6 +809,11 @@ public class BodyResolver {
resolvePropertyAccessors(c, property, propertyDescriptor);
ForceResolveUtil.forceResolveAllContents(propertyDescriptor.getAnnotations());
FieldDescriptor backingField = propertyDescriptor.getBackingField();
if (backingField != null) {
ForceResolveUtil.forceResolveAllContents(backingField.getAnnotations());
}
}
private void resolvePropertyDeclarationBodies(@NotNull BodiesResolveContext c) {
+7
View File
@@ -0,0 +1,7 @@
// KT-45676: annotations on backing fields are missing their attribute values
@Target(AnnotationTarget.FIELD)
annotation class MyFieldAnnotation~MyFieldAnnotation(String)~(val value: String)
@`MyFieldAnnotation(String)`MyFieldAnnotation("SomeStringValue"`:kotlin::String`)
var myProperty = 0
@@ -428,6 +428,11 @@ public class ResolveTestGenerated extends AbstractResolveTest {
runTest("compiler/testData/resolve/regressions/kt300.resolve");
}
@TestMetadata("kt45676.resolve")
public void testKt45676() throws Exception {
runTest("compiler/testData/resolve/regressions/kt45676.resolve");
}
@TestMetadata("objectInsideFun.resolve")
public void testObjectInsideFun() throws Exception {
runTest("compiler/testData/resolve/regressions/objectInsideFun.resolve");