mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
first parameter of @classmethod method is callable
This commit is contained in:
@@ -52,6 +52,9 @@ public class PyCallingNonCallableInspection extends PyInspection {
|
||||
PyType calleeType = myTypeEvalContext.getType(callee);
|
||||
if (calleeType instanceof PyClassType) {
|
||||
PyClassType classType = (PyClassType) calleeType;
|
||||
if (classType.isDefinition()) {
|
||||
return;
|
||||
}
|
||||
PyClass cls = classType.getPyClass();
|
||||
if (isMethodType(node, classType)) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class C:
|
||||
@classmethod
|
||||
def foo(cls):
|
||||
return cls()
|
||||
@@ -35,6 +35,10 @@ public class PyCallingNonCallableTest extends PyLightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassMethodFirstParam() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
setLanguageLevel(LanguageLevel.PYTHON27);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user