Skip to content

[regression] duplicate-set-field on mutually exclusive branches and intentional wrapping assignments #1505

Backlog

Description

@ligurio

0.30.0 reports duplicate-set-field for assignments that 0.25.1 accepts.

Case 1 - the same field assigned in mutually exclusive branches:

local t = {}
if os.getenv('X') then
    t.f = function() end
else
    t.f = function() end
end
return t

Case 2 - intentional wrapping:

local t = {}
t.f = function() end
t.f = t.f
return t

Both produce two "Duplicate field `f" warnings. 0.25.1 reports nothing.

Real-world impact in Tarantool: src/lua/asan.lua (if/else), src/box/lua/backup.lua and src/box/lua/console.lua (wrapping). Note that the same diagnostic also finds real duplicate definitions in Tarantool tests, so it should stay enabled but must not flag branch-exclusive assignments or intentional re-wrapping.

Related: #1355, but it covers different-table and nil-slot cases.

EmmyLua version: 0.30.0, commit 2d2374f

Activity

  1. added a commit that references this issue on Dec 4, 2026
    dd34d92
  2. added theissue type on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions