]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3152: Vim9: accessing "s:" results in an error v8.2.3152
authorBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2021 18:59:00 +0000 (20:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2021 18:59:00 +0000 (20:59 +0200)
Problem:    Vim9: accessing "s:" results in an error.
Solution:   Do not try to lookup a script variable for "s:". (closes #8549)

src/evalvars.c
src/testdir/test_vim9_expr.vim
src/version.c

index 66018cff0592d7ddca760decf29f40533f6944d1..27d73287154bc375cd2ffacc8241adfa652964aa 100644 (file)
@@ -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);
 
index 79a4ea36e54dcd54ea552bdac7b5fe8b0a924b67..f0e15c37ec691fbc64b21580bccebf6d499376ec 100644 (file)
@@ -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()
index 7f9f49efd165fd235e520aa0b7661ba0abfcd2a3..21394aa1a7fff5a999523d7fbe679858063732fc 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3152,
 /**/
     3151,
 /**/