Patch 8.2.1524
Problem: No longer get an error for string concatenation with float.
(Tsuyoshi Cho)
Solution: Only convert float for Vim9 script. (closes #6787)
Files: src/eval.c, src/testdir/test_eval_stuff.vim
*** ../vim-8.2.1523/src/eval.c 2020-08-22 22:37:17.089141677 +0200
--- src/eval.c 2020-08-25 22:28:42.290142834 +0200
***************
*** 2675,2680 ****
--- 2675,2681 ----
int oplen;
int concat;
typval_T var2;
+ int vim9script = in_vim9script();
// "." is only string concatenation when scriptversion is 1
p = eval_next_non_blank(*arg, evalarg, &getnext);
***************
*** 2689,2695 ****
*arg = eval_next_line(evalarg);
else
{
! if (evaluate && in_vim9script() && !VIM_ISWHITE(**arg))
{
error_white_both(p, oplen);
clear_tv(rettv);
--- 2690,2696 ----
*arg = eval_next_line(evalarg);
else
{
! if (evaluate && vim9script && !VIM_ISWHITE(**arg))
{
error_white_both(p, oplen);
clear_tv(rettv);
***************
*** 2721,2734 ****
/*
* Get the second variable.
*/
! if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[oplen]))
{
error_white_both(p, oplen);
clear_tv(rettv);
return FAIL;
}
*arg = skipwhite_and_linebreak(*arg + oplen, evalarg);
! if (eval6(arg, &var2, evalarg, !in_vim9script() && op == '.') == FAIL)
{
clear_tv(rettv);
return FAIL;
--- 2722,2735 ----
/*
* Get the second variable.
*/
! if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[oplen]))
{
error_white_both(p, oplen);
clear_tv(rettv);
return FAIL;
}
*arg = skipwhite_and_linebreak(*arg + oplen, evalarg);
! if (eval6(arg, &var2, evalarg, !vim9script && op == '.') == FAIL)
{
clear_tv(rettv);
return FAIL;
***************
*** 2745,2756 ****
char_u *s1 = tv_get_string_buf(rettv, buf1);
char_u *s2 = NULL;
! if (in_vim9script() && (var2.v_type == VAR_VOID
|| var2.v_type == VAR_CHANNEL
|| var2.v_type == VAR_JOB))
emsg(_(e_inval_string));
#ifdef FEAT_FLOAT
! else if (var2.v_type == VAR_FLOAT)
{
vim_snprintf((char *)buf2, NUMBUFLEN, "%g",
var2.vval.v_float);
--- 2746,2757 ----
char_u *s1 = tv_get_string_buf(rettv, buf1);
char_u *s2 = NULL;
! if (vim9script && (var2.v_type == VAR_VOID
|| var2.v_type == VAR_CHANNEL
|| var2.v_type == VAR_JOB))
emsg(_(e_inval_string));
#ifdef FEAT_FLOAT
! else if (vim9script && var2.v_type == VAR_FLOAT)
{
vim_snprintf((char *)buf2, NUMBUFLEN, "%g",
var2.vval.v_float);
*** ../vim-8.2.1523/src/testdir/test_eval_stuff.vim 2020-08-21
22:46:07.583820586 +0200
--- src/testdir/test_eval_stuff.vim 2020-08-25 22:35:37.607754176 +0200
***************
*** 135,140 ****
--- 135,146 ----
let a = 'a'
let a..=b
call assert_equal('ab', a)
+
+ if has('float')
+ let a = 'A'
+ let b = 1.234
+ call assert_fails('echo a .. b', 'E806:')
+ endif
endfunc
" Test fix for issue #4507
*** ../vim-8.2.1523/src/version.c 2020-08-25 21:19:31.434276759 +0200
--- src/version.c 2020-08-25 22:35:00.992021257 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1524,
/**/
--
He was not in the least bit scared to be mashed into a pulp
Or to have his eyes gouged out and his elbows broken;
To have his kneecaps split and his body burned away
And his limbs all hacked and mangled, brave Sir Robin.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202008252057.07PKvMKl1577835%40masaka.moolenaar.net.