Patch 8.2.4586
Problem:    Vim9: no error for using lower case name for "func" argument.
            (Ernie Rael)
Solution:   Check the name as soon as the type is known.
Files:      src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.4585/src/userfunc.c      2022-03-11 18:54:13.980670599 +0000
--- src/userfunc.c      2022-03-17 16:21:16.354951188 +0000
***************
*** 429,434 ****
--- 429,440 ----
                if (type == NULL)
                    return FAIL;
                fp->uf_arg_types[i] = type;
+               if (i < fp->uf_args.ga_len
+                       && (type->tt_type == VAR_FUNC
+                           || type->tt_type == VAR_PARTIAL)
+                       && var_wrong_func_name(
+                                   ((char_u **)fp->uf_args.ga_data)[i], TRUE))
+                   return FAIL;
            }
        }
      }
*** ../vim-8.2.4585/src/testdir/test_vim9_func.vim      2022-03-16 
17:53:58.311925819 +0000
--- src/testdir/test_vim9_func.vim      2022-03-17 16:27:35.767007885 +0000
***************
*** 1479,1490 ****
  
    lines =<< trim END
        vim9script
!       def g:TestFunc(f: func)
        enddef
        legacy call g:TestFunc({-> 0})
        delfunc g:TestFunc
  
!       def g:TestFunc(f: func(number))
        enddef
        legacy call g:TestFunc({nr -> 0})
        delfunc g:TestFunc
--- 1479,1490 ----
  
    lines =<< trim END
        vim9script
!       def g:TestFunc(F: func)
        enddef
        legacy call g:TestFunc({-> 0})
        delfunc g:TestFunc
  
!       def g:TestFunc(F: func(number))
        enddef
        legacy call g:TestFunc({nr -> 0})
        delfunc g:TestFunc
***************
*** 3788,3795 ****
          return x + 1
        enddef
  
!       def G(g: func): dict<func>
!         return {f: g}
        enddef
  
        def H(d: dict<func>): string
--- 3788,3795 ----
          return x + 1
        enddef
  
!       def G(Fg: func): dict<func>
!         return {f: Fg}
        enddef
  
        def H(d: dict<func>): string
***************
*** 3799,3804 ****
--- 3799,3806 ----
  
    v9.CheckScriptSuccess(lines + ['echo H(G(F1))'])
    v9.CheckScriptFailure(lines + ['echo H(G(F2))'], 'E1013:')
+ 
+   v9.CheckScriptFailure(lines + ['def SomeFunc(ff: func)', 'enddef'], 'E704:')
  enddef
  
  def Test_call_func_with_null()
*** ../vim-8.2.4585/src/version.c       2022-03-17 13:03:05.971464744 +0000
--- src/version.c       2022-03-17 16:20:43.738915617 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4586,
  /**/

-- 
Facepalm reply #3: "I had a great time in Manhattan" "I thought you were
going to New York?"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220317163035.8FC521C7857%40moolenaar.net.

Raspunde prin e-mail lui