diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-19 02:05:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-19 02:05:45 +0800 |
commit | 9b91ebedd8ede80fcd0c001fffe96d2a10e41b39 (patch) | |
tree | b30e6ec4c1d55bd2c2d676979d107cfdaa30f6cb /test | |
parent | bd3cd4a5d1cf8effcf8d8403372d59553245e026 (diff) | |
download | lua-language-server-9b91ebedd8ede80fcd0c001fffe96d2a10e41b39.zip |
run local in function
Diffstat (limited to 'test')
-rw-r--r-- | test/type_inference/init.lua | 131 |
1 files changed, 130 insertions, 1 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 9e3bcc50..91fc0eb8 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -1501,7 +1501,7 @@ local x x = 1 ]] -TEST 'string|integer' [[ +TEST 'integer' [[ local x x = '1' <?x?> = 1 @@ -1521,9 +1521,138 @@ print(<?x?>) x = 1 ]] +TEST 'integer' [[ +local x +x = '1' +x = 1 +print(<?x?>) +]] + +TEST 'unknown' [[ +local x + +function A() + print(<?x?>) +end +]] + TEST 'string|integer' [[ local x + +function A() + print(<?x?>) +end + x = '1' x = 1 +]] + +TEST 'string' [[ +local x + +x = '1' + +function A() + print(<?x?>) +end + +x = 1 +]] + +TEST 'integer' [[ +local x + +x = '1' +x = 1 + +function A() + print(<?x?>) +end + +]] + +TEST 'boolean' [[ +local x + +function A() + x = true + print(<?x?>) +end + +x = '1' +x = 1 +]] + +TEST 'string|integer' [[ +local x + +function A() + x = true +end + print(<?x?>) +x = '1' +x = 1 +]] + +TEST 'boolean' [[ +local x + +function A() + x = true + function B() + print(<?x?>) + end +end + +x = '1' +x = 1 +]] + +TEST 'table' [[ +local x + +function A() + x = true + function B() + x = {} + print(<?x?>) + end +end + +x = '1' +x = 1 +]] + +TEST 'boolean' [[ +local x + +function A() + x = true + function B() + x = {} + end + print(<?x?>) +end + +x = '1' +x = 1 +]] + +TEST 'string|integer' [[ +local x + +function A() + x = true + function B() + x = {} + end +end + +function C() + print(<?x?>) +end + +x = '1' +x = 1 ]] |