You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---@typeClasslocaltesttest.foo.bar=2-- OK, defined in Classtest.foo= {
bar=3
} -- OK, defined in Class---comment---@paramtestParamClasslocaltest2=function(testParam)
testParam.foo= {
bar=4
} -- OK, defined in Classend
Actual Behaviour
Assigning to fields not defined through annotations in classes leads to inject-field diagnostics
Class is defined as having a table field foo.
---@classClasslocalClass= {
foo= {
bar=1
}
}
Yet assigning to foo, even after specifying the type through @type or @param, causes an inject-fields diagnostic to occur.
---@typeClasslocaltesttest.foo.bar=2-- OKtest.foo= {
bar=3
} -- Warning: inject-fields, use @class---comment---@paramtestParamClasslocaltest2=function(testParam)
testParam.foo= {
bar=4
} -- Warning: inject-fields, use @classend
Reproduction steps
Define a class through the @class annotation and table creation syntax.
---@classClasslocalClass= {
foo= {
bar=1
}
}
Assign to fields that store table values.
---@typeClasslocaltesttest.foo.bar=2-- OKtest.foo= {
bar=3
} -- Warning: inject-fields, use @class---comment---@paramtestParamClasslocaltest2=function(testParam)
testParam.foo= {
bar=4
} -- Warning: inject-fields, use @classend
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered:
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?
Annotations, Diagnostics/Syntax Checking
Expected Behaviour
Class definition.
Mutate instance values.
Actual Behaviour
Assigning to fields not defined through annotations in classes leads to inject-field diagnostics
Class
is defined as having a table fieldfoo
.Yet assigning to
foo
, even after specifying the type through@type
or@param
, causes aninject-fields
diagnostic to occur.Reproduction steps
Define a class through the
@class
annotation and table creation syntax.Assign to fields that store table values.
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: