mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
fix(diagnostic): improve validation for list arguments (#16855)
Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
This commit is contained in:
@@ -592,7 +592,7 @@ do
|
||||
-- Check user-provided validation function.
|
||||
local valid, optional_message = types(val)
|
||||
if not valid then
|
||||
local error_message = string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), val)
|
||||
local error_message = string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), tostring(val))
|
||||
if optional_message ~= nil then
|
||||
error_message = error_message .. string.format(". Info: %s", optional_message)
|
||||
end
|
||||
|
Reference in New Issue
Block a user