From 22f85d04594e1a09936227ef62955a7939d584b4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 4 Jul 2021 23:29:30 +0200 Subject: [PATCH] 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) --- src/testdir/test_vim9_assign.vim | 10 ++++++++++ src/userfunc.c | 3 ++- src/version.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index a92a60bbd..6bbbc3681 100644 --- 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() diff --git a/src/userfunc.c b/src/userfunc.c index 404f85bb5..4234681cd 100644 --- 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. diff --git a/src/version.c b/src/version.c index 10231abd8..060c2e770 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3107, /**/ 3106, /**/ -- 2.50.1