Problem: Vim9: no failure if return type differs from returned variable.
Solution: Copy type when copying a list. (closes #8847)
copy = list_alloc();
if (copy != NULL)
{
+ copy->lv_type = orig->lv_type;
if (copyID != 0)
{
// Do this before adding the items, because one of the items may
CheckScriptFailure(lines, 'E1010:')
enddef
+def Test_return_list_any()
+ var lines =<< trim END
+ vim9script
+ def Func(): list<string>
+ var l: list<any>
+ l->add('string')
+ return l
+ enddef
+ echo Func()
+ END
+ CheckScriptFailure(lines, 'E1012:')
+ lines =<< trim END
+ vim9script
+ def Func(): list<string>
+ var l: list<any>
+ l += ['string']
+ return l
+ enddef
+ echo Func()
+ END
+ CheckScriptFailure(lines, 'E1012:')
+enddef
+
func Increment()
let g:counter += 1
endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3422,
/**/
3421,
/**/