Patch 8.2.4260
Problem:    Vim9: can still use a global function without g: at the script
            level.
Solution:   Also check for g: at the script level. (issue #9637)
Files:      src/userfunc.c, src/proto/userfunc.pro, src/evalvars.c,
            src/vim9expr.c, src/testdir/test_vim9_assign.vim,
            src/testdir/test_vim9_builtin.vim, src/testdir/test_vim9_cmd.vim,
            src/testdir/test_vim9_disassemble.vim,
            src/testdir/test_vim9_expr.vim, src/testdir/test_vim9_func.vim,
            src/testdir/test_vim9_import.vim,
            src/testdir/test_ins_complete.vim, src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popupwin_scroll_11.dump,
            src/testdir/dumps/Test_popupwin_scroll_12.dump


*** ../vim-8.2.4259/src/userfunc.c      2022-01-29 21:45:30.473921671 +0000
--- src/userfunc.c      2022-01-30 15:03:15.623749253 +0000
***************
*** 1902,1908 ****
      char_u        buffer[200];
      scriptitem_T    *si;
  
!     if (vim_strchr(name, AUTOLOAD_CHAR) != 0)
        return NULL;    // already has the prefix
      if (!SCRIPT_ID_VALID(sid))
        return NULL;    // not in a script
--- 1902,1908 ----
      char_u        buffer[200];
      scriptitem_T    *si;
  
!     if (vim_strchr(name, AUTOLOAD_CHAR) != NULL)
        return NULL;    // already has the prefix
      if (!SCRIPT_ID_VALID(sid))
        return NULL;    // not in a script
***************
*** 2005,2010 ****
--- 2005,2021 ----
  }
  
  /*
+  * Return TRUE if "ufunc" must be called with a g: prefix in Vim9 script.
+  */
+     int
+ func_requires_g_prefix(ufunc_T *ufunc)
+ {
+     return ufunc->uf_name[0] != K_SPECIAL
+           && (ufunc->uf_flags & FC_LAMBDA) == 0
+           && vim_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL;
+ }
+ 
+ /*
   * Copy the function name of "fp" to buffer "buf".
   * "buf" must be able to hold the function name plus three bytes.
   * Takes care of script-local function names.
***************
*** 3442,3448 ****
--- 3453,3466 ----
             * User defined function.
             */
            if (fp == NULL)
+           {
                fp = find_func(rfname, is_global);
+               if (fp != NULL && !is_global && in_vim9script()
+                                                && func_requires_g_prefix(fp))
+                   // In Vim9 script g: is required to find a global
+                   // non-autoload function.
+                   fp = NULL;
+           }
  
            // Trigger FuncUndefined event, may load the function.
            if (fp == NULL
***************
*** 3672,3677 ****
--- 3690,3696 ----
      char_u    sid_buf[20];
      int               len;
      int               extra = 0;
+     int               prefix_g = FALSE;
      lval_T    lv;
      int               vim9script;
  
***************
*** 3837,3844 ****
        // skip over "s:" and "g:"
        if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
        {
!           if (is_global != NULL && lv.ll_name[0] == 'g')
!               *is_global = TRUE;
            lv.ll_name += 2;
        }
        len = (int)(end - lv.ll_name);
--- 3856,3875 ----
        // skip over "s:" and "g:"
        if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
        {
!           if (lv.ll_name[0] == 'g')
!           {
!               if (is_global != NULL)
!               {
!                   *is_global = TRUE;
!               }
!               else
!               {
!                   // dropping "g:" without setting "is_global" won't work in
!                   // Vim9script, put it back later
!                   prefix_g = TRUE;
!                   extra = 2;
!               }
!           }
            lv.ll_name += 2;
        }
        len = (int)(end - lv.ll_name);
***************
*** 3919,3924 ****
--- 3950,3960 ----
            if (vim9script || lead > 3) // If it's "<SID>"
                STRCPY(name + 3, sid_buf);
        }
+       else if (prefix_g)
+       {
+           name[0] = 'g';
+           name[1] = ':';
+       }
        mch_memmove(name + lead + extra, lv.ll_name, (size_t)len);
        name[lead + extra + len] = NUL;
      }
*** ../vim-8.2.4259/src/proto/userfunc.pro      2022-01-24 13:54:42.298380706 
+0000
--- src/proto/userfunc.pro      2022-01-30 14:27:25.642302302 +0000
***************
*** 11,16 ****
--- 11,17 ----
  ufunc_T *find_func_even_dead(char_u *name, int flags);
  ufunc_T *find_func(char_u *name, int is_global);
  int func_is_global(ufunc_T *ufunc);
