dict_wrong_func_name(dict_T *d, typval_T *tv, char_u *name)
{
return (d == get_globvar_dict()
- || (SCRIPT_ID_VALID(current_sctx.sc_sid)
- && d == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict))
+ || (in_vim9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)
+ && d == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict)
+ || &d->dv_hashtab == get_funccal_local_ht())
&& (tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL)
&& var_wrong_func_name(name, TRUE);
}
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()
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