]> granicus.if.org Git - vim/commitdiff
patch 7.4.1546 v7.4.1546
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Mar 2016 18:03:59 +0000 (19:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Mar 2016 18:03:59 +0000 (19:03 +0100)
Problem:    Sticky type checking is more annoying than useful.
Solution:   Remove the error for changing a variable type.

runtime/doc/eval.txt
src/eval.c
src/testdir/test_alot.vim
src/testdir/test_assign.vim [new file with mode: 0644]
src/version.c

index 0bb4b83b2a4ae661b43fc0f5ea4604e2cb3092f4..370d64b443ffbf4162d0f38896220f0884372ba8 100644 (file)
@@ -1,4 +1,4 @@
-*eval.txt*     For Vim version 7.4.  Last change: 2016 Mar 08
+*eval.txt*     For Vim version 7.4.  Last change: 2016 Mar 12
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -113,16 +113,8 @@ to Float, printf() for Float to String and float2nr() for Float to Number.
                        *E891* *E892* *E893* *E894* *E907* *E911* *E914*
 When expecting a Float a Number can also be used, but nothing else.
 
-                                               *E706* *sticky-type-checking*
-You will get an error if you try to change the type of a variable.  You need
-to |:unlet| it first to avoid this error.  String and Number are considered
-equivalent though, as well are Float and Number.  Consider this sequence of
-commands: >
-       :let l = "string"
-       :let l = 44             " changes type from String to Number
-       :let l = [1, 2, 3]      " error!  l is still a Number
-       :let l = 4.4            " changes type from Number to Float
-       :let l = "string"       " error!
+                                               *no-type-checking*
+You will not get an error if you try to change the type of a variable.
 
 
 1.2 Function references ~
@@ -1969,6 +1961,7 @@ islocked( {expr})         Number  TRUE if {expr} is locked
 isnan( {expr})                 Number  TRUE if {expr} is NaN
 items( {dict})                 List    key-value pairs in {dict}
 job_getchannel( {job})         Channel get the channel handle for {job}
+job_info( {job})               Dict    get information about {job}
 job_setoptions( {job}, {options}) none set options for {job}
 job_start( {command} [, {options}]) Job         start a job
 job_status( {job})             String  get the status of {job}
@@ -4473,10 +4466,18 @@ job_getchannel({job})                                    *job_getchannel()*
 <
                {only available when compiled with the |+job| feature}
 
+job_info({job})                                                *job_info()*
+               Returns a Dictionary with information about {job}:
+                  "status"     what |job_status()| returns
+                  "channel"    what |job_getchannel()| returns
+                  "exitval"    only valid when "status" is "dead"
+                  "exit-cb"    function to be called on exit
+                  "stoponexit" |job-stoponexit|
+
 job_setoptions({job}, {options})                       *job_setoptions()*
                Change options for {job}.  Supported are:
-                       "stoponexit"    |job-stoponexit|
-                       "exit-cb"       |job-exit-cb|
+                  "stoponexit" |job-stoponexit|
+                  "exit-cb"    |job-exit-cb|
 
 job_start({command} [, {options}])                     *job_start()*
                Start a job and return a Job object.  Unlike |system()| and
index f4843e2c023828d11fa3781e61bd83604740c168..765d9b99dd70512213507d2a38670172f6b33887 100644 (file)
@@ -22091,22 +22091,6 @@ set_var(
        if (var_check_ro(v->di_flags, name, FALSE)
                               || tv_check_lock(v->di_tv.v_lock, name, FALSE))
            return;
-       if (v->di_tv.v_type != tv->v_type
-               && !((v->di_tv.v_type == VAR_STRING
-                       || v->di_tv.v_type == VAR_NUMBER)
-                   && (tv->v_type == VAR_STRING
-                       || tv->v_type == VAR_NUMBER))
-#ifdef FEAT_FLOAT
-               && !((v->di_tv.v_type == VAR_NUMBER
-                       || v->di_tv.v_type == VAR_FLOAT)
-                   && (tv->v_type == VAR_NUMBER
-                       || tv->v_type == VAR_FLOAT))
-#endif
-               )
-       {
-           EMSG2(_("E706: Variable type mismatch for: %s"), name);
-           return;
-       }
 
        /*
         * Handle setting internal v: variables separately where needed to
index 46be51584768911f92d949391bc20236411c9795..60717569020801761ea687834dde298025dedb26 100644 (file)
@@ -1,6 +1,7 @@
 " A series of tests that can run in one Vim invocation.
 " This makes testing go faster, since Vim doesn't need to restart.
 
+source test_assign.vim
 source test_backspace_opt.vim
 source test_cursor_func.vim
 source test_delete.vim
diff --git a/src/testdir/test_assign.vim b/src/testdir/test_assign.vim
new file mode 100644 (file)
index 0000000..c1f036a
--- /dev/null
@@ -0,0 +1,9 @@
+" Test for assignment
+
+func Test_no_type_checking()
+  let v = 1
+  let v = [1,2,3]
+  let v = {'a': 1, 'b': 2}
+  let v = 3.4
+  let v = 'hello'
+endfunc
index 0652ab8d47b5f40dbcb144871dab050696fc46d3..fc9cebea1b0bb7892da9fd6dc4a724d50cc6ecd7 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1546,
 /**/
     1545,
 /**/