From eb941c75f9e74e3c1dd5d09fa6d948f01c824a32 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 10 Apr 2017 16:13:34 +0300 Subject: [PATCH] Minor: check that invoke() usages search doesn't find overrides --- .../findUsages/kotlin/conventions/invoke.0.kt | 16 ++++++++++++---- .../findUsages/kotlin/conventions/invoke.log | 12 ++++++++---- .../kotlin/conventions/invoke.results.txt | 6 +++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/idea/testData/findUsages/kotlin/conventions/invoke.0.kt b/idea/testData/findUsages/kotlin/conventions/invoke.0.kt index aabce91d499..fee1763a7b9 100644 --- a/idea/testData/findUsages/kotlin/conventions/invoke.0.kt +++ b/idea/testData/findUsages/kotlin/conventions/invoke.0.kt @@ -3,7 +3,7 @@ package pack open class B(val n: Int) { - operator fun invoke(i: Int){} + open operator fun invoke(i: Int){} } object Obj : B(0) @@ -11,11 +11,19 @@ object Obj : B(0) fun f() = B(1) fun test() { - f(1).invoke(2) - f(2)(2) + f().invoke(2) + f()(2) val v = Obj v(1) - listOf(pack.Obj)[0](1) + listOf(Obj)[0](1) +} + +class C(): B(12) { + override fun invoke(i: Int) {} +} + +fun cTest(c: C) { + c(5) } diff --git a/idea/testData/findUsages/kotlin/conventions/invoke.log b/idea/testData/findUsages/kotlin/conventions/invoke.log index 73dc3c49bd9..8ea9945459f 100644 --- a/idea/testData/findUsages/kotlin/conventions/invoke.log +++ b/idea/testData/findUsages/kotlin/conventions/invoke.log @@ -1,14 +1,18 @@ Checked type of pack.f() Checked type of v -Resolved f(1) -Resolved f(2) -Resolved f(2)(2) -Resolved listOf(pack.Obj)[0](1) +Resolved c(5) +Resolved f() +Resolved f() +Resolved f()(2) +Resolved listOf(Obj)[0](1) Resolved v(1) Searched references to pack.B +Searched references to pack.C Searched references to pack.Obj Searched references to pack.f() in non-Java files +Searched references to parameter c of pack.cTest(c: C) in non-Java files Searched references to v in non-Java files Used plain search of pack.B.invoke(i: Int) in LocalSearchScope: CLASS:B + CLASS:C OBJECT_DECLARATION:Obj \ No newline at end of file diff --git a/idea/testData/findUsages/kotlin/conventions/invoke.results.txt b/idea/testData/findUsages/kotlin/conventions/invoke.results.txt index 3056313ace8..3012bfdfca6 100644 --- a/idea/testData/findUsages/kotlin/conventions/invoke.results.txt +++ b/idea/testData/findUsages/kotlin/conventions/invoke.results.txt @@ -1,4 +1,4 @@ -Function call 14 f(1).invoke(2) -Implicit 'invoke' 15 f(2)(2) +Function call 14 f().invoke(2) +Implicit 'invoke' 15 f()(2) Implicit 'invoke' 18 v(1) -Implicit 'invoke' 20 listOf(pack.Obj)[0](1) \ No newline at end of file +Implicit 'invoke' 20 listOf(Obj)[0](1) \ No newline at end of file