Skip to content

Generic Class Inheritance #1863

Open
Open
@RomanSpector

Description

@RomanSpector

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat/genericRelated to generic emulation feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions