diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-22 19:00:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-22 19:00:27 +0800 |
commit | 79f76ed6611701ca5994fe110eb09e9309499918 (patch) | |
tree | f470f3c16de51d92130c05e920b824e37b9993a6 /test | |
parent | a212b62603f6087bc5a34c4aea45f7cdb0643a8b (diff) | |
download | lua-language-server-79f76ed6611701ca5994fe110eb09e9309499918.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 8 | ||||
-rw-r--r-- | test/diagnostics/common.lua | 4 | ||||
-rw-r--r-- | test/diagnostics/type-check.lua | 26 |
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') |