changeset 23438:4c6ebf531284 v8.2.2262

patch 8.2.2262: Vim9: converting bool to string prefixes v: Commit: https://github.com/vim/vim/commit/a8b8af19e48e1803e20a129e9aebab1aac544956 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 1 15:11:04 2021 +0100 patch 8.2.2262: Vim9: converting bool to string prefixes v: Problem: Vim9: converting bool to string prefixes v:. Solution: Do not use the v: prefix.
author Bram Moolenaar <Bram@vim.org>
date Fri, 01 Jan 2021 15:15:03 +0100
parents b441dd39a450
children ce571f96b8a7
files src/evalvars.c src/testdir/test_vim9_disassemble.vim src/testdir/test_vim9_expr.vim src/version.c
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2068,8 +2068,8 @@ get_var_special_name(int nr)
 {
     switch (nr)
     {
-	case VVAL_FALSE: return "v:false";
-	case VVAL_TRUE:  return "v:true";
+	case VVAL_FALSE: return in_vim9script() ? "false" : "v:false";
+	case VVAL_TRUE:  return in_vim9script() ? "true" : "v:true";
 	case VVAL_NONE:  return "v:none";
 	case VVAL_NULL:  return "v:null";
     }
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -182,7 +182,7 @@ def Test_disassemble_push()
   var res = execute('disass s:ScriptFuncPush')
   assert_match('<SNR>\d*_ScriptFuncPush.*' ..
         'localbool = true.*' ..
-        ' PUSH v:true.*' ..
+        ' PUSH true.*' ..
         'localspec = v:none.*' ..
         ' PUSH v:none.*' ..
         'localblob = 0z1234.*' ..
@@ -1461,7 +1461,7 @@ def Test_disassemble_invert_bool()
   var instr = execute('disassemble InvertBool')
   assert_match('InvertBool\_s*' ..
         'var flag = true\_s*' ..
-        '\d PUSH v:true\_s*' ..
+        '\d PUSH true\_s*' ..
         '\d STORE $0\_s*' ..
         'var invert = !flag\_s*' ..
         '\d LOAD $0\_s*' ..
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1056,14 +1056,19 @@ def Test_expr5()
       assert_equal('123 hello', 123 .. ' hello')
       assert_equal('123456', 123 .. 456)
 
-      assert_equal('av:true', 'a' .. true)
-      assert_equal('av:false', 'a' .. false)
+      assert_equal('atrue', 'a' .. true)
+      assert_equal('afalse', 'a' .. false)
       assert_equal('av:null', 'a' .. v:null)
       assert_equal('av:none', 'a' .. v:none)
       if has('float')
         assert_equal('a0.123', 'a' .. 0.123)
       endif
 
+      set digraph
+      assert_equal('val: true', 'val: ' .. &digraph)
+      set nodigraph
+      assert_equal('val: false', 'val: ' .. &digraph)
+
       assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
       assert_equal(0z11223344, 0z1122 + 0z3344)
       assert_equal(0z112201ab, 0z1122
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2262,
+/**/
     2261,
 /**/
     2260,