Skip to content

v2.4.9 _G的class标记无法识别??? #805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HiKit opened this issue Nov 18, 2021 · 2 comments
Closed

v2.4.9 _G的class标记无法识别??? #805

HiKit opened this issue Nov 18, 2021 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@HiKit
Copy link

HiKit commented Nov 18, 2021

--Test.lua
---@Class Test
_G.Test = {};

function Test:New()
end

function Test:TestA()

end

--TestA.lua
---@Class TestA:Test
local TestA = {};

---@type Test
local t = Test:New();

local ta = TestA:New();

如图,TestA无法识别继承Test,Test是_G的,之前版本这种是可以正确识别的
**
image
**

@sumneko sumneko added the bug Something isn't working label Nov 18, 2021
@sumneko
Copy link
Collaborator

sumneko commented Nov 18, 2021

确实有问题,我把 ---@class 可以影响的复制操作类型做了限制,看来得对这种情况做一些特殊处理。

你可以先改成没有 _G 前缀的赋值方式。

@HiKit
Copy link
Author

HiKit commented Nov 18, 2021

---@Class GObject
local GObject = {};
_G.GObject = GObject;

OK,先这么补救了

@sumneko sumneko added this to the 2.5.0 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants