diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-17 17:19:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-17 17:19:00 +0800 |
commit | be5ef0ab55f4cfa25c1a8a72c4f9df3c3adae16b (patch) | |
tree | abde9cd87cb262baa8da7ac0205ba3468b705e7f /test/diagnostics | |
parent | cf20156aa05c074d3f8ea2bf12277b4b06dfc8c4 (diff) | |
download | lua-language-server-be5ef0ab55f4cfa25c1a8a72c4f9df3c3adae16b.zip |
update
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/common.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index 39839c2a..f9e28941 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -1675,3 +1675,66 @@ local x x = nil ]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type integer +local x + +---@type number +<!x!> = f() +]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type number +local x + +---@type integer +x = f() +]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type number|boolean +local x + +---@type string +<!x!> = f() +]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type number|boolean +local x + +---@type boolean +x = f() +]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type number|boolean +local x + +---@type boolean|string +<!x!> = f() +]] + +TEST [[ +---@diagnostic disable: unused-local, undefined-global + +---@type boolean +local x + +if not x then + return +end + +x = f() +]] |