patch 8.2.3838: cannot use script-local function for setting *func options

Problem:    Cannot use script-local function for setting *func options.
Solution:   Use the script context. (Yegappan Lakshmanan, closes #9362)
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 2f9b1ce..08539de 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -575,6 +575,21 @@
   END
   call CheckTransLegacySuccess(lines)
 
+  " Test for using a script-local function name
+  func s:OpFunc3(type)
+    let g:OpFunc3Args = [a:type]
+  endfunc
+  set opfunc=s:OpFunc3
+  let g:OpFunc3Args = []
+  normal! g@l
+  call assert_equal(['char'], g:OpFunc3Args)
+
+  let &opfunc = 's:OpFunc3'
+  let g:OpFunc3Args = []
+  normal! g@l
+  call assert_equal(['char'], g:OpFunc3Args)
+  delfunc s:OpFunc3
+
   " Using Vim9 lambda expression in legacy context should fail
   set opfunc=(a)\ =>\ OpFunc1(24,\ a)
   let g:OpFunc1Args = []
@@ -598,14 +613,32 @@
   let lines =<< trim END
     vim9script
 
-    # Test for using a def function with opfunc
     def g:Vim9opFunc(val: number, type: string): void
       g:OpFunc1Args = [val, type]
     enddef
+
+    # Test for using a def function with opfunc
     set opfunc=function('g:Vim9opFunc',\ [60])
     g:OpFunc1Args = []
     normal! g@l
     assert_equal([60, 'char'], g:OpFunc1Args)
+
+    # Test for using a global function name
+    &opfunc = g:OpFunc2
+    g:OpFunc2Args = []
+    normal! g@l
+    assert_equal(['char'], g:OpFunc2Args)
+    bw!
+
+    # Test for using a script-local function name
+    def s:LocalOpFunc(type: string): void
+      g:LocalOpFuncArgs = [type]
+    enddef
+    &opfunc = s:LocalOpFunc
+    g:LocalOpFuncArgs = []
+    normal! g@l
+    assert_equal(['char'], g:LocalOpFuncArgs)
+    bw!
   END
   call CheckScriptSuccess(lines)