diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-02-02 15:07:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-02-02 15:07:35 +0800 |
commit | 034d4f4793e0934a697e8cf2c6219e8c5648472d (patch) | |
tree | 606155ab4953cd38e06d8cb87783723e9035ea2e /test/crossfile | |
parent | eeb9ba02ab7b4d51dced712c49eaf976be46bc74 (diff) | |
download | lua-language-server-034d4f4793e0934a697e8cf2c6219e8c5648472d.zip |
special treate for return values of require
2nd should be unknown since Lua 5.3, otherwise should be nil
#1868
Diffstat (limited to 'test/crossfile')
-rw-r--r-- | test/crossfile/infer.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/crossfile/infer.lua b/test/crossfile/infer.lua index 0b458e5f..de29007b 100644 --- a/test/crossfile/infer.lua +++ b/test/crossfile/infer.lua @@ -133,3 +133,33 @@ print(<?X?>) ]], }, infer = 'boolean|integer', } + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local <?a?>, b, c = require 'a +]], }, + infer = 'integer', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, <?b?>, c = require 'a +]], }, + infer = 'unknown', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, b, <?c?> = require 'a +]], }, + infer = 'nil', +} |