Every production call of fromIR in fromUberModule (lib/Language/PureScript/Backend/Lua.hs) passes Set.empty for the topLevelNames parameter, so both branches guarded by Set.member ... topLevelNames (the special case in IR.Ref and the qualified local names in the Let/RecursiveGroup lowering) are dead code.
Beyond the noise, the dead Ref branch is a trap: it matches a Local name against top-level names while ignoring the reference's index, so if anyone ever passes a non-empty set, a local that shadows a top-level name would silently compile to an M.field access. Removing the parameter and both branches eliminates the trap and simplifies the signature.
Found during the 2026-07-02 backend audit (this resolves a hypothesis from the issue #37 session notes: the miscapture is not reachable today precisely because the set is always empty).
Every production call of
fromIRinfromUberModule(lib/Language/PureScript/Backend/Lua.hs) passesSet.emptyfor thetopLevelNamesparameter, so both branches guarded bySet.member ... topLevelNames(the special case inIR.Refand the qualified local names in theLet/RecursiveGrouplowering) are dead code.Beyond the noise, the dead
Refbranch is a trap: it matches aLocalname against top-level names while ignoring the reference's index, so if anyone ever passes a non-empty set, a local that shadows a top-level name would silently compile to anM.fieldaccess. Removing the parameter and both branches eliminates the trap and simplifies the signature.Found during the 2026-07-02 backend audit (this resolves a hypothesis from the issue #37 session notes: the miscapture is not reachable today precisely because the set is always empty).