summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-27 19:07:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-27 19:07:46 +0800
commitedc9797838506728ba65a50b94781ac99e3bdd86 (patch)
tree27aac9c1216cc2075621ad36da57183111cd6c22 /test
parentcae348536cef3f2f5f96c5821c7e45539aeff1cf (diff)
downloadlua-language-server-edc9797838506728ba65a50b94781ac99e3bdd86.zip
diagnostic `missing-return-value`
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/common.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index e88fbf43..5e65b410 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1704,3 +1704,41 @@ function t:init() end
TEST [[
return function f(x, y, z) end
]]
+
+util.arrayInsert(disables, 'redundant-return')
+TEST [[
+---@return number
+function F()
+ <!return!>
+end
+]]
+
+TEST [[
+---@return number, number
+function F()
+ <!return!> 1
+end
+]]
+
+TEST [[
+---@return number, number?
+function F()
+ return 1
+end
+]]
+
+do return end
+TEST [[
+---@return number
+function F()
+ X = 1<!!>
+end
+]]
+
+TEST [[
+---@return number, number?
+function F()
+ return 1, 1, <!1!>
+end
+]]
+util.arrayRemove(disables, 'redundant-return')