patch 8.2.2290: Vim9: unlet of global variable cannot be compiled
Problem: Vim9: unlet of global variable cannot be compiled.
Solution: Skip over variables that might be defined later. Give an error if
a subscript is found. (closes #7585)
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index 5f45b57..bdae635 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -1340,6 +1340,15 @@
assert_false(exists('s:somevar'))
unlet! s:somevar
+ # can compile unlet before variable exists
+ # This doesn't work yet
+ #g:someDict = {key: 'val'}
+ #var k = 'key'
+ #unlet g:someDict[k]
+ #assert_equal({}, g:someDict)
+ #unlet g:someDict
+ #assert_false(exists('g:someDict'))
+
CheckScriptFailure([
'vim9script',
'var svar = 123',