summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/generic.lua8
-rw-r--r--script/parser/ast.lua5
-rw-r--r--test/definition/luadoc.lua15
3 files changed, 26 insertions, 2 deletions
diff --git a/script/core/generic.lua b/script/core/generic.lua
index 61ce55c4..9f203e69 100644
--- a/script/core/generic.lua
+++ b/script/core/generic.lua
@@ -96,9 +96,13 @@ local function createValue(closure, proto, callback, road)
return value
end
if proto.type == 'doc.type.array' then
- road[#road+1] = linker.SPLIT_CHAR
+ if road then
+ road[#road+1] = linker.SPLIT_CHAR
+ end
local node = createValue(closure, proto.node, callback, road)
- road[#road] = nil
+ if road then
+ road[#road] = nil
+ end
if not node then
return nil
end
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 4f27d37d..47093f0e 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -1460,6 +1460,11 @@ local Defs = {
local values
if func then
local call = createCall(exp, func.finish + 1, exp.finish)
+ if #exp == 0 then
+ exp[1] = getSelect(func, 1)
+ exp[2] = getSelect(func, 2)
+ exp[3] = getSelect(func, 3)
+ end
call.node = func
call.start = inA
func.next = call
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 3620f25e..fe6d1e21 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -427,6 +427,21 @@ local <?<!c!>?> = f(b)
]]
TEST [[
+---@class C
+local <!v1!>
+
+---@generic V, T
+---@param t T
+---@return fun(t: V[]): V
+---@return T
+local function iterator(t) end
+
+for <!v!> in iterator(v1) do
+ print(<?v?>)
+end
+]]
+
+TEST [[
---@class Foo
local Foo = {}
function Foo:<!bar1!>() end