summaryrefslogtreecommitdiff
path: root/test/diagnostics/type-check.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-05 16:04:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-05 16:04:12 +0800
commite711f30dbcf840e8adec49a78d734d1a0306934b (patch)
treebb93c69ebfc9363554b939a1f93696fa4ad2f608 /test/diagnostics/type-check.lua
parenta00de14e61b02e3b015fe33f8c01b748113bf4ce (diff)
downloadlua-language-server-e711f30dbcf840e8adec49a78d734d1a0306934b.zip
resolve #1280
Diffstat (limited to 'test/diagnostics/type-check.lua')
-rw-r--r--test/diagnostics/type-check.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 32f60f82..f1f14b48 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -631,5 +631,38 @@ n = nb
]]
config.set(nil, 'Lua.type.weakNilCheck', false)
+TEST [[
+---@class A
+local a = {}
+
+---@class B: A
+local <!b!> = a
+]]
+
+TEST [[
+---@class A
+local a = {}
+a.__index = a
+
+---@class B: A
+local b = setmetatable({}, a)
+]]
+
+TEST [[
+---@class A
+local a = {}
+
+---@class B: A
+local b = setmetatable({}, {__index = a})
+]]
+
+TEST [[
+---@class A
+local a = {}
+
+---@class B
+local <!b!> = setmetatable({}, {__index = a})
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')