diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 17:38:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 17:38:38 +0800 |
commit | 61d9a99cb32487defbf72486d079e9c7324e4e51 (patch) | |
tree | dc1f81dfb50ac5e0254ededb101611f8bf48c6ac /test/diagnostics | |
parent | 5d46db21e707be3b23655ef7fc1dfc41c36464a2 (diff) | |
download | lua-language-server-61d9a99cb32487defbf72486d079e9c7324e4e51.zip |
update
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/type-check.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 147d6229..036456fe 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -396,5 +396,46 @@ a.x = XX f(a.x) ]] +TEST [[ +---@type string? +local x + +local s = <!x!>:upper() +]] + +TEST [[ +---@alias A string|boolean + +---@param x string|boolean +local function f(x) end + +---@type A +local x + +f(x) +]] + +TEST [[ +---@alias A string|boolean + +---@param x A +local function f(x) end + +---@type string|boolean +local x + +f(x) +]] + +TEST [[ +---@type boolean[] +local t = {} + +---@type boolean? +local x + +t[#t+1] = x +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') |