Skip to content

Commit

Permalink
patch 8.2.3152: Vim9: accessing "s:" results in an error
Browse files Browse the repository at this point in the history
Problem:    Vim9: accessing "s:" results in an error.
Solution:   Do not try to lookup a script variable for "s:". (closes #8549)
  • Loading branch information
brammool committed Jul 11, 2021
1 parent ffcfddc commit 11005b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/evalvars.c
Expand Up @@ -2660,7 +2660,8 @@ eval_variable(
}
else if (rettv != NULL)
{
if (ht != NULL && ht == get_script_local_ht())
if (ht != NULL && ht == get_script_local_ht()
&& tv != &SCRIPT_SV(current_sctx.sc_sid)->sv_var.di_tv)
{
svar_T *sv = find_typval_in_script(tv);

Expand Down
7 changes: 7 additions & 0 deletions src/testdir/test_vim9_expr.vim
Expand Up @@ -2478,6 +2478,13 @@ def Test_expr7_dict_vim9script()
else
CheckDefAndScriptFailure(lines, 'E117:', 0)
endif

lines =<< trim END
vim9script
var x = 99
assert_equal({x: 99}, s:)
END
CheckScriptSuccess(lines)
enddef

def Test_expr7_call_2bool()
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3152,
/**/
3151,
/**/
Expand Down

0 comments on commit 11005b0

Please sign in to comment.