lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

duplicate-set-field diagnostic when assigning a function to a table field

Open urnati opened this issue 1 year ago • 1 comments

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

No diagnostic warning on assignment because the variable has been 'cleared'.

Actual Behaviour

The two info.func assignments that are "= function" get a Duplicate field 'func' (duplicate-set-field) diagnostic. The info.func assignment "= l1" does not. Scope depth does not seem to impact the diagnostic - within the same function.

Assignments to other fields that are string, integer, etc do not get the diagnostic. FYI - the ".func" is expected in a library I cannot change.

Reproduction steps

local function l1() end local function f1() local info = {}; do info = {}; info.notCheckable = true info.func = function() -- any code end end info = {}; info.notCheckable = true info.func = function() -- any code end info = {}; info.notCheckable = true info.func = l1 end

Additional Notes

No response

Log File

No response

urnati avatar Feb 28 '24 13:02 urnati

chiming in that I also experience this

pearagit avatar Apr 05 '24 01:04 pearagit