Mercurial > vim
diff src/testdir/test_functions.vim @ 24766:29ed95687f74 v8.2.2921
patch 8.2.2921: E704 for script local variable is not backwards compatible
Commit: https://github.com/vim/vim/commit/b54abeeafb074248597878a874fed9a66b114c06
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 2 11:49:23 2021 +0200
patch 8.2.2921: E704 for script local variable is not backwards compatible
Problem: E704 for script local variable is not backwards compatible.
(Yasuhiro Matsumoto)
Solution: Only give the error in Vim9 script. Also check for function-local
variable.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Jun 2021 12:00:06 +0200 |
parents | 3907cf9be745 |
children | 5f8dd7b3ae41 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -4,6 +4,7 @@ source shared.vim source check.vim source term_util.vim source screendump.vim +source vim9.vim " Must be done first, since the alternate buffer must be unset. func Test_00_bufexists() @@ -2684,8 +2685,13 @@ endfunc func Test_builtin_check() call assert_fails('let g:["trim"] = {x -> " " .. x}', 'E704:') call assert_fails('let g:.trim = {x -> " " .. x}', 'E704:') - call assert_fails('let s:["trim"] = {x -> " " .. x}', 'E704:') - call assert_fails('let s:.trim = {x -> " " .. x}', 'E704:') + call assert_fails('let l:["trim"] = {x -> " " .. x}', 'E704:') + call assert_fails('let l:.trim = {x -> " " .. x}', 'E704:') + let lines =<< trim END + vim9script + var s:trim = (x) => " " .. x + END + call CheckScriptFailure(lines, 'E704:') call assert_fails('call extend(g:, #{foo: { -> "foo" }})', 'E704:') let g:bar = 123