]> granicus.if.org Git - vim/commitdiff
patch 8.2.3107: Vim9: error for arguments while type didn't specify arguments v8.2.3107
authorBram Moolenaar <Bram@vim.org>
Sun, 4 Jul 2021 21:29:30 +0000 (23:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 4 Jul 2021 21:29:30 +0000 (23:29 +0200)
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
src/userfunc.c
src/version.c

index a92a60bbdd7f5cbc1aace0d01b7f5bfdbb523881..6bbbc3681ea3c12236d499b0968a223e9750a83f 100644 (file)
@@ -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()
index 404f85bb511f9c43e22a79f282614ad9c76dcd26..4234681cd7b3947b1904110447b7ebf311422ac5 100644 (file)
@@ -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.
index 10231abd85b5c868621450a5bf012b70188845e9..060c2e770d05582aaab8c318faf0db921eb242b0 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3107,
 /**/
     3106,
 /**/