Patch 8.2.2528
Problem:    Vim9: crash when compiling lambda fails.
Solution:   Bail out after compilation fails. (closes #7862)
Files:      src/eval.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2527/src/eval.c  2021-02-17 17:00:23.483706812 +0100
--- src/eval.c  2021-02-17 18:23:41.128024776 +0100
***************
*** 3428,3435 ****
                        ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
  
                        // compile it here to get the return type
!                       compile_def_function(ufunc,
!                                                TRUE, PROFILING(ufunc), NULL);
                    }
                }
                if (ret == NOTDONE)
--- 3428,3439 ----
                        ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
  
                        // compile it here to get the return type
!                       if (compile_def_function(ufunc,
!                                        TRUE, PROFILING(ufunc), NULL) == FAIL)
!                       {
!                           clear_tv(rettv);
!                           ret = FAIL;
!                       }
                    }
                }
                if (ret == NOTDONE)
*** ../vim-8.2.2527/src/testdir/test_vim9_assign.vim    2021-02-17 
17:00:23.483706812 +0100
--- src/testdir/test_vim9_assign.vim    2021-02-17 18:47:26.024462104 +0100
***************
*** 1118,1123 ****
--- 1118,1128 ----
        Ref = (j) => !j
    END
    CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected 
func(number) but got func(any): bool')
+ 
+   lines =<< trim END
+       echo filter([1, 2, 3], (_, v: string) => v + 1) 
+   END
+   CheckDefAndScriptFailure(lines, 'E1051:')
  enddef
  
  def Test_heredoc()
*** ../vim-8.2.2527/src/version.c       2021-02-17 17:00:23.483706812 +0100
--- src/version.c       2021-02-17 18:25:27.799787570 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2528,
  /**/

-- 
There can't be a crisis today, my schedule is already full.

 /// 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/202102171749.11HHndAf2249182%40masaka.moolenaar.net.

Raspunde prin e-mail lui