[LL API] Add some more 'ContextCollector' tests
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
enum class Direction {
|
||||
NORTH {
|
||||
override val code: Int
|
||||
get() = 1
|
||||
},
|
||||
|
||||
EAST {
|
||||
override val code: Int
|
||||
get() = <expr>2</expr>
|
||||
},
|
||||
|
||||
SOUTH {
|
||||
override val code: Int
|
||||
get() = 3
|
||||
},
|
||||
|
||||
WEST {
|
||||
override val code: Int
|
||||
get() = 4
|
||||
};
|
||||
|
||||
abstract val code: Int
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
Tower Data Context:
|
||||
Element 0
|
||||
Scope: FirDefaultStarImportingScope
|
||||
Element 1
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 2
|
||||
Scope: FirExplicitStarImportingScope
|
||||
Element 3
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 4
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 5
|
||||
Scope: FirPackageMemberScope
|
||||
Element 6
|
||||
Scope: FirExplicitSimpleImportingScope
|
||||
Element 7
|
||||
Implicit receiver:
|
||||
FirRegularClassSymbol public final companion object Companion : R|kotlin/Any|
|
||||
Type: kotlin/Enum.Companion
|
||||
Element 8
|
||||
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 9
|
||||
Scope: FirNameAwareOnlyCallablesScope
|
||||
Functions
|
||||
FirNamedFunctionSymbol public final static fun valueOf(value: R|kotlin/String|): R|Direction|
|
||||
FirNamedFunctionSymbol public final static fun values(): R|kotlin/Array<Direction>|
|
||||
Properties:
|
||||
FirEnumEntrySymbol public final static enum entry EAST: R|Direction| = object : R|Direction|
|
||||
FirEnumEntrySymbol public final static enum entry NORTH: R|Direction| = LAZY_EXPRESSION
|
||||
FirEnumEntrySymbol public final static enum entry SOUTH: R|Direction| = LAZY_EXPRESSION
|
||||
FirEnumEntrySymbol public final static enum entry WEST: R|Direction| = LAZY_EXPRESSION
|
||||
FirPropertySymbol public final static val entries: R|kotlin/enums/EnumEntries<Direction>|
|
||||
public get(): R|kotlin/enums/EnumEntries<Direction>|
|
||||
Element 10
|
||||
Implicit receiver:
|
||||
FirAnonymousObjectSymbol object : R|Direction|
|
||||
Type: <anonymous>
|
||||
Element 11
|
||||
Scope: FirLocalScope
|
||||
Properties:
|
||||
FirBackingFieldSymbol private <explicit backing field>: R|kotlin/Int|
|
||||
Element 12
|
||||
Scope: FirLocalScope
|
||||
|
||||
FILE: [ResolvedTo(IMPORTS)] enumValue.kt
|
||||
public final [ResolvedTo(STATUS)] enum class Direction : R|kotlin/Enum<Direction>| {
|
||||
private [ResolvedTo(STATUS)] constructor(): R|Direction| {
|
||||
LAZY_super<R|kotlin/Enum<Direction>|>
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] enum entry NORTH: R|Direction| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(BODY_RESOLVE)] enum entry EAST: R|Direction| = object : R|Direction| {
|
||||
private [ResolvedTo(BODY_RESOLVE)] constructor(): R|<anonymous>| {
|
||||
super<R|Direction|>()
|
||||
}
|
||||
|
||||
public open override [ResolvedTo(BODY_RESOLVE)] val code: R|kotlin/Int|
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| {
|
||||
^ Int(2)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] enum entry SOUTH: R|Direction| = LAZY_EXPRESSION
|
||||
public final static [ResolvedTo(STATUS)] enum entry WEST: R|Direction| = LAZY_EXPRESSION
|
||||
public abstract [ResolvedTo(STATUS)] val code: R|kotlin/Int|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/Int|
|
||||
|
||||
public final static [ResolvedTo(STATUS)] fun values(): R|kotlin/Array<Direction>| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|Direction| {
|
||||
}
|
||||
|
||||
public final static [ResolvedTo(STATUS)] val entries: R|kotlin/enums/EnumEntries<Direction>|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries<Direction>|
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package <expr>test</expr>
|
||||
|
||||
import java.util.List
|
||||
|
||||
fun test() = List::class
|
||||
|
||||
fun other(): Int {
|
||||
return "foo".length
|
||||
}
|
||||
|
||||
class Foo {
|
||||
fun foo() {
|
||||
require(other() == 3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
Tower Data Context:
|
||||
Element 0
|
||||
Scope: FirDefaultStarImportingScope
|
||||
Element 1
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 2
|
||||
Scope: FirExplicitStarImportingScope
|
||||
Element 3
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 4
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 5
|
||||
Scope: FirPackageMemberScope
|
||||
Element 6
|
||||
Scope: FirExplicitSimpleImportingScope
|
||||
Import name:List
|
||||
Qualified name: java.util.List
|
||||
Is all under: false
|
||||
|
||||
FILE: [ResolvedTo(IMPORTS)] file.kt
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun test(): R|kotlin/reflect/KClass<java/util/List<*>>| {
|
||||
^test <getClass>(Q|java/util/List|)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun other(): R|kotlin/Int| {
|
||||
^other String(foo).R|kotlin/String.length|
|
||||
}
|
||||
public final [ResolvedTo(STATUS)] class Foo : R|kotlin/Any| {
|
||||
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|test/Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| {
|
||||
<Unresolved name: require>#(==(R|test/other|(), Int(3)))
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo(
|
||||
val a: String = "foo"
|
||||
val b: Int = <expr>a.length</expr>,
|
||||
val c: Long = (a.length - 1).toLong()
|
||||
)
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
Tower Data Context:
|
||||
Element 0
|
||||
Scope: FirDefaultStarImportingScope
|
||||
Element 1
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 2
|
||||
Scope: FirExplicitStarImportingScope
|
||||
Element 3
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 4
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 5
|
||||
Scope: FirPackageMemberScope
|
||||
Element 6
|
||||
Scope: FirExplicitSimpleImportingScope
|
||||
Element 7
|
||||
Implicit receiver:
|
||||
FirRegularClassSymbol public final class Foo : R|kotlin/Any|
|
||||
Type: Foo
|
||||
|
||||
FILE: [ResolvedTo(IMPORTS)] primaryConstructorParameter.kt
|
||||
public final [ResolvedTo(STATUS)] class Foo : R|kotlin/Any| {
|
||||
public [ResolvedTo(STATUS)] constructor([ResolvedTo(STATUS)] a: R|kotlin/String| = LAZY_EXPRESSION, [ResolvedTo(STATUS)] b: R|kotlin/Int| = LAZY_EXPRESSION, [ResolvedTo(STATUS)] c: R|kotlin/Long| = LAZY_EXPRESSION): R|Foo| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] val a: R|kotlin/String| = R|<local>/a|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/String|
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] val b: R|kotlin/Int| = R|<local>/b|
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(STATUS)] val c: R|kotlin/Long| = R|<local>/c|
|
||||
public [ResolvedTo(STATUS)] get(): R|kotlin/Long|
|
||||
|
||||
}
|
||||
+18
@@ -36,6 +36,12 @@ public class ContextCollectorTestGenerated extends AbstractContextCollectorTest
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/contextReceiversClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumValue.kt")
|
||||
public void testEnumValue() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/enumValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
@@ -48,6 +54,12 @@ public class ContextCollectorTestGenerated extends AbstractContextCollectorTest
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/extensionLambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("file.kt")
|
||||
public void testFile() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/file.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClasses.kt")
|
||||
public void testInnerClasses() throws Exception {
|
||||
@@ -66,6 +78,12 @@ public class ContextCollectorTestGenerated extends AbstractContextCollectorTest
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorParameter.kt")
|
||||
public void testPrimaryConstructorParameter() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/primaryConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user