summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-28 19:56:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-28 19:56:28 +0800
commit6aa90f4667b8470fe80889e5fe0f9ab4f96ae86b (patch)
treed15ff1aba4439025522c6441080887afb4e3765b /test
parent79979fede8d754ae12a21843f12e45b54acd24d0 (diff)
downloadlua-language-server-6aa90f4667b8470fe80889e5fe0f9ab4f96ae86b.zip
generic
Diffstat (limited to 'test')
-rw-r--r--test/basic/linker.txt31
-rw-r--r--test/definition/luadoc.lua10
2 files changed, 36 insertions, 5 deletions
diff --git a/test/basic/linker.txt b/test/basic/linker.txt
index 5d3f54e8..ea3ba180 100644
--- a/test/basic/linker.txt
+++ b/test/basic/linker.txt
@@ -113,8 +113,29 @@ local <?r?> = f(<!k!>)
```
l:r
-s:1#1
-l:f#1
-dg:T
-l:f@1
-k
+s:1#1 call
+l:f#1 call
+f:1#1 call -> f:1&T = l:k
+l:f@1 --> 从保存的call信息里找到 f:1&T = l:k
+l:k
+
+
+
+```
+---@generic T, V
+---@param p T
+---@return fun(V):T, V
+local function f(p) end
+
+local f2 = f(<!k!>)
+local <?r?> = f2()
+```
+
+l:r
+s:2|#1 call1
+l:f2|#1 call1
+f:2|#1 call1
+s:1#1|#1 call2
+f:1#1|#1 call2 -> f:1&T = l:k
+dfun:1|#1
+dn:V -> f:1&T = l:k
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 61f203f5..a971dfe1 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -328,6 +328,16 @@ local <?<!f2!>?> = f()
]]
TEST [[
+---@generic T
+---@param x T
+---@return fun():T
+local function f(x) end
+
+local v1 = f(<!{}!>)
+local <?<!v2!>?> = v1()
+]]
+
+TEST [[
---@class Foo
local Foo = {}
function Foo:<!bar1!>() end