From 0c7a22d1106cd97b47cb969e2ccfd86ca7ae2629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 20 Oct 2022 20:49:11 +0800 Subject: ignore varargs if a function only has varargs and has `---@overload`, the varargs will be ignored resolve #1641 --- test/completion/common.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'test/completion') diff --git a/test/completion/common.lua b/test/completion/common.lua index 38104d41..cc164d3a 100644 --- a/test/completion/common.lua +++ b/test/completion/common.lua @@ -3847,3 +3847,60 @@ print(t2.A.) kind = define.CompletionItemKind.Field, }, } + +TEST [[ +---@overload fun(x: number) +---@overload fun(x: number, y: number) +local function fff(...) +end + +fff +]] +{ + { + label = 'fff(x)', + kind = define.CompletionItemKind.Function, + }, + { + label = 'fff(x, y)', + kind = define.CompletionItemKind.Function, + }, +} + +TEST [[ +---@overload fun(x: number) +---@overload fun(x: number, y: number) +function fff(...) +end + +fff +]] +{ + { + label = 'fff(x)', + kind = define.CompletionItemKind.Function, + }, + { + label = 'fff(x, y)', + kind = define.CompletionItemKind.Function, + }, +} + +TEST [[ +---@overload fun(x: number) +---@overload fun(x: number, y: number) +function t.fff(...) +end + +t.fff +]] +{ + { + label = 'fff(x)', + kind = define.CompletionItemKind.Function, + }, + { + label = 'fff(x, y)', + kind = define.CompletionItemKind.Function, + }, +} -- cgit v1.2.3