[SLC] inherit SymbolPsiLiteral from PsiLiteralExpression

We should use PsiLiteralExpression instead of PsiLiteral as it
is used in the Java world. Effectively, `psiLiteral` property
already has this type (as `createPsiExpression` produce `PsiExpression`),
but we missed this part before and used just PsiLiteral for our
own class

^KT-63949 Fixed
This commit is contained in:
Dmitrii Gridin
2023-12-18 16:30:32 +01:00
committed by Space Team
parent e068333021
commit f39c72360d
2 changed files with 4 additions and 3 deletions
@@ -109,8 +109,9 @@ internal class SymbolPsiReference(
internal class SymbolPsiLiteral(
override val kotlinOrigin: KtElement?,
lightParent: PsiElement,
private val psiLiteral: PsiLiteral,
) : SymbolPsiAnnotationMemberValue(kotlinOrigin, lightParent), PsiLiteral {
private val psiLiteral: PsiLiteralExpression,
) : SymbolPsiAnnotationMemberValue(kotlinOrigin, lightParent), PsiLiteralExpression {
override fun getValue(): Any? = psiLiteral.value
override fun getText(): String = psiLiteral.text
override fun getType(): PsiType? = psiLiteral.type
}
@@ -210,7 +210,7 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
is KtConstantAnnotationValue -> {
constantValue.createPsiExpression(parent)?.let {
when (it) {
is PsiLiteral -> SymbolPsiLiteral(sourcePsi, parent, it)
is PsiLiteralExpression -> SymbolPsiLiteral(sourcePsi, parent, it)
else -> SymbolPsiExpression(sourcePsi, parent, it)
}
}