patch 8.2.2617: Vim9: script variable in block not found by function

Problem:    Vim9: script variable in a block scope not found by a nested
            function.
Solution:   Copy the block scope IDs before compiling the function.
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 9d05bbf..7470ac3 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -947,7 +947,7 @@
   enddef
 enddef
 
-def Test_nested_func()
+def Test_disassemble_nested_func()
    var instr = execute('disassemble NestedOuter')
    assert_match('NestedOuter\_s*' ..
         'def g:Inner()\_s*' ..
@@ -965,7 +965,7 @@
   def /Info/
 enddef
 
-def Test_nested_def_list()
+def Test_disassemble_nested_def_list()
    var instr = execute('disassemble NestedDefList')
    assert_match('NestedDefList\_s*' ..
         'def\_s*' ..
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 6258b7d..73d8e37 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -393,7 +393,6 @@
   CheckDefFailure(lines, 'E1117:')
 
   # nested function inside conditional
-  # TODO: should it work when "thecount" is inside the "if"?
   lines =<< trim END
       vim9script
       var thecount = 0
@@ -411,6 +410,25 @@
       assert_equal(2, Test())
   END
   CheckScriptSuccess(lines)
+
+  # also works when "thecount" is inside the "if" block
+  lines =<< trim END
+      vim9script
+      if true
+        var thecount = 0
+        def Test(): number
+          def TheFunc(): number
+            thecount += 1
+            return thecount
+          enddef
+          return TheFunc()
+        enddef
+      endif
+      defcompile
+      assert_equal(1, Test())
+      assert_equal(2, Test())
+  END
+  CheckScriptSuccess(lines)
 enddef
 
 def Test_not_nested_function()