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>
diff --git a/src/vim9execute.c b/src/vim9execute.c
index b3e8939..5af3af6 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1638,7 +1638,7 @@
* 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 @@
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 @@
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 @@
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;