-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
1 复现方法
在 test\references\init.lua 中添加下面用例,会提示失败
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
]]
如果去掉用例其中的这2行,可以通过测试
---@type Dog
local foo = self:doSomething()
2 定位到原因
在处理 searchSameFieldsCrossMethod() 穿透 self 时,因为第一处"---@type Dog" 已穿透一次,status.cache.crossMethodMark 已缓存该self。到第二处"---@type Dog"需要穿透时,因为缓存直接跳过,导致失败。
这块逻辑比较复杂,才开始看这个项目的代码。请交下作者有什么好的处理方法了?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working