KT-64080 [LL] Add on-air resolve tests for enum entry resolution

This commit is contained in:
Roman Golyshev
2023-12-06 13:09:07 +01:00
parent a03f0ef4ee
commit a475a3031e
8 changed files with 131 additions and 0 deletions
@@ -0,0 +1,37 @@
Tower Data Context:
Element 0
Scope: FirDefaultStarImportingScope
Element 1
Scope: FirExplicitStarImportingScope
Element 2
Scope: FirDefaultSimpleImportingScope
Element 3
Scope: FirDefaultSimpleImportingScope
Element 4
Scope: FirPackageMemberScope
Element 5
Scope: FirExplicitSimpleImportingScope
Element 6
Implicit receiver:
FirRegularClassSymbol public final companion object Companion : R|kotlin/Any|
Type: kotlin.Enum.Companion
Element 7
Scope: FirNestedClassifierScopeWithSubstitution
Classifiers:
FirRegularClassSymbol public final companion object Companion : R|kotlin/Any|
Static scope owner symbol: FirRegularClassSymbol public abstract class Enum<E : R|kotlin/Enum<E>|> : R|kotlin/Comparable<E>|, R|java/io/Serializable|
Element 8
Scope: FirNameAwareOnlyCallablesScope
Functions
FirNamedFunctionSymbol public final static fun valueOf(value: R|kotlin/String|): R|test/MyEnum|
FirNamedFunctionSymbol public final static fun values(): R|kotlin/Array<test/MyEnum>|
Properties:
FirEnumEntrySymbol public final static enum entry VARIANT: R|test/MyEnum| = LAZY_EXPRESSION
FirPropertySymbol public final static val entries: R|kotlin/enums/EnumEntries<test/MyEnum>|
public get(): R|kotlin/enums/EnumEntries<test/MyEnum>|
Element 9
Implicit receiver:
FirAnonymousObjectSymbol object : R|test/MyEnum|
Type: test.<anonymous>
Element 10
Scope: FirLocalScope
@@ -0,0 +1,7 @@
KT element: KtNamedFunction
FIR element: FirSimpleFunctionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
public final [ResolvedTo(BODY_RESOLVE)] fun test(): R|kotlin/Unit| {
}
@@ -0,0 +1,7 @@
package test
enum class MyEnum() {
VARIANT() {
fun te<caret>st() {}
}
}
@@ -0,0 +1,39 @@
Tower Data Context:
Element 0
Scope: FirDefaultStarImportingScope
Element 1
Scope: FirExplicitStarImportingScope
Element 2
Scope: FirDefaultSimpleImportingScope
Element 3
Scope: FirDefaultSimpleImportingScope
Element 4
Scope: FirPackageMemberScope
Element 5
Scope: FirExplicitSimpleImportingScope
Element 6
Implicit receiver:
FirRegularClassSymbol public final companion object Companion : R|kotlin/Any|
Type: kotlin.Enum.Companion
Element 7
Scope: FirNestedClassifierScopeWithSubstitution
Classifiers:
FirRegularClassSymbol public final companion object Companion : R|kotlin/Any|
Static scope owner symbol: FirRegularClassSymbol public abstract class Enum<E : R|kotlin/Enum<E>|> : R|kotlin/Comparable<E>|, R|java/io/Serializable|
Element 8
Scope: FirNameAwareOnlyCallablesScope
Functions
FirNamedFunctionSymbol public final static fun valueOf(value: R|kotlin/String|): R|test/MyEnum|
FirNamedFunctionSymbol public final static fun values(): R|kotlin/Array<test/MyEnum>|
Properties:
FirEnumEntrySymbol public final static enum entry VARIANT: R|test/MyEnum| = LAZY_EXPRESSION
FirPropertySymbol public final static val entries: R|kotlin/enums/EnumEntries<test/MyEnum>|
public get(): R|kotlin/enums/EnumEntries<test/MyEnum>|
Element 9
Implicit receiver:
FirAnonymousObjectSymbol object : R|test/MyEnum|
Type: test.<anonymous>
Element 10
Scope: FirLocalScope
Element 11
Scope: FirLocalScope
@@ -0,0 +1,6 @@
KT element: KtNameReferenceExpression
FIR element: FirPropertyAccessExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
R|test/property|
@@ -0,0 +1,11 @@
package test
val property: Int = 10
enum class MyEnum(val i: Int) {
VARIANT(property) {
fun test() {
proper<caret>ty
}
}
}
@@ -36,6 +36,18 @@ public class SourceDependentCopyContextTestGenerated extends AbstractSourceDepen
runTest("analysis/low-level-api-fir/testData/dependentCopy/classBody.kt");
}
@Test
@TestMetadata("enumBody.kt")
public void testEnumBody() throws Exception {
runTest("analysis/low-level-api-fir/testData/dependentCopy/enumBody.kt");
}
@Test
@TestMetadata("enumInitializer.kt")
public void testEnumInitializer() throws Exception {
runTest("analysis/low-level-api-fir/testData/dependentCopy/enumInitializer.kt");
}
@Test
@TestMetadata("function.kt")
public void testFunction() throws Exception {
@@ -36,6 +36,18 @@ public class SourceDependentCopyFirTestGenerated extends AbstractSourceDependent
runTest("analysis/low-level-api-fir/testData/dependentCopy/classBody.kt");
}
@Test
@TestMetadata("enumBody.kt")
public void testEnumBody() throws Exception {
runTest("analysis/low-level-api-fir/testData/dependentCopy/enumBody.kt");
}
@Test
@TestMetadata("enumInitializer.kt")
public void testEnumInitializer() throws Exception {
runTest("analysis/low-level-api-fir/testData/dependentCopy/enumInitializer.kt");
}
@Test
@TestMetadata("function.kt")
public void testFunction() throws Exception {