summaryrefslogtreecommitdiff
path: root/test/crossfile
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-02-02 15:07:35 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-02-02 15:07:35 +0800
commit034d4f4793e0934a697e8cf2c6219e8c5648472d (patch)
tree606155ab4953cd38e06d8cb87783723e9035ea2e /test/crossfile
parenteeb9ba02ab7b4d51dced712c49eaf976be46bc74 (diff)
downloadlua-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.lua30
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',
+}