diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-11 20:59:00 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-11 20:59:00 +0200 |
commit | 11005b078d2485a306c74f77c9dd158fdd7f3cbe (patch) | |
tree | dbcaf3031703a66a0afbe1ecbbb4a306f72a6e65 | |
parent | ffcfddc759e583471a1ed55e0938d042bf68c507 (diff) |
patch 8.2.3152: Vim9: accessing "s:" results in an errorv8.2.3152
Problem: Vim9: accessing "s:" results in an error.
Solution: Do not try to lookup a script variable for "s:". (closes #8549)
-rw-r--r-- | src/evalvars.c | 3 | ||||
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 66018cff05..27d7328715 100644 --- 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 index 79a4ea36e5..f0e15c37ec 100644 --- 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 index 7f9f49efd1..21394aa1a7 100644 --- 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, |