Disabled call arguments inspection for decorated functions (PY-10601)

This commit is contained in:
Andrey Vlasovskikh
2013-09-19 20:57:12 +04:00
parent a56383ff3b
commit df135fc4fb
3 changed files with 27 additions and 1 deletions
@@ -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();
}
}