fix the arity of predicate aliases

This commit is contained in:
Erik Krogh Kristensen
2021-05-29 19:20:55 +00:00
committed by GitHub
parent 8dc3948221
commit bd86ffb35b
4 changed files with 29 additions and 1 deletions

View File

@@ -154,7 +154,14 @@ class Predicate extends TPredicate, AstNode {
/**
* Gets the number of parameters.
*/
int getArity() { result = count(getParameter(_)) }
int getArity() {
not this.(ClasslessPredicate).getAlias() instanceof PredicateExpr and
result = count(getParameter(_))
or
exists(PredicateExpr alias | alias = this.(ClasslessPredicate).getAlias() |
result = alias.getArity()
)
}
/**
* Gets the return type (if any) of the predicate.

View File

@@ -240,6 +240,7 @@ module PredConsistency {
query predicate noResolveCall(Call c) {
not resolveCall(c, _) and
not c instanceof NoneCall and
not c instanceof AnyCall and
not c.getLocation().getFile().getAbsolutePath().regexpMatch(".*/(test|examples)/.*")
}