Find Usages: Add support of naming conventions
#KT-1356 Fixed
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>compareTo(other: A): Int = compareTo(other.n)
|
||||
fun compareTo(m: Int): Int = n.compareTo(m)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(0) compareTo A(1)
|
||||
A(0) < A(1)
|
||||
A(0) <= A(1)
|
||||
A(0) > A(1)
|
||||
A(0) >= A(1)
|
||||
A(0) compareTo 1
|
||||
A(0) < 1
|
||||
A(0) <= 1
|
||||
A(0) > 1
|
||||
A(0) >= 1
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
Function call (10: 10) A(0) compareTo A(1)
|
||||
Function call (11: 10) A(0) < A(1)
|
||||
Function call (12: 10) A(0) <= A(1)
|
||||
Function call (13: 10) A(0) > A(1)
|
||||
Function call (14: 10) A(0) >= A(1)
|
||||
@@ -0,0 +1,11 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetParameter
|
||||
// OPTIONS: usages
|
||||
|
||||
data class A(val <caret>n: Int, val s: String, val o: Any)
|
||||
|
||||
fun test() {
|
||||
val a = A(1, "2", Any())
|
||||
a.n
|
||||
a.component1()
|
||||
val (x, y, z) = a
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Function call (9: 7) a.component1()
|
||||
Value read (10: 9) val (x, y, z) = a
|
||||
Value read (8: 7) a.n
|
||||
@@ -0,0 +1,12 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetParameter
|
||||
// OPTIONS: usages
|
||||
// FIND_BY_REF
|
||||
|
||||
data class A(val n: Int, val s: String, val o: Any)
|
||||
|
||||
fun test() {
|
||||
val a = A(1, "2", Any())
|
||||
a.n
|
||||
a.<caret>component1()
|
||||
val (x, y, z) = a
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Function call (10: 7) a.component1()
|
||||
Value read (11: 9) val (x, y, z) = a
|
||||
Value read (9: 7) a.n
|
||||
@@ -0,0 +1,16 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>contains(k: Int): Boolean = k <= n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(2) contains 1
|
||||
1 in A(2)
|
||||
1 !in A(2)
|
||||
when (1) {
|
||||
in A(2) -> {}
|
||||
!in A(2) -> {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
Function call (10: 7) 1 in A(2)
|
||||
Function call (11: 7) 1 !in A(2)
|
||||
Function call (13: 9) in A(2) -> {}
|
||||
Function call (14: 9) !in A(2) -> {}
|
||||
Function call (9: 10) A(2) contains 1
|
||||
@@ -0,0 +1,14 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
override fun <caret>equals(other: Any?): Boolean = other is A && other.n == n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(0) == A(1)
|
||||
A(0) != A(1)
|
||||
A(0) equals A(1)
|
||||
A(0) === A(1)
|
||||
A(0) !== A(1)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Function call (10: 10) A(0) != A(1)
|
||||
Function call (11: 10) A(0) equals A(1)
|
||||
Function call (5: 71) override fun equals(other: Any?): Boolean = other is A && other.n == n
|
||||
Function call (9: 10) A(0) == A(1)
|
||||
@@ -0,0 +1,17 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A<T: Any> {
|
||||
public fun <caret>iterator(): Iterator<T> = throw IllegalStateException("")
|
||||
}
|
||||
|
||||
class B<T: Any> {
|
||||
public fun iterator(): Iterator<T> = throw IllegalStateException("")
|
||||
}
|
||||
|
||||
fun test() {
|
||||
for (a in A<String>()) {}
|
||||
for (b in B<String>()) {}
|
||||
for (a in A<Int>()) {}
|
||||
for (b in B<Int>()) {}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Implicit iteration (13: 12) for (a in A<String>()) {}
|
||||
Implicit iteration (15: 12) for (a in A<Int>()) {}
|
||||
@@ -0,0 +1,11 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class B(val n: Int) {
|
||||
fun <caret>get(i: Int): B = B(i)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
B(1).get(2)
|
||||
B(1)[2]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Function call (9: 10) B(1).get(2)
|
||||
Implicit 'get' (10: 5) B(1)[2]
|
||||
@@ -0,0 +1,16 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
// FIND_BY_REF
|
||||
|
||||
class A(val n: Int) {
|
||||
override fun equals(other: Any?): Boolean = other is A && other.n == n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(0) == A(1)
|
||||
A(0) != A(1)
|
||||
A(0) equals A(1)
|
||||
A(0) <caret>identityEquals A(1)
|
||||
A(0) === A(1)
|
||||
A(0) !== A(1)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Function call (13: 10) A(0) identityEquals A(1)
|
||||
Function call (14: 10) A(0) === A(1)
|
||||
Function call (15: 10) A(0) !== A(1)
|
||||
@@ -0,0 +1,13 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>inc(): A = A(n + 1)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
var a = A(1)
|
||||
a.inc()
|
||||
++a
|
||||
a++
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Function call (10: 7) a.inc()
|
||||
Function call (11: 5) ++a
|
||||
Function call (12: 6) a++
|
||||
@@ -0,0 +1,11 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class B(val n: Int) {
|
||||
fun <caret>invoke(i: Int): B = B(i)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
B(1).invoke(2)
|
||||
B(1)(2)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Function call (9: 10) B(1).invoke(2)
|
||||
Implicit 'invoke' (10: 5) B(1)(2)
|
||||
@@ -0,0 +1,19 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>plus(m: Int): A = A(n + m)
|
||||
fun plus(a: A): A = this + a.n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(0) + A(1) + 2
|
||||
A(0) plus A(1) plus 2
|
||||
A(0).plus(A(1).plus(2))
|
||||
|
||||
var a = A(0)
|
||||
a += 1
|
||||
a += A(1)
|
||||
|
||||
+A(0)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
Function call (12: 20) A(0).plus(A(1).plus(2))
|
||||
Function call (10: 17) A(0) + A(1) + 2
|
||||
Function call (11: 20) A(0) plus A(1) plus 2
|
||||
Function call (15: 7) a += 1
|
||||
Function call (6: 30) fun plus(a: A): A = this + a.n
|
||||
@@ -0,0 +1,19 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(var n: Int) {
|
||||
fun <caret>plusAssign(m: Int) {
|
||||
n += m
|
||||
}
|
||||
|
||||
fun plusAssign(a: A) {
|
||||
this += a.n
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A(0)
|
||||
a.plusAssign(1)
|
||||
a += 1
|
||||
a += A(1)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Function call (16: 7) a.plusAssign(1)
|
||||
Function call (10: 14) this += a.n
|
||||
Function call (17: 7) a += 1
|
||||
@@ -0,0 +1,13 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class B(val n: Int) {
|
||||
fun <caret>set(i: Int, a: B) {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
var a = B(1)
|
||||
a.set(2, B(2))
|
||||
a[2] = B(2)
|
||||
a[2]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Function call (10: 7) a.set(2, B(2))
|
||||
Implicit 'set' (11: 5) a[2] = B(2)
|
||||
@@ -0,0 +1,11 @@
|
||||
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>minus(): A = this
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(1).minus()
|
||||
-A(1)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Function call (9: 10) A(1).minus()
|
||||
Function call (10: 5) -A(1)
|
||||
Reference in New Issue
Block a user