fix(luacats): allow all types inside tuples

This commit is contained in:
Ilia Choly 2024-05-31 11:47:32 -04:00 committed by Lewis Russell
parent f2083bd55c
commit 9eb0426002
2 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ local grammar = P {
fun_param = lname * opt(colon * v.ltype), fun_param = lname * opt(colon * v.ltype),
ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.ltype)), ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.ltype)),
ty_generic = P('`') * letter * P('`'), ty_generic = P('`') * letter * P('`'),
ty_tuple = Pf('[') * comma(v.ty_opt) * fill * P(']'), ty_tuple = Pf('[') * comma(v.ltype) * fill * P(']'),
} }
return grammar --[[@as nvim.luacats.grammar]] return grammar --[[@as nvim.luacats.grammar]]

View File

@ -160,10 +160,10 @@ describe('luacats grammar', function()
type = '`T`', type = '`T`',
}) })
test('@param type [number,string] this is a tuple type', { test('@param type [number,string,"good"|"bad"] this is a tuple type', {
desc = 'this is a tuple type', desc = 'this is a tuple type',
kind = 'param', kind = 'param',
name = 'type', name = 'type',
type = '[number,string]', type = '[number,string,"good"|"bad"]',
}) })
end) end)