From ce3f3cfcb6a299fa7c8a95db3fe51212d5ea6429 Mon Sep 17 00:00:00 2001 From: Amy Jeanes Date: Wed, 19 Aug 2026 12:27:07 +0100 Subject: [PATCH] fix(debug.getinfo): use GMod's (f, what) base signature so value-passing resolves The base signature was the stock-Lua (thread, f, what) form. Since the base is what the analyzer uses when debug.getinfo is passed as a first-class value (e.g. pcall(debug.getinfo, fn, "S")), that produced spurious param-type-mismatch warnings - fn checked against `thread`, the fields string against `f`. GMod's documented signature is debug.getinfo(funcOrStackLevel, fields), with the optional coroutine form still valid Lua 5.1. Make the 2-arg (f, what) form the base and keep the thread-first forms as overloads (adding thread+integer to preserve coverage the old base provided). Direct calls are unchanged - the function / level-0 non-nil refinements still apply - only value-passing is fixed. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_018CzM9mxWHmgA5b5d926jBH --- custom/debug.getinfo.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/custom/debug.getinfo.lua b/custom/debug.getinfo.lua index dcf024e6..f5e6c547 100644 --- a/custom/debug.getinfo.lua +++ b/custom/debug.getinfo.lua @@ -34,10 +34,9 @@ ---For out-of-range stack levels, this can return nil. ---@overload fun(f: function, what?: debuglib.InfoWhat): debuglib.DebugInfo ---@overload fun(f: 0, what?: debuglib.InfoWhat): debuglib.DebugInfo ----@overload fun(f: integer, what?: debuglib.InfoWhat): debuglib.DebugInfo? ---@overload fun(thread: thread, f: function, what?: debuglib.InfoWhat): debuglib.DebugInfo ---@overload fun(thread: thread, f: 0, what?: debuglib.InfoWhat): debuglib.DebugInfo ----@param thread thread +---@overload fun(thread: thread, f: integer, what?: debuglib.InfoWhat): debuglib.DebugInfo? --- ---Takes either a function or a number representing the stack level as an argument. Stack level 0 always corresponds to the debug.getinfo call, 1 would be the function calling debug.getinfo in most cases, and so on. --- Returns useful information about that function in a table. @@ -57,4 +56,4 @@ --- --- A table as a Structures/DebugInfo containing information about the function you passed. Can return nil if the stack level didn't point to a valid stack frame. ---@nodiscard -function debug.getinfo(thread, f, what) end +function debug.getinfo(f, what) end