-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Support for generic classes #734
Labels
enhancement
New feature or request
feat/generic
Related to generic emulation feature
feat/LuaCats Annotations
Related to Lua Language Server Annotations (LuaCats)
Comments
sumneko
added
feat/LuaCats Annotations
Related to Lua Language Server Annotations (LuaCats)
enhancement
New feature or request
labels
Oct 15, 2021
Closed
Just some test cases: ---@class Array<T>: { [integer]: T }
---@type Array<string>
local arr = {}
-- correctly warns that I am assigning a boolean to a string
arr[1] = false
-- no warning despite indexing with a string instead of an integer
arr["foo"] = "bar"
-- correctly does not warn as I am following the type correctly
arr[3] = "Correct" ---@class Dictionary<T>: { [string]: T }
---@type Dictionary<boolean>
local dict = {}
-- no warning despite indexing with a number
dict[1] = "incorrect"
-- no warning despite assigning a string
dict["foo"] = "bar?"
-- correctly does not warn as I am following the type correctly
dict["correct"] = true |
Ran into this today as well 😞. |
Any update on this? This feature would be amazing! |
This has cropped up as an issue that's making modularity difficult. Would love to see it fixed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
feat/generic
Related to generic emulation feature
feat/LuaCats Annotations
Related to Lua Language Server Annotations (LuaCats)
Describe the bug
Despite being mentioned in luanalysis, generic classes are not supported by this language server.
Screenshots
Environment:
The text was updated successfully, but these errors were encountered: