diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-21 18:03:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-21 18:03:04 +0800 |
commit | 57dd96177c217611de4aced4efde94106ee389d3 (patch) | |
tree | 56f2ea84f24b5e9354aeddaef1099767c1140dbd /test-beta | |
parent | d93af8f2d23cace5716aa842901bdfc70a4b429c (diff) | |
download | lua-language-server-57dd96177c217611de4aced4efde94106ee389d3.zip |
泛型的类型推断
Diffstat (limited to 'test-beta')
-rw-r--r-- | test-beta/type_inference/init.lua | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test-beta/type_inference/init.lua b/test-beta/type_inference/init.lua index 27a94607..867293f8 100644 --- a/test-beta/type_inference/init.lua +++ b/test-beta/type_inference/init.lua @@ -298,8 +298,32 @@ TEST 'class' [[ local <?x?> ]] -do return end TEST 'string' [[ ---@type string local <?x?> ]] + +TEST 'string[]' [[ +---@type string[] +local <?x?> +]] + +TEST 'string|table' [[ +---@type string | table +local <?x?> +]] + +TEST '"enum1"|"enum2"' [[ +---@type '"enum1"' | '"enum2"' +local <?x?> +]] + +TEST 'function' [[ +---@type fun() +local <?x?> +]] + +TEST 'table<string, number>' [[ +---@type table<string, number> +local <?x?> +]] |