Mercurial > vim
changeset 25141:99f6087a5fd2 v8.2.3107
patch 8.2.3107: Vim9: error for arguments while type didn't specify arguments
Commit: https://github.com/vim/vim/commit/22f85d04594e1a09936227ef62955a7939d584b4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 4 23:29:30 2021 +0200
patch 8.2.3107: Vim9: error for arguments while type didn't specify arguments
Problem: Vim9: error for arguments while type didn't specify arguments.
Solution: Do not update that type to check when no argument count is
specified. (closes #8492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Jul 2021 23:30:03 +0200 |
parents | c92e6b6d3588 |
children | 31b4d41b8470 |
files | src/testdir/test_vim9_assign.vim src/userfunc.c src/version.c |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -681,6 +681,16 @@ def Test_assignment_partial() assert_equal('done', Partial()) END CheckDefAndScriptSuccess(lines) + + lines =<< trim END + vim9script + def Func(b: bool) + enddef + var Ref: func = function(Func, [true]) + assert_equal('func()', typename(Ref)) + Ref() + END + CheckScriptSuccess(lines) enddef def Test_assignment_list_any_index()
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -3148,7 +3148,8 @@ call_func( argvars = argv; argcount = partial->pt_argc + argcount_in; - if (funcexe->check_type != NULL) + if (funcexe->check_type != NULL + && funcexe->check_type->tt_argcount != -1) { // Now funcexe->check_type is missing the added arguments, make // a copy of the type with the correction.