mirror of
https://github.com/neovim/neovim.git
synced 2026-08-03 14:19:15 +00:00
fix(api): preserve ArrayOf metadata #40429
ArrayOf metadata existed before the LuaCATS type documentation refactor and is
useful to typed clients consuming api_info().
Keep Tuple metadata normalized to Array, since tuple element types can be mixed,
but preserve ArrayOf(...) for exported API metadata.
Fixes #38734
AI-assisted: Codex
(cherry picked from commit ea0af59854)
This commit is contained in:
committed by
github-actions[bot]
parent
fa365cedad
commit
ea07b60fb1
@@ -24,7 +24,16 @@ local function real_type(type, exported)
|
||||
local container = ptype[1]
|
||||
if container == 'Union' then
|
||||
return 'Object'
|
||||
elseif container == 'Tuple' or container == 'ArrayOf' then
|
||||
elseif container == 'Tuple' then
|
||||
return 'Array'
|
||||
elseif container == 'ArrayOf' then
|
||||
if exported then
|
||||
local elem = real_type(ptype[2], true)
|
||||
if ptype[3] then
|
||||
return ('ArrayOf(%s, %s)'):format(elem, ptype[3])
|
||||
end
|
||||
return ('ArrayOf(%s)'):format(elem)
|
||||
end
|
||||
return 'Array'
|
||||
elseif container == 'DictOf' or container == 'DictAs' then
|
||||
return 'Dict'
|
||||
|
||||
Reference in New Issue
Block a user