fix(debug.getinfo): use GMod's (f, what) base signature so value-passing resolves - #19
Merged
Pollux12 merged 1 commit intoAug 26, 2026
Conversation
…ing 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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CzM9mxWHmgA5b5d926jBH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
custom/debug.getinfo.luadeclares the base signature as the stock-Lua(thread, f, what)form. The base signature is what the analyzer uses whendebug.getinfois referenced as a first-class value (rather than called directly) — so passing it topcallproduces spurious diagnostics:resolves against
fun(thread, f, what), giving:expected 'thread' but found 'function'(fn→thread)expected '(function|integer)' but found '"S"'("S"→f)GMod's documented signature is
debug.getinfo(funcOrStackLevel, fields); the coroutine-first form is valid Lua 5.1 but not the common/documented shape.Fix
Make the 2-arg
(f, what)form the base signature and keep the thread-first forms as---@overloads (adding athread, integeroverload so the coverage the old base provided is preserved).Direct calls are unchanged — the
functionand level-0non-nil refinements still apply, and an arbitrary integer stack level still resolves todebuglib.DebugInfo?. Only the value-passing case is corrected.Verified against a real workspace:
pcall(debug.getinfo, fn, "S")now resolves with no cast and no diagnostics.🤖 Generated with Claude Code
Greptile Summary
The PR corrects
debug.getinfo’s base annotation to use GMod’s two-argument(f, what)signature while retaining thread-first forms as overloads.Confidence Score: 5/5
The PR appears safe to merge with no actionable regressions identified.
The new base parameters retain explicit types and nullable return behavior, while the overload set continues to cover refined function, level-zero, and thread-first calls.
Important Files Changed
(f, what)form to the base signature and preserves thread-first integer coverage through an overload.Reviews (1): Last reviewed commit: "fix(debug.getinfo): use GMod's (f, what)..." | Re-trigger Greptile