summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-22 19:00:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-22 19:00:27 +0800
commit79f76ed6611701ca5994fe110eb09e9309499918 (patch)
treef470f3c16de51d92130c05e920b824e37b9993a6 /test
parenta212b62603f6087bc5a34c4aea45f7cdb0643a8b (diff)
downloadlua-language-server-79f76ed6611701ca5994fe110eb09e9309499918.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/definition/luadoc.lua8
-rw-r--r--test/diagnostics/common.lua4
-rw-r--r--test/diagnostics/type-check.lua26
3 files changed, 38 insertions, 0 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 47859b15..b07396fa 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -899,3 +899,11 @@ local <!x!>
---@cast <?x?> integer
]]
+
+TEST [[
+local function f()
+ local <!x!>
+
+ ---@cast <?x?> integer
+end
+]]
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index 5de7d5db..0708f63a 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1655,3 +1655,7 @@ end
k(f())
]]
+
+TEST [[
+---@cast <!x!> integer
+]]
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 46997181..afd0a5b6 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -340,5 +340,31 @@ local x
x = 1 + G
]]
+TEST [[
+---@alias A integer
+
+---@type A
+local a
+
+---@type integer
+local b
+
+b = a
+]]
+
+TEST [[
+---@type string|boolean
+local t
+
+---@cast t string
+]]
+
+TEST [[
+---@type string|boolean
+local t
+
+---@cast t <!number!>
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')