Skip to content

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

@gitpushjoe

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

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