Skip to content

Generic class instanced in function should return as a concrete type #1856

Open
@eigenbom

Description

@eigenbom

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, Hover

Expected Behaviour

Actual Behaviour

Hovering strings in this code below gives the type as local strings: list<<T>>|{ [integer]: string }, whereas I expect the type/hover to be local strings: list<T>.

---@class list<T>: {[integer]:T}

---@generic T
---@param class `T`
---@return list<T>
local function new_list(class)
	return {}
end

local strings = new_list('string')

Reproduction steps

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