Fixed KT-4105: Can't find usages of private function
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.jet.asJava;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.impl.compiled.ClsMethodImpl;
|
import com.intellij.psi.impl.compiled.ClsMethodImpl;
|
||||||
import com.intellij.psi.impl.java.stubs.PsiMethodStub;
|
import com.intellij.psi.impl.java.stubs.PsiMethodStub;
|
||||||
|
import com.intellij.psi.search.SearchScope;
|
||||||
import com.intellij.util.IncorrectOperationException;
|
import com.intellij.util.IncorrectOperationException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||||
@@ -59,4 +60,10 @@ public class JetClsMethodImpl extends ClsMethodImpl implements JetClsMethod {
|
|||||||
if (another instanceof JetClsMethod && getOrigin().equals(((JetClsMethod) another).getOrigin())) return true;
|
if (another instanceof JetClsMethod && getOrigin().equals(((JetClsMethod) another).getOrigin())) return true;
|
||||||
return super.isEquivalentTo(another);
|
return super.isEquivalentTo(another);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SearchScope getUseScope() {
|
||||||
|
return origin.getUseScope();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetClass
|
||||||
|
// OPTIONS: usages, constructorUsages
|
||||||
|
package server;
|
||||||
|
|
||||||
|
public open class Server() {
|
||||||
|
private class <caret>Foo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun processRequest() = Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ServerEx(): Server() {
|
||||||
|
override fun processRequest() = Server.Foo()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import server.*;
|
||||||
|
|
||||||
|
class Client {
|
||||||
|
public fun foo() {
|
||||||
|
println(Server.Foo())
|
||||||
|
ServerEx().processRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Instantiation (10: 33) open fun processRequest() = Foo()
|
||||||
|
Instantiation (14: 44) override fun processRequest() = Server.Foo()
|
||||||
|
Instantiation (5: 24) println(Server.Foo())
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||||
|
// OPTIONS: usages
|
||||||
|
package server;
|
||||||
|
|
||||||
|
public open class Server() {
|
||||||
|
private fun <caret>doProcessRequest() = "foo"
|
||||||
|
|
||||||
|
open fun processRequest() = doProcessRequest()
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ServerEx(): Server() {
|
||||||
|
override fun processRequest() = "foo" + doProcessRequest()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import server.*;
|
||||||
|
|
||||||
|
class Client {
|
||||||
|
public fun foo() {
|
||||||
|
Server().doProcessRequest()
|
||||||
|
ServerEx().processRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Function call (12: 45) override fun processRequest() = "foo" + doProcessRequest()
|
||||||
|
Function call (5: 18) Server().doProcessRequest()
|
||||||
|
Function call (8: 33) open fun processRequest() = doProcessRequest()
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetObjectDeclarationName
|
||||||
|
// OPTIONS: usages
|
||||||
|
package server;
|
||||||
|
|
||||||
|
public open class Server() {
|
||||||
|
private object <caret>Foo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun processRequest() = Foo
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ServerEx(): Server() {
|
||||||
|
override fun processRequest() = Foo
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import server.*;
|
||||||
|
|
||||||
|
class Client {
|
||||||
|
public fun foo() {
|
||||||
|
println(Server().Foo)
|
||||||
|
ServerEx().processRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Selector (5: 26) println(Server().Foo)
|
||||||
|
Value read (10: 33) open fun processRequest() = Foo
|
||||||
|
Value read (14: 37) override fun processRequest() = Foo
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// PSI_ELEMENT: org.jetbrains.jet.lang.psi.JetProperty
|
||||||
|
// OPTIONS: usages
|
||||||
|
package server;
|
||||||
|
|
||||||
|
public open class Server() {
|
||||||
|
private val <caret>foo = "foo"
|
||||||
|
|
||||||
|
open fun processRequest() = foo
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ServerEx(): Server() {
|
||||||
|
override fun processRequest() = "foo" + foo
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import server.*;
|
||||||
|
|
||||||
|
class Client {
|
||||||
|
public fun foo() {
|
||||||
|
println(Server().foo)
|
||||||
|
ServerEx().processRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Selector (5: 26) println(Server().foo)
|
||||||
|
Value read (12: 45) override fun processRequest() = "foo" + foo
|
||||||
|
Value read (8: 33) open fun processRequest() = foo
|
||||||
@@ -163,6 +163,11 @@ public class JetFindUsagesTest extends AbstractJetFindUsagesTest {
|
|||||||
doTest("idea/testData/findUsages/findClassUsages/kotlinDerivedInterfaceUsages2.0.kt");
|
doTest("idea/testData/findUsages/findClassUsages/kotlinDerivedInterfaceUsages2.0.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinPrivateClassUsages.0.kt")
|
||||||
|
public void testKotlinPrivateClassUsages() throws Exception {
|
||||||
|
doTest("idea/testData/findUsages/findClassUsages/kotlinPrivateClassUsages.0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/findUsages/findMethodUsages")
|
@TestMetadata("idea/testData/findUsages/findMethodUsages")
|
||||||
@@ -191,6 +196,11 @@ public class JetFindUsagesTest extends AbstractJetFindUsagesTest {
|
|||||||
doTest("idea/testData/findUsages/findMethodUsages/kotlinOverloadAndExtensionUsages.0.kt");
|
doTest("idea/testData/findUsages/findMethodUsages/kotlinOverloadAndExtensionUsages.0.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinPrivateMethodUsages.0.kt")
|
||||||
|
public void testKotlinPrivateMethodUsages() throws Exception {
|
||||||
|
doTest("idea/testData/findUsages/findMethodUsages/kotlinPrivateMethodUsages.0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlinTopLevelMethodUsages.0.kt")
|
@TestMetadata("kotlinTopLevelMethodUsages.0.kt")
|
||||||
public void testKotlinTopLevelMethodUsages() throws Exception {
|
public void testKotlinTopLevelMethodUsages() throws Exception {
|
||||||
doTest("idea/testData/findUsages/findMethodUsages/kotlinTopLevelMethodUsages.0.kt");
|
doTest("idea/testData/findUsages/findMethodUsages/kotlinTopLevelMethodUsages.0.kt");
|
||||||
@@ -214,6 +224,11 @@ public class JetFindUsagesTest extends AbstractJetFindUsagesTest {
|
|||||||
doTest("idea/testData/findUsages/findObjectUsages/kotlinObjectUsages.0.kt");
|
doTest("idea/testData/findUsages/findObjectUsages/kotlinObjectUsages.0.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinPrivateObjectUsages.0.kt")
|
||||||
|
public void testKotlinPrivateObjectUsages() throws Exception {
|
||||||
|
doTest("idea/testData/findUsages/findObjectUsages/kotlinPrivateObjectUsages.0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/findUsages/findPropertyUsages")
|
@TestMetadata("idea/testData/findUsages/findPropertyUsages")
|
||||||
@@ -227,6 +242,11 @@ public class JetFindUsagesTest extends AbstractJetFindUsagesTest {
|
|||||||
doTest("idea/testData/findUsages/findPropertyUsages/javaPropertyUsages.0.kt");
|
doTest("idea/testData/findUsages/findPropertyUsages/javaPropertyUsages.0.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinPrivatePropertyUsages.0.kt")
|
||||||
|
public void testKotlinPrivatePropertyUsages() throws Exception {
|
||||||
|
doTest("idea/testData/findUsages/findPropertyUsages/kotlinPrivatePropertyUsages.0.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlinTopLevelPropertyUsages.0.kt")
|
@TestMetadata("kotlinTopLevelPropertyUsages.0.kt")
|
||||||
public void testKotlinTopLevelPropertyUsages() throws Exception {
|
public void testKotlinTopLevelPropertyUsages() throws Exception {
|
||||||
doTest("idea/testData/findUsages/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt");
|
doTest("idea/testData/findUsages/findPropertyUsages/kotlinTopLevelPropertyUsages.0.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user