diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-08 19:41:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-08 19:41:06 +0800 |
commit | 256b37771a9203ab0c27d5690e35d9a1f9185465 (patch) | |
tree | ffe9fda7167f17099dd3bdcfa27ec5c4e51dadca /test | |
parent | dd7317a907b88cb102f45535ef19d67b47564c7f (diff) | |
download | lua-language-server-256b37771a9203ab0c27d5690e35d9a1f9185465.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/type_inference/init.lua | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 46c5a4f0..07bbf195 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -1,6 +1,6 @@ local files = require 'files' local guide = require 'parser.guide' -local infer = require 'core.infer' +local infer = require 'vm.infer' local config = require 'config' local catch = require 'catch' @@ -27,9 +27,9 @@ function TEST(wanted) files.setText('', newScript) local source = getSource(catched['?'][1][1]) assert(source) - local result = infer.searchAndViewInfers(source) + local result = infer.viewType(source) if wanted ~= result then - infer.searchAndViewInfers(source) + infer.viewType(source) end assert(wanted == result) files.remove('') @@ -52,12 +52,17 @@ TEST 'number' [[ local <?var?> = 1.0 ]] +TEST 'number' [[ +local <?var?> +var = 1 +var = 1.0 +]] + TEST 'string' [[ local var = '111' t.<?x?> = var ]] -config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST 'string' [[ local <?var?> var = '111' @@ -68,7 +73,6 @@ local var var = '111' print(<?var?>) ]] -config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST 'function' [[ function <?xx?>() @@ -80,13 +84,11 @@ local function <?xx?>() end ]] -config.set(nil, 'Lua.IntelliSense.traceLocalSet', true) TEST 'function' [[ local xx <?xx?> = function () end ]] -config.set(nil, 'Lua.IntelliSense.traceLocalSet', false) TEST 'table' [[ local <?t?> = {} @@ -100,7 +102,7 @@ TEST 'boolean' [[ <?x?> = not y ]] -TEST 'any' [[ +TEST 'integer' [[ <?x?> = #y ]] @@ -112,7 +114,7 @@ TEST 'integer' [[ <?x?> = #{} ]] -TEST 'any' [[ +TEST 'number' [[ <?x?> = - y ]] @@ -120,7 +122,7 @@ TEST 'number' [[ <?x?> = - 1.0 ]] -TEST 'any' [[ +TEST 'integer' [[ <?x?> = ~ y ]] |