patch 8.2.2944: Vim9: no error when using job or channel as a string
Problem: Vim9: no error when using job or channel as a string.
Solution: Be more strict about conversion to string. (closes #8312)
diff --git a/src/eval.c b/src/eval.c
index 77578f3..1fb1f5e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5060,7 +5060,8 @@
case VAR_JOB:
case VAR_CHANNEL:
*tofree = NULL;
- r = tv_get_string_buf(tv, numbuf);
+ r = tv->v_type == VAR_JOB ? job_to_string_buf(tv, numbuf)
+ : channel_to_string_buf(tv, numbuf);
if (composite_val)
{
*tofree = string_quote(r, FALSE);