summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-13 01:38:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-13 01:38:26 +0800
commitd94e046f62badc58eeb761e39269b0f39e08d8ae (patch)
tree2c5d87377fe3cc6c4d4fedab207e47e23f4e944c /test/diagnostics
parent7f04a46898cae87e57912a7e6b4739c61d74b18c (diff)
downloadlua-language-server-d94e046f62badc58eeb761e39269b0f39e08d8ae.zip
diagnostics consider `overload`
resolve #1582
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/type-check.lua33
1 files changed, 23 insertions, 10 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 5450eda4..a938f14c 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -810,16 +810,29 @@ local function f(x)
end
]]
---TEST [[
------@param x boolean
------@return number
------@overload fun()
---local function f(x)
--- if x then
--- return 1
--- end
---end
---]]
+TEST [[
+---@param x boolean
+---@return number
+---@overload fun()
+local function f(x)
+ if x then
+ return 1
+ end
+end
+]]
+
+TEST [[
+---@param x boolean
+---@return number
+---@overload fun(): boolean, boolean
+local function f(x)
+ if x then
+ return 1
+ else
+ return false, false
+ end
+end
+]]
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')