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?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
No warning.
Actual Behaviour
Fields cannot be injected into the reference of `AClass` for `a`. To do so, use `---@class` for `o`.Lua Diagnostics.(inject-field)

Reproduction steps
local function new()
---@class AClass
local obj = {
a = 1
}
obj.b = 2
return obj
end
local o = new()
o.a = 2 -- This gives a warning
o.b = 3
Additional Notes
When initializing a class with a table constructor, the used fields are no longer mutable, they seem to be semi existent. Existent enough for autocompletion and usage, but not for modifications.
Log File
No response
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?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
No warning.
Actual Behaviour
Reproduction steps
Additional Notes
When initializing a class with a table constructor, the used fields are no longer mutable, they seem to be semi existent. Existent enough for autocompletion and usage, but not for modifications.
Log File
No response