# HG changeset patch # User Bram Moolenaar # Date 1626030004 -7200 # Node ID 346002a63bc6744c3f056d38e151c98cae2b21e1 # Parent 0962ebca21220af429090f73a1727f668c15d13d patch 8.2.3152: Vim9: accessing "s:" results in an error Commit: https://github.com/vim/vim/commit/11005b078d2485a306c74f77c9dd158fdd7f3cbe Author: Bram Moolenaar Date: Sun Jul 11 20:59:00 2021 +0200 patch 8.2.3152: Vim9: accessing "s:" results in an error Problem: Vim9: accessing "s:" results in an error. Solution: Do not try to lookup a script variable for "s:". (closes https://github.com/vim/vim/issues/8549) diff --git a/src/evalvars.c b/src/evalvars.c --- a/src/evalvars.c +++ b/src/evalvars.c @@ -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); diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -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() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3152, +/**/ 3151, /**/ 3150,