File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44<!-- Add all new changes here. They will be moved under a version at release -->
5+ * ` FIX ` Incorrect infer for function array annotation on tables [ #2367 ] ( https://github.com/LuaLS/lua-language-server/issues/2367 )
56
67## 3.13.4
78` 2024-12-13 `
Original file line number Diff line number Diff line change @@ -940,6 +940,7 @@ local assignTypeMap = {
940940 [' setindex' ] = true ,
941941 [' tablefield' ] = true ,
942942 [' tableindex' ] = true ,
943+ [' tableexp' ] = true ,
943944 [' label' ] = true ,
944945 [' doc.class' ] = true ,
945946 [' doc.alias' ] = true ,
Original file line number Diff line number Diff line change @@ -1671,7 +1671,9 @@ local compilerSwitch = util.switch()
16711671 vm .compileByParentNode (source .node , key , function (src )
16721672 if src .type == ' doc.field'
16731673 or src .type == ' doc.type.field'
1674- or src .type == ' doc.type.name' then
1674+ or src .type == ' doc.type.name'
1675+ or src .type == ' doc.type.function'
1676+ then
16751677 hasMarkDoc = true
16761678 vm .setNode (source , vm .compileNode (src ))
16771679 end
Original file line number Diff line number Diff line change @@ -3943,6 +3943,34 @@ TEST 'number' [[
39433943local function f(<?x?>) end
39443944]]
39453945
3946+ TEST ' number' [[
3947+ ---@type fun(x:number)[]
3948+ local t = {
3949+ function (<?x?>) end,
3950+ }
3951+ ]]
3952+
3953+ TEST ' number' [[
3954+ ---@type fun(x:number)[]
3955+ local t = {
3956+ [1] = function (<?x?>) end,
3957+ }
3958+ ]]
3959+
3960+ TEST ' number' [[
3961+ ---@type {[integer]: fun(x:number)}
3962+ local t = {
3963+ function (<?x?>) end,
3964+ }
3965+ ]]
3966+
3967+ TEST ' number' [[
3968+ ---@type {[integer]: fun(x:number)}
3969+ local t = {
3970+ [1] = function (<?x?>) end,
3971+ }
3972+ ]]
3973+
39463974TEST ' boolean' [[
39473975---@generic T: string | boolean | table
39483976---@param x T
You can’t perform that action at this time.
0 commit comments