Skip to content
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

define a class bug? #1050

Closed
ZhangMingHe2333 opened this issue Apr 13, 2022 · 1 comment
Closed

define a class bug? #1050

ZhangMingHe2333 opened this issue Apr 13, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ZhangMingHe2333
Copy link

     ---@class Student
local Student = {
	name = nil,
	age = nil,
}
---@type Student
local sd = {}
local age = sd.age

this way can work at v2.6.8 and it did't work after update to 3.X

@kevinhwang91
Copy link
Contributor

I have some issue here:

---@class Foo
---@field f number
---@type fun(self: Foo, ...): Foo
local Foo = setmetatable({}, {
    __call = function(self)
        return self
    end
})

function Foo.new()
end

function Foo:doSomething()
    return self.f -- Undefined field `f`. 
end

@sumneko sumneko added the bug Something isn't working label Apr 13, 2022
sumneko added a commit that referenced this issue Apr 14, 2022
class -> local/global -> .value
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

3 participants