comparison src/testdir/test_vim9_assign.vim @ 24531:3bfec39ce31c v8.2.2805

patch 8.2.2805: Vim9: cannot use legacy syntax in Vim9 script Commit: https://github.com/vim/vim/commit/96cf4ba8fb96e5778192d2dab7458b9a7da0a49d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 24 14:15:41 2021 +0200 patch 8.2.2805: Vim9: cannot use legacy syntax in Vim9 script Problem: Vim9: cannot use legacy syntax in Vim9 script. Solution: Add the :legacy command.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Apr 2021 14:30:04 +0200
parents 7c4f50c02e18
children 9c404d78d767
comparison
equal deleted inserted replaced
24530:51e01f7c2069 24531:3bfec39ce31c
1498 1498
1499 def Test_script_local_in_legacy() 1499 def Test_script_local_in_legacy()
1500 # OK to define script-local later when prefixed with s: 1500 # OK to define script-local later when prefixed with s:
1501 var lines =<< trim END 1501 var lines =<< trim END
1502 def SetLater() 1502 def SetLater()
1503 s:legacy = 'two' 1503 s:legvar = 'two'
1504 enddef 1504 enddef
1505 defcompile 1505 defcompile
1506 let s:legacy = 'one' 1506 let s:legvar = 'one'
1507 call SetLater() 1507 call SetLater()
1508 call assert_equal('two', s:legacy) 1508 call assert_equal('two', s:legvar)
1509 END 1509 END
1510 CheckScriptSuccess(lines) 1510 CheckScriptSuccess(lines)
1511 1511
1512 # OK to leave out s: prefix when script-local already defined 1512 # OK to leave out s: prefix when script-local already defined
1513 lines =<< trim END 1513 lines =<< trim END
1514 let s:legacy = 'one' 1514 let s:legvar = 'one'
1515 def SetNoPrefix() 1515 def SetNoPrefix()
1516 legacy = 'two' 1516 legvar = 'two'
1517 enddef 1517 enddef
1518 call SetNoPrefix() 1518 call SetNoPrefix()
1519 call assert_equal('two', s:legacy) 1519 call assert_equal('two', s:legvar)
1520 END 1520 END
1521 CheckScriptSuccess(lines) 1521 CheckScriptSuccess(lines)
1522 1522
1523 # Not OK to leave out s: prefix when script-local defined later 1523 # Not OK to leave out s: prefix when script-local defined later
1524 lines =<< trim END 1524 lines =<< trim END
1525 def SetLaterNoPrefix() 1525 def SetLaterNoPrefix()
1526 legacy = 'two' 1526 legvar = 'two'
1527 enddef 1527 enddef
1528 defcompile 1528 defcompile
1529 let s:legacy = 'one' 1529 let s:legvar = 'one'
1530 END 1530 END
1531 CheckScriptFailure(lines, 'E476:', 1) 1531 CheckScriptFailure(lines, 'E476:', 1)
1532 enddef 1532 enddef
1533 1533
1534 def Test_var_type_check() 1534 def Test_var_type_check()