summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
+}
+]]