summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-19 16:12:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-19 16:12:51 +0800
commit5e3f203d76473e2ade05cfd344f2dc6608d65e1a (patch)
treec7fc3f6cfab0aaeb076f39817a3369aba41bd807
parentbb9920e0925aa88ca512e789a72be010404011a0 (diff)
downloadlua-language-server-5e3f203d76473e2ade05cfd344f2dc6608d65e1a.zip
fix #798
-rw-r--r--changelog.md1
-rw-r--r--script/core/noder.lua3
-rw-r--r--test/type_inference/init.lua16
3 files changed, 18 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 854f7c2f..7519281f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 2.4.10
* `FIX` [#790](https://github.com/sumneko/lua-language-server/issues/790)
+* `FIX` [#798](https://github.com/sumneko/lua-language-server/issues/798)
## 2.4.9
`2021-11-18`
diff --git a/script/core/noder.lua b/script/core/noder.lua
index cdf2c710..3a8b9fe2 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -1412,8 +1412,7 @@ compileNodeMap = util.switch()
end
for _, rtn in ipairs(source.returns) do
for _, src in ipairs(source.bindSources) do
- if src.type == 'function'
- or guide.isSet(src) then
+ if src.type == 'function' then
local fullID = sformat('%s%s%s'
, getID(src)
, RETURN_INDEX
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 908d613c..5526d6d8 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -943,3 +943,19 @@ local x
<?x?> = 1
]]
+
+TEST 'any' [[
+---@return number
+local function f(x)
+ local <?y?> = x()
+end
+]]
+
+TEST 'any' [[
+local mt
+
+---@return number
+function mt:f() end
+
+local <?v?> = mt()
+]]