To: vim_dev@googlegroups.com Subject: Patch 8.2.2261 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2261 Problem: Vim9: boolean option gets string type. Solution: Check for VAR_BOOL. (closes #7588) Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.2260/src/vim9compile.c 2020-12-31 21:28:43.419217945 +0100 --- src/vim9compile.c 2021-01-01 14:45:41.637520908 +0100 *************** *** 3172,3179 **** if (ret == OK) { // include the '&' in the name, eval_option() expects it. ! char_u *name = vim_strnsave(start, *arg - start); ! type_T *type = rettv.v_type == VAR_NUMBER ? &t_number : &t_string; ret = generate_LOAD(cctx, ISN_LOADOPT, 0, name, type); vim_free(name); --- 3172,3180 ---- if (ret == OK) { // include the '&' in the name, eval_option() expects it. ! char_u *name = vim_strnsave(start, *arg - start); ! type_T *type = rettv.v_type == VAR_BOOL ? &t_bool ! : rettv.v_type == VAR_NUMBER ? &t_number : &t_string; ret = generate_LOAD(cctx, ISN_LOADOPT, 0, name, type); vim_free(name); *** ../vim-8.2.2260/src/testdir/test_vim9_expr.vim 2020-12-31 21:28:43.423217932 +0100 --- src/testdir/test_vim9_expr.vim 2021-01-01 14:47:12.153286168 +0100 *************** *** 2417,2422 **** --- 2417,2427 ---- &grepprg = test_null_string() assert_equal('', &grepprg) set grepprg& + + # check matching type + var bval: bool = &tgc + var nval: number = &ts + var sval: string = &path enddef def Test_expr7_environment() *** ../vim-8.2.2260/src/version.c 2021-01-01 14:31:30.204198897 +0100 --- src/version.c 2021-01-01 14:48:06.193139813 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2261, /**/ -- Proof techniques #2: Proof by Oddity. SAMPLE: To prove that horses have an infinite number of legs. (1) Horses have an even number of legs. (2) They have two legs in back and fore legs in front. (3) This makes a total of six legs, which certainly is an odd number of legs for a horse. (4) But the only number that is both odd and even is infinity. (5) Therefore, horses must have an infinite number of legs. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///