Skip to content

Remove dead name-minting helpers: Lua.Name.specialNameType and Lua.Fixture.uniqueName #309

Description

@Unisay

Problem

Two name-minting helpers in the Lua backend are exported but referenced nowhere in lib/, exe/ or test/:

  • Language.PureScript.Backend.Lua.Name.specialNameType — builds the constant Name "$type" through the raw constructor, bypassing the module's own validation (fromText rejects $, and makeSafe would mangle it to _S_type), so the value is not even a valid Lua identifier;
  • Language.PureScript.Backend.Lua.Fixture.uniqueName — a MonadState Natural m ⇒ Text → m Name counter-based minting helper, superseded by the supply in Language.PureScript.Backend.Lua.freshName (which additionally mangles through makeSafe and documents its capture-freedom contract).
-- Lua/Name.hs — the only definition site; no use site exists
specialNameType  Name
specialNameType = Name "$type"

-- Lua/Fixture.hs — likewise unused
uniqueName  MonadState Natural m  Text  m Name
uniqueName prefix = do
  index  get
  modify' (+ 1)
  pure $ unsafeName (prefix <> show index)

Dead exports cost review attention (they look load-bearing, especially specialNameType with its invalid-identifier trick) and uniqueName is an attractive-nuisance duplicate of the real fresh-name supply.

Approach

Delete both definitions and their export entries; the build stays green since nothing references them.

Prerequisites / Relations

Independent. Both helpers live in Lua-backend modules last touched by the emission-time renumbering work (#306, merged); nothing blocks this and it blocks nothing.

Verification / Measurement

grep -rn 'specialNameType\|uniqueName' lib/ exe/ test/ finds only the definition and export sites before the change (the uniqueName in IR/Uniquify.hs is an unrelated local function); after the deletion the tree greps clean for both names and cabal test all stays green with no new warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: codegenLua code generation / printingchoreMaintenance / infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions