[LL] ensure FirConstExpression's annotations are not lost (KTIJ-23968)
This commit is contained in:
+6
@@ -58,6 +58,12 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationInsideFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnCallSite.kt")
|
||||
public void testAnnotationOnCallSite() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationInsideFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnCallSite.kt")
|
||||
public void testAnnotationOnCallSite() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationInsideFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnCallSite.kt")
|
||||
public void testAnnotationOnCallSite() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationInsideFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnCallSite.kt")
|
||||
public void testAnnotationOnCallSite() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationInsideFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnCallSite.kt")
|
||||
public void testAnnotationOnCallSite() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fun x() {
|
||||
val y = @Sup<caret>press("") ""
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.Suppress) constructor(vararg names: kotlin.String)
|
||||
+3
@@ -69,6 +69,9 @@ internal open class FirElementsRecorder : FirVisitor<Unit, MutableMap<KtElement,
|
||||
|
||||
override fun <T> visitConstExpression(constExpression: FirConstExpression<T>, data: MutableMap<KtElement, FirElement>) {
|
||||
cacheElement(constExpression, data)
|
||||
constExpression.annotations.forEach {
|
||||
it.accept(this, data)
|
||||
}
|
||||
// KtPrefixExpression(-, KtConstExpression(n)) is represented as FirConstExpression(-n) with converted constant value.
|
||||
// If one queries FIR for KtConstExpression, we still return FirConstExpression(-n) even though its source is KtPrefixExpression.
|
||||
// Here, we cache FirConstExpression(n) for KtConstExpression(n) to make everything natural and intuitive!
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
|
||||
fun x() {
|
||||
val y = <expr>@Suppress("")</expr> ""
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KT element: KtAnnotationEntry
|
||||
FIR element: FirAnnotationCallImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|kotlin/Suppress|(names = vararg(String()))
|
||||
+6
@@ -63,6 +63,12 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationWithArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationApplicationWithArgumentsOnCallSite.kt")
|
||||
public void testAnnotationApplicationWithArgumentsOnCallSite() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationWithArgumentsOnCallSite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fileAnnotation.kt")
|
||||
public void testFileAnnotation() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user