changeset 22133:4fd33ca087e1 v8.2.1616

patch 8.2.1616: Vim9: cannot pass "true" to synID() Commit: https://github.com/vim/vim/commit/fcb6d7082d563acc33866b3d3a659c32ad19a9e1 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 5 21:41:56 2020 +0200 patch 8.2.1616: Vim9: cannot pass "true" to synID() Problem: Vim9: cannot pass "true" to synID(). Solution: Use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6860)
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Sep 2020 21:45:04 +0200
parents ec61183332b7
children 9d18db2f508e
files src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -8487,7 +8487,7 @@ f_synID(typval_T *argvars UNUSED, typval
 
     lnum = tv_get_lnum(argvars);		// -1 on type error
     col = (linenr_T)tv_get_number(&argvars[1]) - 1;	// -1 on type error
-    trans = (int)tv_get_number_chk(&argvars[2], &transerr);
+    trans = (int)tv_get_bool_chk(&argvars[2], &transerr);
 
     if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
 	    && col >= 0 && col < (long)STRLEN(ml_get(lnum)))
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1551,6 +1551,13 @@ def Test_searchdecl()
   assert_equal(1, searchdecl('blah', true, true))
 enddef
 
+def Test_synID()
+  new
+  setline(1, "text")
+  assert_equal(0, synID(1, 1, true))
+  bwipe!
+enddef
+
 def Fibonacci(n: number): number
   if n < 2
     return n
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1616,
+/**/
     1615,
 /**/
     1614,