diff src/evalvars.c @ 25405:747ebbce2421 v8.2.3239

patch 8.2.3239: Vim9: no error using heredoc for a number variable Commit: https://github.com/vim/vim/commit/81530e36033dec2c2cd94af6dd48ceb0389e95a2 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 28 21:25:49 2021 +0200 patch 8.2.3239: Vim9: no error using heredoc for a number variable Problem: Vim9: no error using heredoc for a number variable. Solution: Add a type check. (closes https://github.com/vim/vim/issues/8627)
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Jul 2021 21:30:04 +0200
parents f03271631eb5
children 2063b858cad9
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -817,6 +817,7 @@ ex_let(exarg_T *eap)
     else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
     {
 	list_T	*l;
+	long	cur_lnum = SOURCING_LNUM;
 
 	// HERE document
 	l = heredoc_get(eap, expr + 3, FALSE);
@@ -825,6 +826,8 @@ ex_let(exarg_T *eap)
 	    rettv_list_set(&rettv, l);
 	    if (!eap->skip)
 	    {
+		// errors are for the assignment, not the end marker
+		SOURCING_LNUM = cur_lnum;
 		op[0] = '=';
 		op[1] = NUL;
 		(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,