Skip to content

Commit 953cc7f

Browse files
committed
patch 7.4.1606
Problem: Having type() handle a Funcref that is or isn't a partial differently causes problems for existing scripts. Solution: Make type() return the same value. (Thinca)
1 parent 3905e29 commit 953cc7f

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20398,6 +20398,7 @@ f_type(typval_T *argvars, typval_T *rettv)
2039820398
{
2039920399
case VAR_NUMBER: n = 0; break;
2040020400
case VAR_STRING: n = 1; break;
20401+
case VAR_PARTIAL:
2040120402
case VAR_FUNC: n = 2; break;
2040220403
case VAR_LIST: n = 3; break;
2040320404
case VAR_DICT: n = 4; break;
@@ -20411,7 +20412,6 @@ f_type(typval_T *argvars, typval_T *rettv)
2041120412
break;
2041220413
case VAR_JOB: n = 8; break;
2041320414
case VAR_CHANNEL: n = 9; break;
20414-
case VAR_PARTIAL: n = 10; break;
2041520415
case VAR_UNKNOWN:
2041620416
EMSG2(_(e_intern2), "f_type(UNKNOWN)");
2041720417
n = -1;

src/testdir/test_viml.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ func Test_type()
942942
call assert_equal(0, type(0))
943943
call assert_equal(1, type(""))
944944
call assert_equal(2, type(function("tr")))
945+
call assert_equal(2, type(function("tr", [8])))
945946
call assert_equal(3, type([]))
946947
call assert_equal(4, type({}))
947948
call assert_equal(5, type(0.0))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1606,
751753
/**/
752754
1605,
753755
/**/

0 commit comments

Comments
 (0)