Patch 8.2.1471
Problem:    :const only locks the variable, not the value.
Solution:   Lock the value as ":lockvar 1 var" would do. (closes #6719)
Files:      src/evalvars.c, src/testdir/test_const.vim


*** ../vim-8.2.1470/src/evalvars.c      2020-08-16 21:29:01.982630120 +0200
--- src/evalvars.c      2020-08-16 22:22:31.953445972 +0200
***************
*** 3087,3093 ****
      }
  
      if (flags & LET_IS_CONST)
!       di->di_tv.v_lock |= VAR_LOCKED;
  }
  
  /*
--- 3087,3093 ----
      }
  
      if (flags & LET_IS_CONST)
!       item_lock(&di->di_tv, 1, TRUE);
  }
  
  /*
*** ../vim-8.2.1470/src/testdir/test_const.vim  2020-03-18 19:32:22.510363327 
+0100
--- src/testdir/test_const.vim  2020-08-16 22:42:10.665017597 +0200
***************
*** 41,46 ****
--- 41,47 ----
      call assert_fails('let s = "vim"', 'E741:')
      call assert_fails('let F = funcref("s:noop")', 'E741:')
      call assert_fails('let l = [1, 2, 3]', 'E741:')
+     call assert_fails('call filter(l, "v:val % 2 == 0")', 'E741:')
      call assert_fails('let d = {"foo": 10}', 'E741:')
      if has('channel')
        call assert_fails('let j = test_null_job()', 'E741:')
***************
*** 276,288 ****
      const l = [1, 2, 3]
      const d = {'foo': 10}
  
!     " Modify list
!     call add(l, 4)
      let l[0] = 42
  
!     " Modify dict
!     let d['bar'] = 'hello'
      let d.foo = 44
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
--- 277,292 ----
      const l = [1, 2, 3]
      const d = {'foo': 10}
  
!     " Modify list - setting item is OK, adding/removing items not
      let l[0] = 42
+     call assert_fails('call add(l, 4)', 'E741:')
+     call assert_fails('unlet l[1]', 'E741:')
  
!     " Modify dict - changing item is OK, adding/removing items not
!     let d['foo'] = 'hello'
      let d.foo = 44
+     call assert_fails("let d['bar'] = 'hello'", 'E741:')
+     call assert_fails("unlet d['foo']", 'E741:')
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1470/src/version.c       2020-08-16 21:51:45.490384078 +0200
--- src/version.c       2020-08-16 22:23:29.337036431 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1471,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
220. Your wife asks for sex and you tell her where to find you on IRC.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202008162050.07GKoWKo676360%40masaka.moolenaar.net.

Raspunde prin e-mail lui