summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-09 14:35:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-09 14:35:02 +0800
commit1efc05d573a33d2ed2f2bc43fb4142a450bbfa02 (patch)
tree85b74ecd60a1dfa4da8f94900d23f66d9f0f7a73
parent49ed110bca2ee7d39311f1a973792748ad138437 (diff)
downloadlua-language-server-1efc05d573a33d2ed2f2bc43fb4142a450bbfa02.zip
incorrect type infer
-rw-r--r--changelog.md1
-rw-r--r--script/core/infer.lua6
-rw-r--r--test/hover/init.lua9
3 files changed, 13 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md
index 583c6eb7..9d568f20 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 2.2.2
* `FIX` incorrect syntax color
+* `FIX` incorrect type infer
## 2.2.1
`2021-7-8`
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 39625021..84a2b2e5 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -541,9 +541,9 @@ function m.searchInfers(source, field, mark)
end
end
end
- end
- if source.type == 'field' or source.type == 'method' then
- searchInfer(source.parent, infers, mark)
+ if source.type == 'field' or source.type == 'method' then
+ searchInfer(source.parent, infers, mark)
+ end
end
for _, def in ipairs(defs) do
searchInfer(def, infers, mark)
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 9a30ab81..80f6009c 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1629,3 +1629,12 @@ a.<?b?> = 10 * 60
[[
global a.b: integer
]]
+
+TEST [[
+a.<?b?>.c = 1 * 1
+]]
+[[
+global a.b: {
+ c: integer,
+}
+]]