File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 22
33## 3.6.9
44* ` FIX ` [ #1864 ]
5+ * ` FIX ` [ #1868 ]
56
67[ #1864 ] : https://github.com/sumneko/lua-language-server/issues/1864
8+ [ #1868 ] : https://github.com/sumneko/lua-language-server/issues/1868
79
810## 3.6.8
911` 2023-1-31 `
Original file line number Diff line number Diff line change @@ -1484,6 +1484,21 @@ local compilerSwitch = util.switch()
14841484 return
14851485 end
14861486 if func .special == ' require' then
1487+ if index == 2 then
1488+ local uri = guide .getUri (source )
1489+ local version = config .get (uri , ' Lua.runtime.version' )
1490+ if version == ' Lua 5.3'
1491+ or version == ' Lua 5.4' then
1492+ vm .setNode (source , vm .declareGlobal (' type' , ' unknown' ))
1493+ else
1494+ vm .setNode (source , vm .declareGlobal (' type' , ' nil' ))
1495+ end
1496+ return
1497+ end
1498+ if index >= 3 then
1499+ vm .setNode (source , vm .declareGlobal (' type' , ' nil' ))
1500+ return
1501+ end
14871502 if not args then
14881503 return
14891504 end
Original file line number Diff line number Diff line change @@ -133,3 +133,33 @@ print(<?X?>)
133133]] , },
134134 infer = ' boolean|integer' ,
135135}
136+
137+ TEST {
138+ { path = ' a.lua' , content = [[
139+ return 1337, "string", true
140+ ]] , },
141+ { path = ' b.lua' , content = [[
142+ local <?a?>, b, c = require 'a
143+ ]] , },
144+ infer = ' integer' ,
145+ }
146+
147+ TEST {
148+ { path = ' a.lua' , content = [[
149+ return 1337, "string", true
150+ ]] , },
151+ { path = ' b.lua' , content = [[
152+ local a, <?b?>, c = require 'a
153+ ]] , },
154+ infer = ' unknown' ,
155+ }
156+
157+ TEST {
158+ { path = ' a.lua' , content = [[
159+ return 1337, "string", true
160+ ]] , },
161+ { path = ' b.lua' , content = [[
162+ local a, b, <?c?> = require 'a
163+ ]] , },
164+ infer = ' nil' ,
165+ }
You can’t perform that action at this time.
0 commit comments