mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
#PY-16228 fixed Enable PyArgumentEqualDefaultInspection for decorators
This commit is contained in:
@@ -80,6 +80,18 @@ public class PyArgumentEqualDefaultInspection extends PyInspection {
|
||||
checkArguments(node, node.getArguments());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPyDecoratorList(final PyDecoratorList node) {
|
||||
PyDecorator[] decorators = node.getDecorators();
|
||||
|
||||
for (PyDecorator decorator: decorators) {
|
||||
if (decorator.hasArgumentList()) {
|
||||
PyExpression[] arguments = decorator.getArguments();
|
||||
checkArguments(decorator, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasSpecialCasedDefaults(PyCallable callable, PsiElement anchor) {
|
||||
final String name = callable.getName();
|
||||
final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor);
|
||||
|
||||
@@ -78,4 +78,11 @@ def f1(value=-1):
|
||||
print(value)
|
||||
|
||||
def f2():
|
||||
f1(value =-2)
|
||||
f1(value =-2)
|
||||
|
||||
def decorator(arg='baz'):
|
||||
return lambda x: x
|
||||
|
||||
@decorator(<weak_warning descr="Argument equals to default parameter value">arg='baz'</weak_warning>)
|
||||
def f<error descr="'(' expected">:</error>
|
||||
pass
|
||||
Reference in New Issue
Block a user