[KAPT] Correct type for property with accessor

^KT-39060 Fixed
This commit is contained in:
Andrey Zinovyev
2021-02-08 10:11:50 +03:00
committed by GitHub
parent dcb47d9934
commit c75d2c05f0
3 changed files with 10 additions and 3 deletions
@@ -1023,10 +1023,10 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
val returnType = getNonErrorType(
descriptor.returnType, RETURN_TYPE,
ktTypeProvider = {
val element = kaptContext.origins[method]?.element
when (element) {
when (val element = kaptContext.origins[method]?.element) {
is KtFunction -> element.typeReference
is KtProperty -> if (descriptor is PropertyGetterDescriptor) element.typeReference else null
is KtPropertyAccessor -> if (descriptor is PropertyGetterDescriptor) element.property.typeReference else null
is KtParameter -> if (descriptor is PropertyGetterDescriptor) element.typeReference else null
else -> null
}
@@ -8,7 +8,9 @@ object NonExistentType {
val b: List<ABCDEF>? = null
val c: (ABCDEF) -> Unit = { f -> }
val d: ABCDEF<String, (List<ABCDEF>) -> Unit>? = null
val foo: Foo get() = Foo()
fun a(a: ABCDEF, s: String): ABCDEF {}
fun b(s: String): ABCDEF {}
}
}
@@ -38,6 +38,11 @@ public final class NonExistentType {
return null;
}
@org.jetbrains.annotations.NotNull()
public final Foo getFoo() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final ABCDEF a(@org.jetbrains.annotations.NotNull()
ABCDEF a, @org.jetbrains.annotations.NotNull()