summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-25 03:48:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-25 03:48:33 +0800
commitfa7375775e97d68ce7507b0c7e50eced84bab2ac (patch)
tree6e54e79cc4f8b4b1cdf6e97c8bad09db09673902 /test
parent711c5d44484366ac80d02ff42fc8fab908b10739 (diff)
downloadlua-language-server-fa7375775e97d68ce7507b0c7e50eced84bab2ac.zip
add 2 type related settings
`type.castNumberToInteger` and `type.weakUnionCheck`
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/type-check.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 036456fe..711211e8 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -437,5 +437,47 @@ local x
t[#t+1] = x
]]
+TEST [[
+---@type number
+local n
+---@type integer
+local i
+
+<?i?> = n
+]]
+
+config.set(nil, 'Lua.type.castNumberToInteger', true)
+TEST [[
+---@type number
+local n
+---@type integer
+local i
+
+i = n
+]]
+config.set(nil, 'Lua.type.castNumberToInteger', false)
+
+TEST [[
+---@type number|boolean
+local nb
+
+---@type number
+local n
+
+<?n?> = nb
+]]
+
+config.set(nil, 'Lua.type.weakUnionCheck', true)
+TEST [[
+---@type number|boolean
+local nb
+
+---@type number
+local n
+
+n = nb
+]]
+config.set(nil, 'Lua.type.weakUnionCheck', false)
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')