mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
find usages considers a reference to be a usage if it resolves to an element that shadows our name or is shadowed by ours (PY-6241)
This commit is contained in:
@@ -446,6 +446,12 @@ public class PyReferenceImpl implements PsiReferenceEx, PsiPolyVariantReference
|
||||
return true;
|
||||
}
|
||||
|
||||
// we shadow their name or they shadow ours (PY-6241)
|
||||
if (resolveResult instanceof PsiNamedElement && resolveResult instanceof ScopeOwner && element instanceof ScopeOwner &&
|
||||
ourScopeOwner == PsiTreeUtil.getParentOfType(resolveResult, ScopeOwner.class)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!haveQualifiers(element) && ourScopeOwner != null && theirScopeOwner != null) {
|
||||
if (resolvesToSameGlobal(element, elementName, ourScopeOwner, theirScopeOwner, resolveResult)) return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class C(object):
|
||||
def __init__(self):
|
||||
self._x = None
|
||||
|
||||
@property
|
||||
def <caret>x(self):
|
||||
"""I'm the 'x' property."""
|
||||
return self._x
|
||||
|
||||
@x.setter
|
||||
def x(self, value):
|
||||
self._x = value
|
||||
|
||||
@x.deleter
|
||||
def x(self):
|
||||
del self._x
|
||||
@@ -127,6 +127,11 @@ public class PyFindUsagesTest extends PyTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNameShadowing() { // PY-6241
|
||||
final Collection<UsageInfo> usages = myFixture.testFindUsages("findUsages/NameShadowing.py");
|
||||
assertEquals(2, usages.size());
|
||||
}
|
||||
|
||||
private Collection<UsageInfo> findMultiFileUsages(String filename) {
|
||||
final String testName = getTestName(false);
|
||||
myFixture.copyDirectoryToProject("findUsages/" + testName, "");
|
||||
|
||||
Reference in New Issue
Block a user