File tree 4 files changed +33
-1
lines changed
4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
<!-- 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 )
5
6
6
7
## 3.13.4
7
8
` 2024-12-13 `
Original file line number Diff line number Diff line change @@ -940,6 +940,7 @@ local assignTypeMap = {
940
940
[' setindex' ] = true ,
941
941
[' tablefield' ] = true ,
942
942
[' tableindex' ] = true ,
943
+ [' tableexp' ] = true ,
943
944
[' label' ] = true ,
944
945
[' doc.class' ] = true ,
945
946
[' doc.alias' ] = true ,
Original file line number Diff line number Diff line change @@ -1671,7 +1671,9 @@ local compilerSwitch = util.switch()
1671
1671
vm .compileByParentNode (source .node , key , function (src )
1672
1672
if src .type == ' doc.field'
1673
1673
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
1675
1677
hasMarkDoc = true
1676
1678
vm .setNode (source , vm .compileNode (src ))
1677
1679
end
Original file line number Diff line number Diff line change @@ -3943,6 +3943,34 @@ TEST 'number' [[
3943
3943
local function f(<?x?>) end
3944
3944
]]
3945
3945
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
+
3946
3974
TEST ' boolean' [[
3947
3975
---@generic T: string | boolean | table
3948
3976
---@param x T
You can’t perform that action at this time.
0 commit comments