[light classes] create enum references as PsiReferenceExpressions
Ensure that enum constants with special characters in their names are properly ignored
This commit is contained in:
+1
-1
@@ -200,7 +200,7 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
|
|||||||
private fun KtEnumEntryAnnotationValue.asPsiReferenceExpression(parent: PsiElement): SymbolPsiReference? {
|
private fun KtEnumEntryAnnotationValue.asPsiReferenceExpression(parent: PsiElement): SymbolPsiReference? {
|
||||||
val fqName = this.callableId?.asSingleFqName()?.asString() ?: return null
|
val fqName = this.callableId?.asSingleFqName()?.asString() ?: return null
|
||||||
val psiReference = parent.project.withElementFactorySafe {
|
val psiReference = parent.project.withElementFactorySafe {
|
||||||
createExpressionFromText(fqName, parent) as PsiReferenceExpression
|
createExpressionFromText(fqName, parent) as? PsiReferenceExpression
|
||||||
} ?: return null
|
} ?: return null
|
||||||
|
|
||||||
return SymbolPsiReference(sourcePsi, parent, psiReference)
|
return SymbolPsiReference(sourcePsi, parent, psiReference)
|
||||||
|
|||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
@p.Anno(value = ?)
|
||||||
|
public final class Foo /* p.Foo*/ {
|
||||||
|
public Foo();// .ctor()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// PSI: org.jetbrains.kotlin.light.classes.symbol.classes.SymbolLightClassForClassOrObject
|
||||||
|
// EXPECTED: p.Anno
|
||||||
|
package p
|
||||||
|
|
||||||
|
@Anno(E.`TA-DA`)
|
||||||
|
class Fo<caret>o {}
|
||||||
|
|
||||||
|
enum class E {`TA-DA`, `TA-TA` }
|
||||||
|
annotation class Anno(val value: E)
|
||||||
+6
@@ -30,6 +30,12 @@ public class SymbolLightClassesAnnotationEqualityForSourceTestGenerated extends
|
|||||||
runTest("analysis/symbol-light-classes/testData/annotationsEquality/Deprecated.kt");
|
runTest("analysis/symbol-light-classes/testData/annotationsEquality/Deprecated.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("EnumConstantNameInQuotes.kt")
|
||||||
|
public void testEnumConstantNameInQuotes() throws Exception {
|
||||||
|
runTest("analysis/symbol-light-classes/testData/annotationsEquality/EnumConstantNameInQuotes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("ExplicitRetension.kt")
|
@TestMetadata("ExplicitRetension.kt")
|
||||||
public void testExplicitRetension() throws Exception {
|
public void testExplicitRetension() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user