summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md6
-rw-r--r--script/vm/tracer.lua4
-rw-r--r--test/type_inference/init.lua14
3 files changed, 22 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index a80ed3a9..9de56cf6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,12 +3,14 @@
## 3.6.11
* `CHG` completion: don't show loading process
* `FIX` [#1886]
-* `FIX` [#1895]
+* `FIX` [#1887]
* `FIX` [#1889]
+* `FIX` [#1895]
[#1886]: https://github.com/LuaLS/lua-language-server/issues/1886
-[#1895]: https://github.com/LuaLS/lua-language-server/issues/1895
+[#1887]: https://github.com/LuaLS/lua-language-server/issues/1887
[#1889]: https://github.com/LuaLS/lua-language-server/issues/1889
+[#1895]: https://github.com/LuaLS/lua-language-server/issues/1895
## 3.6.10
`2023-2-7`
diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua
index a13d00e1..b526d087 100644
--- a/script/vm/tracer.lua
+++ b/script/vm/tracer.lua
@@ -282,6 +282,10 @@ local lookIntoChild = util.switch()
---@param topNode vm.node
---@param outNode? vm.node
: call(function (tracer, action, topNode, outNode)
+ if action.type == 'loop' then
+ tracer:lookIntoChild(action.init, topNode)
+ tracer:lookIntoChild(action.max, topNode)
+ end
if action[1] then
tracer:lookIntoBlock(action, action.bstart, topNode:copy())
local lastAssign = tracer:getLastAssign(action.start, action.finish)
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 4e3c9d5b..87e6c490 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -4219,3 +4219,17 @@ end
function Y()
end
]]
+
+TEST 'A_Class' [[
+---@class A_Class
+local A = { x = 5 }
+
+function A:func()
+ for i = 1, <?self?>.x do
+ print(i)
+ end
+
+ self.y = 3
+ self.y = self.y + 3
+end
+]]