FIR IDE: move low level api testdata sources to the analysis directory

This commit is contained in:
Ilya Kirillov
2021-09-14 16:39:48 +02:00
parent 633b0fa612
commit 989f3248e4
371 changed files with 0 additions and 0 deletions
@@ -0,0 +1,3 @@
fun foo(f: Float.(Int, String) -> Boolean) {
}
@@ -0,0 +1,11 @@
class A {
val a = run {
class X()
val y = 10
}
}
inline fun <R> run(block: () -> R): R {
return block()
}
@@ -0,0 +1,13 @@
enum class A {
X,
Y,
Z
;
fun foo(){}
val x = 10
fun bar() = 10
}
@@ -0,0 +1,13 @@
enum class A {
X {
fun localInX() = 1
},
Y {
override fun foo() {}
},
Z,
;
open fun foo() {}
}
@@ -0,0 +1,3 @@
class A(val x: Int = 10, val b: String) {
}
@@ -0,0 +1,6 @@
class A {
init {
val x = 10
class B
}
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
val x = run {
val inLambda = 10
println(inLambda)
inLambda
}
@@ -0,0 +1,32 @@
class Outer {
val i: Int = 1
get() {
class Inner {
var i: Int = 2
get() {
field++
return field
}
val j: Int = 3
get() {
field = 42
return field
}
fun innerMember() {
field++
}
}
return field
}
val j: Int = 4
get() {
fun local() {
field++
field++
}
local()
return field
}
}
@@ -0,0 +1,3 @@
fun foo() {
fun local() = 0
}
@@ -0,0 +1,5 @@
fun foo() {
fun local() {
println("local")
}
}
@@ -0,0 +1,7 @@
class A {
fun foo1() = 10
fun foo2() {
}
}
@@ -0,0 +1,7 @@
class A {
fun foo1() = 10
fun foo2() {
}
}
@@ -0,0 +1,3 @@
class A {
typealias X = Int
}
@@ -0,0 +1,15 @@
class A {
}
class B {
}
class C {
}
class D {
}
@@ -0,0 +1,7 @@
fun foo1() = 1
fun foo2() = 2
fun foo3() = 3
fun foo4() = 4
@@ -0,0 +1,15 @@
fun foo1() {
println("foo1")
}
fun foo2() {
println("foo2")
}
fun foo3() {
println("foo3")
}
fun foo4() {
println("foo4")
}
@@ -0,0 +1,11 @@
class A {
class B {
}
object C {
class D {
}
}
}
@@ -0,0 +1,7 @@
class A {
fun y() {}
class B {
fun x() {}
}
}
@@ -0,0 +1,15 @@
var x: Int = 10
get() = field
set(value) {
println(1)
field = value
}
class X {
var y: Int = 10
get() = field
set(value) {
println(2)
field = value
}
}
@@ -0,0 +1,5 @@
var withGetterAndSetter: Int = 42
get() = field
set(value) {
field = value
}
@@ -0,0 +1,3 @@
class A(val x: Int = 10, val b: String) {
constructor(i: Int) : this(x = 1, b = i.toString())
}
@@ -0,0 +1 @@
typealias A = 10
@@ -0,0 +1,6 @@
class A {/* NonReanalyzableDeclarationStructureElement */
fun x() {/* ReanalyzableFunctionStructureElement */
}
fun y(): Int = 10/* ReanalyzableFunctionStructureElement */
}
@@ -0,0 +1,11 @@
class X {/* NonReanalyzableDeclarationStructureElement */
var x: Int/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
val y = 42/* NonReanalyzableDeclarationStructureElement */
var z: Int = 15/* ReanalyzablePropertyStructureElement */
}
@@ -0,0 +1,11 @@
class A {/* NonReanalyzableDeclarationStructureElement */
val a = run {
class X()
val y = 10
}/* NonReanalyzableDeclarationStructureElement */
}
inline fun <R> run(block: () -> R): R {/* ReanalyzableFunctionStructureElement */
return block()
}
@@ -0,0 +1,13 @@
enum class A {/* NonReanalyzableDeclarationStructureElement */
X,
Y,
Z
;
fun foo(){/* ReanalyzableFunctionStructureElement */}
val x = 10/* NonReanalyzableDeclarationStructureElement */
fun bar() = 10/* NonReanalyzableDeclarationStructureElement */
}
@@ -0,0 +1,13 @@
enum class A {/* NonReanalyzableDeclarationStructureElement */
X {
fun localInX() = 1
},
Y {
override fun foo() {}
},
Z,
;
open fun foo() {/* ReanalyzableFunctionStructureElement */}
}
@@ -0,0 +1,6 @@
class A {/* NonReanalyzableDeclarationStructureElement */
init {
val x = 10
class B
}
}
@@ -0,0 +1,9 @@
fun a() {/* ReanalyzableFunctionStructureElement */
class X
}
class Y {/* NonReanalyzableDeclarationStructureElement */
fun b() {/* ReanalyzableFunctionStructureElement */
class Z
}
}
@@ -0,0 +1,13 @@
fun x() {/* ReanalyzableFunctionStructureElement */
fun y() {
}
}
class A {/* NonReanalyzableDeclarationStructureElement */
fun z() {/* ReanalyzableFunctionStructureElement */
fun q() {
}
}
}
@@ -0,0 +1,15 @@
fun foo() {/* ReanalyzableFunctionStructureElement */
var x: Int
}
class A {/* NonReanalyzableDeclarationStructureElement */
fun q() {/* ReanalyzableFunctionStructureElement */
val y = 42
}
}
class B {/* NonReanalyzableDeclarationStructureElement */
class C {/* NonReanalyzableDeclarationStructureElement */
fun u() {/* ReanalyzableFunctionStructureElement */
var z: Int = 15
}
}
}
@@ -0,0 +1,3 @@
class A {/* NonReanalyzableDeclarationStructureElement */
typealias X = Int/* NonReanalyzableDeclarationStructureElement */
}
@@ -0,0 +1,16 @@
class A {/* NonReanalyzableDeclarationStructureElement */
class B {/* NonReanalyzableDeclarationStructureElement */
fun x() {/* ReanalyzableFunctionStructureElement */
}
class C {/* NonReanalyzableDeclarationStructureElement */
}
}
class E {/* NonReanalyzableDeclarationStructureElement */
}
fun y(): Int = 10/* ReanalyzableFunctionStructureElement */
}
@@ -0,0 +1,13 @@
var x: Int = 10/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
class X {/* NonReanalyzableDeclarationStructureElement */
var y: Int = 10/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
}
@@ -0,0 +1 @@
fun foo(): Int = 42/* ReanalyzableFunctionStructureElement */
@@ -0,0 +1 @@
fun foo() = 42/* NonReanalyzableDeclarationStructureElement */
@@ -0,0 +1,4 @@
fun foo(): Int {/* ReanalyzableFunctionStructureElement */
println("")
return 10
}
@@ -0,0 +1,9 @@
var x: Int/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
val y = 42/* NonReanalyzableDeclarationStructureElement */
var z: Int = 15/* ReanalyzablePropertyStructureElement */
@@ -0,0 +1,4 @@
fun foo() {/* ReanalyzableFunctionStructureElement */
println("")
}
@@ -0,0 +1 @@
typealias A = 10/* NonReanalyzableDeclarationStructureElement */
@@ -0,0 +1,6 @@
public annotation class Annotation(val name: String)
@Annotation(<expr>"y"</expr>)
fun x() {
}
@@ -0,0 +1,5 @@
KT element: KtValueArgument
FIR element: FirConstExpressionImpl
FIR element rendered:
String(y)
@@ -0,0 +1,8 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtValueArgumentList
public annotation class Annotation(val name: String)
@Annotation<expr>("y")</expr>
fun x() {
}
@@ -0,0 +1,5 @@
KT element: KtValueArgumentList
FIR element: FirResolvedArgumentListImpl
FIR element rendered:
String(y)
@@ -0,0 +1,5 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtConstructorCalleeExpression
@<expr>Suppress</expr>("")
fun x() {
}
@@ -0,0 +1,5 @@
KT element: KtConstructorCalleeExpression
FIR element: FirAnnotationCallImpl
FIR element rendered:
@R|kotlin/Suppress|(names = vararg(String()))
@@ -0,0 +1,4 @@
@Suppress("1", <expr>"2"</expr>)
fun x() {
}
@@ -0,0 +1,5 @@
KT element: KtValueArgument
FIR element: FirConstExpressionImpl
FIR element rendered:
String(2)
@@ -0,0 +1,5 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
<expr>@Suppress("")</expr>
fun x() {
}
@@ -0,0 +1,5 @@
KT element: KtAnnotationEntry
FIR element: FirAnnotationCallImpl
FIR element rendered:
@R|kotlin/Suppress|(names = vararg(String()))
@@ -0,0 +1,4 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
// WITH_STDLIB
<expr>@file:Suppress("")</expr>
@@ -0,0 +1,5 @@
KT element: KtAnnotationEntry
FIR element: FirAnnotationCallImpl
FIR element rendered:
@FILE:R|kotlin/Suppress|(names = vararg(String()))
@@ -0,0 +1,5 @@
fun y(a: Int){}
fun x() {
y(<expr>1</expr>)
}
@@ -0,0 +1,5 @@
KT element: KtValueArgument
FIR element: FirConstExpressionImpl
FIR element rendered:
Int(1)
@@ -0,0 +1,5 @@
fun y<T>(){}
fun x() {
y< <expr>Int</expr> >()
}
@@ -0,0 +1,5 @@
KT element: KtTypeProjection
FIR element: FirTypeProjectionWithVarianceImpl
FIR element rendered:
R|kotlin/Int|
@@ -0,0 +1,4 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtSuperTypeCallEntry
open class B(x: Int)
class A : <expr>B(1)</expr>
@@ -0,0 +1,5 @@
KT element: KtSuperTypeCallEntry
FIR element: FirDelegatedConstructorCallImpl
FIR element rendered:
super<R|B|>(Int(1))
@@ -0,0 +1,3 @@
class A(x: Int) {
constructor(y: String) : <expr>this(1)</expr>
}
@@ -0,0 +1,5 @@
KT element: KtConstructorDelegationCall
FIR element: FirDelegatedConstructorCallImpl
FIR element rendered:
this<R|A|>(Int(1))
@@ -0,0 +1,9 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtValueArgumentList
fun callMe(x: Int, y: String) {
}
fun foo() {
callMe<expr>(1, "2")</expr>
}
@@ -0,0 +1,5 @@
KT element: KtValueArgumentList
FIR element: FirResolvedArgumentListImpl
FIR element rendered:
Int(1)String(2)
@@ -0,0 +1,5 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtValueArgumentList
fun foo(f: (Int, String) -> Unit) {
f<expr>(1, "2")</expr>
}
@@ -0,0 +1,5 @@
KT element: KtValueArgumentList
FIR element: FirResolvedArgumentListImpl
FIR element rendered:
Int(1)String(2)
@@ -0,0 +1,7 @@
object A {
fun y(a: Int){}
}
fun x() {
A.<expr>y(1)</expr>
}
@@ -0,0 +1,5 @@
KT element: KtCallExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Q|A|.R|/A.y|(Int(1))
@@ -0,0 +1,7 @@
object A {
fun y(a: Int){}
}
fun x() {
<expr>A.y(1)</expr>
}
@@ -0,0 +1,5 @@
KT element: KtDotQualifiedExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Q|A|.R|/A.y|(Int(1))
@@ -0,0 +1,2 @@
// WITH_STDLIB
val x <expr>by lazy {1}</expr>
@@ -0,0 +1,8 @@
KT element: KtPropertyDelegate
FIR element: FirFunctionCallImpl
FIR element rendered:
R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=NoInline> {
^ Int(1)
}
)
@@ -0,0 +1,2 @@
// WITH_STDLIB
val x by <expr>lazy {1}</expr>
@@ -0,0 +1,8 @@
KT element: KtCallExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=NoInline> {
^ Int(1)
}
)
@@ -0,0 +1,4 @@
// WITH_STDLIB
fun foo(x: List<Int>) {
val a= <expr>x[1]</expr>
}
@@ -0,0 +1,5 @@
KT element: KtArrayAccessExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
R|<local>/x|.R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/Int|>|(Int(1))
@@ -0,0 +1,3 @@
fun foo(x: Any): String {
return <expr>x as String</expr>
}
@@ -0,0 +1,5 @@
KT element: KtBinaryExpressionWithTypeRHS
FIR element: FirTypeOperatorCallImpl
FIR element rendered:
(R|<local>/x| as R|kotlin/String|)
@@ -0,0 +1 @@
val x = <expr>1 + 1</expr>
@@ -0,0 +1,5 @@
KT element: KtBinaryExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Int(1).R|kotlin/Int.plus|(Int(1))
@@ -0,0 +1 @@
val x = 1 <expr>+</expr> 1
@@ -0,0 +1,5 @@
KT element: KtOperationReferenceExpression
FIR element: FirResolvedNamedReferenceImpl
FIR element rendered:
R|kotlin/Int.plus|
@@ -0,0 +1,4 @@
fun x() <expr> {
}
</expr>
@@ -0,0 +1,6 @@
KT element: KtBlockExpression
FIR element: FirBlockImpl
FIR element rendered:
{
}
@@ -0,0 +1 @@
val x = <expr>true</expr>
@@ -0,0 +1,5 @@
KT element: KtConstantExpression
FIR element: FirConstExpressionImpl
FIR element rendered:
Boolean(true)
@@ -0,0 +1 @@
val x = <expr>Int::class</expr>
@@ -0,0 +1,5 @@
KT element: KtClassLiteralExpression
FIR element: FirGetClassCallImpl
FIR element rendered:
<getClass>(Q|kotlin/Int|)
@@ -0,0 +1,7 @@
fun foo() {
<expr>
for (x in 0..1) {
}
</expr>
}
@@ -0,0 +1,7 @@
KT element: KtForExpression
FIR element: FirWhileLoopImpl
FIR element rendered:
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval x: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
}
@@ -0,0 +1,6 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtBinaryExpression
fun foo() {
for (x in <expr>0..1</expr>) {
}
}
@@ -0,0 +1,5 @@
KT element: KtBinaryExpression
FIR element: FirFunctionCallImpl
FIR element rendered:
Int(0).R|kotlin/Int.rangeTo|(Int(1))
@@ -0,0 +1,5 @@
fun foo() {
for (<expr>x</expr> in 0..1) {
}
}
@@ -0,0 +1,5 @@
KT element: KtParameter
FIR element: FirPropertyImpl
FIR element rendered:
lval x: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
@@ -0,0 +1,3 @@
fun foo(x: Any): String {
return <expr>if (x is String) "1" else "2"</expr>
}
@@ -0,0 +1,12 @@
KT element: KtIfExpression
FIR element: FirWhenExpressionImpl
FIR element rendered:
when () {
(R|<local>/x| is R|kotlin/String|) -> {
String(1)
}
else -> {
String(2)
}
}
@@ -0,0 +1 @@
val x = <expr>1</expr>
@@ -0,0 +1,5 @@
KT element: KtConstantExpression
FIR element: FirConstExpressionImpl
FIR element rendered:
Int(1)
@@ -0,0 +1,3 @@
fun foo(x: Any): Boolean {
return <expr>x is String</expr>
}
@@ -0,0 +1,5 @@
KT element: KtIsExpression
FIR element: FirTypeOperatorCallImpl
FIR element rendered:
(R|<local>/x| is R|kotlin/String|)
@@ -0,0 +1,4 @@
// WITH_STDLIB
val x = run <expr>{
1
}</expr>
@@ -0,0 +1,7 @@
KT element: KtLambdaArgument
FIR element: FirAnonymousFunctionExpressionImpl
FIR element rendered:
run@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
^ Int(1)
}

Some files were not shown because too many files have changed in this diff Show More