Skip to content

Commit

Permalink
check doc.field
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Aug 14, 2023
1 parent 01a741f commit 5ccedb1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions script/core/diagnostics/inject-field.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ return function (uri, callback)
if def.type == 'doc.type.field' then
return
end
if def.type == 'doc.field' then
return
end
end

local howToFix = lang.script('DIAG_INJECT_FIELD_FIX_CLASS', {
Expand Down
23 changes: 23 additions & 0 deletions test/diagnostics/inject-field.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,26 @@ local m
m.xx = 1 -- OK
m.yy = 1 -- OK
]]

TEST [[
---@class Class
---@field x number
---@type Class
local t
t.x = 1 -- OK
t.<!y!> = 2 -- Warning
]]

TEST [[
---@class Class
---@field x number
---@field [any] any
---@type Class
local t
t.x = 1 -- OK
t.y = 2 -- OK
]]

0 comments on commit 5ccedb1

Please sign in to comment.