Analysis API: fix invalid psi elements for constants and annotation values

This commit is contained in:
Ilya Kirillov
2021-12-02 15:36:29 +01:00
parent dc9c2aa39d
commit 7440c726d0
5 changed files with 15 additions and 9 deletions
@@ -29,7 +29,7 @@ public data class KtAnnotationApplication(
*
* Present only for declarations from sources. For declarations from other places (libraries, stdlib) it's `null`
*/
public val psi: KtAnnotationEntry?,
public val psi: KtCallElement?,
/**
* [AnnotationUseSiteTarget] to which annotation was applied. May be not-null only for annotation applications for declarations.
@@ -26,15 +26,17 @@ import org.jetbrains.kotlin.psi.KtElement
* [KtAnnotationApplicationValue] represents annotation types (with annotation fq name and arguments); and
* [KtArrayAnnotationValue] abstracts an array of [KtAnnotationValue]s.
*/
public sealed class KtAnnotationValue(
public open val sourcePsi: KtElement? = null
)
public sealed class KtAnnotationValue {
public abstract val sourcePsi: KtElement?
}
/**
* This represents an unsupported expression used as an annotation value.
*/
public object KtUnsupportedAnnotationValue : KtAnnotationValue()
public object KtUnsupportedAnnotationValue : KtAnnotationValue() {
override val sourcePsi: KtElement? get() = null
}
/**
* Array of annotation values. E.g: `@A([1, 2])`
@@ -116,7 +118,9 @@ public class KtEnumEntryAnnotationValue(
*/
public class KtConstantAnnotationValue(
public val constantValue: KtConstantValue,
) : KtAnnotationValue()
) : KtAnnotationValue() {
override val sourcePsi: KtElement? get() = constantValue.sourcePsi
}
/**