Python: ObjectAPI to ValueAPI: Makes isAbstract a predicate in CallArgs

This commit is contained in:
Rebecca Valentine
2020-03-31 22:56:44 -07:00
parent 85eb43de7d
commit 741317bd05
2 changed files with 5 additions and 1 deletions

View File

@@ -255,3 +255,7 @@ predicate overridden_call(FunctionValue func, FunctionValue overriding, Call cal
overriding.getACall().getNode() = call
}
/** Holds if `func` will raise a `NotImplemented` error. */
predicate isAbstract(FunctionValue func) {
func.getARaisedType() = ClassValue::notImplementedError()
}

View File

@@ -21,7 +21,7 @@ where
or
too_few_args(call, func, limit) and too = "too few arguments" and should = "no fewer than "
) and
not func.isAbstract() and
not isAbstract(func) and
not exists(FunctionValue overridden | func.overrides(overridden) and correct_args_if_called_as_method(call, overridden))
/* The semantics of `__new__` can be a bit subtle, so we simply exclude `__new__` methods */
and not func.getName() = "__new__"