Skip to content

Inheriting from a generic class, which uses an annotated table definition causes fields to get lost #3443

Description

@sewbacca

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Windows

What is the issue affecting?

Annotations, Type Checking

Expected Behaviour

--- (field) Specific.value: string
hover(t.value)

Actual Behaviour

--- (field) Specific.value: unknown
hover(t.value)

Reproduction steps

---@class GenericSuper<T> : { value: T }

---@class Specific : GenericSuper<string>

---@type Specific
local t

hover(t.value)

Then hover on t.value

Additional Notes

Interestingly this seems to only affect inheriting from table constructor. When converting it into a field, it works as expected:

---@class GenericSuper<T>
---@field value T

---@class Specific : GenericSuper<string>

---@type Specific
local t

--- (field) Specific.value: string
hover(t.value)

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions