mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed callable inspection for 'namedtuple' instances (PY-8801)
Don't cast reference type returned by a type provider to an instance type. It should know better what type to return.
This commit is contained in:
@@ -420,9 +420,6 @@ public class PyCallExpressionHelper {
|
||||
}
|
||||
final PyType providedType = PyReferenceExpressionImpl.getReferenceTypeFromProviders(target, context, call);
|
||||
if (providedType != null) {
|
||||
if (providedType instanceof PyClassType) {
|
||||
return ((PyClassType)providedType).toInstance();
|
||||
}
|
||||
return providedType;
|
||||
}
|
||||
if (target instanceof Callable) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import collections
|
||||
|
||||
Point = collections.namedtuple('Point', 'x y')
|
||||
p1 = Point(1, 2)
|
||||
+5
@@ -69,6 +69,11 @@ public class PyCallingNonCallableInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-8801
|
||||
public void testQualifiedNamedTuple() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
setLanguageLevel(LanguageLevel.PYTHON27);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user