diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 15:54:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 15:54:58 +0800 |
commit | 93abb07995244becd028828c1bfb9ee4a76ca7f9 (patch) | |
tree | be0f7cfe7a3c86eec157585f82f407ed067b5f59 /test/diagnostics | |
parent | e9c0fee9f413cc55d141231a40775cb48037ccf3 (diff) | |
parent | 5a8e3212d25a5c511e25cdf00232e807a7fb5da7 (diff) | |
download | lua-language-server-93abb07995244becd028828c1bfb9ee4a76ca7f9.zip |
Merge branch 'master' into not-yieldable
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/init.lua | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 1d8c4018..96e9e16d 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -307,7 +307,7 @@ Instance = _G[InstanceName] ]] TEST [[ -(''):sub(1, 2) +local _ = (''):sub(1, 2) ]] TEST [=[ @@ -432,7 +432,7 @@ f(1, 2, 3, 4) ]] TEST [[ -next({}, 1, <!2!>) +local _ = next({}, 1, <!2!>) print(1, 2, 3, 4, 5) ]] @@ -464,7 +464,7 @@ f(1, 2, 3) ]] TEST [[ -<!unpack!>() +local _ = <!unpack!>() ]] TEST [[ @@ -1354,8 +1354,8 @@ f() TEST [[ ---@type file* local f -f:read '*a' -f:read('*a') +local _ = f:read '*a' +local _ = f:read('*a') ]] TEST [[ @@ -1391,55 +1391,40 @@ end ]] TEST [[ ----@param f async fun() -function CB(f) - <!f!>() +local function f(cb) + cb() end -]] - -TEST [[ -local cb -cb(function () ---@async +<!f!>(function () ---@async return nil end) ]] TEST [[ ----@param f async fun() -function CB(f) - return f +local function f(cb) + pcall(cb) end -CB(function () ---@async +<!f!>(function () ---@async return nil end) ]] TEST [[ -function CB(f) - return f +---@nodiscard +local function f() + return 1 end -<!CB!>(function () ---@async - return nil -end) +<!f()!> ]] -TEST [[ ----@type fun(f: async fun()) -local cb - -cb(function () ---@async - return nil -end) -]] TEST [[ ----@type fun(f: fun()) -local cb +---@nodiscard +local function f() + return 1 +end -<!cb!>(function () ---@async - return nil -end) +X = f() ]] |