EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.75k stars 292 forks source link

self 识别有问题 #371

Closed CppCXY closed 4 years ago

CppCXY commented 4 years ago

全局或者外部声明的叫self 的变量会影响 function aaaa:bbbb()end 形式内部self 的类型推断

CppCXY commented 4 years ago

---@class ffff local ffff = {}

function ffff:xxxx()

local old_self = self
self.aaa =123
self = old_self

end

cccc = {}

function cccc:xxxxyyyy() self.aaa =123 end

这里的self 会固定被识别为 ffff 类型