[LL] Add getOrBuildFir test for deserialized enum entry annotation argument

- The `getOrBuildFir` test clearly shows the difference between the
  unresolved enum entry and the resolved one (see the next commit).

^KT-63330
This commit is contained in:
Marco Pennekamp
2024-01-31 21:12:31 +01:00
committed by Space Team
parent acf828621a
commit a38d613dc3
5 changed files with 79 additions and 0 deletions
@@ -0,0 +1,25 @@
// KT-63330
// SKIP_WHEN_OUT_OF_CONTENT_ROOT
// MODULE: library1
// MODULE_KIND: LibraryBinary
// FILE: EnumClass.kt
enum class EnumClass {
First, Second
}
@Target(AnnotationTarget.TYPE)
annotation class Anno(val enumEntry: EnumClass)
// MODULE: library2(library1)
// MODULE_KIND: LibraryBinary
// FILE: Usage.kt
class Usage
val usage: @Anno(EnumClass.First) Usage = Usage()
// MODULE: main(library1, library2)
// FILE: main.kt
fun foo() {
<expr>val x = usage</expr>
}
@@ -0,0 +1,12 @@
KT element: KtProperty
FIR element: FirPropertyImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
[ResolvedTo(BODY_RESOLVE)] lval x: R|@R|Anno|(enumEntry = ) Usage| = R|/usage|
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] main.kt
public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| {
[ResolvedTo(BODY_RESOLVE)] lval x: R|@R|Anno|(enumEntry = ) Usage| = R|/usage|
}
@@ -610,6 +610,22 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized")
@TestDataPath("$PROJECT_ROOT")
public class Deserialized {
@Test
public void testAllFilesPresentInDeserialized() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
}
@Test
@TestMetadata("annotationWithEnumEntryArgument.kt")
public void testAnnotationWithEnumEntryArgument() throws Exception {
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized/annotationWithEnumEntryArgument.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/destructuring")
@TestDataPath("$PROJECT_ROOT")
@@ -412,6 +412,16 @@ public class ScriptGetOrBuildFirTestGenerated extends AbstractScriptGetOrBuildFi
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized")
@TestDataPath("$PROJECT_ROOT")
public class Deserialized {
@Test
public void testAllFilesPresentInDeserialized() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized"), Pattern.compile("^(.+)\\.(kts)$"), null, true);
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/destructuring")
@TestDataPath("$PROJECT_ROOT")
@@ -610,6 +610,22 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized")
@TestDataPath("$PROJECT_ROOT")
public class Deserialized {
@Test
public void testAllFilesPresentInDeserialized() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
}
@Test
@TestMetadata("annotationWithEnumEntryArgument.kt")
public void testAnnotationWithEnumEntryArgument() throws Exception {
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/deserialized/annotationWithEnumEntryArgument.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testData/getOrBuildFir/destructuring")
@TestDataPath("$PROJECT_ROOT")