mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Disabled call arguments inspection for decorated functions (PY-10601)
This commit is contained in:
@@ -10,7 +10,10 @@ import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.types.*;
|
||||
import com.jetbrains.python.psi.types.PyABCUtil;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.PyTypeChecker;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -88,6 +91,14 @@ public class PyArgumentListInspection extends PyInspection {
|
||||
public static void inspectPyArgumentList(PyArgumentList node, ProblemsHolder holder, final TypeEvalContext context, int implicitOffset) {
|
||||
if (node.getParent() instanceof PyClass) return; // class Foo(object) is also an arg list
|
||||
CallArgumentsMapping result = node.analyzeCall(PyResolveContext.noImplicits().withTypeEvalContext(context), implicitOffset);
|
||||
final PyCallExpression.PyMarkedCallee callee = result.getMarkedCallee();
|
||||
if (callee != null) {
|
||||
final Callable callable = callee.getCallable();
|
||||
// Decorate functions may have different parameter lists. We don't match arguments with parameters of decorators yet
|
||||
if (callable instanceof PyFunction && PyUtil.hasCustomDecorators((PyFunction)callable)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
highlightIncorrectArguments(holder, result, context);
|
||||
highlightMissingArguments(node, holder, result);
|
||||
highlightStarArgumentTypeMismatch(node, holder, context);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
def fill(f):
|
||||
return lambda: f('test')
|
||||
|
||||
|
||||
@fill
|
||||
def test(x):
|
||||
return x
|
||||
|
||||
|
||||
test()
|
||||
@@ -133,4 +133,9 @@ public class PyArgumentListInspectionTest extends PyTestCase {
|
||||
public void testFloatConstructor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-10601
|
||||
public void testDecoratedChangedParameters() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user