diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-08-23 15:13:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-08-23 15:13:51 +0800 |
commit | c2018e05de0e9eebadbe094357d22883a608fdf5 (patch) | |
tree | 9a95a05a88f0e828c37c973732ef15fc80ce216b /test/diagnostics | |
parent | cb16010fbb4128e2a5a31013e02b8cc4a4318be8 (diff) | |
download | lua-language-server-c2018e05de0e9eebadbe094357d22883a608fdf5.zip |
support `---@class (exact)`
#1990
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/inject-field.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/diagnostics/inject-field.lua b/test/diagnostics/inject-field.lua index f4d847e9..9bb0f8fc 100644 --- a/test/diagnostics/inject-field.lua +++ b/test/diagnostics/inject-field.lua @@ -62,3 +62,23 @@ local t t.x = 1 -- OK t.y = 2 -- OK ]] + + +TEST [[ +---@class (exact) Class +---@field x number +local m = { + x = 1, -- OK + <!y!> = 2, -- Warning +} + +m.x = 1 -- OK +m.<!y!> = 2 -- Warning + +function m:init() -- OK + self.x = 1 -- OK + self.<!y!> = 2 -- Warning + function self:<!xx!>() -- Warning + end +end +]] |