comparison src/testdir/test_vim9_assign.vim @ 23537:7f0fc2ab90e3 v8.2.2311

patch 8.2.2311: Vim9: cannot assign to variable that shadows command modifier Commit: https://github.com/vim/vim/commit/17126b13969c3b91516a8e9ff80fb6a1f6924d40 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 7 22:03:02 2021 +0100 patch 8.2.2311: Vim9: cannot assign to variable that shadows command modifier Problem: Vim9: cannot assign to a variable that shadows a command modifier. Solution: Check for assignment after possible command modifier. (closes #7632)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Jan 2021 22:15:05 +0100
parents f39a18a42aed
children 4156f972efb1
comparison
equal deleted inserted replaced
23536:708e07fe1fb4 23537:7f0fc2ab90e3
1462 assert_equal('foobar', $ENVVAR) 1462 assert_equal('foobar', $ENVVAR)
1463 unlet $ENVVAR 1463 unlet $ENVVAR
1464 assert_equal('', $ENVVAR) 1464 assert_equal('', $ENVVAR)
1465 enddef 1465 enddef
1466 1466
1467 def Test_assign_command_modifier()
1468 var lines =<< trim END
1469 var verbose = 0
1470 verbose = 1
1471 assert_equal(1, verbose)
1472 silent verbose = 2
1473 assert_equal(2, verbose)
1474 silent verbose += 2
1475 assert_equal(4, verbose)
1476 silent verbose -= 1
1477 assert_equal(3, verbose)
1478
1479 var topleft = {one: 1}
1480 sandbox topleft.one = 3
1481 assert_equal({one: 3}, topleft)
1482 leftabove topleft[' '] = 4
1483 assert_equal({one: 3, ' ': 4}, topleft)
1484 END
1485 CheckDefAndScriptSuccess(lines)
1486 enddef
1487
1467 1488
1468 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 1489 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker