LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.25k stars 305 forks source link

problem with table return type checking #1674

Open max397574 opened 1 year ago

max397574 commented 1 year ago

related: https://github.com/sumneko/lua-language-server/issues/1667 I expected this to give an error

---@class cool_tbl
---@field test fun():string[]
local my_tbl = {
    test = function()
        return {
            2,
            { "test" },
        }
    end,
}
Papipo commented 1 year ago

How is this coming along? Thanks!

max397574 commented 10 months ago

@sumneko any updates on this? since 3.7 was already released

max397574 commented 10 months ago

here is the example where I encountered this problem again

---@return { [1]: string, [2]: string }[][]
local function x()
    return {
        { { 3, "b" } },
        { { "c", "d" } },
    }
end