mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
return weak type of class as return type of constructor call if the actual return type of __new__ is unknown (PY-6671)
This commit is contained in:
@@ -162,6 +162,12 @@ public class PyCallExpressionImpl extends PyElementImpl implements PyCallExpress
|
||||
}
|
||||
}
|
||||
if (t != null && !(t instanceof PyNoneType)) {
|
||||
if (t instanceof PyTypeReference) {
|
||||
PyType resolved = ((PyTypeReference)t).resolve(callee, context);
|
||||
if (resolved == null) {
|
||||
return new PyWeakClassType(cls, false);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
def foo(): return foo()
|
||||
|
||||
class Template(object):
|
||||
def __new__(cls):
|
||||
return foo()
|
||||
|
||||
def xyzzy(self):
|
||||
pass
|
||||
|
||||
t = Template()
|
||||
t.xyzzy()
|
||||
@@ -0,0 +1,11 @@
|
||||
def foo(): return foo()
|
||||
|
||||
class Template(object):
|
||||
def __new__(cls):
|
||||
return foo()
|
||||
|
||||
def xyzzy(self):
|
||||
pass
|
||||
|
||||
t = Template()
|
||||
t.x<caret>
|
||||
@@ -584,4 +584,8 @@ public class PythonCompletionTest extends PyTestCase {
|
||||
public void testNoInitForSubmodules() {
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
public void testUnknownNewReturnType() { // PY-6671
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user