summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/hover.lua3
-rw-r--r--server/src/matcher/vm.lua4
-rw-r--r--server/test/hover/init.lua12
3 files changed, 18 insertions, 1 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index 310d7e84..a2ced9fe 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -252,6 +252,9 @@ local function buildValueReturns(result)
for i, rtn in ipairs(func.returns) do
strs[i] = rtn.type
end
+ if #strs == 0 then
+ strs[1] = 'any'
+ end
return '\n -> ' .. table.concat(strs, ', ')
end
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 50de4041..fc66d6aa 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -964,15 +964,17 @@ function mt:doDo(action)
end
function mt:doReturn(action)
+ self:getCurrentFunction().hasReturn = true
for i, exp in ipairs(action) do
local value = self:getExp(exp)
- self:addInfo(value, 'return', exp)
if value.type == 'list' then
for x, v in ipairs(value) do
+ self:addInfo(v, 'return', exp)
self:setFunctionReturn(self:getCurrentFunction(), i + x - 1, v)
end
break
else
+ self:addInfo(value, 'return', exp)
self:setFunctionReturn(self:getCurrentFunction(), i, value)
end
end
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 3cc8305f..7aaad1e4 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -192,3 +192,15 @@ end
[[
function x(a: number, ...)
]]
+
+TEST [[
+local function x()
+ return y()
+end
+
+<?x?>()
+]]
+[[
+function x()
+ -> any
+]]