patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script

Problem:    Vim9: error for an autocmd defined in a :def function in legacy
            Vim script.
Solution:   Don't check the variable type. (closes #6758)
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 91867f2..5a25147 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -3166,6 +3166,23 @@
   &rtp = save_rtp
 enddef
 
+def Test_script_var_in_autocmd()
+  # using a script variable from an autocommand, defined in a :def function in a
+  # legacy Vim script, cannot check the variable type.
+  let lines =<< trim END
+    let s:counter = 1
+    def s:Func()
+      au! CursorHold
+      au CursorHold * s:counter += 1
+    enddef
+    call s:Func()
+    doau CursorHold
+    call assert_equal(2, s:counter)
+    au! CursorHold
+  END
+  CheckScriptSuccess(lines)
+enddef
+
 def Test_cmdline_win()
   # if the Vim syntax highlighting uses Vim9 constructs they can be used from
   # the command line window.