summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-16 15:10:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-16 15:10:38 +0800
commit073afa589be41900e4881d755ba663d8718fffec (patch)
tree484d2c2b158cc8c77771e4c52674cc89beace0b4
parent182b2b7ed8201f4528b177d66ce661dc91066365 (diff)
downloadlua-language-server-073afa589be41900e4881d755ba663d8718fffec.zip
fix #1213 change back to enum
-rw-r--r--changelog.md1
-rw-r--r--script/vm/runner.lua10
-rw-r--r--test/type_inference/init.lua13
3 files changed, 20 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md
index 5d5de00a..bef611ac 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,7 @@
# changelog
## 3.3.1
+* `FIX` [#1213](https://github.com/sumneko/lua-language-server/issues/1213)
* `FIX` [#1215](https://github.com/sumneko/lua-language-server/issues/1215)
## 3.3.0
diff --git a/script/vm/runner.lua b/script/vm/runner.lua
index 793b4417..2de06aaa 100644
--- a/script/vm/runner.lua
+++ b/script/vm/runner.lua
@@ -296,10 +296,12 @@ function mt:_lookInto(action, topNode, outNode)
end
elseif action.type == 'paren' then
topNode, outNode = self:_lookInto(action.exp, topNode, outNode)
- else
- guide.eachSourceContain(action, top.finish, function(source)
- self:_lookInto(source, topNode)
- end)
+ elseif action.type == 'return' then
+ for _, rtn in ipairs(action) do
+ self:_lookInto(rtn, topNode)
+ end
+ elseif action.type == 'getindex' then
+ self:_lookInto(action.index, topNode)
end
::RETURN::
topNode = self:_fastWard(action.finish, topNode)
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 8201f9d4..32a35fbd 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -2637,3 +2637,16 @@ else
print(<?x?>)
end
]]
+
+TEST 'B' [[
+---@class A
+---@class B
+
+---@type A
+local x
+
+---@type B
+x = call(x)
+
+print(<?x?>)
+]]