Fix search scope of Kotlin light methods

#KT-4638 Fixed
This commit is contained in:
Alexey Sedunov
2014-03-04 14:56:06 +04:00
parent 3729966270
commit 1edaa877dc
8 changed files with 55 additions and 0 deletions
@@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.psi.JetProperty
import com.intellij.psi.PsiTypeParameter
import org.jetbrains.jet.lang.psi.JetClassOrObject
import com.intellij.psi.impl.light.LightTypeParameterListBuilder
import com.intellij.psi.search.SearchScope
public class KotlinLightMethodForDeclaration(
manager: PsiManager, override val delegate: PsiMethod, override val origin: JetDeclaration, containingClass: PsiClass
@@ -106,4 +107,6 @@ public class KotlinLightMethodForDeclaration(
override fun copy(): PsiElement {
return KotlinLightMethodForDeclaration(getManager()!!, delegate, origin.copy() as JetDeclaration, getContainingClass()!!)
}
override fun getUseScope(): SearchScope = origin.getUseScope()
}
@@ -0,0 +1,3 @@
<node text="Tester.Test ()" base="true">
<node text="Tester.test() ()"/>
</node>
@@ -0,0 +1,9 @@
open class Tester {
open fun test() {
val test = Test()
}
private class <caret>Test {
}
}
@@ -0,0 +1,3 @@
<node text="Tester.privateTest() ()" base="true">
<node text="Tester.test() ()"/>
</node>
@@ -0,0 +1,9 @@
open class Tester {
open fun test() {
privateTest()
}
private fun <caret>privateTest() {
println(this)
}
}
@@ -0,0 +1,3 @@
<node text="Tester.privateTest ()" base="true">
<node text="Tester.test()(2 usages) ()"/>
</node>
@@ -0,0 +1,10 @@
open class Tester {
open fun test() {
privateTest = "test"
println(privateTest)
}
private var <caret>privateTest: String
get() = ""
set(value) { println(value) }
}
@@ -297,6 +297,21 @@ public class HierarchyTestGenerated extends AbstractHierarchyTest {
doCallerHierarchyTest("idea/testData/hierarchy/calls/callers/kotlinPackageProperty");
}
@TestMetadata("kotlinPrivateClass")
public void testKotlinPrivateClass() throws Exception {
doCallerHierarchyTest("idea/testData/hierarchy/calls/callers/kotlinPrivateClass");
}
@TestMetadata("kotlinPrivateFunction")
public void testKotlinPrivateFunction() throws Exception {
doCallerHierarchyTest("idea/testData/hierarchy/calls/callers/kotlinPrivateFunction");
}
@TestMetadata("kotlinPrivateProperty")
public void testKotlinPrivateProperty() throws Exception {
doCallerHierarchyTest("idea/testData/hierarchy/calls/callers/kotlinPrivateProperty");
}
@TestMetadata("kotlinProperty")
public void testKotlinProperty() throws Exception {
doCallerHierarchyTest("idea/testData/hierarchy/calls/callers/kotlinProperty");