Mercurial > vim
diff src/vim9execute.c @ 34957:3cacfb652766 v9.1.0335
patch 9.1.0335: String interpolation fails for List type
Commit: https://github.com/vim/vim/commit/bce51d9005dd1c5bc002acbac2e12b649abcb013
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Apr 15 19:19:52 2024 +0200
patch 9.1.0335: String interpolation fails for List type
Problem: String interpolation fails for List type
Solution: use implicit string(list) for string interpolation and :put =
(Yegappan Lakshmanan)
related: #14529
closes: #14556
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 15 Apr 2024 19:30:04 +0200 |
parents | 1e6f45f5ca23 |
children | 5df4ad0a5200 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1638,7 +1638,7 @@ store_var(char_u *name, typval_T *tv) * Return FAIL if not allowed. */ static int -do_2string(typval_T *tv, int is_2string_any, int tolerant) +do_2string(typval_T *tv, int is_2string_any, int tostring_flags) { if (tv->v_type == VAR_STRING) return OK; @@ -1657,7 +1657,7 @@ do_2string(typval_T *tv, int is_2string_ case VAR_BLOB: break; case VAR_LIST: - if (tolerant) + if (tostring_flags & TOSTRING_TOLERANT) { char_u *s, *e, *p; garray_T ga; @@ -1690,6 +1690,8 @@ do_2string(typval_T *tv, int is_2string_ tv->vval.v_string = ga.ga_data; return OK; } + if (tostring_flags & TOSTRING_INTERPOLATE) + break; // FALLTHROUGH default: to_string_error(tv->v_type); return FAIL; @@ -5685,7 +5687,7 @@ exec_instructions(ectx_T *ectx) SOURCING_LNUM = iptr->isn_lnum; if (do_2string(STACK_TV_BOT(iptr->isn_arg.tostring.offset), iptr->isn_type == ISN_2STRING_ANY, - iptr->isn_arg.tostring.tolerant) == FAIL) + iptr->isn_arg.tostring.flags) == FAIL) goto on_error; break;