summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/parser/guide.lua5
-rw-r--r--test/hover/init.lua14
3 files changed, 21 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index ae9865e1..9b76de6e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 1.16.2
+* `FIX` [#406](https://github.com/sumneko/lua-language-server/issues/406)
+
## 1.16.1
`2021-2-22`
* `FIX` signature: parameters may be misplaced
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index c34e65f9..53849a52 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -2937,6 +2937,11 @@ end
function m.getRefCache(status, obj, mode)
local isDeep = status.deep
+ if mode == 'infer' then
+ if not isDeep then
+ return nil, nil
+ end
+ end
local globalCache = status.interface.cache and status.interface.cache() or {}
if m.isGlobal(obj) then
obj = m.getKeyName(obj)
diff --git a/test/hover/init.lua b/test/hover/init.lua
index dc9125ed..0cfb501b 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -439,7 +439,7 @@ t[any] = any
]]
[[
local t: {
- [integer]: integer = 1,
+ [number]: integer = 1,
}
]]
@@ -1526,3 +1526,15 @@ local t: {
a: integer = 1,
}
]]
+
+TEST [[
+---@return number
+local function f() end
+local <?u?> = f()
+print(u.x)
+]]
+[[
+local u: number {
+ x: any,
+}
+]]