FIR IDE: more comprehensive abstractions of annotation values

This commit is contained in:
Jinseong Jeon
2021-09-16 12:04:28 -07:00
committed by Ilya Kirillov
parent fe41c4513f
commit 6ef2dad895
36 changed files with 316 additions and 52 deletions
@@ -0,0 +1,6 @@
annotation class Annotation(vararg val strings: String)
annotation class AnnotationInner(val value: Annotation)
@AnnotationInner(<expr>Annotation(strings = arrayOf("v1", "v2"))</expr>)
class C
@@ -0,0 +1,6 @@
expression: Annotation(strings = arrayOf("v1", "v2"))
constant_value: KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v1)
KtSimpleConstantValue(constantValueKind=String, value=v2)
]))
constant: null
@@ -0,0 +1,6 @@
annotation class Annotation(vararg val strings: String)
annotation class AnnotationInner(val value: Annotation)
@AnnotationInner(<expr>Annotation(["v1", "v2"])</expr>)
class C
@@ -0,0 +1,6 @@
expression: Annotation(["v1", "v2"])
constant_value: KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v1)
KtSimpleConstantValue(constantValueKind=String, value=v2)
]))
constant: null
@@ -0,0 +1,6 @@
annotation class Annotation(vararg val strings: String)
annotation class AnnotationArray(vararg val annos: Annotation)
@AnnotationArray(<expr>annos = arrayOf(Annotation("v1", "v2"), Annotation(strings = arrayOf("v3", "v4")))</expr>)
class C
@@ -0,0 +1,12 @@
expression: arrayOf(Annotation("v1", "v2"), Annotation(strings = arrayOf("v3", "v4")))
constant_value: KtArrayConstantValue [
KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v1)
KtSimpleConstantValue(constantValueKind=String, value=v2)
]))
KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v3)
KtSimpleConstantValue(constantValueKind=String, value=v4)
]))
]
constant: null
@@ -0,0 +1,6 @@
annotation class Annotation(vararg val strings: String)
annotation class AnnotationArray(vararg val annos: Annotation)
@AnnotationArray(<expr>[Annotation("v1", "v2"), Annotation(["v3", "v4"])]</expr>)
class C
@@ -0,0 +1,12 @@
expression: [Annotation("v1", "v2"), Annotation(["v3", "v4"])]
constant_value: KtArrayConstantValue [
KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v1)
KtSimpleConstantValue(constantValueKind=String, value=v2)
]))
KtAnnotationConstantValue(Annotation, (strings = KtArrayConstantValue [
KtSimpleConstantValue(constantValueKind=String, value=v3)
KtSimpleConstantValue(constantValueKind=String, value=v4)
]))
]
constant: null
@@ -0,0 +1,10 @@
enum class Color {
R,
G,
B
}
annotation class Annotation(val color : Color)
@Annotation(<expr>Color.R</expr>)
class C
@@ -0,0 +1,3 @@
expression: Color.R
constant_value: KtEnumEntryValue(/Color.R)
constant: null
@@ -0,0 +1,4 @@
annotation class Annotation(vararg val values: String)
@Annotation(<expr>"42"</expr>)
class C
@@ -0,0 +1,3 @@
expression: "42"
constant_value: KtSimpleConstantValue(constantValueKind=String, value=42)
constant: 42