summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-12 21:11:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-12 21:11:18 +0800
commit7f04a46898cae87e57912a7e6b4739c61d74b18c (patch)
tree7fa0ff87c5407f2b0a835cc7a080e01e2760d1c1 /test
parentb353856c94faa6ec76944f5dea70af3d31a77d14 (diff)
downloadlua-language-server-7f04a46898cae87e57912a7e6b4739c61d74b18c.zip
stash
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/type-check.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 383527c2..5450eda4 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -784,6 +784,43 @@ local x
t[x] = true
]]
+TEST [[
+---@param x boolean
+---@return number
+---@overload fun(): boolean
+local function f(x)
+ if x then
+ return 1
+ else
+ return false
+ end
+end
+]]
+
+TEST [[
+---@param x boolean
+---@return number
+---@overload fun()
+local function f(x)
+ if x then
+ return 1
+ else
+ return
+ end
+end
+]]
+
+--TEST [[
+-----@param x boolean
+-----@return number
+-----@overload fun()
+--local function f(x)
+-- if x then
+-- return 1
+-- end
+--end
+--]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')