File tree 4 files changed +27
-13
lines changed
4 files changed +27
-13
lines changed Original file line number Diff line number Diff line change 8
8
* ` FIX ` [ #1922 ]
9
9
* ` FIX ` [ #1924 ]
10
10
* ` FIX ` [ #1928 ]
11
+ * ` FIX ` [ #1945 ]
11
12
12
13
[ #1715 ] : https://github.com/LuaLS/lua-language-server/issues/1715
13
14
[ #1753 ] : https://github.com/LuaLS/lua-language-server/issues/1753
14
15
[ #1914 ] : https://github.com/LuaLS/lua-language-server/issues/1914
15
16
[ #1922 ] : https://github.com/LuaLS/lua-language-server/issues/1922
16
17
[ #1924 ] : https://github.com/LuaLS/lua-language-server/issues/1924
17
18
[ #1928 ] : https://github.com/LuaLS/lua-language-server/issues/1928
19
+ [ #1945 ] : https://github.com/LuaLS/lua-language-server/issues/1945
18
20
19
21
## 3.6.13
20
22
` 2023-3-2 `
Original file line number Diff line number Diff line change @@ -1974,6 +1974,12 @@ local function parseSimple(node, funcName)
1974
1974
and node .node == lastMethod then
1975
1975
lastMethod = nil
1976
1976
end
1977
+ if node .type == ' call' then
1978
+ if node .node .special == ' error'
1979
+ or node .node .special == ' os.exit' then
1980
+ node .hasExit = true
1981
+ end
1982
+ end
1977
1983
if node == lastMethod then
1978
1984
if funcName then
1979
1985
lastMethod = nil
@@ -2899,18 +2905,15 @@ local function compileExpAsAction(exp)
2899
2905
end
2900
2906
end
2901
2907
2902
- if exp .type == ' call' then
2903
- if exp .node .special == ' error'
2904
- or exp .node .special == ' os.exit' then
2905
- for i = # Chunk , 1 , - 1 do
2906
- local block = Chunk [i ]
2907
- if block .type == ' ifblock'
2908
- or block .type == ' elseifblock'
2909
- or block .type == ' elseblock'
2910
- or block .type == ' function' then
2911
- block .hasExit = true
2912
- break
2913
- end
2908
+ if exp .hasExit then
2909
+ for i = # Chunk , 1 , - 1 do
2910
+ local block = Chunk [i ]
2911
+ if block .type == ' ifblock'
2912
+ or block .type == ' elseifblock'
2913
+ or block .type == ' elseblock'
2914
+ or block .type == ' function' then
2915
+ block .hasExit = true
2916
+ break
2914
2917
end
2915
2918
end
2916
2919
return exp
Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ vm.binarySwitch = util.switch()
199
199
elseif r1 == false then
200
200
vm .setNode (source , node2 )
201
201
else
202
- local node = node1 :copy ():setTruthy ():merge (node2 )
202
+ local node = node1 :copy ():setTruthy ()
203
+ if not source [2 ].hasExit then
204
+ node :merge (node2 )
205
+ end
203
206
vm .setNode (source , node )
204
207
end
205
208
end )
Original file line number Diff line number Diff line change @@ -4233,3 +4233,9 @@ function A:func()
4233
4233
self.y = self.y + 3
4234
4234
end
4235
4235
]]
4236
+
4237
+ TEST ' number' [[
4238
+ ---@type number?
4239
+ local n
4240
+ local <?v?> = n or error('')
4241
+ ]]
You can’t perform that action at this time.
0 commit comments