[KAPT] Bring back properties resolution in light analysis

Because kapt fails on evaluation constant expressions of SomeType::class
This commit is contained in:
Andrey Zinovyev
2021-04-14 07:50:22 +00:00
committed by Space
parent 9bbfe5a7a2
commit 8c464b4de5
3 changed files with 18 additions and 6 deletions
@@ -85,12 +85,7 @@ open class PartialAnalysisHandlerExtension : AnalysisHandlerExtension {
if (declaration is KtProperty) {
/* TODO Now we analyse body with anonymous object initializers. Check if we can't avoid it
* val a: Runnable = object : Runnable { ... } */
//resolve property in case it has delegate expression or explicit accessor, otherwise just infer type
if (declaration.delegateExpression != null || declaration.accessors.isNotEmpty()) {
bodyResolver.resolveProperty(topDownAnalysisContext, declaration, descriptor)
} else {
BodyResolver.computeDeferredType(descriptor.returnType)
}
bodyResolver.resolveProperty(topDownAnalysisContext, declaration, descriptor)
}
}
is FunctionDescriptor -> {
@@ -5,4 +5,7 @@ class Test {
val getter: String = "O"
get() = { field }() + "K"
val constJavaClassValue: Class<*> = String::class.java
val constClassValue: kotlin.reflect.KClass<*> = (String::class)
}
@@ -8,6 +8,10 @@ public final class Test {
private final java.lang.String inferType = null;
@org.jetbrains.annotations.NotNull()
private final java.lang.String getter = "O";
@org.jetbrains.annotations.NotNull()
private final java.lang.Class<?> constJavaClassValue = null;
@org.jetbrains.annotations.NotNull()
private final kotlin.reflect.KClass<?> constClassValue = null;
public Test() {
super();
@@ -27,4 +31,14 @@ public final class Test {
public final java.lang.String getGetter() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.Class<?> getConstJavaClassValue() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final kotlin.reflect.KClass<?> getConstClassValue() {
return null;
}
}