From 8ce543bf4ddc2127abf249c7042347a55314c296 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Mon, 8 Jun 2026 23:15:55 +0200 Subject: [PATCH] Fix: `getNumResult()` was wrong in some cases It was the number of result declarations, which is different from the number of results when one result declaration declares more than one variable, as in `x, y int`. --- go/ql/lib/semmle/go/Expr.qll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/ql/lib/semmle/go/Expr.qll b/go/ql/lib/semmle/go/Expr.qll index d50456411fd..0d3955a80df 100644 --- a/go/ql/lib/semmle/go/Expr.qll +++ b/go/ql/lib/semmle/go/Expr.qll @@ -1063,8 +1063,8 @@ class FuncTypeExpr extends @functypeexpr, TypeExpr, ScopeNode, FieldParent { */ ResultVariableDecl getAResultDecl() { result = this.getResultDecl(_) } - /** Gets the number of results of this function type. */ - int getNumResult() { result = count(this.getAResultDecl()) } + /** Gets the number of result parameters of this function type. */ + int getNumResult() { result = count(this.getAResultDecl().getANameExpr()) } /** * Gets the result of this function type, if there is only one.