summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-29 15:12:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-29 15:12:43 +0800
commit5881d4846e20499d3dafe643f1a5fb355756ed7b (patch)
tree0990ad50a4ba1995a4ed3b0e26093906ffd41d0e /test
parentf0522c026acbe08be716aa751b548602604eb3e9 (diff)
downloadlua-language-server-5881d4846e20499d3dafe643f1a5fb355756ed7b.zip
#686
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua40
1 files changed, 34 insertions, 6 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 5d052f7f..d3ff258c 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -96,19 +96,35 @@ TEST 'boolean' [[
<?x?> = not y
]]
-TEST 'integer' [[
+TEST 'any' [[
<?x?> = #y
]]
-TEST 'number' [[
-<?x?> = - y
+TEST 'integer' [[
+<?x?> = #'aaaa'
]]
TEST 'integer' [[
+<?x?> = #{}
+]]
+
+TEST 'any' [[
+<?x?> = - y
+]]
+
+TEST 'number' [[
+<?x?> = - 1.0
+]]
+
+TEST 'any' [[
<?x?> = ~ y
]]
TEST 'integer' [[
+<?x?> = ~ 1
+]]
+
+TEST 'integer' [[
local a = true
local b = 1
<?x?> = a and b
@@ -124,18 +140,30 @@ TEST 'boolean' [[
<?x?> = a == b
]]
-TEST 'integer' [[
+TEST 'any' [[
<?x?> = a << b
]]
-TEST 'string' [[
+TEST 'integer' [[
+<?x?> = 1 << 2
+]]
+
+TEST 'any' [[
<?x?> = a .. b
]]
-TEST 'number' [[
+TEST 'string' [[
+<?x?> = 'a' .. 'b'
+]]
+
+TEST 'any' [[
<?x?> = a + b
]]
+TEST 'number' [[
+<?x?> = 1 + 2.0
+]]
+
TEST 'tablelib' [[
---@class tablelib
table = {}