Skip to content

Fields of a generic class can't pass the generic to another generic class #3390

Open

Description

@gitpushjoe

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Type Checking

Expected Behaviour

local works = f.a -- type is `number[]`
local doesnt = f.b -- type is `table<string, number>`
local also_doesnt = f.b["hello"] -- type is `number`

Actual Behaviour

local works = f.a -- type is `number[]`
local doesnt = f.b -- type is `table<string, <T>>`
local also_doesnt = f.b["hello"] -- type is `<V>`

Reproduction steps

---@class Foo<T>
---@field a T[]
---@field b table<string, T>

---@type Foo<number>
local f = {}

Additional Notes

No response

Log File

No response

Activity

  1. changed the title [-]Fields of generic classes cannot reference the class generic[/-] [+]Fields of generic classes sometimes can't reference the class generic[/+] on Mar 26, 2026
  2. changed the title [-]Fields of generic classes sometimes can't reference the class generic[/-] [+]Fields of a generic class can't pass the generic to another generic class[/+] on Mar 26, 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