diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-15 16:29:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-15 16:29:20 +0800 |
commit | e88c7d0e1a0ce37b9377f86b37d6ed963fd935b0 (patch) | |
tree | 4fae828ed6652ec5e6d84e67e9d198e8333f6433 /test | |
parent | 96b4e0ba089c717aa5455a7f6fcf6caee863a74e (diff) | |
download | lua-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.lua | 21 |
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] +]] |