File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11619,10 +11619,9 @@ text...
1161911619 If the system does not support deleting an environment
1162011620 variable, it is made empty.
1162111621
11622- *:cons* *:const* *E996*
11622+ *:cons* *:const*
1162311623:cons[t] {var-name} = {expr1}
1162411624:cons[t] [{name1} , {name2} , ...] = {expr1}
11625- :cons[t] [{name1} , {name2} , ...] .= {expr1}
1162611625:cons[t] [{name} , ..., ; {lastname} ] = {expr1}
1162711626:cons[t] {var-name} =<< [trim] {marker}
1162811627text...
@@ -11641,7 +11640,11 @@ text...
1164111640 | :const | does not allow to for changing a variable. >
1164211641 :let x = 1
1164311642 :const x = 2 " Error!
11644- <
11643+ < *E996*
11644+ Note that environment variables, option values and
11645+ register values cannot be used here, since they cannot
11646+ be locked.
11647+
1164511648:lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv*
1164611649 Lock the internal variable {name} . Locking means that
1164711650 it can no longer be changed (until it is unlocked).
Original file line number Diff line number Diff line change @@ -21,6 +21,21 @@ func Test_define_var_with_lock()
2121 hello
2222 EOS
2323
24+ call assert_true (exists (' i' ))
25+ call assert_true (exists (' f' ))
26+ call assert_true (exists (' s' ))
27+ call assert_true (exists (' F' ))
28+ call assert_true (exists (' l' ))
29+ call assert_true (exists (' d' ))
30+ if has (' channel' )
31+ call assert_true (exists (' j' ))
32+ call assert_true (exists (' c' ))
33+ endif
34+ call assert_true (exists (' b' ))
35+ call assert_true (exists (' n' ))
36+ call assert_true (exists (' bl' ))
37+ call assert_true (exists (' here' ))
38+
2439 call assert_fails (' let i = 1' , ' E741:' )
2540 call assert_fails (' let f = 1.1' , ' E741:' )
2641 call assert_fails (' let s = "vim"' , ' E741:' )
@@ -218,6 +233,17 @@ func Test_const_with_special_variables()
218233 call assert_fails (' const &g:encoding = "utf-8"' , ' E996:' )
219234endfunc
220235
236+ func Test_const_with_eval_name ()
237+ let s = ' foo'
238+
239+ " eval name with :const should work
240+ const abc_{s } = 1
241+ const {s }{s } = 1
242+
243+ let s2 = ' abc_foo'
244+ call assert_fails (' const {s2} = "bar"' , ' E995:' )
245+ endfunc
246+
221247func Test_lock_depth_is_1 ()
222248 const l = [1 , 2 , 3 ]
223249 const d = {' foo' : 10 }
Original file line number Diff line number Diff line change @@ -777,6 +777,8 @@ static char *(features[]) =
777777
778778static int included_patches [] =
779779{ /* Add new patch number below this line */
780+ /**/
781+ 1554 ,
780782/**/
781783 1553 ,
782784/**/
You can’t perform that action at this time.
0 commit comments