+ int func_requires_g_prefix(ufunc_T *ufunc);
  int func_name_refcount(char_u *name);
  void func_clear_free(ufunc_T *fp, int force);
  int copy_func(char_u *lambda, char_u *global, ectx_T *ectx);
*** ../vim-8.2.4259/src/evalvars.c      2022-01-26 21:01:11.188928567 +0000
--- src/evalvars.c      2022-01-30 14:26:43.478901111 +0000
***************
*** 2779,2795 ****
        }
        else if (in_vim9script() && (flags & EVAL_VAR_NO_FUNC) == 0)
        {
            ufunc_T *ufunc = find_func(name, FALSE);
  
            // In Vim9 script we can get a function reference by using the
!           // function name.
!           if (ufunc != NULL)
            {
                found = TRUE;
                if (rettv != NULL)
                {
                    rettv->v_type = VAR_FUNC;
!                   if (STRNCMP(name, "g:", 2) == 0)
                        // Keep the "g:", otherwise script-local may be
                        // assumed.
                        rettv->vval.v_string = vim_strsave(name);
--- 2779,2798 ----
        }
        else if (in_vim9script() && (flags & EVAL_VAR_NO_FUNC) == 0)
        {
+           int     has_g_prefix = STRNCMP(name, "g:", 2) == 0;
            ufunc_T *ufunc = find_func(name, FALSE);
  
            // In Vim9 script we can get a function reference by using the
!           // function name.  For a global non-autoload function "g:" is
!           // required.
!           if (ufunc != NULL && (has_g_prefix
!                                           || !func_requires_g_prefix(ufunc)))
            {
                found = TRUE;
                if (rettv != NULL)
                {
                    rettv->v_type = VAR_FUNC;
!                   if (has_g_prefix)
                        // Keep the "g:", otherwise script-local may be
                        // assumed.
                        rettv->vval.v_string = vim_strsave(name);
*** ../vim-8.2.4259/src/vim9expr.c      2022-01-29 21:45:30.473921671 +0000
--- src/vim9expr.c      2022-01-30 14:28:01.873787466 +0000
***************
*** 349,359 ****
  }
  
      static int
! generate_funcref(cctx_T *cctx, char_u *name)
  {
      ufunc_T *ufunc = find_func(name, FALSE);
  
!     if (ufunc == NULL)
        return FAIL;
  
      // Need to compile any default values to get the argument types.
--- 349,360 ----
  }
  
      static int
! generate_funcref(cctx_T *cctx, char_u *name, int has_g_prefix)
  {
      ufunc_T *ufunc = find_func(name, FALSE);
  
!     // Reject a global non-autoload function found without the "g:" prefix.
!     if (ufunc == NULL || (!has_g_prefix && func_requires_g_prefix(ufunc)))
        return FAIL;
  
      // Need to compile any default values to get the argument types.
***************
*** 420,426 ****
                          break;
                case 's': if (is_expr && ASCII_ISUPPER(*name)
                                       && find_func(name, FALSE) != NULL)
!                             res = generate_funcref(cctx, name);
                          else
                              res = compile_load_scriptvar(cctx, name,
                                                            NULL, &end, error);
--- 421,427 ----
                          break;
                case 's': if (is_expr && ASCII_ISUPPER(*name)
                                       && find_func(name, FALSE) != NULL)
!                             res = generate_funcref(cctx, name, FALSE);
                          else
                              res = compile_load_scriptvar(cctx, name,
                                                            NULL, &end, error);
***************
*** 429,435 ****
                          {
                              if (is_expr && ASCII_ISUPPER(*name)
                                       && find_func(name, FALSE) != NULL)
!                                 res = generate_funcref(cctx, name);
                              else
                                  isn_type = ISN_LOADG;
                          }
--- 430,436 ----
                          {
                              if (is_expr && ASCII_ISUPPER(*name)
                                       && find_func(name, FALSE) != NULL)
!                                 res = generate_funcref(cctx, name, TRUE);
                              else
                                  isn_type = ISN_LOADG;
                          }
***************
*** 505,511 ****
                // uppercase letter it can be a user defined function.
                // generate_funcref() will fail if the function can't be found.
                if (res == FAIL && is_expr && ASCII_ISUPPER(*name))
!                   res = generate_funcref(cctx, name);
            }
        }
        if (gen_load)
--- 506,512 ----
                // uppercase letter it can be a user defined function.
                // generate_funcref() will fail if the function can't be found.
                if (res == FAIL && is_expr && ASCII_ISUPPER(*name))
!                   res = generate_funcref(cctx, name, FALSE);
            }
        }
        if (gen_load)
***************
*** 812,818 ****
  
      // If the name is a variable, load it and use PCALL.
      // Not for g:Func(), we don't know if it is a variable or not.
!     // Not for eome#Func(), it will be loaded later.
      p = namebuf;
      if (!has_g_namespace && !is_autoload
            && compile_load(&p, namebuf + varlen, cctx, FALSE, FALSE) == OK)
--- 813,819 ----
  
      // If the name is a variable, load it and use PCALL.
      // Not for g:Func(), we don't know if it is a variable or not.
!     // Not for some#Func(), it will be loaded later.
      p = namebuf;
      if (!has_g_namespace && !is_autoload
            && compile_load(&p, namebuf + varlen, cctx, FALSE, FALSE) == OK)
*** ../vim-8.2.4259/src/testdir/test_vim9_assign.vim    2022-01-29 
21:45:30.477921609 +0000
--- src/testdir/test_vim9_assign.vim    2022-01-30 13:57:37.655562643 +0000
***************
*** 75,81 ****
  
    # lower case name is OK for a list
    var lambdaLines =<< trim END
!       var lambdaList: list<func> = [Test_syntax]
        lambdaList[0] = () => "lambda"
    END
    v9.CheckDefAndScriptSuccess(lambdaLines)
--- 75,81 ----
  
    # lower case name is OK for a list
    var lambdaLines =<< trim END
!       var lambdaList: list<func> = [g:Test_syntax]
        lambdaList[0] = () => "lambda"
    END
    v9.CheckDefAndScriptSuccess(lambdaLines)
***************
*** 890,896 ****
  
  def Test_assignment_partial()
    var lines =<< trim END
!       var Partial: func(): string = function(PartFuncBool, [true])
        assert_equal('done', Partial())
    END
    v9.CheckDefAndScriptSuccess(lines)
--- 890,896 ----
  
  def Test_assignment_partial()
    var lines =<< trim END
!       var Partial: func(): string = function(g:PartFuncBool, [true])
        assert_equal('done', Partial())
    END
    v9.CheckDefAndScriptSuccess(lines)
***************
*** 1393,1399 ****
    v9.CheckDefFailure(['var name: dict <number>'], 'E1068:')
    v9.CheckDefFailure(['var name: dict<number'], 'E1009:')
  
!   assert_fails('s/^/\=Mess()/n', 'E794:')
    v9.CheckDefFailure(['var name: dict<number'], 'E1009:')
  
    v9.CheckDefFailure(['w:foo: number = 10'],
--- 1393,1399 ----
    v9.CheckDefFailure(['var name: dict <number>'], 'E1068:')
    v9.CheckDefFailure(['var name: dict<number'], 'E1009:')
  
!   assert_fails('s/^/\=g:Mess()/n', 'E794:')
    v9.CheckDefFailure(['var name: dict<number'], 'E1009:')
  
    v9.CheckDefFailure(['w:foo: number = 10'],
*** ../vim-8.2.4259/src/testdir/test_vim9_builtin.vim   2022-01-30 
12:36:48.732985521 +0000
--- src/testdir/test_vim9_builtin.vim   2022-01-30 13:58:24.294921031 +0000
***************
*** 1303,1309 ****
  enddef
  
  def Test_filter_wrong_dict_key_type()
!   assert_fails('Wrong_dict_key_type([1, v:null, 3])', 'E1013:')
  enddef
  
  def Test_filter_return_type()
--- 1303,1309 ----
  enddef
  
  def Test_filter_wrong_dict_key_type()
!   assert_fails('g:Wrong_dict_key_type([1, v:null, 3])', 'E1013:')
  enddef
  
  def Test_filter_return_type()
*** ../vim-8.2.4259/src/testdir/test_vim9_cmd.vim       2022-01-29 
21:45:30.477921609 +0000
--- src/testdir/test_vim9_cmd.vim       2022-01-30 13:59:37.553908406 +0000
***************
*** 1324,1330 ****
    bwipe!
  enddef
  
! def g:SomeComplFunc(findstart: number, base: string): any
    if findstart
      return 0
    else
--- 1324,1330 ----
    bwipe!
  enddef
  
! def s:SomeComplFunc(findstart: number, base: string): any
    if findstart
      return 0
    else
*** ../vim-8.2.4259/src/testdir/test_vim9_disassemble.vim       2022-01-29 
21:45:30.477921609 +0000
--- src/testdir/test_vim9_disassemble.vim       2022-01-30 14:15:01.700861513 
+0000
***************
*** 887,893 ****
  enddef
  
  
! def HasEval()
    if has("eval")
      echo "yes"
    else
--- 887,893 ----
  enddef
  
  
! def s:HasEval()
    if has("eval")
      echo "yes"
    else
***************
*** 895,901 ****
    endif
  enddef
  
! def HasNothing()
    if has("nothing")
      echo "yes"
    else
--- 895,901 ----
    endif
  enddef
  
! def s:HasNothing()
    if has("nothing")
      echo "yes"
    else
***************
*** 903,909 ****
    endif
  enddef
  
! def HasSomething()
    if has("nothing")
      echo "nothing"
    elseif has("something")
--- 903,909 ----
    endif
  enddef
  
! def s:HasSomething()
    if has("nothing")
      echo "nothing"
    elseif has("something")
***************
*** 915,921 ****
    endif
  enddef
  
! def HasGuiRunning()
    if has("gui_running")
      echo "yes"
    else
--- 915,921 ----
    endif
  enddef
  
! def s:HasGuiRunning()
    if has("gui_running")
      echo "yes"
    else
***************
*** 2487,2493 ****
          res)
  enddef
  
! func Legacy() dict
    echo 'legacy'
  endfunc
  
--- 2487,2493 ----
          res)
  enddef
  
! func s:Legacy() dict
    echo 'legacy'
  endfunc
  
***************
*** 2501,2507 ****
    assert_match('<SNR>\d*_UseMember\_s*' ..
            'var d = {func: Legacy}\_s*' ..
            '\d PUSHS "func"\_s*' ..
!           '\d PUSHFUNC "g:Legacy"\_s*' ..
            '\d NEWDICT size 1\_s*' ..
            '\d STORE $0\_s*' ..
  
--- 2501,2507 ----
    assert_match('<SNR>\d*_UseMember\_s*' ..
            'var d = {func: Legacy}\_s*' ..
            '\d PUSHS "func"\_s*' ..
!           '\d PUSHFUNC "<80><fd>R\d\+_Legacy"\_s*' ..
            '\d NEWDICT size 1\_s*' ..
            '\d STORE $0\_s*' ..
  
*** ../vim-8.2.4259/src/testdir/test_vim9_expr.vim      2022-01-29 
21:45:30.481921547 +0000
--- src/testdir/test_vim9_expr.vim      2022-01-30 14:01:24.388422756 +0000
***************
*** 61,72 ****
        var RetThat: func = g:atrue ? RetOne : RetTwo
        assert_equal(function('len'), RetThat)
  
!       var X = FuncOne
!       var Y = FuncTwo
!       var Z = g:cond ? FuncOne : FuncTwo
        assert_equal(123, Z(3))
    END
    v9.CheckDefAndScriptSuccess(lines)
  enddef
  
  def Test_expr1_trinary_vimscript()
--- 61,77 ----
        var RetThat: func = g:atrue ? RetOne : RetTwo
        assert_equal(function('len'), RetThat)
  
!       var X = g:FuncOne
!       var Y = g:FuncTwo
!       var Z = g:cond ? g:FuncOne : g:FuncTwo
        assert_equal(123, Z(3))
    END
    v9.CheckDefAndScriptSuccess(lines)
+ 
+   lines =<< trim END
+       var Z = g:cond ? FuncOne : FuncTwo
+   END
+   v9.CheckDefAndScriptFailure(lines, ['E1001: Variable not found: FuncOne', 
'E121: Undefined variable: FuncTwo'])
  enddef
  
  def Test_expr1_trinary_vimscript()
***************
*** 209,217 ****
  
    " missing argument detected even when common type is used
    call v9.CheckDefAndScriptFailure([
!       \ 'var X = FuncOne',
!       \ 'var Y = FuncTwo',
!       \ 'var Z = g:cond ? FuncOne : FuncTwo',
        \ 'Z()'], 'E119:', 4)
  endfunc
  
--- 214,222 ----
  
    " missing argument detected even when common type is used
    call v9.CheckDefAndScriptFailure([
!       \ 'var X = g:FuncOne',
!       \ 'var Y = g:FuncTwo',
!       \ 'var Z = g:cond ? g:FuncOne : g:FuncTwo',
        \ 'Z()'], 'E119:', 4)
  endfunc
  
***************
*** 2334,2340 ****
        def Test()
          var Ref = g:GlobalFunc
          assert_equal('global', Ref())
!         Ref = GlobalFunc
          assert_equal('global', Ref())
  
          Ref = s:ScriptFunc
--- 2339,2345 ----
        def Test()
          var Ref = g:GlobalFunc
          assert_equal('global', Ref())
!         Ref = g:GlobalFunc
          assert_equal('global', Ref())
  
          Ref = s:ScriptFunc
***************
*** 3083,3094 ****
    v9.CheckDefAndScriptFailure(["var Ref = function('len' [1, 2])"], 
['E1123:', 'E116:'], 1)
  enddef
  
! def g:ExistingGloba(): string
    return 'existing'
  enddef
  
  def Test_expr8_call_global()
!   assert_equal('existing', g:ExistingGloba())
  
    def g:DefinedLater(): string
      return 'later'
--- 3088,3099 ----
    v9.CheckDefAndScriptFailure(["var Ref = function('len' [1, 2])"], 
['E1123:', 'E116:'], 1)
  enddef
  
! def g:ExistingGlobal(): string
    return 'existing'
  enddef
  
  def Test_expr8_call_global()
!   assert_equal('existing', g:ExistingGlobal())
  
    def g:DefinedLater(): string
      return 'later'
*** ../vim-8.2.4259/src/testdir/test_vim9_func.vim      2022-01-29 
21:45:30.481921547 +0000
--- src/testdir/test_vim9_func.vim      2022-01-30 15:10:36.161501475 +0000
***************
*** 340,346 ****
  def Test_return_something()
    g:ReturnString()->assert_equal('string')
    g:ReturnNumber()->assert_equal(123)
!   assert_fails('ReturnGlobal()', 'E1012: Type mismatch; expected number but 
got string', '', 1, 'ReturnGlobal')
  
    var lines =<< trim END
        vim9script
--- 340,346 ----
  def Test_return_something()
    g:ReturnString()->assert_equal('string')
    g:ReturnNumber()->assert_equal(123)
!   assert_fails('g:ReturnGlobal()', 'E1012: Type mismatch; expected number but 
got string', '', 1, 'ReturnGlobal')
  
    var lines =<< trim END
        vim9script
***************
*** 943,949 ****
        def g:Func(): string
          return 'global'
        enddef
!       assert_equal('global', Func())
        delfunc g:Func
    END
    v9.CheckScriptSuccess(lines)
--- 943,949 ----
        def g:Func(): string
          return 'global'
        enddef
!       assert_equal('global', g:Func())
        delfunc g:Func
    END
    v9.CheckScriptSuccess(lines)
***************
*** 1498,1511 ****
  
  def Test_func_type_varargs()
    var RefDefArg: func(?string)
!   RefDefArg = FuncOneDefArg
    RefDefArg()
    s:value->assert_equal('text')
    RefDefArg('some')
    s:value->assert_equal('some')
  
    var RefDef2Arg: func(?number, ?string): string
!   RefDef2Arg = FuncTwoDefArg
    RefDef2Arg()->assert_equal('123text')
    RefDef2Arg(99)->assert_equal('99text')
    RefDef2Arg(77, 'some')->assert_equal('77some')
--- 1498,1511 ----
  
  def Test_func_type_varargs()
    var RefDefArg: func(?string)
!   RefDefArg = g:FuncOneDefArg
    RefDefArg()
    s:value->assert_equal('text')
    RefDefArg('some')
    s:value->assert_equal('some')
  
    var RefDef2Arg: func(?number, ?string): string
!   RefDef2Arg = g:FuncTwoDefArg
    RefDef2Arg()->assert_equal('123text')
    RefDef2Arg(99)->assert_equal('99text')
    RefDef2Arg(77, 'some')->assert_equal('77some')
***************
*** 1514,1520 ****
    v9.CheckDefFailure(['var RefWrong: func(?string, string)'], 'E1007:')
  
    var RefVarargs: func(...list<string>): string
!   RefVarargs = FuncVarargs
    RefVarargs()->assert_equal('')
    RefVarargs('one')->assert_equal('one')
    RefVarargs('one', 'two')->assert_equal('one,two')
--- 1514,1520 ----
    v9.CheckDefFailure(['var RefWrong: func(?string, string)'], 'E1007:')
  
    var RefVarargs: func(...list<string>): string
!   RefVarargs = g:FuncVarargs
    RefVarargs()->assert_equal('')
    RefVarargs('one')->assert_equal('one')
    RefVarargs('one', 'two')->assert_equal('one,two')
***************
*** 1721,1727 ****
  
  def Test_error_in_nested_function()
    # Error in called function requires unwinding the call stack.
!   assert_fails('FuncWithForwardCall()', 'E1096:', '', 1, 
'FuncWithForwardCall')
  enddef
  
  def Test_nested_function_with_nextcmd()
--- 1721,1727 ----
  
  def Test_error_in_nested_function()
    # Error in called function requires unwinding the call stack.
!   assert_fails('g:FuncWithForwardCall()', 'E1096:', '', 1, 
'FuncWithForwardCall')
  enddef
  
  def Test_nested_function_with_nextcmd()
***************
*** 2199,2205 ****
    s:funcResult->assert_equal(22)
  
    s:funcResult = 0
!   Ref2 = FuncOneArgRetNumber
    Ref2(13)->assert_equal(13)
    s:funcResult->assert_equal(13)
  enddef
--- 2199,2205 ----
    s:funcResult->assert_equal(22)
  
    s:funcResult = 0
!   Ref2 = g:FuncOneArgRetNumber
    Ref2(13)->assert_equal(13)
    s:funcResult->assert_equal(13)
  enddef
***************
*** 2232,2242 ****
    RefVoid = g:FuncNoArgNoRet
    RefVoid = g:FuncOneArgNoRet
    v9.CheckDefFailure(['var RefVoid: func: void', 'RefVoid = 
g:FuncNoArgRetNumber'], 'E1012: Type mismatch; expected func(...) but got 
func(): number')
!   v9.CheckDefFailure(['var RefVoid: func: void', 'RefVoid = 
FuncNoArgRetString'], 'E1012: Type mismatch; expected func(...) but got func(): 
string')
  
    var RefAny: func(): any
    RefAny = g:FuncNoArgRetNumber
!   RefAny = FuncNoArgRetString
    v9.CheckDefFailure(['var RefAny: func(): any', 'RefAny = 
g:FuncNoArgNoRet'], 'E1012: Type mismatch; expected func(): any but got func()')
    v9.CheckDefFailure(['var RefAny: func(): any', 'RefAny = 
g:FuncOneArgNoRet'], 'E1012: Type mismatch; expected func(): any but got 
func(number)')
  
--- 2232,2242 ----
    RefVoid = g:FuncNoArgNoRet
    RefVoid = g:FuncOneArgNoRet
    v9.CheckDefFailure(['var RefVoid: func: void', 'RefVoid = 
g:FuncNoArgRetNumber'], 'E1012: Type mismatch; expected func(...) but got 
func(): number')
!   v9.CheckDefFailure(['var RefVoid: func: void', 'RefVoid = 
g:FuncNoArgRetString'], 'E1012: Type mismatch; expected func(...) but got 
func(): string')
  
    var RefAny: func(): any
    RefAny = g:FuncNoArgRetNumber
!   RefAny = g:FuncNoArgRetString
    v9.CheckDefFailure(['var RefAny: func(): any', 'RefAny = 
g:FuncNoArgNoRet'], 'E1012: Type mismatch; expected func(): any but got func()')
    v9.CheckDefFailure(['var RefAny: func(): any', 'RefAny = 
g:FuncOneArgNoRet'], 'E1012: Type mismatch; expected func(): any but got 
func(number)')
  
***************
*** 2244,2255 ****
  
    var RefNr: func: number
    RefNr = g:FuncNoArgRetNumber
!   RefNr = FuncOneArgRetNumber
    v9.CheckDefFailure(['var RefNr: func: number', 'RefNr = g:FuncNoArgNoRet'], 
'E1012: Type mismatch; expected func(...): number but got func()')
!   v9.CheckDefFailure(['var RefNr: func: number', 'RefNr = 
FuncNoArgRetString'], 'E1012: Type mismatch; expected func(...): number but got 
func(): string')
  
    var RefStr: func: string
!   RefStr = FuncNoArgRetString
    RefStr = FuncOneArgRetString
    v9.CheckDefFailure(['var RefStr: func: string', 'RefStr = 
g:FuncNoArgNoRet'], 'E1012: Type mismatch; expected func(...): string but got 
func()')
    v9.CheckDefFailure(['var RefStr: func: string', 'RefStr = 
g:FuncNoArgRetNumber'], 'E1012: Type mismatch; expected func(...): string but 
got func(): number')
--- 2244,2255 ----
  
    var RefNr: func: number
    RefNr = g:FuncNoArgRetNumber
!   RefNr = g:FuncOneArgRetNumber
    v9.CheckDefFailure(['var RefNr: func: number', 'RefNr = g:FuncNoArgNoRet'], 
'E1012: Type mismatch; expected func(...): number but got func()')
!   v9.CheckDefFailure(['var RefNr: func: number', 'RefNr = 
g:FuncNoArgRetString'], 'E1012: Type mismatch; expected func(...): number but 
got func(): string')
  
    var RefStr: func: string
!   RefStr = g:FuncNoArgRetString
    RefStr = FuncOneArgRetString
    v9.CheckDefFailure(['var RefStr: func: string', 'RefStr = 
g:FuncNoArgNoRet'], 'E1012: Type mismatch; expected func(...): string but got 
func()')
    v9.CheckDefFailure(['var RefStr: func: string', 'RefStr = 
g:FuncNoArgRetNumber'], 'E1012: Type mismatch; expected func(...): string but 
got func(): number')
***************
*** 2260,2266 ****
  
    v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncNoArgRetNumber'], 
'E1012: Type mismatch; expected func() but got func(): number')
    v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncOneArgNoRet'], 
'E1012: Type mismatch; expected func() but got func(number)')
!   v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = FuncOneArgRetNumber'], 
'E1012: Type mismatch; expected func() but got func(number): number')
    v9.CheckDefFailure(['var Ref1: func(bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(bool) but got func(bool, number)')
    v9.CheckDefFailure(['var Ref1: func(?bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(?bool) but got func(bool, number)')
    v9.CheckDefFailure(['var Ref1: func(...bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(...bool) but got func(bool, number)')
--- 2260,2266 ----
  
    v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncNoArgRetNumber'], 
'E1012: Type mismatch; expected func() but got func(): number')
    v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncOneArgNoRet'], 
'E1012: Type mismatch; expected func() but got func(number)')
!   v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncOneArgRetNumber'], 
'E1012: Type mismatch; expected func() but got func(number): number')
    v9.CheckDefFailure(['var Ref1: func(bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(bool) but got func(bool, number)')
    v9.CheckDefFailure(['var Ref1: func(?bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(?bool) but got func(bool, number)')
    v9.CheckDefFailure(['var Ref1: func(...bool)', 'Ref1 = g:FuncTwoArgNoRet'], 
'E1012: Type mismatch; expected func(...bool) but got func(bool, number)')
***************
*** 3355,3361 ****
  enddef
  
  def Test_opfunc()
!   nnoremap <F3> <cmd>set opfunc=Opfunc<cr>g@
    def g:Opfunc(_: any): string
      setline(1, 'ASDF')
      return ''
--- 3355,3361 ----
  enddef
  
  def Test_opfunc()
!   nnoremap <F3> <cmd>set opfunc=g:Opfunc<cr>g@
    def g:Opfunc(_: any): string
      setline(1, 'ASDF')
      return ''
*** ../vim-8.2.4259/src/testdir/test_vim9_import.vim    2022-01-29 
21:45:30.481921547 +0000
--- src/testdir/test_vim9_import.vim    2022-01-30 14:01:54.328004810 +0000
***************
*** 2018,2024 ****
    delete('Xdir', 'rf')
  enddef
  
! def Test_autoload_name_wring()
    var lines =<< trim END
       vim9script
       def Xscriptname#Func()
--- 2018,2024 ----
    delete('Xdir', 'rf')
  enddef
  
! def Test_autoload_name_wrong()
    var lines =<< trim END
       vim9script
       def Xscriptname#Func()
*** ../vim-8.2.4259/src/testdir/test_ins_complete.vim   2022-01-29 
21:45:30.485921485 +0000
--- src/testdir/test_ins_complete.vim   2022-01-30 15:20:10.205334218 +0000
***************
*** 1422,1428 ****
      call assert_fails("set completefunc=funcref('abc')", "E700:")
  
      #" set 'completefunc' to a non-existing function
!     set completefunc=CompleteFunc2
      call setline(1, 'five')
      call assert_fails("set completefunc=function('NonExistingFunc')", 'E700:')
      call assert_fails("LET &completefunc = function('NonExistingFunc')", 
'E700:')
--- 1422,1428 ----
      call assert_fails("set completefunc=funcref('abc')", "E700:")
  
      #" set 'completefunc' to a non-existing function
!     set completefunc=g:CompleteFunc2
      call setline(1, 'five')
      call assert_fails("set completefunc=function('NonExistingFunc')", 'E700:')
      call assert_fails("LET &completefunc = function('NonExistingFunc')", 
'E700:')
***************
*** 1679,1685 ****
      call assert_fails("set omnifunc=funcref('abc')", "E700:")
  
      #" set 'omnifunc' to a non-existing function
!     set omnifunc=OmniFunc2
      call setline(1, 'nine')
      call assert_fails("set omnifunc=function('NonExistingFunc')", 'E700:')
      call assert_fails("LET &omnifunc = function('NonExistingFunc')", 'E700:')
--- 1679,1685 ----
      call assert_fails("set omnifunc=funcref('abc')", "E700:")
  
      #" set 'omnifunc' to a non-existing function
!     set omnifunc=g:OmniFunc2
      call setline(1, 'nine')
      call assert_fails("set omnifunc=function('NonExistingFunc')", 'E700:')
      call assert_fails("LET &omnifunc = function('NonExistingFunc')", 'E700:')
***************
*** 1936,1942 ****
      call assert_fails("set thesaurusfunc=funcref('abc')", "E700:")
  
      #" set 'thesaurusfunc' to a non-existing function
!     set thesaurusfunc=TsrFunc2
      call setline(1, 'ten')
      call assert_fails("set thesaurusfunc=function('NonExistingFunc')", 
'E700:')
      call assert_fails("LET &thesaurusfunc = function('NonExistingFunc')", 
'E700:')
--- 1936,1942 ----
      call assert_fails("set thesaurusfunc=funcref('abc')", "E700:")
  
      #" set 'thesaurusfunc' to a non-existing function
!     set thesaurusfunc=g:TsrFunc2
      call setline(1, 'ten')
      call assert_fails("set thesaurusfunc=function('NonExistingFunc')", 
'E700:')
      call assert_fails("LET &thesaurusfunc = function('NonExistingFunc')", 
'E700:')
*** ../vim-8.2.4259/src/testdir/test_popupwin.vim       2022-01-29 
21:45:30.485921485 +0000
--- src/testdir/test_popupwin.vim       2022-01-30 15:21:59.855772408 +0000
***************
*** 2263,2269 ****
            \ wrap: true,
            \ scrollbar: true,
            \ mapping: false,
!           \ filter: Popup_filter,
            \ })
      enddef
  
--- 2263,2269 ----
            \ wrap: true,
            \ scrollbar: true,
            \ mapping: false,
!           \ filter: g:Popup_filter,
            \ })
      enddef
  
***************
*** 2328,2334 ****
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_10', {})
  
    " check size with non-wrapping lines
!   call term_sendkeys(buf, ":call PopupScroll()\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_11', {})
  
    " check size with wrapping lines
--- 2328,2334 ----
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_10', {})
  
    " check size with non-wrapping lines
!   call term_sendkeys(buf, ":call g:PopupScroll()\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_11', {})
  
    " check size with wrapping lines
*** ../vim-8.2.4259/src/testdir/dumps/Test_popupwin_scroll_11.dump      
2019-11-02 15:12:48.000000000 +0000
--- src/testdir/dumps/Test_popupwin_scroll_11.dump      2022-01-30 
15:22:14.283566902 +0000
***************
*** 7,10 ****
  |7| @20|4+0#0000001#ffd7ff255| @28| +0#0000000#a8a8a8255| +0&#ffffff0@21
  |8| @73
  |9| @73
! |:|c|a|l@1| |P|o|p|u|p|S|c|r|o|l@1|(|)| @37|1|,|1| @10|T|o|p| 
--- 7,10 ----
  |7| @20|4+0#0000001#ffd7ff255| @28| +0#0000000#a8a8a8255| +0&#ffffff0@21
  |8| @73
  |9| @73
! |:|c|a|l@1| |g|:|P|o|p|u|p|S|c|r|o|l@1|(|)| @35|1|,|1| @10|T|o|p| 
*** ../vim-8.2.4259/src/testdir/dumps/Test_popupwin_scroll_12.dump      
2019-11-02 15:12:49.000000000 +0000
--- src/testdir/dumps/Test_popupwin_scroll_12.dump      2022-01-30 
15:23:36.754392293 +0000
***************
*** 7,10 ****
  |7| @20|l+0#0000001#ffd7ff255|o|n|g| |l|i|n|e| |l|o|n|g| |l|i|n|e| |l|o|n|g| 
|l|i|n|e| | +0#0000000#a8a8a8255| +0&#ffffff0@21
  |8| @73
  |9| @73
! |:|c|a|l@1| |P|o|p|u|p|S|c|r|o|l@1|(|)| @37|1|,|1| @10|T|o|p| 
--- 7,10 ----
  |7| @20|l+0#0000001#ffd7ff255|o|n|g| |l|i|n|e| |l|o|n|g| |l|i|n|e| |l|o|n|g| 
|l|i|n|e| | +0#0000000#a8a8a8255| +0&#ffffff0@21
  |8| @73
  |9| @73
! |:|c|a|l@1| |g|:|P|o|p|u|p|S|c|r|o|l@1|(|)| @35|1|,|1| @10|T|o|p| 
*** ../vim-8.2.4259/src/version.c       2022-01-30 12:36:48.732985521 +0000
--- src/version.c       2022-01-30 13:05:33.660084591 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4260,
  /**/

-- 
ARTHUR: I've said I'm sorry about the old woman, but from the behind you
        looked ...
DENNIS: What I object to is that you automatically treat me like an inferior...
ARTHUR: Well ... I AM king.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220130152902.5772E1C1918%40moolenaar.net.

Raspunde prin e-mail lui