summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-08-11 19:40:52 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-08-11 19:40:52 +0800
commit525d095c55c696a36f67caae5e4e8f631e10c116 (patch)
treec3475e08b037efdbbe2562f3a5c1086889056573 /test
parent1055a8547668308633601a8b67f1a0b52075de3f (diff)
downloadlua-language-server-525d095c55c696a36f67caae5e4e8f631e10c116.zip
stash
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/init.lua1
-rw-r--r--test/diagnostics/inject-field.lua25
2 files changed, 26 insertions, 0 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index cd6a5c03..99a5dc24 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -90,6 +90,7 @@ check 'empty-block'
check 'global-element'
check 'global-in-nil-env'
check 'incomplete-signature-doc'
+check 'inject-field'
check 'invisible'
check 'lowercase-global'
check 'missing-fields'
diff --git a/test/diagnostics/inject-field.lua b/test/diagnostics/inject-field.lua
new file mode 100644
index 00000000..8e2273b5
--- /dev/null
+++ b/test/diagnostics/inject-field.lua
@@ -0,0 +1,25 @@
+TEST [[
+---@class Class
+local m = {}
+
+m.xx = 1 -- OK
+
+---@type Class
+local m
+
+m.xx = 1 -- OK
+m.<!yy!> = 1 -- Warning
+]]
+
+TEST [[
+---@class Class
+local m = {}
+
+m.xx = 1 -- OK
+
+---@class Class
+local m
+
+m.xx = 1 -- OK
+m.yy = 1 -- OK
+]]