summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-05-23 14:08:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-05-23 14:08:38 +0800
commit7aac1748434eda3726d1ed001edd1327c3973e0b (patch)
tree8e33cfa5fb954a168fcb04745aa3bad677d85981
parentfc63802fca2c98643bcfc63bd251a7394536c1de (diff)
downloadlua-language-server-7aac1748434eda3726d1ed001edd1327c3973e0b.zip
trace filter of `repeat`
fix #2113
-rw-r--r--.vscode/launch.json3
-rw-r--r--changelog.md3
-rw-r--r--script/vm/tracer.lua6
-rw-r--r--test/type_inference/init.lua6
4 files changed, 15 insertions, 3 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 2b077bee..b80e7f49 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -36,9 +36,6 @@
]
],
"windows": {
- "name": "🍄attach",
- "type": "lua",
- "request": "attach",
"sourceMaps": [
[
"script\\*",
diff --git a/changelog.md b/changelog.md
index 50328c9c..167f6984 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,9 @@
## 3.6.20
* `NEW` support connecting by socket with `--socket=PORT`
+* `FIX` [#2113]
+
+[#2113]: https://github.com/LuaLS/lua-language-server/issues/2113
## 3.6.19
`2023-4-26`
diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua
index a8aa0c7c..e47a9824 100644
--- a/script/vm/tracer.lua
+++ b/script/vm/tracer.lua
@@ -296,6 +296,9 @@ local lookIntoChild = util.switch()
topNode = tracer.nodes[action]:copy()
end
end
+ if action.type == 'repeat' then
+ tracer:lookIntoChild(action.filter, topNode)
+ end
return topNode, outNode
end)
: case 'in'
@@ -745,6 +748,9 @@ function mt:lookIntoBlock(block, start, node)
::CONTINUE::
end
self.nodes[block] = node
+ if block.type == 'repeat' then
+ self:lookIntoChild(block.filter, node)
+ end
if block.type == 'do'
or block.type == 'loop'
or block.type == 'in'
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 6a8ba588..55b4f7af 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -4292,3 +4292,9 @@ local m = setmetatable({},{ __index = { a = 1 } })
m.<?a?>
]]
+
+TEST 'integer' [[
+local x = 1
+repeat
+until <?x?>
+]]