mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
invoke scanOuterContext() also for lambdas (PY-2182)
This commit is contained in:
@@ -162,7 +162,7 @@ public class PyResolveUtil {
|
||||
// if we're under a cap, an external object that we want to use might be also defined below us.
|
||||
// look through all contexts, closest first.
|
||||
PsiElement ret = null;
|
||||
PsiElement our_cap = PsiTreeUtil.getParentOfType(start, PyFunction.class);
|
||||
PsiElement our_cap = PsiTreeUtil.getParentOfType(start, Callable.class);
|
||||
if (our_cap != null) {
|
||||
PsiElement cap = our_cap;
|
||||
while (true) {
|
||||
|
||||
6
python/testData/resolve/LambdaToClass.py
Normal file
6
python/testData/resolve/LambdaToClass.py
Normal file
@@ -0,0 +1,6 @@
|
||||
class TestOne():
|
||||
x = lambda self: TestTwo()
|
||||
# <ref>
|
||||
|
||||
class TestTwo():
|
||||
pass
|
||||
@@ -48,7 +48,7 @@ public class PyResolveTest extends PyResolveTestCase {
|
||||
|
||||
public void testToConstructorInherited() {
|
||||
ResolveResult[] targets = multiResolve();
|
||||
assertEquals(targets.length, 2); // to class, to init
|
||||
assertEquals(2, targets.length); // to class, to init
|
||||
PsiElement elt;
|
||||
// class
|
||||
elt = targets[0].getElement();
|
||||
@@ -366,4 +366,8 @@ public class PyResolveTest extends PyResolveTestCase {
|
||||
final PyFunction pyFunction = assertResolvesTo(PyFunction.class, "eval");
|
||||
assertEquals("__builtin__.py", pyFunction.getContainingFile().getName());
|
||||
}
|
||||
|
||||
public void testLambdaToClass() { // PY-2182
|
||||
assertResolvesTo(PyClass.class, "TestTwo");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user