From 9b9581f34ed7b595c8747fd226c0804b67043bba Mon Sep 17 00:00:00 2001 From: Napalys Date: Fri, 29 Nov 2024 17:24:58 +0100 Subject: [PATCH] Fixed bug where some predicates were flagged without return type even thought they had --- ql/ql/src/queries/style/ValidatePredicateGetReturns.ql | 2 +- ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ql/ql/src/queries/style/ValidatePredicateGetReturns.ql b/ql/ql/src/queries/style/ValidatePredicateGetReturns.ql index ad7db6e059075..7b02f50280871 100644 --- a/ql/ql/src/queries/style/ValidatePredicateGetReturns.ql +++ b/ql/ql/src/queries/style/ValidatePredicateGetReturns.ql @@ -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(). diff --git a/ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll b/ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll index b18649ea8cc7f..907dbff082354 100644 --- a/ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll +++ b/ql/ql/test/queries/style/ValidatePredicateGetReturns/test.qll @@ -35,3 +35,6 @@ 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()) }