[FIR] Call enum entries in deserialized annotations as property access

KT-56177
This commit is contained in:
Kirill Rakhman
2023-02-23 10:23:20 +01:00
committed by Space Team
parent e1c0d2d9c2
commit 9268fd0e87
40 changed files with 86 additions and 89 deletions
@@ -57,7 +57,7 @@ internal class AnnotationsLoader(private val session: FirSession, private val ko
}
private fun ClassId.toEnumEntryReferenceExpression(name: Name): FirExpression {
return buildFunctionCall {
return buildPropertyAccessExpression {
val entryPropertySymbol =
session.symbolProvider.getClassDeclaredPropertySymbols(
this@toEnumEntryReferenceExpression, name,
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
import org.jetbrains.kotlin.fir.expressions.buildUnaryArgumentList
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.expressions.builder.*
import org.jetbrains.kotlin.fir.java.declarations.buildJavaValueParameter
import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference
@@ -134,8 +131,8 @@ private val JAVA_TARGETS_TO_KOTLIN = mapOf(
"TYPE_USE" to EnumSet.of(AnnotationTarget.TYPE)
)
private fun buildEnumCall(session: FirSession, classId: ClassId?, entryName: Name?): FirFunctionCall {
return buildFunctionCall {
private fun buildEnumCall(session: FirSession, classId: ClassId?, entryName: Name?): FirPropertyAccessExpression {
return buildPropertyAccessExpression {
val calleeReference = if (classId != null && entryName != null) {
session.symbolProvider.getClassDeclaredPropertySymbols(classId, entryName)
.firstOrNull()?.let { propertySymbol ->