summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-15 16:29:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-15 16:29:20 +0800
commite88c7d0e1a0ce37b9377f86b37d6ed963fd935b0 (patch)
tree4fae828ed6652ec5e6d84e67e9d198e8333f6433 /test
parent96b4e0ba089c717aa5455a7f6fcf6caee863a74e (diff)
downloadlua-language-server-e88c7d0e1a0ce37b9377f86b37d6ed963fd935b0.zip
resolve #1154 resolve #1165
infer type by `t and t.x`
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 5ed572dd..a12e702f 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -2559,3 +2559,24 @@ end
print(<?n?>)
]]
+
+TEST 'table' [[
+---@type table?
+local n
+
+print((n and <?n?>.x))
+]]
+
+TEST 'table' [[
+---@type table?
+local n
+
+n = n and <?n?>.x or 1
+]]
+
+TEST 'table' [[
+---@type table?
+local n
+
+n = ff[n and <?n?>.x]
+]]