Skip to content

Commit

Permalink
Fixed bug where some predicates were flagged without return type even…
Browse files Browse the repository at this point in the history
… thought they had
  • Loading branch information
Napalys committed Nov 29, 2024
1 parent a462ec9 commit 7c1aa84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ql/ql/src/queries/style/ValidatePredicateGetReturns.ql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ predicate isGetPredicate(Predicate pred) { pred.getName().regexpMatch("(get|as)[
/**
* Checks if a predicate has a return type.
*/
predicate hasReturnType(Predicate pred) { exists(pred.getReturnType()) }
predicate hasReturnType(Predicate pred) { exists(pred.getReturnTypeExpr()) }

/**
* Checks if a predicate is an alias using getAlias().
Expand Down
5 changes: 5 additions & 0 deletions ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ predicate assessment() { none() }

// OK -- starts with as and returns a value
string asString() { result = "string" }

// OK -- starts with get and returns a value
HiddenType getInjectableCompositeActionNode() {
exists(HiddenType hidden | result = hidden.toString())
}

0 comments on commit 7c1aa84

Please sign in to comment.