diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-17 18:15:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-17 18:15:13 +0800 |
commit | 166504aa87a5b2f7fe6bd41b2c572afccb717534 (patch) | |
tree | 5a61486aca3e1a98a4eeceed13e3ac583d0894eb /test/diagnostics | |
parent | 6431519640a087499ea497066a78a6079993b945 (diff) | |
download | lua-language-server-166504aa87a5b2f7fe6bd41b2c572afccb717534.zip |
update
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/common.lua | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index f9e28941..704ac9e5 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -1007,7 +1007,7 @@ function mt2:method2() end local v ---@type Bar local v2 -v2 = v -- TODO 这里应该给警告 +<!v2!> = v v2:<!method1!>() v2:method2() ]] @@ -1677,6 +1677,15 @@ x = nil ]] TEST [[ +---@diagnostic disable: unused-local + +---@type string? +local x + +x = nil +]] + +TEST [[ ---@diagnostic disable: unused-local, undefined-global ---@type integer @@ -1738,3 +1747,51 @@ end x = f() ]] + + +TEST [[ +---@diagnostic disable: unused-local + +---@type boolean +local x + +---@type integer +local y + +<!x!> = y +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class A +---@field x integer +local t + +<!t.x!> = true +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class A +---@field x integer +local t + +---@type boolean +local y + +<!t.x!> = y +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class A +---@field x integer +local t + +t = { + <!x!> = true +} +]] |