fix(lua): pesc, tbl_islist result types #20751

Problem:
- pesc() returns multiple results, it should return a single result.
- tbl_islist() returns non-boolean in some branches.
- Docstring: @generic must be declared first

Solution:
Constrain docstring annotations.
Fix return types.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
NAKAI Tsuyoshi
2022-10-24 21:53:53 +09:00
committed by GitHub
parent 1248c12666
commit 4573cfa3ad
3 changed files with 15 additions and 16 deletions

View File

@@ -430,6 +430,8 @@ describe('lua stdlib', function()
it('vim.pesc', function()
eq('foo%-bar', exec_lua([[return vim.pesc('foo-bar')]]))
eq('foo%%%-bar', exec_lua([[return vim.pesc(vim.pesc('foo-bar'))]]))
-- pesc() returns one result. #20751
eq({'x'}, exec_lua([[return {vim.pesc('x')}]]))
-- Validates args.
matches('s: expected string, got number',