diff options
author | Will Hopkins <willothyh@gmail.com> | 2024-06-01 00:18:59 -0700 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-06-11 16:36:29 +0100 |
commit | e947f226bebef1310af39ce3d93d7bb87e85d757 (patch) | |
tree | 482f979769ef21af1e57bd0f4f5c67525adb9c7d | |
parent | c06f3dbe3ee82bd8c9e5d8625b225a937a9e5e9e (diff) | |
download | rneovim-e947f226bebef1310af39ce3d93d7bb87e85d757.tar.gz rneovim-e947f226bebef1310af39ce3d93d7bb87e85d757.tar.bz2 rneovim-e947f226bebef1310af39ce3d93d7bb87e85d757.zip |
fix(types): use vararg return type annotation
build(types): allow vararg returns in function types
-rw-r--r-- | runtime/doc/lua.txt | 8 | ||||
-rw-r--r-- | runtime/lua/vim/iter.lua | 2 | ||||
-rw-r--r-- | scripts/luacats_grammar.lua | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 72babb067e..fe2abfe956 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -4082,10 +4082,10 @@ Iter:map({f}) *Iter:map()* < Parameters: ~ - • {f} (`fun(...):any`) Mapping function. Takes all values returned from - the previous stage in the pipeline as arguments and returns one - or more new values, which are used in the next pipeline stage. - Nil return values are filtered from the output. + • {f} (`fun(...):...:any`) Mapping function. Takes all values returned + from the previous stage in the pipeline as arguments and returns + one or more new values, which are used in the next pipeline + stage. Nil return values are filtered from the output. Return: ~ (`Iter`) diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index 1093759efe..6bddf0bc5e 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -276,7 +276,7 @@ end --- -- { 6, 12 } --- ``` --- ----@param f fun(...):any Mapping function. Takes all values returned from +---@param f fun(...):...:any Mapping function. Takes all values returned from --- the previous stage in the pipeline as arguments --- and returns one or more new values, which are used --- in the next pipeline stage. Nil return values diff --git a/scripts/luacats_grammar.lua b/scripts/luacats_grammar.lua index 9360eb9417..ebb0183fd9 100644 --- a/scripts/luacats_grammar.lua +++ b/scripts/luacats_grammar.lua @@ -178,7 +178,8 @@ local grammar = P { table_elem = v.table_key * colon * v.ltype, ty_table = Pf('{') * comma1(v.table_elem) * fill * P('}'), fun_param = lname * opt(colon * v.ltype), - ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.ltype)), + fun_ret = v.ltype + (ident * colon * v.ltype) + (P('...') * opt(colon * v.ltype)), + ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.fun_ret)), ty_generic = P('`') * letter * P('`'), ty_tuple = Pf('[') * comma(v.ltype) * fill * P(']'), } |