Skip to content

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

Open

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

Activity

  1. changed the title [-]Inheriting from generic defined as table does not add field to subclass[/-] [+]Inheriting from a generic class, which uses a annotated table definition causes fields to get lost[/+] on Jul 31, 2026
  2. changed the title [-]Inheriting from a generic class, which uses a annotated table definition causes fields to get lost[/-] [+]Inheriting from a generic class, which uses an annotated table definition causes fields to get lost[/+] on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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