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 Inheritance #1863

Open
RomanSpector opened this issue Jan 31, 2023 · 0 comments
Open

Generic Class Inheritance #1863

RomanSpector opened this issue Jan 31, 2023 · 0 comments
Labels
feat/generic Related to generic emulation feature

Comments

@RomanSpector
Copy link

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Annotations

Expected Behaviour

image

image

Actual Behaviour

Inheritance does not work and the methods of the main class are not visible

image

And also the problem with the return type

image

Reproduction steps

---@diagnostic disable: missing-return, unused-local

---@class LinQ<T>: { [integer]: T }, tablelib -- ["where"]: fun(t: T[], query: fun(a: T): boolean): LinQ<T>
local linq = {};

---@generic T
---@param t T[]
---@param query fun(a: T): boolean
---@return LinQ<T>
function linq.where(t, query) end

---@generic T
---@param t T[]
---@param query fun(a: T): boolean
---@return T?
function linq.first(t, query) end

---@type LinQ<string>
local tab = {};

tab:where(function (a) return a == "" end)

Additional Notes

No response

Log File

No response

@sumneko sumneko added the feat/generic Related to generic emulation feature label Feb 1, 2023
@carsakiller carsakiller changed the title generic class Generic Class Inheritance Feb 1, 2023
@carsakiller carsakiller mentioned this issue Feb 1, 2023
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/generic Related to generic emulation feature
Projects
None yet
Development

No branches or pull requests

2 participants