[FIR IDE] Add find usages tests for FIR plugin

This commit is contained in:
Igor Yakovlev
2020-09-19 10:49:15 +03:00
parent d534d92123
commit d2bdab2ef5
168 changed files with 2622 additions and 170 deletions
@@ -1,5 +1,6 @@
// PSI_ELEMENT: com.intellij.psi.PsiField
// OPTIONS: skipWrite
// FIR_COMPARISON
public class A {
public String <caret>foo = "foo";
}
@@ -1,5 +1,6 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
// FIR_COMPARISON
class A {
public void <caret>foo() {
@@ -1,5 +1,6 @@
// PSI_ELEMENT: com.intellij.psi.PsiMethod
// OPTIONS: usages
// FIR_COMPARISON
public class Bar {
public String getValue() {
return "value";
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
package pack
data class A(val <caret>a: Int, val b: String)
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>a: Int, val b: Int) {
fun f() {}
@@ -1,4 +1,4 @@
Value read 19 val (a1, b1) = fun2()
Value read 20 val (a2, b2) = fun3()
Value read 23 val (a3, b3) = constructor(1, 2)
Value read 25 val (a4, b4) = A::class.java.newInstance()
Value read 20 val (a1, b1) = fun2()
Value read 21 val (a2, b2) = fun3()
Value read 24 val (a3, b3) = constructor(1, 2)
Value read 26 val (a4, b4) = A::class.java.newInstance()
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_COMPARISON
data class A(val <caret>x: Int, val y: Int) {
companion object {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
package pack
data class A(val <caret>n: Int, val s: String, val o: Any) {
@@ -1,5 +1,5 @@
[dataClass.0.kt] Value read 16 val (x, y) = getThis()
[dataClass.0.kt] Value read 24 val (x, y) = get(0)
[dataClass.0.kt] Value read 18 val (x, y) = getThis()
[dataClass.0.kt] Value read 26 val (x, y) = get(0)
[dataClass.1.kt] Function call 6 a.component1()
[dataClass.1.kt] Value read 10 val (x2, y2, z2) = g()
[dataClass.1.kt] Value read 11 val (x3, y3, z3) = h()
@@ -1,6 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIND_BY_REF
// FIR_IGNORE
data class A(val n: Int, val s: String, val o: Any)
@@ -1 +1 @@
Value read 9 a.n
Value read 10 a.n
@@ -1,3 +1,3 @@
Function call 10 a.component1()
Value read 11 val (x, y, z) = a
Value read 9 a.n
Function call 11 a.component1()
Value read 10 a.n
Value read 12 val (x, y, z) = a
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>x: Int, val y: Int, val z: String)
data class B(val a: A, val n: Int)
@@ -1 +1 @@
Value read 14 val (x, y, z) = a
Value read 15 val (x, y, z) = a
@@ -1,2 +1,2 @@
Value read 14 val (x, y, z) = a
Value read 17 val (x1, y1, z1) = a1
Value read 15 val (x, y, z) = a
Value read 18 val (x1, y1, z1) = a1
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>n: Int, val s: String, val o: Any) {
@@ -1,2 +1,2 @@
Value read 11 val (x, y) = a
Value read 7 for ((x, y, z) in arrayOf<A>()) {
Value read 12 val (x, y) = a
Value read 8 for ((x, y, z) in arrayOf<A>()) {
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>x: Int, val y: Int)
@@ -1,2 +1,2 @@
Value read 15 val (x, y) = list[0]
Value read 8 val (x, y) = o
Value read 16 val (x, y) = list[0]
Value read 9 val (x, y) = o
@@ -1,3 +1,3 @@
Value read 15 val (x, y) = list[0]
Value read 8 val (x, y) = o
Value read 9 val (x1, y1) = A(1, "", "")
Value read 10 val (x1, y1) = A(1, "", "")
Value read 16 val (x, y) = list[0]
Value read 9 val (x, y) = o
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>a: Int, val b: Int)
@@ -1 +1 @@
Value read 28 takeFun2 { a, n -> val (x, y) = a!! }
Value read 29 takeFun2 { a, n -> val (x, y) = a!! }
@@ -1,8 +1,8 @@
Value read 19 p[0] = { val (x, y) = it }
Value read 25 takeExtFun { val (x, y) = this }
Value read 27 takeFun1 { val (x, y) = it }
Value read 28 takeFun2 { a, n -> val (x, y) = a!! }
Value read 29 takeFun3 { val (x, y) = it[0] }
Value read 31 x(p) { val (x, y) = it }
Value read 32 x(p, fun (p) { val (x, y) = p })
Value read 40 "".v = { val (x, y ) = it }
Value read 20 p[0] = { val (x, y) = it }
Value read 26 takeExtFun { val (x, y) = this }
Value read 28 takeFun1 { val (x, y) = it }
Value read 29 takeFun2 { a, n -> val (x, y) = a!! }
Value read 30 takeFun3 { val (x, y) = it[0] }
Value read 32 x(p) { val (x, y) = it }
Value read 33 x(p, fun (p) { val (x, y) = p })
Value read 41 "".v = { val (x, y ) = it }
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>n: Int, val s: String)
@@ -1,2 +1,2 @@
Value read 19 val (x1, y1) = if (b) {
Value read 20 A(1, "").apply { val (x2, y2) = this }
Value read 20 val (x1, y1) = if (b) {
Value read 21 A(1, "").apply { val (x2, y2) = this }
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>x: Int, val y: Int) {
fun f() {
@@ -1,2 +1,2 @@
Value read 15 val (x, y) = b1 + b2
Value read 6 val (x, y) = this
Value read 16 val (x, y) = b1 + b2
Value read 7 val (x, y) = this
@@ -1,2 +1,2 @@
Value read 15 val (x, y) = b1 + b2
Value read 6 val (x, y) = this
Value read 16 val (x, y) = b1 + b2
Value read 7 val (x, y) = this
@@ -1,6 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_COMPARISON
data class A(val <caret>a: A?, val n: Int)
fun f(a: A) {
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>b: B, val n: Int)
data class B(val a: A?, val s: String)
@@ -1 +1 @@
Value read 8 val (b, n) = a
Value read 9 val (b, n) = a
@@ -1 +1 @@
Value read 8 val (b, n) = a
Value read 9 val (b, n) = a
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
data class A(val <caret>a: Int, val b: Int)
@@ -1,2 +1,2 @@
Value read 23 val (x, y) = o
Value read 9 val (x, y) = o
Value read 10 val (x, y) = o
Value read 24 val (x, y) = o
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_COMPARISON
package server
data class <caret>Data
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages, skipImports
// FIR_COMPARISON
package server
open class <caret>Server {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: functionUsages
// FIR_COMPARISON
interface <caret>X {
val a: String
get() {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: functionUsages
// FIR_COMPARISON
interface X {
val a: String
get() {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: propertyUsages
// FIR_COMPARISON
interface <caret>X {
val a: String
get() {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: propertyUsages
// FIR_COMPARISON
interface X {
val a: String
get() {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
fun foo(): Any {
class <caret>Bar
@@ -1 +1 @@
New instance creation 6 return Bar()
New instance creation 8 return Bar()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
fun foo(): Any {
if (false) {
class <caret>Bar
@@ -1 +1 @@
New instance creation 7 return Bar()
New instance creation 9 return Bar()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
package server
public open class Server() {
@@ -1 +1 @@
New instance creation 10 open fun processRequest() = Foo()
New instance creation 12 open fun processRequest() = Foo()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages, constructorUsages
// FIR_IGNORE
class <caret>C {
init {
println("global")
@@ -1 +1 @@
New instance creation 10 C()
New instance creation 12 C()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
// OPTIONS: usages
// FIR_IGNORE
class <caret>A<T>
typealias B = A<Int>
@@ -1 +1 @@
Type alias 5 typealias B = A<Int>
Type alias 7 typealias B = A<Int>
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: textOccurrences
// FIR_COMPARISON
package test
class Foo {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_COMPARISON
package server
fun <caret>processRequest() = "foo"
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
fun foo() {
fun <caret>bar() {
@@ -1 +1 @@
Function call 8 bar()
Function call 10 bar()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
fun foo() {
if (true) {
fun <caret>bar() {
@@ -1 +1 @@
Function call 9 bar()
Function call 11 bar()
@@ -1,6 +1,7 @@
// IGNORE: see KotlinFindUsagesHandlerFactory: it is ambiguous case: ImportAlias does not have any reference to be resolved
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtImportAlias
// OPTIONS: usages
// FIR_COMPARISON
package c
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: overloadUsages
// FIR_IGNORE
interface X<T> {
}
@@ -1,7 +1,7 @@
[kotlinOverloadAndExtensionUsages.0.kt] Function call 11 x.foo(1, 2)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 25 foo(t)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 30 a.foo(1, "")
[kotlinOverloadAndExtensionUsages.0.kt] Function call 35 foo(t)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 39 foo(s)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 13 x.foo(1, 2)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 27 foo(t)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 32 a.foo(1, "")
[kotlinOverloadAndExtensionUsages.0.kt] Function call 37 foo(t)
[kotlinOverloadAndExtensionUsages.0.kt] Function call 41 foo(s)
[kotlinOverloadAndExtensionUsages.1.kt] Function call 11 a.foo(0, "")
[kotlinOverloadAndExtensionUsages.1.kt] Function call 3 super<A>.foo(t)
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
package server
public open class Server() {
@@ -1 +1 @@
Function call 8 open fun processRequest() = doProcessRequest()
Function call 10 open fun processRequest() = doProcessRequest()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages, skipImports
// FIR_COMPARISON
package server
fun <caret>processRequest() = "foo"
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
package anonymousUnused
fun main(args: Array<String>) {
@@ -1 +1 @@
Function call 11 LocalClass().f()
Function call 13 LocalClass().f()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
package anonymousUnused
fun main(args: Array<String>) {
@@ -1 +1 @@
Value read 14 a.b.c.d
Value read 16 a.b.c.d
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
package anonymousUnused
fun main(args: Array<String>) {
@@ -1 +1 @@
Function call 11 localObject.f()
Function call 13 localObject.f()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
package anonymousUnused
fun main(args: Array<String>) {
@@ -1 +1 @@
Function call 11 localObject().f()
Function call 13 localObject().f()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
class Foo {
private val localObject = object : Any() {
fun <caret>f() {
@@ -1 +1 @@
Function call 10 localObject.f()
Function call 12 localObject.f()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
class Foo {
companion object {
private val localObject = object : Any() {
@@ -1 +1 @@
Function call 12 localObject.f()
Function call 14 localObject.f()
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
// OPTIONS: usages
// FIR_IGNORE
private val localObject = object : Any() {
fun <caret>f() {
}
@@ -1 +1 @@
Function call 10 localObject.f()
Function call 12 localObject.f()
@@ -1,4 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// FIR_IGNORE
import Imported as Alias
object <caret>Imported
@@ -1 +1 @@
Usage in import 2 import Imported as Alias
Usage in import 4 import Imported as Alias
@@ -1,4 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// FIR_COMPARISON
package server
object <caret>O {
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
// FIR_IGNORE
package server
public open class Server() {
@@ -1 +1 @@
Value read 10 open fun processRequest() = Foo
Value read 12 open fun processRequest() = Foo
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtPrimaryConstructor
// OPTIONS: usages
// FIR_COMPARISON
class <caret>() {
}
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
fun foo(): String {
val <caret>bar = ""
@@ -1 +1 @@
Value read 6 return bar
Value read 8 return bar
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
fun foo(): String {
if (true) {
val <caret>bar = ""
@@ -1 +1 @@
Value read 7 return bar
Value read 9 return bar
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
class Outer {
val x = Outer.t
@@ -1 +1 @@
Value read 4 val x = Outer.t
Value read 6 val x = Outer.t
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages, skipWrite
// FIR_IGNORE
package server
open class A<T> {
@@ -1,3 +1,3 @@
[kotlinPropertyReadUsages.0.kt] Value read 13 return super<A>.foo
[kotlinPropertyReadUsages.0.kt] Value read 14 return super<A>.foo
[kotlinPropertyReadUsages.1.kt] Value read 11 println("b.foo = ${b.foo}")
[kotlinPropertyReadUsages.1.kt] Value read 7 println("a.foo = ${a.foo}")
[kotlinPropertyReadUsages.1.kt] Value read 7 println("a.foo = ${a.foo}")
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages, skipWrite
// FIR_IGNORE
package server
open class A<T>(open var <caret>foo: T)
@@ -1,3 +1,3 @@
[kotlinPropertyReadUsages2.0.kt] Value read 11 return super<A>.foo
[kotlinPropertyReadUsages2.0.kt] Value read 13 return super<A>.foo
[kotlinPropertyReadUsages2.1.kt] Value read 11 println("b.foo = ${b.foo}")
[kotlinPropertyReadUsages2.1.kt] Value read 7 println("a.foo = ${a.foo}")
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
class P
interface C {
@@ -1 +1 @@
Value read 11 println(p)
Value read 13 println(p)
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
// FIR_IGNORE
package server
open class A<T> {
@@ -1,6 +1,6 @@
[kotlinPropertyUsages.0.kt] Value read 13 return super<A>.foo
[kotlinPropertyUsages.0.kt] Value write 17 super<A>.foo = value
[kotlinPropertyUsages.0.kt] Value read 14 return super<A>.foo
[kotlinPropertyUsages.0.kt] Value write 18 super<A>.foo = value
[kotlinPropertyUsages.1.kt] Value read 11 println("b.foo = ${b.foo}")
[kotlinPropertyUsages.1.kt] Value read 7 println("a.foo = ${a.foo}")
[kotlinPropertyUsages.1.kt] Value write 10 b.foo = "b"
[kotlinPropertyUsages.1.kt] Value write 6 a.foo = "a"
[kotlinPropertyUsages.1.kt] Value write 6 a.foo = "a"
@@ -1,5 +1,6 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
// FIR_IGNORE
package server
open class A<T>(open var <caret>foo: T)
@@ -1,6 +1,6 @@
[kotlinPropertyUsages2.0.kt] Value read 11 return super<A>.foo
[kotlinPropertyUsages2.0.kt] Value write 15 super<A>.foo = value
[kotlinPropertyUsages2.0.kt] Value read 12 return super<A>.foo
[kotlinPropertyUsages2.0.kt] Value write 16 super<A>.foo = value
[kotlinPropertyUsages2.1.kt] Value read 11 println("b.foo = ${b.foo}")
[kotlinPropertyUsages2.1.kt] Value read 7 println("a.foo = ${a.foo}")
[kotlinPropertyUsages2.1.kt] Value write 10 b.foo = "b"
[kotlinPropertyUsages2.1.kt] Value write 6 a.foo = "a"
[kotlinPropertyUsages2.1.kt] Value write 6 a.foo = "a"
@@ -1,5 +1,7 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages, skipRead
// FIR_IGNORE
package server
open class A<T> {
@@ -1,3 +1,3 @@
[kotlinPropertyWriteUsages.0.kt] Value write 17 super<A>.foo = value
[kotlinPropertyWriteUsages.0.kt] Value write 19 super<A>.foo = value
[kotlinPropertyWriteUsages.1.kt] Value write 10 b.foo = "b"
[kotlinPropertyWriteUsages.1.kt] Value write 6 a.foo = "a"
[kotlinPropertyWriteUsages.1.kt] Value write 6 a.foo = "a"

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