diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/diagnostics/init.lua | 12 | ||||
-rw-r--r-- | test/full/example.lua | 1 | ||||
-rw-r--r-- | test/???.md | 94 |
3 files changed, 10 insertions, 97 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 4e485d2a..d95bf380 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -350,8 +350,7 @@ TEST [[ --<!function F() end!> --]] -config.config.diagnostics.disable['unused-local'] = false -config.config.diagnostics.disable['unused-function'] = true +config.config.diagnostics.disable['unused-local'] = nil TEST [[ local mt, x function mt:m() @@ -833,7 +832,7 @@ TEST [[ ---@class class local t ]] - +---[==[ -- checkUndefinedField 通用 TEST [[ ---@class Foo @@ -960,3 +959,10 @@ print(T1.f1) T2 = {} print(T2.<!f2!>) ]] +--]==] +TEST [[ +---@overload fun(...) +local function f() end + +f(1) +]] diff --git a/test/full/example.lua b/test/full/example.lua index 57d02c38..4f6090ee 100644 --- a/test/full/example.lua +++ b/test/full/example.lua @@ -41,6 +41,7 @@ local function testIfExit(path) local lines = parser:lines(buf) for i = 1, max do files.removeAll() + files.open('') files.setText('', buf) diag('', function () end) local passed = os.clock() - clock diff --git a/test/???.md b/test/???.md deleted file mode 100644 index 46a4b58a..00000000 --- a/test/???.md +++ /dev/null @@ -1,94 +0,0 @@ -# 如何搜索引用 - -```lua -local x = 1 -print(x) -- 通过语法搜索到 local x -``` - -```lua -local function f() -end - -local x = f -print(x) -- 通过 x 的赋值搜索到函数 -``` - -```lua -X.Y.Z = 1 -print(X.Y.Z) -- 通过 field 的赋值行为搜索 -``` - -```lua -local function f() - return f -end - -local x = f() -print(x) -- 引用不穿透函数调用? -``` - -```lua -local t = { - x = 1 -} - -print(t.x) -- 引用穿透表 -``` - -```lua -local function f() - return { - x = 1 - } -end - -local t = f() -print(t.x) -- 是否穿透函数返回的表? -``` - -在栈帧上标记值? - -```lua -X.Y.Z = 1 -local t = X.Y -print(t.Z) -``` - -字符串匹配? -1. t -> Z -2. X.Y -> Z -3. X.Y.Z = 1 - -语义匹配? -1. t -> Z -2. X.Y -> Z -3. X -> Y -> Z -4. X.Y.Z = 1 - -建立标记? -```lua -{ - type = 'set', - key = { - 's|X', - 's|Y', - 's|Z', - } - v = 1, -}, -{ - type = 'local', - key = 't', - v = { - 's|X', - 's|Y', - }, -}, -{ - type = 'get', - key = { - 'l|t', - 's|Z', - } -} -``` |