diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 03:32:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 03:32:57 +0800 |
commit | 420812ce4e77ff4143437b2893dd77fc729c7622 (patch) | |
tree | 92293fc9ab871147060130e432819ea3c3e6f6b9 /test | |
parent | 838ce36fdd7abdff0b4cab5e67c2500325178805 (diff) | |
download | lua-language-server-420812ce4e77ff4143437b2893dd77fc729c7622.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/diagnostics/common.lua | 16 | ||||
-rw-r--r-- | test/type_inference/init.lua | 27 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index 0708f63a..a837fc0f 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -1659,3 +1659,19 @@ k(f()) TEST [[ ---@cast <!x!> integer ]] + +TEST [[ +---@class A + +---@class B +---@field [integer] A +---@field [A] true +]] + +TEST [[ +---@class A + +---@class B +---@field [A] A +---@field [<!A!>] true +]] diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index bca3a546..434307a2 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -3016,3 +3016,30 @@ if type(x) == 'number' then print(<?x?>) end ]] + +TEST 'boolean' [[ +---@class A +---@field [integer] boolean +local mt + +function mt:f() + ---@type integer + local index + local <?x?> = self[index] +end +]] + +TEST 'boolean' [[ +---@class A +---@field [B] boolean + +---@class B + +---@type A +local a + +---@type B +local b + +local <?x?> = a[b] +]] |