diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 11:02:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 11:02:02 +0800 |
commit | 31a4c20b3597cdf07e4b4e3ddbfeb2181a1e1559 (patch) | |
tree | 53b880dce6049f7a89d24581d1d718cc717046ee | |
parent | acf1fe450e713911c6d0b9f60a0f0b81a2fce143 (diff) | |
download | lua-language-server-31a4c20b3597cdf07e4b4e3ddbfeb2181a1e1559.zip |
fix #276 dont share crossMethodMark
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/parser/guide.lua | 4 | ||||
-rw-r--r-- | test/references/init.lua | 21 |
3 files changed, 24 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index 9ab1228c..58279dfc 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * `NEW` setting `runtime.unicodeName` * `NEW` fully supports `---@generic T` * `FIX` [#274](https://github.com/sumneko/lua-language-server/issues/274) +* `FIX` [#276](https://github.com/sumneko/lua-language-server/issues/276) * `FIX` [#279](https://github.com/sumneko/lua-language-server/issues/279) * `FIX` [#280](https://github.com/sumneko/lua-language-server/issues/280) diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 7fa2f3e2..4766257c 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -1697,10 +1697,10 @@ function m.searchSameMethod(ref, mark) end function m.searchSameFieldsCrossMethod(status, ref, start, queue) - local mark = status.cache.crossMethodMark + local mark = status.crossMethodMark if not mark then mark = {} - status.cache.crossMethodMark = mark + status.crossMethodMark = mark end local method = m.searchSameMethod(ref, mark) or m.searchSameMethodCrossSelf(ref, mark) diff --git a/test/references/init.lua b/test/references/init.lua index 4673d2f8..22afc8ac 100644 --- a/test/references/init.lua +++ b/test/references/init.lua @@ -302,3 +302,24 @@ TEST [[ ---@return <?any?> function f() end ]] + +TEST [[ +---@class Dog +local mt = {} +function mt:<?eat?>() +end + +---@class Master +local mt2 = {} +function mt2:init() + ---@type Dog + local foo = self:doSomething() + ---@type Dog + self.dog = getDog() +end +function mt2:feed() + self.dog:<!eat!>() +end +function mt2:doSomething() +end +]] |