patch 8.2.4548: script-local function is deleted when used in a funcref
Problem: Script-local function is deleted when used in a funcref.
Solution: Do not consider a function starting with "<SNR>" reference
counted. (closes #9916, closes #9820)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 85e8e9d..43fc68e 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -3717,6 +3717,24 @@
v9.CheckScriptSuccess(lines)
enddef
+def Test_script_local_other_script()
+ var lines =<< trim END
+ function LegacyJob()
+ let FuncRef = function('s:close_cb')
+ endfunction
+ function s:close_cb(...)
+ endfunction
+ END
+ lines->writefile('Xlegacy.vim')
+ source Xlegacy.vim
+ g:LegacyJob()
+ g:LegacyJob()
+ g:LegacyJob()
+
+ delfunc g:LegacyJob
+ delete('Xlegacy.vim')
+enddef
+
def Test_check_func_arg_types()
var lines =<< trim END
vim9script