Skip to content

Codegen: dropped unused parameters make call sites trip lua-language-server redundant-parameter #273

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.

Instance methods whose parameters are unused emit a function with fewer parameters than the class-method call site passes. The canonical case is IsSymbol: for a concrete symbol the instance is reflectSymbol _ = "tail", which compiles to a zero-parameter function, while the call site keeps the uniform convention and passes the Proxy:

reflectSymbol = function() return "tail" end            -- definition: 0 params
--
local key = dictIsSymbol.reflectSymbol(Type_Proxy_Proxy) -- call site: 1 arg

Lua discards the extra argument, so this runs fine, but lua-language-server flags redundant-parameter at every such call site, and there are many. Present in the Golden.GenericEqTwoTypes and Golden.BugListGenericEq output. Low priority, language-server noise only.

Approach

Either keep a placeholder _ parameter so the definition arity matches the call convention, or narrow the call site to the real arity.

Prerequisites / Relations

Relates to #275 (shared unused-parameter / dead-argument handling; non-blocking).

Verification / Measurement

lua-language-server reports no redundant-parameter on the affected golden outputs (Golden.GenericEqTwoTypes, Golden.BugListGenericEq).

Open questions

Which fix direction to take: a placeholder _ parameter on the definition, or narrowing the call site to the real arity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: codegenLua code generation / printingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions