Skip to content

Codegen: zero-method dictionaries are threaded through as empty-table arguments #275

Description

@Unisay

Problem

Found while linting pslua-generated Lua in a downstream application (OpenResty, with luacheck and lua-language-server). Cosmetic only: the code runs and passes luac -p. Re-confirmed on current main.

Dictionaries for method-less classes (Prim.Row.Cons, Prim.RowList.RowToList, and similar) are emitted as empty tables and passed to call sites that never read them. An example is a dispatchCons slot receiving an empty Row.Cons dictionary in RowToList-driven dispatch. No pass erases empty dictionaries or the parameters bound to them, so they ride through as inert {} values.

Approach

Erase parameters bound to provably zero-method dictionaries and drop the matching call-site arguments.

Prerequisites / Relations

Overlaps with #273 (shared unused-parameter / dead-argument handling; non-blocking).

Verification / Measurement

The RowToList-driven dispatchCons example no longer receives an empty Row.Cons dictionary argument; generated output still passes luac -p. Low priority: a handful of dead arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OptimisationA Compiler Optimisationarea: irIR / optimizer / DCE / inlinerenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions