File tree 3 files changed +47
-0
lines changed
3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## 3.6.9
4
4
* ` FIX ` [ #1864 ]
5
+ * ` FIX ` [ #1868 ]
5
6
6
7
[ #1864 ] : https://github.com/sumneko/lua-language-server/issues/1864
8
+ [ #1868 ] : https://github.com/sumneko/lua-language-server/issues/1868
7
9
8
10
## 3.6.8
9
11
` 2023-1-31 `
Original file line number Diff line number Diff line change @@ -1484,6 +1484,21 @@ local compilerSwitch = util.switch()
1484
1484
return
1485
1485
end
1486
1486
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
1487
1502
if not args then
1488
1503
return
1489
1504
end
Original file line number Diff line number Diff line change @@ -133,3 +133,33 @@ print(<?X?>)
133
133
]] , },
134
134
infer = ' boolean|integer' ,
135
135
}
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