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

Generic class field #1216

Closed
Vurv78 opened this issue Jun 16, 2022 · 1 comment
Closed

Generic class field #1216

Vurv78 opened this issue Jun 16, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats)

Comments

@Vurv78
Copy link

Vurv78 commented Jun 16, 2022

Describe the bug
Generics do not work when declaring classes,
I get Undefined type or alias T, and the field data does not autocomplete.

I am not sure if this is intentional or not because the <T> does highlight in the ---@class properly. I didn't see anyone using generic class fields though although I thought that'd be a very common usecase.

To Reproduce

---@class Test<T>
---@field data T

---@return Test<number>
function Test.new()
	return {}
end

local x = Test.new()

Expected behavior
I expected the field data to be defined as a number

Screenshots
image

Environment (please complete the following information):

  • OS: Windows
  • Is WSL remote? No
  • Client: VSCode
@sumneko sumneko added enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats) labels Jun 16, 2022
@sumneko
Copy link
Collaborator

sumneko commented Jun 30, 2022

see #734

@sumneko sumneko closed this as completed Jun 30, 2022
@sumneko sumneko added the duplicate This issue or pull request already exists label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats)
Projects
None yet
Development

No branches or pull requests

2 participants