diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 21:08:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 21:08:12 +0800 |
commit | 896a1affdeed8304688611674df88140a5cc180e (patch) | |
tree | b9336e9c8d4ea52cf4b6f1aa54d341e1edad305f /test | |
parent | e1912470260bac17e7efc565cb59719beb810d01 (diff) | |
download | lua-language-server-896a1affdeed8304688611674df88140a5cc180e.zip |
infer definitions and types across chain exp
resolve #1561
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 24 | ||||
-rw-r--r-- | test/type_inference/init.lua | 12 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 2da10f93..c14e1242 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -932,4 +932,28 @@ local <!b!> b.<!<?__index?>!> = b ]] +TEST [[ +---@class myClass +local myClass = { nested = {} } + +function myClass.nested.<!fn!>() end + +---@type myClass +local class + +class.nested.<?fn?>() +]] + +TEST [[ +---@class myClass +local myClass = { has = { nested = {} } } + +function myClass.has.nested.<!fn!>() end + +---@type myClass +local class + +class.has.nested.<?fn?>() +]] + config.set(nil, 'Lua.type.castNumberToInteger', true) diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 6f74e1af..f0948b49 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -3791,3 +3791,15 @@ TEST 'A|B' [[ ---@type A|B local <?t?> ]] + +TEST 'function' [[ +---@class myClass +local myClass = { has = { nested = {} } } + +function myClass.has.nested.fn() end + +---@type myClass +local class + +class.has.nested.<?fn?>() +]] |